From f858c6d52ce8f0d3f7bc5daa97b486429eed5525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Tue, 17 Sep 2024 16:32:23 +0200 Subject: [PATCH] kernel: Add basic password support for noshell raw --- lib/kernel/src/group.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl index d5c6253a47ae..4bb3dfcecaf3 100644 --- a/lib/kernel/src/group.erl +++ b/lib/kernel/src/group.erl @@ -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}),