mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 13:40:39 +01:00
cli: move show_secret field to NmcConfig
The show-secret property is basically a part of the current configuration, relevant during printing. It will be passed on to nmc_print(), and hence must be part of NmcConfig.
This commit is contained in:
parent
fdd40b6a68
commit
f0d91455ca
6 changed files with 11 additions and 11 deletions
|
|
@ -840,7 +840,7 @@ nmc_secrets_requested (NMSecretAgentSimple *agent,
|
|||
}
|
||||
|
||||
success = get_secrets_from_user (request_id, title, msg, connection, nmc->nmc_config.in_editor || nmc->ask,
|
||||
nmc->show_secrets, nmc->pwds_hash, secrets);
|
||||
nmc->nmc_config.show_secrets, nmc->pwds_hash, secrets);
|
||||
if (success)
|
||||
nm_secret_agent_simple_response (agent, request_id, secrets);
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -1873,9 +1873,9 @@ do_connections_show (NmCli *nmc, int argc, char **argv)
|
|||
if (without_fields || profile_flds) {
|
||||
if (con) {
|
||||
nmc->required_fields = profile_flds;
|
||||
if (nmc->show_secrets)
|
||||
if (nmc->nmc_config.show_secrets)
|
||||
update_secrets_in_connection (NM_REMOTE_CONNECTION (con), con);
|
||||
res = nmc_connection_profile_details (con, nmc, nmc->show_secrets);
|
||||
res = nmc_connection_profile_details (con, nmc, nmc->nmc_config.show_secrets);
|
||||
nmc->required_fields = NULL;
|
||||
if (!res)
|
||||
goto finish;
|
||||
|
|
|
|||
|
|
@ -3110,7 +3110,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
|
|||
if (ap_flags & NM_802_11_AP_FLAGS_PRIVACY) {
|
||||
/* Ask for missing password when one is expected and '--ask' is used */
|
||||
if (!password && nmc->ask)
|
||||
password = passwd_ask = nmc_readline_echo (nmc->show_secrets, _("Password: "));
|
||||
password = passwd_ask = nmc_readline_echo (nmc->nmc_config.show_secrets, _("Password: "));
|
||||
|
||||
if (password) {
|
||||
if (!connection)
|
||||
|
|
@ -3408,7 +3408,7 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
|
|||
|
||||
next_arg (nmc, &argc, &argv, NULL);
|
||||
}
|
||||
show_password = nmc->show_secrets || show_password;
|
||||
show_password = nmc->nmc_config.show_secrets || show_password;
|
||||
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ nmc_init (NmCli *nmc)
|
|||
nmc->required_fields = NULL;
|
||||
nmc->ask = FALSE;
|
||||
nmc->complete = FALSE;
|
||||
nmc->show_secrets = FALSE;
|
||||
nmc->nmc_config_mutable.show_secrets = FALSE;
|
||||
nmc->nmc_config_mutable.use_colors = NMC_USE_COLOR_AUTO;
|
||||
nmc->nmc_config_mutable.in_editor = FALSE;
|
||||
nmc->editor_status_line = FALSE;
|
||||
|
|
|
|||
|
|
@ -111,9 +111,10 @@ typedef enum {
|
|||
typedef struct _NmcConfig {
|
||||
NMCPrintOutput print_output; /* Output mode */
|
||||
NmcColorOption use_colors; /* Whether to use colors for output: option '--color' */
|
||||
gboolean multiline_output; /* Multiline output instead of default tabular */
|
||||
gboolean escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
|
||||
gboolean in_editor; /* Whether running the editor - nmcli con edit' */
|
||||
bool multiline_output; /* Multiline output instead of default tabular */
|
||||
bool escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
|
||||
bool in_editor; /* Whether running the editor - nmcli con edit' */
|
||||
bool show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */
|
||||
} NmcConfig;
|
||||
|
||||
typedef struct _NmcOutputData {
|
||||
|
|
@ -143,7 +144,6 @@ typedef struct _NmCli {
|
|||
char *required_fields; /* Required fields in output: '--fields' option */
|
||||
gboolean ask; /* Ask for missing parameters: option '--ask' */
|
||||
gboolean complete; /* Autocomplete the command line */
|
||||
gboolean show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */
|
||||
gboolean editor_status_line; /* Whether to display status line in connection editor */
|
||||
gboolean editor_save_confirmation; /* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
|
||||
gboolean editor_show_secrets; /* Whether to display secrets in the editor' */
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ parse_global_arg (NmCli *nmc, const char *arg)
|
|||
if (nmc_arg_is_option (arg, "ask"))
|
||||
nmc->ask = TRUE;
|
||||
else if (nmc_arg_is_option (arg, "show-secrets"))
|
||||
nmc->show_secrets = TRUE;
|
||||
nmc->nmc_config_mutable.show_secrets = TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue