summaryrefslogtreecommitdiff
path: root/client/mysqladmin.c
diff options
context:
space:
mode:
authorunknown <peter@mysql.com>2002-11-24 17:07:53 +0300
committerunknown <peter@mysql.com>2002-11-24 17:07:53 +0300
commit8c8b97fdf4756a699346ae1688136624d76713bc (patch)
treedb7cb82e2166048d043214a331a5ad63bc7d0621 /client/mysqladmin.c
parent85bbdcf016dadf31335ad9ee98c3c8acfc167e2f (diff)
downloadmariadb-git-8c8b97fdf4756a699346ae1688136624d76713bc.tar.gz
SCRUM: Main change for Secure connection handling. Still needs some more coding. Commit
done for merge with newer version of code. client/mysqladmin.c: Support for new password format include/mysql.h: Increase buffer as new scramble is larger include/mysql_com.h: Add new prototypes for new auth handling libmysql/libmysql.c: New handshake handling code mysql-test/install_test_db.sh: Extend password length to handle new passwords mysql-test/t/rpl000017-slave.sh: Adjust test to work with longer password scripts/mysql_fix_privilege_tables.sh: Increase password length at priv table convertion scripts/mysql_install_db.sh: Longer passwords sql/item_strfunc.cc: New password generation function needs seed for password generation sql/mini_client.cc: Change MiniClient to handle new auth in replication sql/mysqld.cc: Remove unneeded flag (was added earlier for same change) sql/password.c: A lot of changes to handle new authentication and doccumentation sql/sql_acl.cc: Password handling function adjustment sql/sql_acl.h: Change prototype sql/sql_class.h: Extend scramble length sql/sql_parse.cc: Handling server side of new authentication sql/sql_yacc.yy: Adjustment for new prototypes
Diffstat (limited to 'client/mysqladmin.c')
-rw-r--r--client/mysqladmin.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index e9572e0ad8d..cf6368cc707 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -87,7 +87,7 @@ enum commands {
ADMIN_FLUSH_HOSTS, ADMIN_FLUSH_TABLES, ADMIN_PASSWORD,
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
- ADMIN_FLUSH_THREADS
+ ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
};
static const char *command_names[]= {
"create", "drop", "shutdown",
@@ -97,7 +97,7 @@ static const char *command_names[]= {
"flush-hosts", "flush-tables", "password",
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
- "flush-threads",
+ "flush-threads","old-password",
NullS
};
@@ -419,7 +419,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
const char *status;
-
+ struct rand_struct rand_st;
+
for (; argc > 0 ; argv++,argc--)
{
switch (find_type(argv[0],&command_typelib,2)) {
@@ -721,17 +722,23 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
break;
}
+ case ADMIN_OLD_PASSWORD:
case ADMIN_PASSWORD:
{
- char buff[128],crypted_pw[33];
-
+ char buff[128],crypted_pw[64];
+ time_t start_time;
+ /* Do initialization the same way as we do in mysqld */
+ start_time=time((time_t*) 0);
+ randominit(&rand_st,(ulong) start_time,(ulong) start_time/2);
+
if (argc < 2)
{
my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL));
return 1;
}
if (argv[1][0])
- make_scrambled_password(crypted_pw,argv[1],0); /* New passwords only */
+ make_scrambled_password(crypted_pw,argv[1],(find_type(argv[0],&command_typelib,2)
+ ==ADMIN_OLD_PASSWORD),&rand_st);
else
crypted_pw[0]=0; /* No password */
sprintf(buff,"set password='%s',sql_log_off=0",crypted_pw);
@@ -836,7 +843,8 @@ static void usage(void)
kill id,id,... Kill mysql threads");
#if MYSQL_VERSION_ID >= 32200
puts("\
- password new-password Change old password to new-password");
+ password new-password Change old password to new-password, MySQL 4.1 hashing.\n\
+ old-password new-password Change old password to new-password in old format.\n");
#endif
puts("\
ping Check if mysqld is alive\n\