summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-05-16 16:32:51 +0300
committermonty@hundin.mysql.fi <>2002-05-16 16:32:51 +0300
commit353fb57b741ee01054a0f2a9eb83c44d0bc4dcd2 (patch)
tree145820cb9685468167f09ba07a59a1f61ca640cf
parent14b55bcc72554f3f356df4e7b1d8e7c8244de959 (diff)
downloadmariadb-git-353fb57b741ee01054a0f2a9eb83c44d0bc4dcd2.tar.gz
New my_gethostbyname_r() handling
Changed some status variable names Fix bug in GRANT ... PASSWORD string
-rw-r--r--Docs/manual.texi23
-rw-r--r--include/my_net.h36
-rw-r--r--include/my_pthread.h25
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--libmysql/libmysql.c15
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/my_gethostbyname.c119
-rw-r--r--mysys/my_pthread.c54
-rw-r--r--mysys/my_thr_init.c9
-rw-r--r--sql/hostname.cc7
-rw-r--r--sql/mini_client.cc15
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/sql_acl.cc13
13 files changed, 203 insertions, 121 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 0c5c9d57b19..c202c2c07a7 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -19678,17 +19678,17 @@ have.
@item @code{Open_files} @tab Number of files that are open.
@item @code{Open_streams} @tab Number of streams that are open (used mainly for logging).
@item @code{Opened_tables} @tab Number of tables that have been opened.
-@item @code{Select_full_join} @tab Number of joins without keys (Should be 0).
+@item @code{Select_full_join} @tab Number of joins without keys (If this is 0, you should carefully check the index of your tables).
@item @code{Select_full_range_join} @tab Number of joins where we used a range search on reference table.
@item @code{Select_range} @tab Number of joins where we used ranges on the first table. (It's normally not critical even if this is big.)
-@item @code{Select_scan} @tab Number of joins where we scanned the first table.
-@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (Should be 0).
+@item @code{Select_scan} @tab Number of joins where we did a full scann of the first table.
+@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (If this is 0, you should carefully check the index of your tables).
@item @code{Questions} @tab Number of queries sent to the server.
@item @code{Slave_open_temp_tables} @tab Number of temporary tables currently
open by the slave thread
-@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to connect.
+@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to create.
@item @code{Slow_queries} @tab Number of queries that have taken more than @code{long_query_time}. @xref{Slow query log}.
-@item @code{Sort_merge_passes} @tab Number of merges the sort has to do. If this value is large you should consider increasing @code{sort_buffer}.
+@item @code{Sort_merge_passes} @tab Number of merges passes the sort algoritm have had to do. If this value is large you should consider increasing @code{sort_buffer}.
@item @code{Sort_range} @tab Number of sorts that where done with ranges.
@item @code{Sort_rows} @tab Number of sorted rows.
@item @code{Sort_scan} @tab Number of sorts that where done by scanning the table.
@@ -19712,8 +19712,8 @@ Some comments about the above:
If @code{Opened_tables} is big, then your @code{table_cache}
variable is probably too small.
@item
-If @code{key_reads} is big, then your @code{key_cache} is probably too
-small. The cache hit rate can be calculated with
+If @code{key_reads} is big, then your @code{key_buffer_size} variable is
+probably too small. The cache hit rate can be calculated with
@code{key_reads}/@code{key_read_requests}.
@item
If @code{Handler_read_rnd} is big, then you probably have a lot of
@@ -46916,6 +46916,15 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
+Changed name of variables @code{Com_show_master_stat} to
+@code{Com_show_master_status} and @code{Com_show_slave_stat} to
+@code{Com_show_slave_status}.
+@item
+Changed handling of @code{gethostbyname()} to make the client library
+threadsafe even if @code{gethostbyname_r} doesn't exists.
+@item
+Fixed core-dump problem when giving a wrong password string to @code{GRANT}.
+@item
Fixed bug in @code{DROP DATABASE} with symlinked directory.
@item
Fixed optimization problem with @code{DATETIME} and value outside
diff --git a/include/my_net.h b/include/my_net.h
index 6a8e98d685c..e3db765cff7 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -36,6 +36,42 @@ extern "C" {
void my_inet_ntoa(struct in_addr in, char *buf);
+/*
+ Handling of gethostbyname_r()
+*/
+
+#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
+#if !defined(HPUX)
+struct hostent;
+#endif /* HPUX */
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop);
+#define my_gethostbyname_r_free()
+#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
+#define GETHOSTBYNAME_BUFF_SIZE 2048
+#else
+#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
+#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
+
+#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
+#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop);
+#define my_gethostbyname_r_free()
+#elif !defined(HAVE_GETHOSTBYNAME_R)
+#define GETHOSTBYNAME_BUFF_SIZE 2048
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop);
+void my_gethostbyname_r_free();
+#else
+#define GETHOSTBYNAME_BUFF_SIZE 2048
+#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
+#define my_gethostbyname_r_free()
+#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
+
#ifdef __cplusplus
}
#endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 4c90882e76b..24e73707288 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -426,31 +426,6 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#define HAVE_PTHREAD_KILL
#endif
-#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#if !defined(HPUX)
-struct hostent;
-#endif /* HPUX */
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#else
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#else
-#ifdef HAVE_GETHOSTBYNAME_R_RETURN_INT
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#else
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
-#endif /* HAVE_GETHOSTBYNAME_R_RETURN_INT */
-#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
#endif /* defined(__WIN__) */
/* safe_mutex adds checking to mutex for easier debugging */
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index e9e100e38b1..76d37c149c9 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -56,7 +56,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
thr_mutex.lo mulalloc.lo string.lo default.lo \
my_compress.lo array.lo my_once.lo list.lo my_net.lo \
charset.lo hash.lo mf_iocache.lo my_seek.lo \
- my_pread.lo mf_cache.lo
+ my_pread.lo mf_cache.lo my_gethostbyname.lo
# Not needed in the minimum library
mysysobjects2 = getopt.lo getopt1.lo getvar.lo my_lib.lo
mysysobjects = $(mysysobjects1) $(mysysobjects2)
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index ffce5f6bce7..4190a4c37f4 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1312,7 +1312,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
}
else
-#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD)
{
int tmp_errno;
struct hostent tmp_hostent,*hp;
@@ -1323,22 +1322,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
{
net->last_errno=CR_UNKNOWN_HOST;
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
+ my_gethostbyname_r_free();
goto error;
}
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
+ my_gethostbyname_r_free();
}
-#else
- {
- struct hostent *hp;
- if (!(hp=gethostbyname(host)))
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#endif
sock_addr.sin_port = (ushort) htons((ushort) port);
if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
mysql->options.connect_timeout) <0)
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 73cd9768013..ce24d6f6f5b 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -46,7 +46,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_quick.c my_lockmem.c my_static.c \
getopt.c getopt1.c getvar.c my_mkdir.c \
default.c my_compress.c checksum.c raid.cc my_net.c \
- my_vsnprintf.c charset.c my_bitmap.c
+ my_vsnprintf.c charset.c my_bitmap.c my_gethostbyname.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c
libmysys_a_LIBADD = @THREAD_LOBJECTS@
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
new file mode 100644
index 00000000000..19381734e83
--- /dev/null
+++ b/mysys/my_gethostbyname.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA */
+
+/* Thread safe version of gethostbyname_r() */
+
+#include "mysys_priv.h"
+#include "my_pthread.h"
+#include <assert.h>
+#include <my_net.h>
+#if !defined(MSDOS) && !defined(__WIN__)
+#include <netdb.h>
+#endif
+
+/* This file is not needed if my_gethostbyname_r is a macro */
+#if !defined(my_gethostbyname_r)
+
+#ifndef THREAD
+#define pthread_mutex_lock(A)
+#define pthread_mutex_unlock(A)
+#endif
+
+/*
+ Emulate SOLARIS style calls, not because it's better, but just to make the
+ usage of getbostbyname_r simpler.
+*/
+
+#if defined(HAVE_GETHOSTBYNAME_R)
+
+#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
+
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop)
+{
+ struct hostent *hp;
+ dbug_assert((size_t) buflen >= sizeof(*result));
+ if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
+ return 0;
+ return hp;
+}
+
+#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
+
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop)
+{
+ dbug_assert(buflen >= sizeof(struct hostent_data));
+ if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
+ {
+ *h_errnop= errno;
+ return 0;
+ }
+ return result;
+}
+
+#else
+
+/* gethostbyname_r with similar interface as gethostbyname() */
+
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop)
+{
+ struct hostent *hp;
+ dbug_assert(buflen >= sizeof(struct hostent_data));
+ hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
+ *h_errnop= errno;
+ return hp;
+}
+#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
+
+#else /* !HAVE_GETHOSTBYNAME_R */
+
+#ifdef THREAD
+extern pthread_mutex_t LOCK_gethostbyname_r;
+#endif
+
+/*
+ No gethostbyname_r() function exists.
+ In this case we have to keep a mutex over the call to ensure that no
+ other thread is going to reuse the internal memory.
+
+ The user is responsible to call my_gethostbyname_r_free() when he
+ is finished with the structure.
+*/
+
+struct hostent *my_gethostbyname_r(const char *name,
+ struct hostent *result, char *buffer,
+ int buflen, int *h_errnop)
+{
+ struct hostent *hp;
+ pthread_mutex_lock(&LOCK_gethostbyname_r);
+ hp= gethostbyname(name);
+ *h_errnop= h_errno;
+ return hp;
+}
+
+void my_gethostbyname_r_free()
+{
+ pthread_mutex_unlock(&LOCK_gethostbyname_r);
+}
+
+#endif /* !HAVE_GETHOSTBYNAME_R */
+#endif /* !my_gethostbyname_r */
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 72409b6aa86..706712086c6 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -23,9 +23,6 @@
#include <m_string.h>
#include <thr_alarm.h>
#include <assert.h>
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <netdb.h>
-#endif
#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
#define SCHED_POLICY SCHED_RR
@@ -424,57 +421,6 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond,
}
#endif /* HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT */
-/*
- Emulate SOLARIS style calls, not because it's better, but just to make the
- usage of getbostbyname_r simpler.
-*/
-
-#if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R)
-
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert((size_t) buflen >= sizeof(*result));
- if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
- return 0;
- return hp;
-}
-
-#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- dbug_assert(buflen >= sizeof(struct hostent_data));
- if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
- {
- *h_errnop= errno;
- return 0;
- }
- return result;
-}
-
-#else
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert(buflen >= sizeof(struct hostent_data));
- hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
- *h_errnop= errno;
- return hp;
-}
-
-#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
-#endif
-
/* Some help functions */
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index e1f9e23912e..2782576d8cd 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -35,6 +35,9 @@ pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
#ifndef HAVE_LOCALTIME_R
pthread_mutex_t LOCK_localtime_r;
#endif
+#ifndef HAVE_GETHOSTBYNAME_R
+pthread_mutex_t LOCK_gethostbyname_r;
+#endif
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
#endif
@@ -78,6 +81,9 @@ my_bool my_thread_global_init(void)
#ifndef HAVE_LOCALTIME_R
pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
#endif
+#ifndef HAVE_GETHOSTBYNAME_R
+ pthread_mutex_init(&LOCK_gethostbyname_r,MY_MUTEX_INIT_SLOW);
+#endif
return my_thread_init();
}
@@ -92,6 +98,9 @@ void my_thread_global_end(void)
#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
pthread_mutexattr_destroy(&my_errchk_mutexattr);
#endif
+#ifndef HAVE_GETHOSTBYNAME_R
+ pthread_mutex_destroy(&LOCK_gethostbyname_r);
+#endif
}
static long thread_id=0;
diff --git a/sql/hostname.cc b/sql/hostname.cc
index bc812341337..21dbd5a2bbe 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -171,17 +171,22 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
{
DBUG_PRINT("error",("gethostbyname_r returned %d",tmp_errno));
add_wrong_ip(in);
+ my_gethostbyname_r_free();
DBUG_RETURN(0);
}
if (!hp->h_name[0])
{
DBUG_PRINT("error",("Got an empty hostname"));
add_wrong_ip(in);
+ my_gethostbyname_r_free();
DBUG_RETURN(0); // Don't allow empty hostnames
}
if (!(name=my_strdup(hp->h_name,MYF(0))))
+ {
+ my_gethostbyname_r_free();
DBUG_RETURN(0); // out of memory
-
+ }
+ my_gethostbyname_r_free();
#else
VOID(pthread_mutex_lock(&LOCK_hostname));
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 3dfd58375a5..8f703b80e3a 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -614,7 +614,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
}
else
-#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD)
{
int tmp_errno;
struct hostent tmp_hostent,*hp;
@@ -625,22 +624,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
{
net->last_errno=CR_UNKNOWN_HOST;
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
+ my_gethostbyname_r_free();
goto error;
}
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
+ my_gethostbyname_r_free();
}
-#else
- {
- struct hostent *hp;
- if (!(hp=gethostbyname(host)))
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#endif
sock_addr.sin_port = (ushort) htons((ushort) port);
if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
mysql->options.connect_timeout) <0)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ebb7592820b..9ac6ea6fff8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3149,10 +3149,10 @@ struct show_var_st status_vars[]= {
{"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG},
{"Com_show_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG},
{"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),SHOW_LONG},
- {"Com_show_master_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG},
+ {"Com_show_master_status", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG},
{"Com_show_open_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_OPEN_TABLES),SHOW_LONG},
{"Com_show_processlist", (char*) (com_stat+(uint) SQLCOM_SHOW_PROCESSLIST),SHOW_LONG},
- {"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
+ {"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
{"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG},
{"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG},
{"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG},
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e6b0248e29b..446076e0d55 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -983,12 +983,17 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
char *password,empty_string[1];
DBUG_ENTER("replace_user_table");
+ password=empty_string;
+ empty_string[0]=0;
+
if (combo.password.str && combo.password.str[0])
- password=combo.password.str;
- else
{
- password=empty_string;
- empty_string[0]=0;
+ if (combo.password.length != HASH_PASSWORD_LENGTH)
+ {
+ my_error(ER_PASSWORD_NO_MATCH,MYF(0));
+ DBUG_RETURN(-1);
+ }
+ password=combo.password.str;
}
table->field[0]->store(combo.host.str,combo.host.length);