diff options
author | mzinal <zinal@ydb.tech> | 2023-02-16 17:32:54 +0300 |
---|---|---|
committer | mzinal <zinal@ydb.tech> | 2023-02-16 17:32:54 +0300 |
commit | defd24f1f446ca99645908ccd5b7295d7206460e (patch) | |
tree | 77465c718719261b8952f3568d03a09bb94d2569 | |
parent | 144eb8b0c1c95bcaec141a13f832a189cbbd4fdc (diff) | |
download | ydb-defd24f1f446ca99645908ccd5b7295d7206460e.tar.gz |
password prompts via stderr
-rw-r--r-- | ydb/core/driver_lib/cli_base/cli_cmds_root.cpp | 4 | ||||
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp | 2 | ||||
-rw-r--r-- | ydb/public/lib/ydb_cli/common/common.cpp | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ydb/core/driver_lib/cli_base/cli_cmds_root.cpp b/ydb/core/driver_lib/cli_base/cli_cmds_root.cpp index db2e802f8fd..f876386554a 100644 --- a/ydb/core/driver_lib/cli_base/cli_cmds_root.cpp +++ b/ydb/core/driver_lib/cli_base/cli_cmds_root.cpp @@ -109,7 +109,7 @@ void TClientCommandRootKikimrBase::ParseCredentials(TConfig& config) { if (PasswordFile) { config.StaticCredentials.Password = ReadFromFile(PasswordFile, "password", true); } else if (!DoNotAskForPassword) { - Cout << "Enter password for user " << UserName << ": "; + Cerr << "Enter password for user " << UserName << ": "; config.StaticCredentials.Password = InputPassword(); } return; @@ -132,7 +132,7 @@ void TClientCommandRootKikimrBase::ParseCredentials(TConfig& config) { if (!envPassword.empty()) { config.StaticCredentials.Password = envPassword; } else if (!DoNotAskForPassword) { - Cout << "Enter password for user " << envUser << ": "; + Cerr << "Enter password for user " << envUser << ": "; config.StaticCredentials.Password = InputPassword(); } return; diff --git a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp index 34743b9640f..e0da10be1a0 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp @@ -654,7 +654,7 @@ void TClientCommandRootCommon::ParseCredentials(TConfig& config) { if (config.UseStaticCredentials) { if (config.StaticCredentials.User) { if (!config.StaticCredentials.Password && !DoNotAskForPassword) { - Cout << "Enter password for user " << config.StaticCredentials.User << ": "; + Cerr << "Enter password for user " << config.StaticCredentials.User << ": "; config.StaticCredentials.Password = InputPassword(); } } else { diff --git a/ydb/public/lib/ydb_cli/common/common.cpp b/ydb/public/lib/ydb_cli/common/common.cpp index c7b13482cb6..6703102bfad 100644 --- a/ydb/public/lib/ydb_cli/common/common.cpp +++ b/ydb/public/lib/ydb_cli/common/common.cpp @@ -138,7 +138,7 @@ TString InputPassword() { if (c == '\b' || c == 0x7F) { // Backspace. Remove last char if there is any if (password.size()) { - Cout << "\b \b"; + Cerr << "\b \b"; password.pop_back(); } } else if (c == 0x03) { @@ -151,11 +151,11 @@ TString InputPassword() { #endif exit(EXIT_FAILURE); } else { - Cout << '*'; + Cerr << '*'; password.push_back(c); } } - Cout << Endl; + Cerr << Endl; #if defined(_unix_) tcsetattr(STDIN_FILENO, TCSANOW, &oldState); |