Skip to content

Commit

Permalink
kernel: Add basic password support for noshell raw
Browse files Browse the repository at this point in the history
  • Loading branch information
garazdawi committed Oct 17, 2024
1 parent 8129a6b commit f858c6d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/kernel/src/group.erl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ dumb(internal, {get_line, Encoding, Prompt}, Data) ->
dumb(internal, {get_until, Encoding, Prompt, M, F, As}, Data) ->
dumb(input_request, {get_until, {M, F, As}, Prompt, Encoding, fun get_line_dumb/5}, Data);

dumb(internal, {get_password, Encoding}, Data = #state{ terminal_mode = raw }) ->

%% When getting the password we force echo to be off for the time of
%% the get password and set a shell in order to use edit_line_dumb instead
%% of edit_line_noshell.
GetLine = fun(Buf, Pbs, Cont, LineEncoding, LineData) ->
get_line_dumb(Buf, Pbs, Cont, LineEncoding,
LineData#state{ echo = false, shell = self() })
end,
dumb(input_request, {collect_line_no_eol, [], "", Encoding, GetLine}, Data);
dumb(internal, {get_password, _Encoding}, Data) ->
%% TODO: Implement for noshell by disabling characters echo if isatty(stdin)
io_reply(Data, {error, enotsup}),
Expand Down

0 comments on commit f858c6d

Please sign in to comment.