diff options
Diffstat (limited to 'cli/src/cli.c')
-rw-r--r-- | cli/src/cli.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index 745b0b45bf5..fa3c747d154 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -297,7 +297,8 @@ cli_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, int cli_opt_parse (char *opt, struct cli_state *state) { - char *oarg; + char *oarg = NULL; + gf_boolean_t secure_mgmt_tmp = 0; if (strcmp (opt, "") == 0) return 1; @@ -370,6 +371,20 @@ cli_opt_parse (char *opt, struct cli_state *state) return 0; } + oarg = strtail (opt, "secure-mgmt="); + if (oarg) { + if (gf_string2boolean(oarg,&secure_mgmt_tmp) == 0) { + if (secure_mgmt_tmp) { + /* See declaration for why this is an int. */ + state->ctx->secure_mgmt = 1; + } + } + else { + cli_err ("invalide secure-mgmt value (ignored)"); + } + return 0; + } + return -1; } @@ -384,6 +399,11 @@ parse_cmdline (int argc, char *argv[], struct cli_state *state) state->argc=argc-1; state->argv=&argv[1]; + /* Do this first so that an option can override. */ + if (access(SECURE_ACCESS_FILE,F_OK) == 0) { + state->ctx->secure_mgmt = 1; + } + for (i = 0; i < state->argc; i++) { opt = strtail (state->argv[i], "--"); if (opt) { @@ -546,7 +566,6 @@ cli_rpc_init (struct cli_state *state) int port = CLI_GLUSTERD_PORT; xlator_t *this = NULL; - this = THIS; cli_rpc_prog = &cli_prog; options = dict_new (); @@ -565,7 +584,8 @@ cli_rpc_init (struct cli_state *state) 0); if (ret) goto out; - } else if (state->remote_host) { + } + else if (state->remote_host) { gf_log ("cli", GF_LOG_INFO, "Connecting to remote glusterd at " "%s", state->remote_host); ret = dict_set_str (options, "remote-host", state->remote_host); @@ -583,7 +603,8 @@ cli_rpc_init (struct cli_state *state) "inet"); if (ret) goto out; - } else { + } + else { gf_log ("cli", GF_LOG_DEBUG, "Connecting to glusterd using " "default socket"); ret = rpc_transport_unix_options_build |