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
aa77916c
Commit
aa77916c
authored
Dec 29, 2002
by
peter@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
ba1e8571
333420e2
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
113 additions
and
29 deletions
+113
-29
include/mysqld_error.h
include/mysqld_error.h
+2
-1
mysql-test/r/func_crypt.result
mysql-test/r/func_crypt.result
+10
-1
mysql-test/t/func_crypt.test
mysql-test/t/func_crypt.test
+6
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+41
-7
sql/item_strfunc.h
sql/item_strfunc.h
+1
-0
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+1
-0
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+1
-0
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+1
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+1
-0
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+1
-0
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+1
-0
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+1
-0
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+1
-0
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+1
-0
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+1
-0
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+1
-0
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+1
-0
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+1
-0
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+1
-0
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+1
-0
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+1
-0
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+1
-0
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+1
-0
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+1
-0
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+1
-0
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+1
-0
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+1
-0
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+27
-16
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-3
No files found.
include/mysqld_error.h
View file @
aa77916c
...
...
@@ -265,4 +265,5 @@
#define ER_DERIVED_MUST_HAVE_ALIAS 1246
#define ER_SELECT_REDUCED 1247
#define ER_TABLENAME_NOT_ALLOWED_HERE 1248
#define ER_ERROR_MESSAGES 249
#define ER_NOT_SUPPORTED_AUTH_MODE 1249
#define ER_ERROR_MESSAGES 250
mysql-test/r/func_crypt.result
View file @
aa77916c
select length(encrypt('foo', 'ff')) <> 0;
length(encrypt('foo', 'ff')) <> 0
1
select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa');
select password("a",""), password("a",NULL), password("","a"), password(NULL,"a");
password("a","") password("a",NULL) password("","a") password(NULL,"a")
*2517f7235d68d4ba2e5019c93420523101157a792c01 NULL NULL
select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa");
password("aaaaaaaaaaaaaaaa","a") password("a","aaaaaaaaaaaaaaaa")
*2cd3b9a44e9a9994789a30f935c92f45a96c5472f381 *37c7c5c794ff144819f2531bf03c57772cd84e40db09
select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa');
old_password('test') length(password("1")) length(encrypt('test')) encrypt('test','aa')
378b243e220ca493 45 13 aaqPiZY5xR5l.
select old_password(""), old_password(NULL), password(""), password(NULL);
old_password("") old_password(NULL) password("") password(NULL)
NULL NULL
mysql-test/t/func_crypt.test
View file @
aa77916c
select
length
(
encrypt
(
'foo'
,
'ff'
))
<>
0
;
--
replace_result
$
1
$aa
$
4
OSUA5cjdx0RUQ08opV27
/
aaqPiZY5xR5l
.
select
old_password
(
'test'
),
length
(
password
(
"1"
)),
length
(
encrypt
(
'test'
)),
encrypt
(
'test'
,
'aa'
);
# Test new and old password handling functions
select
password
(
"a"
,
""
),
password
(
"a"
,
NULL
),
password
(
""
,
"a"
),
password
(
NULL
,
"a"
);
select
password
(
"aaaaaaaaaaaaaaaa"
,
"a"
),
password
(
"a"
,
"aaaaaaaaaaaaaaaa"
);
select
old_password
(
'test'
),
length
(
password
(
"1"
)),
length
(
encrypt
(
'test'
)),
encrypt
(
'test'
,
'aa'
);
select
old_password
(
""
),
old_password
(
NULL
),
password
(
""
),
password
(
NULL
);
sql/item_strfunc.cc
View file @
aa77916c
...
...
@@ -1271,18 +1271,52 @@ String *Item_func_trim::val_str(String *str)
return
&
tmp_value
;
}
/*
Password() function can have 2 args now. Second argument can be used
to make results repeatable
*/
String
*
Item_func_password
::
val_str
(
String
*
str
)
{
String
*
res
=
args
[
0
]
->
val_str
(
str
);
struct
rand_struct
rand_st
;
// local structure for 2 param version
ulong
seed
=
0
;
// seed to initialise random generator to
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
if
(
res
->
length
()
==
0
)
return
&
empty_string
;
make_scrambled_password
(
tmp_value
,
res
->
c_ptr
(),
opt_old_passwords
,
&
current_thd
->
rand
);
str
->
set
(
tmp_value
,
get_password_length
(
opt_old_passwords
),
res
->
charset
());
return
str
;
if
(
arg_count
==
1
)
{
String
*
res
=
args
[
0
]
->
val_str
(
str
);
if
(
res
->
length
()
==
0
)
return
&
empty_string
;
make_scrambled_password
(
tmp_value
,
res
->
c_ptr
(),
opt_old_passwords
,
&
current_thd
->
rand
);
str
->
set
(
tmp_value
,
get_password_length
(
opt_old_passwords
),
res
->
charset
());
return
str
;
}
else
{
/* Check second argument for NULL value. First one is already checked */
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
/* Generate the seed first this allows to avoid double allocation */
char
*
seed_ptr
=
args
[
1
]
->
val_str
(
str
)
->
c_ptr
();
while
(
*
seed_ptr
)
{
seed
=
seed
*
211
+*
seed_ptr
;
/* Use simple hashing */
seed_ptr
++
;
}
/* Use constants which allow nice random values even with small seed */
randominit
(
&
rand_st
,
seed
*
111111
+
33333333L
,
seed
*
1111
+
55555555L
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
if
(
res
->
length
()
==
0
)
return
&
empty_string
;
make_scrambled_password
(
tmp_value
,
res
->
c_ptr
(),
opt_old_passwords
,
&
rand_st
);
str
->
set
(
tmp_value
,
get_password_length
(
opt_old_passwords
),
res
->
charset
());
return
str
;
}
}
String
*
Item_func_old_password
::
val_str
(
String
*
str
)
...
...
sql/item_strfunc.h
View file @
aa77916c
...
...
@@ -257,6 +257,7 @@ class Item_func_password :public Item_str_func
char
tmp_value
[
64
];
/* This should be enough for new password format */
public:
Item_func_password
(
Item
*
a
)
:
Item_str_func
(
a
)
{}
Item_func_password
(
Item
*
a
,
Item
*
b
)
:
Item_str_func
(
a
,
b
)
{}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
max_length
=
get_password_length
(
opt_old_passwords
);
}
const
char
*
func_name
()
const
{
return
"password"
;
}
...
...
sql/share/czech/errmsg.txt
View file @
aa77916c
...
...
@@ -259,3 +259,4 @@ v/*
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/danish/errmsg.txt
View file @
aa77916c
...
...
@@ -253,3 +253,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/dutch/errmsg.txt
View file @
aa77916c
...
...
@@ -261,3 +261,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/english/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias",
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/estonian/errmsg.txt
View file @
aa77916c
...
...
@@ -255,3 +255,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/french/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/german/errmsg.txt
View file @
aa77916c
...
...
@@ -260,3 +260,4 @@
"Für jede abgeleitete Tabelle muss ein eigener Alias angegeben werden.",
"Select %u wurde während der Optimierung reduziert.",
"Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden."
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/greek/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/hungarian/errmsg.txt
View file @
aa77916c
...
...
@@ -252,3 +252,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/italian/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/japanese/errmsg.txt
View file @
aa77916c
...
...
@@ -252,3 +252,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/korean/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/norwegian-ny/errmsg.txt
View file @
aa77916c
...
...
@@ -252,3 +252,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/norwegian/errmsg.txt
View file @
aa77916c
...
...
@@ -252,3 +252,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/polish/errmsg.txt
View file @
aa77916c
...
...
@@ -254,3 +254,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/portuguese/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/romanian/errmsg.txt
View file @
aa77916c
...
...
@@ -254,3 +254,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/russian/errmsg.txt
View file @
aa77916c
...
...
@@ -253,3 +253,4 @@
"Every derived table must have it's own alias"
"Select %u ",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/serbian/errmsg.txt
View file @
aa77916c
...
...
@@ -246,3 +246,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/slovak/errmsg.txt
View file @
aa77916c
...
...
@@ -258,3 +258,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/spanish/errmsg.txt
View file @
aa77916c
...
...
@@ -251,3 +251,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/swedish/errmsg.txt
View file @
aa77916c
...
...
@@ -250,3 +250,4 @@
"Every derived table must have it's own alias"
"Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/share/ukrainian/errmsg.txt
View file @
aa77916c
...
...
@@ -255,3 +255,4 @@
"Every derived table must have it's own alias"
"Select %u was iii",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s"
"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file
sql/sql_parse.cc
View file @
aa77916c
...
...
@@ -189,9 +189,9 @@ static int get_or_create_user_conn(THD *thd, const char *user,
static
int
check_user
(
THD
*
thd
,
enum_server_command
command
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
db
,
bool
check_count
,
bool
do_send_error
,
char
*
crypted_scramble
,
bool
had_password
,
uint
*
cur_priv_version
,
ACL_USER
**
hint_user
)
bool
simple_connect
,
bool
do_send_error
,
char
*
crypted_scramble
,
bool
had_password
,
uint
*
cur_priv_version
,
ACL_USER
**
hint_user
)
{
thd
->
db
=
0
;
thd
->
db_length
=
0
;
...
...
@@ -222,14 +222,23 @@ static int check_user(THD *thd,enum_server_command command, const char *user,
{
if
(
do_send_error
)
{
net_printf
(
thd
,
ER_ACCESS_DENIED_ERROR
,
thd
->
user
,
thd
->
host_or_ip
,
had_password
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
mysql_log
.
write
(
thd
,
COM_CONNECT
,
ER
(
ER_ACCESS_DENIED_ERROR
),
thd
->
user
,
thd
->
host_or_ip
,
had_password
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
/* Old client should get nicer error message if password version is not supported*/
if
(
simple_connect
&&
*
hint_user
&&
(
*
hint_user
)
->
pversion
)
{
net_printf
(
thd
,
ER_NOT_SUPPORTED_AUTH_MODE
);
mysql_log
.
write
(
thd
,
COM_CONNECT
,
ER
(
ER_NOT_SUPPORTED_AUTH_MODE
));
}
else
{
net_printf
(
thd
,
ER_ACCESS_DENIED_ERROR
,
thd
->
user
,
thd
->
host_or_ip
,
had_password
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
mysql_log
.
write
(
thd
,
COM_CONNECT
,
ER
(
ER_ACCESS_DENIED_ERROR
),
thd
->
user
,
thd
->
host_or_ip
,
had_password
?
ER
(
ER_YES
)
:
ER
(
ER_NO
));
}
return
(
1
);
// Error already given
}
else
...
...
@@ -638,8 +647,9 @@ check_connections(THD *thd)
/* Store information if we used password. passwd will be dammaged */
bool
using_password
=
test
(
passwd
[
0
]);
/* Check user permissions. If password failure we'll get scramble back */
if
(
check_user
(
thd
,
COM_CONNECT
,
user
,
passwd
,
db
,
1
,
simple_connect
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
)
<
0
)
if
(
check_user
(
thd
,
COM_CONNECT
,
user
,
passwd
,
db
,
1
,
simple_connect
,
simple_connect
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
)
<
0
)
{
/* If The client is old we just have to return error */
if
(
simple_connect
)
...
...
@@ -679,7 +689,7 @@ check_connections(THD *thd)
}
/* Final attempt to check the user based on reply */
if
(
check_user
(
thd
,
COM_CONNECT
,
tmp_user
,
(
char
*
)
net
->
read_pos
,
tmp_db
,
1
,
1
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
tmp_db
,
1
,
0
,
1
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
))
return
-
1
;
}
...
...
@@ -1077,7 +1087,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
Do not retry if we already have sent error (result>0)
*/
if
(
check_user
(
thd
,
COM_CHANGE_USER
,
user
,
passwd
,
db
,
0
,
simple_connect
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
)
<
0
)
simple_connect
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
)
<
0
)
{
/* If The client is old we just have to have auth failure */
if
(
simple_connect
)
...
...
@@ -1112,7 +1123,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Final attempt to check the user based on reply */
if
(
check_user
(
thd
,
COM_CHANGE_USER
,
tmp_user
,
(
char
*
)
net
->
read_pos
,
tmp_db
,
0
,
1
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
tmp_db
,
0
,
0
,
1
,
prepared_scramble
,
using_password
,
&
cur_priv_version
,
&
cached_user
))
goto
restore_user
;
}
...
...
sql/sql_yacc.yy
View file @
aa77916c
...
...
@@ -2209,9 +2209,9 @@ simple_expr:
| NOW_SYM '(' expr ')'
{ $$= new Item_func_now($3); Lex->safe_to_cache_query=0;}
| PASSWORD '(' expr ')'
{
$$= new Item_func_password($3);
}
{
$$= new Item_func_password($3); }
| PASSWORD '(' expr ',' expr ')'
{ $$= new Item_func_password($3,$5);
}
| POINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3); }
| POINTFROMTEXT '(' expr ',' expr ')'
...
...
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