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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d43f1020
Commit
d43f1020
authored
Feb 14, 2004
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
eb83bb37
6e0cda9f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
40 deletions
+67
-40
include/mysql.h
include/mysql.h
+1
-0
libmysql/client_settings.h
libmysql/client_settings.h
+1
-0
libmysql/libmysql.c
libmysql/libmysql.c
+33
-30
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+11
-3
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+1
-1
mysql-test/t/union.test
mysql-test/t/union.test
+1
-1
sql-common/client.c
sql-common/client.c
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+17
-4
No files found.
include/mysql.h
View file @
d43f1020
...
...
@@ -575,6 +575,7 @@ typedef struct st_mysql_methods
void
(
*
free_embedded_thd
)(
MYSQL
*
mysql
);
const
char
*
(
*
read_statistic
)(
MYSQL
*
mysql
);
int
(
*
next_result
)(
MYSQL
*
mysql
);
int
(
*
read_change_user_result
)(
MYSQL
*
mysql
,
char
*
buff
,
const
char
*
passwd
);
#endif
}
MYSQL_METHODS
;
...
...
libmysql/client_settings.h
View file @
d43f1020
...
...
@@ -58,6 +58,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt);
MYSQL_DATA
*
cli_read_binary_rows
(
MYSQL_STMT
*
stmt
);
int
cli_unbuffered_fetch
(
MYSQL
*
mysql
,
char
**
row
);
const
char
*
cli_read_statistic
(
MYSQL
*
mysql
);
int
cli_read_change_user_result
(
MYSQL
*
mysql
,
char
*
buff
,
const
char
*
passwd
);
#ifdef EMBEDDED_LIBRARY
int
init_embedded_server
(
int
argc
,
char
**
argv
,
char
**
groups
);
...
...
libmysql/libmysql.c
View file @
d43f1020
...
...
@@ -606,13 +606,42 @@ mysql_connect(MYSQL *mysql,const char *host,
/**************************************************************************
Change user and database
**************************************************************************/
int
cli_read_change_user_result
(
MYSQL
*
mysql
,
char
*
buff
,
const
char
*
passwd
)
{
NET
*
net
=
&
mysql
->
net
;
ulong
pkt_length
;
pkt_length
=
net_safe_read
(
mysql
);
if
(
pkt_length
==
packet_error
)
return
1
;
if
(
pkt_length
==
1
&&
net
->
read_pos
[
0
]
==
254
&&
mysql
->
server_capabilities
&
CLIENT_SECURE_CONNECTION
)
{
/*
By sending this very specific reply server asks us to send scrambled
password in old format. The reply contains scramble_323.
*/
scramble_323
(
buff
,
mysql
->
scramble
,
passwd
);
if
(
my_net_write
(
net
,
buff
,
SCRAMBLE_LENGTH_323
+
1
)
||
net_flush
(
net
))
{
net
->
last_errno
=
CR_SERVER_LOST
;
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
return
1
;
}
/* Read what server thinks about out new auth message report */
if
(
net_safe_read
(
mysql
)
==
packet_error
)
return
1
;
}
return
0
;
}
my_bool
STDCALL
mysql_change_user
(
MYSQL
*
mysql
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
db
)
{
char
buff
[
512
],
*
end
=
buff
;
NET
*
net
=
&
mysql
->
net
;
ulong
pkt_length
;
DBUG_ENTER
(
"mysql_change_user"
);
if
(
!
user
)
...
...
@@ -646,31 +675,8 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
/* Write authentication package */
simple_command
(
mysql
,
COM_CHANGE_USER
,
buff
,(
ulong
)
(
end
-
buff
),
1
);
pkt_length
=
net_safe_read
(
mysql
);
if
(
pkt_length
==
packet_error
)
goto
error
;
if
(
pkt_length
==
1
&&
net
->
read_pos
[
0
]
==
254
&&
mysql
->
server_capabilities
&
CLIENT_SECURE_CONNECTION
)
{
/*
By sending this very specific reply server asks us to send scrambled
password in old format. The reply contains scramble_323.
*/
scramble_323
(
buff
,
mysql
->
scramble
,
passwd
);
if
(
my_net_write
(
net
,
buff
,
SCRAMBLE_LENGTH_323
+
1
)
||
net_flush
(
net
))
{
net
->
last_errno
=
CR_SERVER_LOST
;
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
}
/* Read what server thinks about out new auth message report */
if
(
net_safe_read
(
mysql
)
==
packet_error
)
goto
error
;
}
if
((
*
mysql
->
methods
->
read_change_user_result
)(
mysql
,
buff
,
passwd
))
DBUG_RETURN
(
1
);
/* Free old connect information */
my_free
(
mysql
->
user
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
mysql
->
passwd
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
...
@@ -681,9 +687,6 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
mysql
->
passwd
=
my_strdup
(
passwd
,
MYF
(
MY_WME
));
mysql
->
db
=
db
?
my_strdup
(
db
,
MYF
(
MY_WME
))
:
0
;
DBUG_RETURN
(
0
);
error:
DBUG_RETURN
(
1
);
}
#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
...
...
libmysqld/lib_sql.cc
View file @
d43f1020
...
...
@@ -258,6 +258,13 @@ int emb_next_result(MYSQL *mysql)
DBUG_RETURN
(
0
);
/* No more results */
}
int
emb_read_change_user_result
(
MYSQL
*
mysql
,
char
*
buff
__attribute__
((
unused
)),
const
char
*
passwd
__attribute__
((
unused
)))
{
return
mysql_errno
(
mysql
);
}
MYSQL_METHODS
embedded_methods
=
{
emb_mysql_read_query_result
,
...
...
@@ -272,7 +279,8 @@ MYSQL_METHODS embedded_methods=
emb_unbuffered_fetch
,
emb_free_embedded_thd
,
emb_read_statistic
,
emb_next_result
emb_next_result
,
emb_read_change_user_result
};
C_MODE_END
...
...
@@ -612,8 +620,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
}
else
{
client_field
->
def
=
strdup_root
(
field_alloc
,
tmp
.
ptr
());
client_field
->
def_length
=
tmp
.
length
();
client_field
->
def
=
strdup_root
(
field_alloc
,
res
->
ptr
());
client_field
->
def_length
=
res
->
length
();
}
}
else
...
...
mysql-test/t/subselect.test
View file @
d43f1020
...
...
@@ -522,7 +522,7 @@ set @a:=(SELECT a from t1);
CREATE
TABLE
t1
(
a
int
,
KEY
(
a
));
HANDLER
t1
OPEN
;
--
error
1
149
--
error
1
064
HANDLER
t1
READ
a
=
((
SELECT
1
));
HANDLER
t1
CLOSE
;
drop
table
t1
;
...
...
mysql-test/t/union.test
View file @
d43f1020
...
...
@@ -213,7 +213,7 @@ select found_rows();
(
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t1
)
UNION
all
(
SELECT
*
FROM
t2
LIMIT
1
);
select
found_rows
();
# This used to work in 4.0 but not anymore in 4.1
--
error
1
149
--
error
1
064
(
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t1
LIMIT
1
)
UNION
SELECT
*
FROM
t2
LIMIT
1
;
#select found_rows();
...
...
sql-common/client.c
View file @
d43f1020
...
...
@@ -1421,7 +1421,8 @@ static MYSQL_METHODS client_methods=
cli_unbuffered_fetch
,
NULL
,
cli_read_statistic
,
cli_read_query_result
cli_read_query_result
,
cli_read_change_user_result
#endif
};
...
...
sql/sql_parse.cc
View file @
d43f1020
...
...
@@ -206,7 +206,21 @@ int check_user(THD *thd, enum enum_server_command command,
#ifdef NO_EMBEDDED_ACCESS_CHECKS
thd
->
master_access
=
GLOBAL_ACLS
;
// Full rights
return
0
;
/* Change database if necessary: OK or FAIL is sent in mysql_change_db */
if
(
db
&&
db
[
0
])
{
thd
->
db
=
0
;
thd
->
db_length
=
0
;
if
(
mysql_change_db
(
thd
,
db
))
{
if
(
thd
->
user_connect
)
decrease_user_connections
(
thd
->
user_connect
);
DBUG_RETURN
(
-
1
);
}
}
else
send_ok
(
thd
);
DBUG_RETURN
(
0
);
#else
my_bool
opt_secure_auth_local
;
...
...
@@ -1282,7 +1296,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
send_error
(
thd
);
// dump to NET
break
;
}
#ifndef EMBEDDED_LIBRARY
case
COM_CHANGE_USER
:
{
thd
->
change_user
();
...
...
@@ -1301,13 +1314,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
uint
passwd_len
=
thd
->
client_capabilities
&
CLIENT_SECURE_CONNECTION
?
*
passwd
++
:
strlen
(
passwd
);
db
+=
passwd_len
+
1
;
#ifndef EMBEDDED_LIBRARY
/* Small check for incomming packet */
if
((
uint
)
((
uchar
*
)
db
-
net
->
read_pos
)
>
packet_length
)
{
send_error
(
thd
,
ER_UNKNOWN_COM_ERROR
);
break
;
}
#endif
/* Convert database name to utf8 */
db_buff
[
copy_and_convert
(
db_buff
,
sizeof
(
db_buff
)
-
1
,
system_charset_info
,
db
,
strlen
(
db
),
...
...
@@ -1358,7 +1372,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
break
;
}
#endif
/* EMBEDDED_LIBRARY */
case
COM_EXECUTE
:
{
mysql_stmt_execute
(
thd
,
packet
);
...
...
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