Commit d32fc5b8 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-31461 mariadb SIGSEGV when built with -DCLIENT_PLUGIN_DIALOG=STATIC

parent f5dceafd
...@@ -1958,7 +1958,7 @@ static int get_options(int argc, char **argv) ...@@ -1958,7 +1958,7 @@ static int get_options(int argc, char **argv)
current_db= my_strdup(*argv, MYF(MY_WME)); current_db= my_strdup(*argv, MYF(MY_WME));
} }
if (tty_password) if (tty_password)
opt_password= get_tty_password(NullS); opt_password= my_get_tty_password(NullS);
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag) if (debug_check_flag)
...@@ -4659,7 +4659,7 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type, ...@@ -4659,7 +4659,7 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
if (type == 2) /* password */ if (type == 2) /* password */
{ {
s= get_tty_password(""); s= my_get_tty_password("");
strnmov(buf, s, buf_len); strnmov(buf, s, buf_len);
buf[buf_len-1]= 0; buf[buf_len-1]= 0;
my_free(s); my_free(s);
......
...@@ -1350,7 +1350,7 @@ int main(int argc, char **argv) ...@@ -1350,7 +1350,7 @@ int main(int argc, char **argv)
if (tty_password) if (tty_password)
{ {
opt_password= get_tty_password(NullS); opt_password= my_get_tty_password(NullS);
/* add password to defaults file */ /* add password to defaults file */
add_one_option_cnf_file(&ds_args, "password", opt_password); add_one_option_cnf_file(&ds_args, "password", opt_password);
} }
......
...@@ -339,7 +339,7 @@ int main(int argc,char *argv[]) ...@@ -339,7 +339,7 @@ int main(int argc,char *argv[])
} }
commands = temp_argv; commands = temp_argv;
if (tty_password) if (tty_password)
opt_password = get_tty_password(NullS); opt_password = my_get_tty_password(NullS);
(void) signal(SIGINT,endprog); /* Here if abort */ (void) signal(SIGINT,endprog); /* Here if abort */
(void) signal(SIGTERM,endprog); /* Here if abort */ (void) signal(SIGTERM,endprog); /* Here if abort */
...@@ -1128,8 +1128,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -1128,8 +1128,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else if (argc == 1) else if (argc == 1)
{ {
/* prompt for password */ /* prompt for password */
typed_password= get_tty_password("New password: "); typed_password= my_get_tty_password("New password: ");
verified= get_tty_password("Confirm new password: "); verified= my_get_tty_password("Confirm new password: ");
if (strcmp(typed_password, verified) != 0) if (strcmp(typed_password, verified) != 0)
{ {
my_printf_error(0,"Passwords don't match",MYF(ME_BELL)); my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
......
...@@ -2095,7 +2095,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -2095,7 +2095,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
} }
if (tty_password) if (tty_password)
pass= get_tty_password(NullS); pass= my_get_tty_password(NullS);
return 0; return 0;
} }
......
...@@ -458,7 +458,7 @@ static int get_options(int *argc, char ***argv) ...@@ -458,7 +458,7 @@ static int get_options(int *argc, char ***argv)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (tty_password) if (tty_password)
opt_password = get_tty_password(NullS); opt_password = my_get_tty_password(NullS);
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag) if (debug_check_flag)
......
...@@ -1233,7 +1233,7 @@ static int get_options(int *argc, char ***argv) ...@@ -1233,7 +1233,7 @@ static int get_options(int *argc, char ***argv)
return EX_USAGE; return EX_USAGE;
} }
if (tty_password) if (tty_password)
opt_password=get_tty_password(NullS); opt_password=my_get_tty_password(NullS);
return(0); return(0);
} /* get_options */ } /* get_options */
......
...@@ -299,7 +299,7 @@ static int get_options(int *argc, char ***argv) ...@@ -299,7 +299,7 @@ static int get_options(int *argc, char ***argv)
current_db= *((*argv)++); current_db= *((*argv)++);
(*argc)--; (*argc)--;
if (tty_password) if (tty_password)
opt_password=get_tty_password(NullS); opt_password=my_get_tty_password(NullS);
return(0); return(0);
} }
......
...@@ -352,7 +352,7 @@ get_options(int *argc,char ***argv) ...@@ -352,7 +352,7 @@ get_options(int *argc,char ***argv)
exit(ho_error); exit(ho_error);
if (tty_password) if (tty_password)
opt_password=get_tty_password(NullS); opt_password=my_get_tty_password(NullS);
if (opt_count) if (opt_count)
{ {
/* /*
......
...@@ -1523,7 +1523,7 @@ get_options(int *argc,char ***argv) ...@@ -1523,7 +1523,7 @@ get_options(int *argc,char ***argv)
} }
if (tty_password) if (tty_password)
opt_password= get_tty_password(NullS); opt_password= my_get_tty_password(NullS);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -7293,7 +7293,7 @@ int parse_args(int argc, char **argv) ...@@ -7293,7 +7293,7 @@ int parse_args(int argc, char **argv)
if (argc == 1) if (argc == 1)
opt_db= *argv; opt_db= *argv;
if (tty_password) if (tty_password)
opt_pass= get_tty_password(NullS); /* purify tested */ opt_pass= my_get_tty_password(NullS); /* purify tested */
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag) if (debug_check_flag)
......
...@@ -1058,7 +1058,7 @@ extern void add_compiled_collation(struct charset_info_st *cs); ...@@ -1058,7 +1058,7 @@ extern void add_compiled_collation(struct charset_info_st *cs);
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info, extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length, char *to, size_t to_length,
const char *from, size_t length); const char *from, size_t length);
extern char *get_tty_password(const char *opt_message); extern char *my_get_tty_password(const char *opt_message);
#ifdef __WIN__ #ifdef __WIN__
#define BACKSLASH_MBTAIL #define BACKSLASH_MBTAIL
/* File system character set */ /* File system character set */
......
...@@ -226,3 +226,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -226,3 +226,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
char *get_tty_password(const char *opt_message)
{
return my_get_tty_password(opt_message);
}
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
/* were just going to fake it here and get input from /* were just going to fake it here and get input from
the keyboard */ the keyboard */
char *get_tty_password(const char *opt_message) char *my_get_tty_password(const char *opt_message)
{ {
char to[80]; char to[80];
char *pos=to,*end=to+sizeof(to)-1; char *pos=to,*end=to+sizeof(to)-1;
DBUG_ENTER("get_tty_password"); DBUG_ENTER("my_get_tty_password");
_cputs(opt_message ? opt_message : "Enter password: "); _cputs(opt_message ? opt_message : "Enter password: ");
for (;;) for (;;)
{ {
...@@ -145,7 +145,7 @@ static void get_password(char *to,uint length,int fd, my_bool echo) ...@@ -145,7 +145,7 @@ static void get_password(char *to,uint length,int fd, my_bool echo)
#endif /* ! HAVE_GETPASS */ #endif /* ! HAVE_GETPASS */
char *get_tty_password(const char *opt_message) char *my_get_tty_password(const char *opt_message)
{ {
#ifdef HAVE_GETPASS #ifdef HAVE_GETPASS
char *passbuff; char *passbuff;
...@@ -154,7 +154,7 @@ char *get_tty_password(const char *opt_message) ...@@ -154,7 +154,7 @@ char *get_tty_password(const char *opt_message)
#endif /* HAVE_GETPASS */ #endif /* HAVE_GETPASS */
char buff[80]; char buff[80];
DBUG_ENTER("get_tty_password"); DBUG_ENTER("my_get_tty_password");
#ifdef HAVE_GETPASS #ifdef HAVE_GETPASS
passbuff = getpass(opt_message ? opt_message : "Enter password: "); passbuff = getpass(opt_message ? opt_message : "Enter password: ");
......
...@@ -371,7 +371,7 @@ main(int argc, char *argv[]) ...@@ -371,7 +371,7 @@ main(int argc, char *argv[])
if (err) if (err)
exit(err); exit(err);
if (tty_password) if (tty_password)
opt_password= get_tty_password(NullS); opt_password= my_get_tty_password(NullS);
if (opt_query_file) if (opt_query_file)
{ {
......
...@@ -1362,7 +1362,7 @@ static void get_options(int *argc, char ***argv) ...@@ -1362,7 +1362,7 @@ static void get_options(int *argc, char ***argv)
exit(ho_error); exit(ho_error);
if (tty_password) if (tty_password)
opt_password= get_tty_password(NullS); opt_password= my_get_tty_password(NullS);
return; return;
} }
......
...@@ -174,7 +174,7 @@ static void get_options(int argc, char **argv) ...@@ -174,7 +174,7 @@ static void get_options(int argc, char **argv)
free_defaults(argv); free_defaults(argv);
if (tty_password) if (tty_password)
password=get_tty_password(NullS); password=my_get_tty_password(NullS);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment