From 932da9d53a5b67ed7c67b2f67312852d89f5a7fd Mon Sep 17 00:00:00 2001 From: hzcheng Date: Wed, 17 Jul 2019 20:04:44 +0800 Subject: [PATCH] Fix shell password issue #92 --- src/kit/shell/shellEngine.c | 2 +- src/kit/shell/shellLinux.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/kit/shell/shellEngine.c b/src/kit/shell/shellEngine.c index 3ea6babf9f..938090740e 100644 --- a/src/kit/shell/shellEngine.c +++ b/src/kit/shell/shellEngine.c @@ -57,7 +57,7 @@ TAOS *shellInit(struct arguments *args) { } if (args->is_use_passwd) { - args->password = getpass("Enter password: "); + if (args->password == NULL) args->password = getpass("Enter password: "); } else { args->password = tsDefaultPass; } diff --git a/src/kit/shell/shellLinux.c b/src/kit/shell/shellLinux.c index 6602ac742e..bdb233e367 100644 --- a/src/kit/shell/shellLinux.c +++ b/src/kit/shell/shellLinux.c @@ -72,10 +72,8 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { arguments->host = arg; break; case 'p': - if (arg) - arguments->password = arg; - else - arguments->is_use_passwd = true; + arguments->is_use_passwd = true; + if (arg) arguments->password = arg; break; case 'P': tsMgmtShellPort = atoi(arg); -- GitLab