nvme_manage: Use getpass for secret input

Change-Id: Ie13f3d4284971fc832a45df2c5bc474d746fb530
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459956
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Chunyang Hui 2019-07-02 03:41:37 +08:00 committed by Changpeng Liu
parent 3d1995c35b
commit 5228002c13

View File

@ -983,7 +983,7 @@ opal_take_ownership(struct dev *iter)
if (spdk_opal_supported(iter->opal_dev)) {
printf("Please input the new password for ownership:\n");
while ((ch = getchar()) != '\n' && ch != EOF);
passwd_p = get_line(new_passwd, MAX_PASSWORD_SIZE, stdin);
passwd_p = getpass(new_passwd);
if (passwd_p) {
ret = spdk_opal_cmd_take_ownership(iter->opal_dev, passwd_p);
if (ret) {
@ -1020,7 +1020,7 @@ opal_revert_tper(struct dev *iter)
printf("Please be noted this operation will erase ALL DATA on this drive\n");
printf("Please input password for revert TPer:\n");
while ((ch = getchar()) != '\n' && ch != EOF);
passwd_p = get_line(passwd, MAX_PASSWORD_SIZE, stdin);
passwd_p = getpass(passwd);
if (passwd_p) {
ret = spdk_opal_cmd_revert_tper(iter->opal_dev, passwd_p);
if (ret) {