cli: use nmc_readline_echo() for asking password in 'nmcli con add'
This commit is contained in:
@@ -3656,7 +3656,7 @@ do_questionnaire_wimax (char **mac)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_questionnaire_pppoe (char **password, char **service, char **mtu, char **mac)
|
do_questionnaire_pppoe (gboolean echo, char **password, char **service, char **mtu, char **mac)
|
||||||
{
|
{
|
||||||
gboolean once_more;
|
gboolean once_more;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -3666,7 +3666,7 @@ do_questionnaire_pppoe (char **password, char **service, char **mtu, char **mac)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*password)
|
if (!*password)
|
||||||
*password = nmc_readline (_("Password [none]: "));
|
*password = nmc_readline_echo (echo, _("Password [none]: "));
|
||||||
if (!*service)
|
if (!*service)
|
||||||
*service = nmc_readline (_("Service [none]: "));
|
*service = nmc_readline (_("Service [none]: "));
|
||||||
|
|
||||||
@@ -3695,7 +3695,7 @@ do_questionnaire_pppoe (char **password, char **service, char **mtu, char **mac)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_questionnaire_mobile (char **user, char **password)
|
do_questionnaire_mobile (gboolean echo, char **user, char **password)
|
||||||
{
|
{
|
||||||
/* Ask for optional 'gsm' or 'cdma' arguments. */
|
/* Ask for optional 'gsm' or 'cdma' arguments. */
|
||||||
if (!want_provide_opt_args (_("mobile broadband"), 2))
|
if (!want_provide_opt_args (_("mobile broadband"), 2))
|
||||||
@@ -3704,7 +3704,7 @@ do_questionnaire_mobile (char **user, char **password)
|
|||||||
if (!*user)
|
if (!*user)
|
||||||
*user = nmc_readline (_("Username [none]: "));
|
*user = nmc_readline (_("Username [none]: "));
|
||||||
if (!*password)
|
if (!*password)
|
||||||
*password = nmc_readline (_("Password [none]: "));
|
*password = nmc_readline_echo (echo, _("Password [none]: "));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WORD_PANU "panu"
|
#define WORD_PANU "panu"
|
||||||
@@ -4181,7 +4181,7 @@ do_questionnaire_olpc (char **channel, char **dhcp_anycast)
|
|||||||
|
|
||||||
#define PROMPT_ADSL_ENCAP "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]: "
|
#define PROMPT_ADSL_ENCAP "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]: "
|
||||||
static void
|
static void
|
||||||
do_questionnaire_adsl (char **password, char **encapsulation)
|
do_questionnaire_adsl (gboolean echo, char **password, char **encapsulation)
|
||||||
{
|
{
|
||||||
gboolean once_more;
|
gboolean once_more;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -4191,7 +4191,7 @@ do_questionnaire_adsl (char **password, char **encapsulation)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*password)
|
if (!*password)
|
||||||
*password = nmc_readline (_("Password [none]: "));
|
*password = nmc_readline_echo (echo, _("Password [none]: "));
|
||||||
|
|
||||||
if (!*encapsulation) {
|
if (!*encapsulation) {
|
||||||
do {
|
do {
|
||||||
@@ -4650,6 +4650,7 @@ complete_connection_by_type (NMConnection *connection,
|
|||||||
const char *con_type,
|
const char *con_type,
|
||||||
const GPtrArray *all_connections,
|
const GPtrArray *all_connections,
|
||||||
gboolean ask,
|
gboolean ask,
|
||||||
|
gboolean show_secrets,
|
||||||
int argc,
|
int argc,
|
||||||
char **argv,
|
char **argv,
|
||||||
GError **error)
|
GError **error)
|
||||||
@@ -4970,7 +4971,7 @@ cleanup_wimax:
|
|||||||
mtu = g_strdup (mtu_c);
|
mtu = g_strdup (mtu_c);
|
||||||
mac = g_strdup (mac_c);
|
mac = g_strdup (mac_c);
|
||||||
if (ask)
|
if (ask)
|
||||||
do_questionnaire_pppoe (&password, &service, &mtu, &mac);
|
do_questionnaire_pppoe (show_secrets, &password, &service, &mtu, &mac);
|
||||||
|
|
||||||
if (!check_and_convert_mtu (mtu, &mtu_int, error))
|
if (!check_and_convert_mtu (mtu, &mtu_int, error))
|
||||||
goto cleanup_pppoe;
|
goto cleanup_pppoe;
|
||||||
@@ -5040,7 +5041,7 @@ cleanup_pppoe:
|
|||||||
user = g_strdup (user_c);
|
user = g_strdup (user_c);
|
||||||
password = g_strdup (password_c);
|
password = g_strdup (password_c);
|
||||||
if (ask)
|
if (ask)
|
||||||
do_questionnaire_mobile (&user, &password);
|
do_questionnaire_mobile (show_secrets, &user, &password);
|
||||||
|
|
||||||
if (is_gsm) {
|
if (is_gsm) {
|
||||||
g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, NM_SETTING_GSM_SETTING_NAME, NULL);
|
g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, NM_SETTING_GSM_SETTING_NAME, NULL);
|
||||||
@@ -5760,7 +5761,7 @@ cleanup_olpc:
|
|||||||
password = g_strdup (password_c);
|
password = g_strdup (password_c);
|
||||||
encapsulation = g_strdup (encapsulation_c);
|
encapsulation = g_strdup (encapsulation_c);
|
||||||
if (ask)
|
if (ask)
|
||||||
do_questionnaire_adsl (&password, &encapsulation);
|
do_questionnaire_adsl (show_secrets, &password, &encapsulation);
|
||||||
|
|
||||||
if (!check_adsl_encapsulation (&encapsulation, error))
|
if (!check_adsl_encapsulation (&encapsulation, error))
|
||||||
goto cleanup_adsl;
|
goto cleanup_adsl;
|
||||||
@@ -6620,6 +6621,7 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
|
|||||||
setting_name,
|
setting_name,
|
||||||
nmc->connections,
|
nmc->connections,
|
||||||
nmc->ask,
|
nmc->ask,
|
||||||
|
nmc->show_secrets,
|
||||||
argc,
|
argc,
|
||||||
argv,
|
argv,
|
||||||
&error)) {
|
&error)) {
|
||||||
|
Reference in New Issue
Block a user