summaryrefslogtreecommitdiff
path: root/sql/mini_client.cc
diff options
context:
space:
mode:
authorunknown <peter@mysql.com>2002-12-05 03:55:29 +0300
committerunknown <peter@mysql.com>2002-12-05 03:55:29 +0300
commit339cf7ce7bc856996812786f95dfa9f8717d3b99 (patch)
tree0d1d28ba46e738e0d01fff771cd505a057e5d664 /sql/mini_client.cc
parentd318b4b857c2c8312842ec132aad786ce165138f (diff)
downloadmariadb-git-339cf7ce7bc856996812786f95dfa9f8717d3b99.tar.gz
Basically minor code optimizations and cleanups
client/mysqladmin.c: fix folding libmysql/libmysql.c: Minor optimizations sql/mini_client.cc: Minor optimizations sql/password.c: Optimiations sql/sql_acl.cc: Get rid of stage parameter and flag old passwords with '*' instead of zero sql/sql_acl.h: fix prototype sql/sql_parse.cc: Minor optimizations
Diffstat (limited to 'sql/mini_client.cc')
-rw-r--r--sql/mini_client.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 7f841255454..31668e38a6f 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -810,9 +810,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
{
if (passwd[0])
{
- /* Use something for not empty password not to match it against empty one */
- end=scramble(strend(buff+5)+1, mysql->scramble_buff,"~MySQL#!",
- (my_bool) (mysql->protocol_version == 9));
+ /* Prepare false scramble */
+ end=strend(buff+5)+1;
+ bfill(end, SCRAMBLE_LENGTH, 'x');
+ end+=SCRAMBLE_LENGTH;
+ *end=0;
+ end++;
}
else /* For empty password*/
{
@@ -820,8 +823,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
*end=0; /* Store zero length scramble */
}
}
- /* Real scramble is sent only for old servers. This is to be blocked by option */
else
+ /*
+ Real scramble is only sent to old servers. This can be blocked
+ by calling mysql_options(MYSQL *, MYSQL_SECURE_CONNECT, (char*) &1);
+ */
end=scramble(strend(buff+5)+1, mysql->scramble_buff, passwd,
(my_bool) (mysql->protocol_version == 9));
@@ -847,11 +853,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
{
- /* This should basically always happen with new server unless empty password */
- if (pkt_length==24) /* We have new hash back */
+ /* This should always happen with new server unless empty password */
+ if (pkt_length==24 && net->read_pos[0])
+ /* OK/Error message has zero as the first character */
{
/* Old passwords will have zero at the first byte of hash */
- if (net->read_pos[0])
+ if (net->read_pos[0] != '*')
{
/* Build full password hash as it is required to decode scramble */
password_hash_stage1(buff, passwd);