Skip to content

Commit 8386a52

Browse files
vuvovasanja-byelkin
authored andcommitted
MDEV-19949 mariabackup option of '--password' or '-p' without specifying password in commandline
password handling as in other command-line tools
1 parent ba15ea1 commit 8386a52

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

extra/mariabackup/xtrabackup.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ my_bool opt_noversioncheck = FALSE;
373373
my_bool opt_decompress = FALSE;
374374
my_bool opt_remove_original;
375375
my_bool opt_log_innodb_page_corruption;
376+
my_bool tty_password= FALSE;
376377

377378
my_bool opt_lock_ddl_per_table = FALSE;
378379
static my_bool opt_check_privileges;
@@ -1655,7 +1656,7 @@ struct my_option xb_client_options[]= {
16551656
"This option specifies the password to use "
16561657
"when connecting to the database. It accepts a string argument. "
16571658
"See mysql --help for details.",
1658-
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1659+
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
16591660

16601661
{"protocol", OPT_PROTOCOL,
16611662
"The protocol to use for connection (tcp, socket, pipe, memory).", 0, 0,
@@ -2333,6 +2334,7 @@ xb_get_one_option(const struct my_option *opt,
23332334
break;
23342335
case 'p':
23352336
opt_password = argument;
2337+
tty_password = argument == NULL;
23362338
break;
23372339
case OPT_PROTOCOL:
23382340
if (argument)
@@ -7332,6 +7334,8 @@ void handle_options(int argc, char **argv, char ***argv_server,
73327334
if (*start)
73337335
start[1]= 0;
73347336
}
7337+
else if (tty_password)
7338+
opt_password= my_get_tty_password(NullS);
73357339

73367340
/* 4) Process --mysqld-args options, ignore unknown options */
73377341

0 commit comments

Comments
 (0)