mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Merge work.mysql.com:/home/bk/mysql-4.0
into volk.internalnet:/home/tonu/mysql-4.0
This commit is contained in:
commit
6dd99c0342
4 changed files with 61 additions and 29 deletions
|
@ -30,8 +30,8 @@ abandoned
|
|||
abandoning
|
||||
abandonment
|
||||
abandons
|
||||
set password = password('foo');
|
||||
set password = password('');
|
||||
set password for root@"localhost" = password('foo');
|
||||
set password for root@"localhost" = password('');
|
||||
create table t3(n int);
|
||||
insert into t3 values(1),(2);
|
||||
use test;
|
||||
|
|
|
@ -7,8 +7,8 @@ create table t1 (word char(20) not null);
|
|||
load data infile '../../std_data/words.dat' into table t1;
|
||||
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
||||
select * from t1;
|
||||
set password = password('foo');
|
||||
set password = password('');
|
||||
set password for root@"localhost" = password('foo');
|
||||
set password for root@"localhost" = password('');
|
||||
create table t3(n int);
|
||||
insert into t3 values(1),(2);
|
||||
save_master_pos;
|
||||
|
|
|
@ -769,7 +769,7 @@ int wild_case_compare(const char *str,const char *wildstr)
|
|||
{
|
||||
reg3 int flag;
|
||||
DBUG_ENTER("wild_case_compare");
|
||||
|
||||
DBUG_PRINT("enter",("str='%s', wildstr='%s'",str,wildstr));
|
||||
while (*wildstr)
|
||||
{
|
||||
while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
|
||||
|
@ -892,16 +892,18 @@ bool acl_check_host(const char *host, const char *ip)
|
|||
bool change_password(THD *thd, const char *host, const char *user,
|
||||
char *new_password)
|
||||
{
|
||||
DBUG_ENTER("change_password");
|
||||
DBUG_PRINT("enter",("thd=%x, host='%s', user='%s', new_password='%s'",thd,host,user,new_password));
|
||||
uint length=0;
|
||||
if (!user[0])
|
||||
{
|
||||
send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!initialized)
|
||||
{
|
||||
send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */
|
||||
return 1; /* purecov: inspected */
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
if (!host)
|
||||
host=thd->ip; /* purecov: tested */
|
||||
|
@ -913,15 +915,16 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
my_strcasecmp(host,thd->host ? thd->host : thd->ip))))
|
||||
{
|
||||
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
ACL_USER *acl_user;
|
||||
DBUG_PRINT("info",("host=%s, user=%s",host,user));
|
||||
if (!(acl_user= find_acl_user(host,user)) || !acl_user->user)
|
||||
{
|
||||
send_error(&thd->net, ER_PASSWORD_NO_MATCH);
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (update_user_table(thd,
|
||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||
|
@ -929,7 +932,7 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
|
||||
send_error(&thd->net,0); /* purecov: deadcode */
|
||||
return 1; /* purecov: deadcode */
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
}
|
||||
get_salt_from_password(acl_user->salt,new_password);
|
||||
if (!new_password[0])
|
||||
|
@ -950,7 +953,7 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
new_password));
|
||||
mysql_update_log.write(thd,buff,qinfo.q_len);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -961,17 +964,23 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
static ACL_USER *
|
||||
find_acl_user(const char *host, const char *user)
|
||||
{
|
||||
DBUG_ENTER("find_acl_user");
|
||||
DBUG_PRINT("enter",("host='%s', user='%s'",host,user));
|
||||
for (uint i=0 ; i < acl_users.elements ; i++)
|
||||
{
|
||||
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
|
||||
DBUG_PRINT("info",("strcmp('%s','%s'), compare_hostname('%s','%s'),",
|
||||
user,acl_user->user,(host),(acl_user->host)));
|
||||
if (!acl_user->user && !user[0] ||
|
||||
acl_user->user && !strcmp(user,acl_user->user))
|
||||
{
|
||||
if (compare_hostname(&acl_user->host,host,host))
|
||||
return acl_user;
|
||||
if (compare_hostname(&(acl_user->host),host,host))
|
||||
{
|
||||
DBUG_RETURN(acl_user);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -699,8 +699,11 @@ int wild_case_compare(const char *str,const char *str_end,
|
|||
|
||||
int wild_case_compare(String &match,String &wild, char escape)
|
||||
{
|
||||
return wild_case_compare(match.ptr(),match.ptr()+match.length(),
|
||||
wild.ptr(), wild.ptr()+wild.length(),escape);
|
||||
DBUG_ENTER("wild_case_compare");
|
||||
DBUG_PRINT("enter",("match='%s', wild='%s', escape='%c'"
|
||||
,match.ptr(),wild.ptr(),escape));
|
||||
DBUG_RETURN(wild_case_compare(match.ptr(),match.ptr()+match.length(),
|
||||
wild.ptr(), wild.ptr()+wild.length(),escape));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -710,6 +713,9 @@ int wild_case_compare(String &match,String &wild, char escape)
|
|||
int wild_compare(const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,char escape)
|
||||
{
|
||||
DBUG_ENTER("wild_compare");
|
||||
DBUG_PRINT("enter",("str='%s', str_end='%s', wildstr='%s', wildend='%s', escape='%c'"
|
||||
,str,str_end,wildstr,wildend,escape));
|
||||
int result= -1; // Not found, using wildcards
|
||||
while (wildstr != wildend)
|
||||
{
|
||||
|
@ -718,9 +724,13 @@ int wild_compare(const char *str,const char *str_end,
|
|||
if (*wildstr == escape && wildstr+1 != wildend)
|
||||
wildstr++;
|
||||
if (str == str_end || *wildstr++ != *str++)
|
||||
return(1);
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (wildstr == wildend)
|
||||
return (str != str_end); // Match if both are at end
|
||||
{
|
||||
DBUG_RETURN(str != str_end); // Match if both are at end
|
||||
}
|
||||
result=1; // Found an anchor char
|
||||
}
|
||||
if (*wildstr == wild_one)
|
||||
|
@ -728,7 +738,7 @@ int wild_compare(const char *str,const char *str_end,
|
|||
do
|
||||
{
|
||||
if (str == str_end) // Skip one char if possible
|
||||
return (result);
|
||||
DBUG_RETURN(result);
|
||||
str++;
|
||||
} while (*++wildstr == wild_one && wildstr != wildend);
|
||||
if (wildstr == wildend)
|
||||
|
@ -745,17 +755,22 @@ int wild_compare(const char *str,const char *str_end,
|
|||
if (*wildstr == wild_one)
|
||||
{
|
||||
if (str == str_end)
|
||||
return (-1);
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
break; // Not a wild character
|
||||
}
|
||||
if (wildstr == wildend)
|
||||
return(0); // Ok if wild_many is last
|
||||
{
|
||||
DBUG_RETURN(0); // Ok if wild_many is last
|
||||
}
|
||||
if (str == str_end)
|
||||
return -1;
|
||||
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
char cmp;
|
||||
if ((cmp= *wildstr) == escape && wildstr+1 != wildend)
|
||||
cmp= *++wildstr;
|
||||
|
@ -764,22 +779,30 @@ int wild_compare(const char *str,const char *str_end,
|
|||
{
|
||||
while (str != str_end && *str != cmp)
|
||||
str++;
|
||||
if (str++ == str_end) return (-1);
|
||||
if (str++ == str_end)
|
||||
{
|
||||
DBUG_RETURN(-1)
|
||||
};
|
||||
{
|
||||
int tmp=wild_compare(str,str_end,wildstr,wildend,escape);
|
||||
if (tmp <= 0)
|
||||
return (tmp);
|
||||
{
|
||||
DBUG_RETURN(tmp);
|
||||
}
|
||||
}
|
||||
} while (str != str_end && wildstr[0] != wild_many);
|
||||
return(-1);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
return (str != str_end ? 1 : 0);
|
||||
DBUG_RETURN(str != str_end ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
int wild_compare(String &match,String &wild, char escape)
|
||||
{
|
||||
return wild_compare(match.ptr(),match.ptr()+match.length(),
|
||||
wild.ptr(), wild.ptr()+wild.length(),escape);
|
||||
DBUG_ENTER("wild_compare");
|
||||
DBUG_PRINT("enter",("match='%s', wild='%s', escape='%c'"
|
||||
,match.ptr(),wild.ptr(),escape));
|
||||
DBUG_RETURN(wild_compare(match.ptr(),match.ptr()+match.length(),
|
||||
wild.ptr(), wild.ptr()+wild.length(),escape));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue