diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-09-09 21:45:45 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-09-15 08:32:51 +0200 |
commit | b8e34bcdb38d73819964537c0a175e3d25abe926 (patch) | |
tree | 2cfdd423589f8338b0abc089397f5fd0c89b9c73 | |
parent | ce3e2152bc5253f73ee1ce5132fa6c1e48aebb24 (diff) | |
download | NetworkManager-b8e34bcdb38d73819964537c0a175e3d25abe926.tar.gz |
clients: don't show "(null)" prompt for secrets
If the caller doesn't provide a message, simply don't show it.
(cherry picked from commit a80af27fc930936cbdd2646a64b66359d09a603b)
-rw-r--r-- | clients/cli/agent.c | 3 | ||||
-rw-r--r-- | clients/cli/common.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clients/cli/agent.c b/clients/cli/agent.c index e876d26227..9211d9a0fb 100644 --- a/clients/cli/agent.c +++ b/clients/cli/agent.c @@ -96,7 +96,8 @@ get_secrets_from_user (const char *request_id, char *pwd = NULL; /* Ask user for the password */ - g_print ("%s\n", msg); + if (msg) + g_print ("%s\n", msg); if (secret->value) { /* Prefill the password if we have it. */ rl_startup_hook = set_deftext; diff --git a/clients/cli/common.c b/clients/cli/common.c index f1ec46a11e..62cd6c9c77 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -1058,13 +1058,15 @@ get_secrets_from_user (const char *request_id, nmc_rl_pre_input_deftext = g_strdup (secret->value); } } - g_print ("%s\n", msg); + if (msg) + g_print ("%s\n", msg); pwd = nmc_readline_echo (secret->password ? echo_on : TRUE, "%s (%s): ", secret->name, secret->prop_name); if (!pwd) pwd = g_strdup (""); } else { - g_print ("%s\n", msg); + if (msg) + g_print ("%s\n", msg); g_printerr (_("Warning: password for '%s' not given in 'passwd-file' " "and nmcli cannot ask without '--ask' option.\n"), secret->prop_name); |