summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-12-15 17:05:24 +0100
committerLubomir Rintel <lkundrak@v3.sk>2017-12-18 14:47:31 +0100
commit7c3e1d926a9056227d65945eb65b4348dc21248b (patch)
tree7e74a1013f249eb40b361a1ffcfaa48a86c7801d /clients
parente912b36d95a3c26a6021eeb27e663bd05910a9b4 (diff)
clients/cli: don't store a password in history
History is probably even not useful at all outside the interactive edit mode, but that is another story. This just avoids awkward surprises, such as: https://bugzilla.gnome.org/show_bug.cgi?id=791200
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c
index f785e2c568..4c15463d34 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -892,6 +892,8 @@ nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...)
va_list args;
char *prompt, *str;
struct termios termios_orig, termios_new;
+ HISTORY_STATE *saved_history;
+ HISTORY_STATE passwd_history = { 0, };
va_start (args, prompt_fmt);
prompt = g_strdup_vprintf (prompt_fmt, args);
@@ -899,6 +901,8 @@ nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...)
/* Disable echoing characters */
if (!echo_on) {
+ saved_history = history_get_history_state ();
+ history_set_history_state (&passwd_history);
tcgetattr (STDIN_FILENO, &termios_orig);
termios_new = termios_orig;
termios_new.c_lflag &= ~(ECHO);
@@ -914,6 +918,7 @@ nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...)
tcsetattr (STDIN_FILENO, TCSADRAIN, &termios_orig);
/* New line - setting ECHONL | ICANON did not help */
fprintf (stdout, "\n");
+ history_set_history_state (saved_history);
}
return str;