summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-03-12 11:38:22 +0200
committerunknown <monty@hundin.mysql.fi>2002-03-12 11:38:22 +0200
commit4c221321b624e55238c641b515e24ad1091cdc93 (patch)
treec217663c9f7a4fba0c5a00acb72b3e980954f780 /sql/sql_acl.cc
parentc13baf70ec937501389ed6e9f94c98635f1c1b76 (diff)
downloadmariadb-git-4c221321b624e55238c641b515e24ad1091cdc93.tar.gz
Added help for --local-infile
Fix for bug on intel where (int32) 1 << 32 == 1, which gave problems when using 32 keys. Allow SET PASSWORD for anonymous user Docs/manual.texi: Changelog client/mysql.cc: Added help for --local-infile client/mysqlimport.c: Merge with 4.0. Patch for LOCAL INFILE handling configure.in: cleanup include/global.h: Fix for bug on intel where (int32) 1 << 32 == 1 mysql-test/r/create.result: Test of CREATE TABLE with 32 keys mysql-test/t/create.test: Test of CREATE TABLE with 32 keys scripts/mysqlhotcopy.sh: Patch for databasenames with space. sql/ha_isam.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/ha_myisam.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/ha_myisammrg.cc: Fix for bug on intel where (int32) 1 << 32 == 1 sql/mysqld.cc: Added help for --local-infile sql/sql_acl.cc: Allow SET PASSWORD of anonymous user sql/table.cc: Fix for bug on intel where (int32) 1 << 32 == 1
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 7ad778cf5d0..33924ada8ab 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -765,11 +765,6 @@ bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
uint length=0;
- if (!user[0])
- {
- send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
- return 1;
- }
if (!initialized)
{
send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */
@@ -781,15 +776,21 @@ bool change_password(THD *thd, const char *host, const char *user,
length=(uint) strlen(new_password);
new_password[length & 16]=0;
- if (!thd || (!thd->slave_thread && ( strcmp(thd->user,user) ||
- my_strcasecmp(host,thd->host ? thd->host : thd->ip))))
+ if (!thd->slave_thread &&
+ (strcmp(thd->user,user) ||
+ my_strcasecmp(host,thd->host ? thd->host : thd->ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return 1;
}
+ if (!thd->slave_thread && !thd->user[0])
+ {
+ send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
+ return 1;
+ }
VOID(pthread_mutex_lock(&acl_cache->lock));
ACL_USER *acl_user;
- if (!(acl_user= find_acl_user(host,user)) || !acl_user->user)
+ if (!(acl_user= find_acl_user(host,user)))
{
send_error(&thd->net, ER_PASSWORD_NO_MATCH);
VOID(pthread_mutex_unlock(&acl_cache->lock));
@@ -797,7 +798,8 @@ bool change_password(THD *thd, const char *host, const char *user,
}
if (update_user_table(thd,
acl_user->host.hostname ? acl_user->host.hostname : "",
- acl_user->user, new_password))
+ acl_user->user ? acl_user->user : "",
+ new_password))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(&thd->net,0); /* purecov: deadcode */
@@ -817,7 +819,7 @@ bool change_password(THD *thd, const char *host, const char *user,
qinfo.q_len =
my_sprintf(buff,
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
- acl_user->user,
+ acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "",
new_password));
mysql_update_log.write(thd,buff,qinfo.q_len);