Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6b762898
Commit
6b762898
authored
Nov 27, 2001
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work.mysql.com:/home/bk/mysql-4.0
into volk.internalnet:/home/tonu/mysql-4.0
parents
a3c5f0ca
c7067c29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
29 deletions
+61
-29
mysql-test/r/rpl000001.result
mysql-test/r/rpl000001.result
+2
-2
mysql-test/t/rpl000001.test
mysql-test/t/rpl000001.test
+2
-2
sql/sql_acl.cc
sql/sql_acl.cc
+19
-10
sql/sql_string.cc
sql/sql_string.cc
+38
-15
No files found.
mysql-test/r/rpl000001.result
View file @
6b762898
...
@@ -30,8 +30,8 @@ abandoned
...
@@ -30,8 +30,8 @@ abandoned
abandoning
abandoning
abandonment
abandonment
abandons
abandons
set password = password('foo');
set password
for root@"localhost"
= password('foo');
set password = password('');
set password
for root@"localhost"
= password('');
create table t3(n int);
create table t3(n int);
insert into t3 values(1),(2);
insert into t3 values(1),(2);
use test;
use test;
...
...
mysql-test/t/rpl000001.test
View file @
6b762898
...
@@ -7,8 +7,8 @@ create table t1 (word char(20) not null);
...
@@ -7,8 +7,8 @@ create table t1 (word char(20) not null);
load
data
infile
'../../std_data/words.dat'
into
table
t1
;
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
;
eval
load
data
local
infile
'$MYSQL_TEST_DIR/std_data/words.dat'
into
table
t1
;
select
*
from
t1
;
select
*
from
t1
;
set
password
=
password
(
'foo'
);
set
password
for
root
@
"localhost"
=
password
(
'foo'
);
set
password
=
password
(
''
);
set
password
for
root
@
"localhost"
=
password
(
''
);
create
table
t3
(
n
int
);
create
table
t3
(
n
int
);
insert
into
t3
values
(
1
),(
2
);
insert
into
t3
values
(
1
),(
2
);
save_master_pos
;
save_master_pos
;
...
...
sql/sql_acl.cc
View file @
6b762898
...
@@ -769,7 +769,7 @@ int wild_case_compare(const char *str,const char *wildstr)
...
@@ -769,7 +769,7 @@ int wild_case_compare(const char *str,const char *wildstr)
{
{
reg3
int
flag
;
reg3
int
flag
;
DBUG_ENTER
(
"wild_case_compare"
);
DBUG_ENTER
(
"wild_case_compare"
);
DBUG_PRINT
(
"enter"
,(
"str='%s', wildstr='%s'"
,
str
,
wildstr
));
while
(
*
wildstr
)
while
(
*
wildstr
)
{
{
while
(
*
wildstr
&&
*
wildstr
!=
wild_many
&&
*
wildstr
!=
wild_one
)
while
(
*
wildstr
&&
*
wildstr
!=
wild_many
&&
*
wildstr
!=
wild_one
)
...
@@ -892,16 +892,18 @@ bool acl_check_host(const char *host, const char *ip)
...
@@ -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
,
bool
change_password
(
THD
*
thd
,
const
char
*
host
,
const
char
*
user
,
char
*
new_password
)
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
;
uint
length
=
0
;
if
(
!
user
[
0
])
if
(
!
user
[
0
])
{
{
send_error
(
&
thd
->
net
,
ER_PASSWORD_ANONYMOUS_USER
);
send_error
(
&
thd
->
net
,
ER_PASSWORD_ANONYMOUS_USER
);
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
!
initialized
)
if
(
!
initialized
)
{
{
send_error
(
&
thd
->
net
,
ER_PASSWORD_NOT_ALLOWED
);
/* purecov: inspected */
send_error
(
&
thd
->
net
,
ER_PASSWORD_NOT_ALLOWED
);
/* purecov: inspected */
return
1
;
/* purecov: inspected */
DBUG_RETURN
(
1
)
;
/* purecov: inspected */
}
}
if
(
!
host
)
if
(
!
host
)
host
=
thd
->
ip
;
/* purecov: tested */
host
=
thd
->
ip
;
/* purecov: tested */
...
@@ -913,15 +915,16 @@ bool change_password(THD *thd, const char *host, const char *user,
...
@@ -913,15 +915,16 @@ bool change_password(THD *thd, const char *host, const char *user,
my_strcasecmp
(
host
,
thd
->
host
?
thd
->
host
:
thd
->
ip
))))
my_strcasecmp
(
host
,
thd
->
host
?
thd
->
host
:
thd
->
ip
))))
{
{
if
(
check_access
(
thd
,
UPDATE_ACL
,
"mysql"
,
0
,
1
))
if
(
check_access
(
thd
,
UPDATE_ACL
,
"mysql"
,
0
,
1
))
return
1
;
DBUG_RETURN
(
1
)
;
}
}
VOID
(
pthread_mutex_lock
(
&
acl_cache
->
lock
));
VOID
(
pthread_mutex_lock
(
&
acl_cache
->
lock
));
ACL_USER
*
acl_user
;
ACL_USER
*
acl_user
;
DBUG_PRINT
(
"info"
,(
"host=%s, user=%s"
,
host
,
user
));
if
(
!
(
acl_user
=
find_acl_user
(
host
,
user
))
||
!
acl_user
->
user
)
if
(
!
(
acl_user
=
find_acl_user
(
host
,
user
))
||
!
acl_user
->
user
)
{
{
send_error
(
&
thd
->
net
,
ER_PASSWORD_NO_MATCH
);
send_error
(
&
thd
->
net
,
ER_PASSWORD_NO_MATCH
);
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
return
1
;
DBUG_RETURN
(
1
)
;
}
}
if
(
update_user_table
(
thd
,
if
(
update_user_table
(
thd
,
acl_user
->
host
.
hostname
?
acl_user
->
host
.
hostname
:
""
,
acl_user
->
host
.
hostname
?
acl_user
->
host
.
hostname
:
""
,
...
@@ -929,7 +932,7 @@ bool change_password(THD *thd, const char *host, const char *user,
...
@@ -929,7 +932,7 @@ bool change_password(THD *thd, const char *host, const char *user,
{
{
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
/* purecov: deadcode */
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
/* purecov: deadcode */
send_error
(
&
thd
->
net
,
0
);
/* 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
);
get_salt_from_password
(
acl_user
->
salt
,
new_password
);
if
(
!
new_password
[
0
])
if
(
!
new_password
[
0
])
...
@@ -950,7 +953,7 @@ bool change_password(THD *thd, const char *host, const char *user,
...
@@ -950,7 +953,7 @@ bool change_password(THD *thd, const char *host, const char *user,
new_password
));
new_password
));
mysql_update_log
.
write
(
thd
,
buff
,
qinfo
.
q_len
);
mysql_update_log
.
write
(
thd
,
buff
,
qinfo
.
q_len
);
mysql_bin_log
.
write
(
&
qinfo
);
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,
...
@@ -961,17 +964,23 @@ bool change_password(THD *thd, const char *host, const char *user,
static
ACL_USER
*
static
ACL_USER
*
find_acl_user
(
const
char
*
host
,
const
char
*
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
++
)
for
(
uint
i
=
0
;
i
<
acl_users
.
elements
;
i
++
)
{
{
ACL_USER
*
acl_user
=
dynamic_element
(
&
acl_users
,
i
,
ACL_USER
*
);
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
]
||
if
(
!
acl_user
->
user
&&
!
user
[
0
]
||
acl_user
->
user
&&
!
strcmp
(
user
,
acl_user
->
user
))
acl_user
->
user
&&
!
strcmp
(
user
,
acl_user
->
user
))
{
{
if
(
compare_hostname
(
&
acl_user
->
host
,
host
,
host
))
if
(
compare_hostname
(
&
(
acl_user
->
host
),
host
,
host
))
return
acl_user
;
{
DBUG_RETURN
(
acl_user
);
}
}
}
}
}
return
0
;
DBUG_RETURN
(
0
)
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
sql/sql_string.cc
View file @
6b762898
...
@@ -699,8 +699,11 @@ int wild_case_compare(const char *str,const char *str_end,
...
@@ -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
)
int
wild_case_compare
(
String
&
match
,
String
&
wild
,
char
escape
)
{
{
return
wild_case_compare
(
match
.
ptr
(),
match
.
ptr
()
+
match
.
length
(),
DBUG_ENTER
(
"wild_case_compare"
);
wild
.
ptr
(),
wild
.
ptr
()
+
wild
.
length
(),
escape
);
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)
...
@@ -710,6 +713,9 @@ int wild_case_compare(String &match,String &wild, char escape)
int
wild_compare
(
const
char
*
str
,
const
char
*
str_end
,
int
wild_compare
(
const
char
*
str
,
const
char
*
str_end
,
const
char
*
wildstr
,
const
char
*
wildend
,
char
escape
)
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
int
result
=
-
1
;
// Not found, using wildcards
while
(
wildstr
!=
wildend
)
while
(
wildstr
!=
wildend
)
{
{
...
@@ -718,9 +724,13 @@ int wild_compare(const char *str,const char *str_end,
...
@@ -718,9 +724,13 @@ int wild_compare(const char *str,const char *str_end,
if
(
*
wildstr
==
escape
&&
wildstr
+
1
!=
wildend
)
if
(
*
wildstr
==
escape
&&
wildstr
+
1
!=
wildend
)
wildstr
++
;
wildstr
++
;
if
(
str
==
str_end
||
*
wildstr
++
!=
*
str
++
)
if
(
str
==
str_end
||
*
wildstr
++
!=
*
str
++
)
return
(
1
);
{
DBUG_RETURN
(
1
);
}
if
(
wildstr
==
wildend
)
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
result
=
1
;
// Found an anchor char
}
}
if
(
*
wildstr
==
wild_one
)
if
(
*
wildstr
==
wild_one
)
...
@@ -728,7 +738,7 @@ int wild_compare(const char *str,const char *str_end,
...
@@ -728,7 +738,7 @@ int wild_compare(const char *str,const char *str_end,
do
do
{
{
if
(
str
==
str_end
)
// Skip one char if possible
if
(
str
==
str_end
)
// Skip one char if possible
return
(
result
);
DBUG_RETURN
(
result
);
str
++
;
str
++
;
}
while
(
*++
wildstr
==
wild_one
&&
wildstr
!=
wildend
);
}
while
(
*++
wildstr
==
wild_one
&&
wildstr
!=
wildend
);
if
(
wildstr
==
wildend
)
if
(
wildstr
==
wildend
)
...
@@ -745,17 +755,22 @@ int wild_compare(const char *str,const char *str_end,
...
@@ -745,17 +755,22 @@ int wild_compare(const char *str,const char *str_end,
if
(
*
wildstr
==
wild_one
)
if
(
*
wildstr
==
wild_one
)
{
{
if
(
str
==
str_end
)
if
(
str
==
str_end
)
return
(
-
1
);
{
DBUG_RETURN
(
-
1
);
}
str
++
;
str
++
;
continue
;
continue
;
}
}
break
;
// Not a wild character
break
;
// Not a wild character
}
}
if
(
wildstr
==
wildend
)
if
(
wildstr
==
wildend
)
return
(
0
);
// Ok if wild_many is last
{
DBUG_RETURN
(
0
);
// Ok if wild_many is last
}
if
(
str
==
str_end
)
if
(
str
==
str_end
)
return
-
1
;
{
DBUG_RETURN
(
-
1
);
}
char
cmp
;
char
cmp
;
if
((
cmp
=
*
wildstr
)
==
escape
&&
wildstr
+
1
!=
wildend
)
if
((
cmp
=
*
wildstr
)
==
escape
&&
wildstr
+
1
!=
wildend
)
cmp
=
*++
wildstr
;
cmp
=
*++
wildstr
;
...
@@ -764,22 +779,30 @@ int wild_compare(const char *str,const char *str_end,
...
@@ -764,22 +779,30 @@ int wild_compare(const char *str,const char *str_end,
{
{
while
(
str
!=
str_end
&&
*
str
!=
cmp
)
while
(
str
!=
str_end
&&
*
str
!=
cmp
)
str
++
;
str
++
;
if
(
str
++
==
str_end
)
return
(
-
1
);
if
(
str
++
==
str_end
)
{
DBUG_RETURN
(
-
1
)
};
{
{
int
tmp
=
wild_compare
(
str
,
str_end
,
wildstr
,
wildend
,
escape
);
int
tmp
=
wild_compare
(
str
,
str_end
,
wildstr
,
wildend
,
escape
);
if
(
tmp
<=
0
)
if
(
tmp
<=
0
)
return
(
tmp
);
{
DBUG_RETURN
(
tmp
);
}
}
}
}
while
(
str
!=
str_end
&&
wildstr
[
0
]
!=
wild_many
);
}
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
)
int
wild_compare
(
String
&
match
,
String
&
wild
,
char
escape
)
{
{
return
wild_compare
(
match
.
ptr
(),
match
.
ptr
()
+
match
.
length
(),
DBUG_ENTER
(
"wild_compare"
);
wild
.
ptr
(),
wild
.
ptr
()
+
wild
.
length
(),
escape
);
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
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment