Commit 56d24063 authored by cmiller@zippy.cornsilk.net's avatar cmiller@zippy.cornsilk.net

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
parents e1209262 a039376c
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
#define USERNAME_LENGTH 16 #define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60 #define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5 #define SQLSTATE_LENGTH 5
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_BYTE_LEN NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN
#define LOCAL_HOST "localhost" #define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "." #define LOCAL_HOST_NAMEDPIPE "."
......
...@@ -1072,6 +1072,7 @@ explain select a from t1 group by a; ...@@ -1072,6 +1072,7 @@ explain select a from t1 group by a;
select a from t1 group by a; select a from t1 group by a;
drop table t1; drop table t1;
# #
# Bug#20393: User name truncation in mysql client # Bug#20393: User name truncation in mysql client
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte # Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
...@@ -1099,5 +1100,4 @@ explain ...@@ -1099,5 +1100,4 @@ explain
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@' ...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
# Create options # Create options
# We intentionally add a space to the beginning of lib strings, simplifies replace later # We intentionally add a space to the beginning and end of lib strings, simplifies replace later
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@" libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@" libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@" embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ "
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
...@@ -111,8 +111,9 @@ include="-I$pkgincludedir" ...@@ -111,8 +111,9 @@ include="-I$pkgincludedir"
# and -xstrconst to make --cflags usable for Sun Forte C++ # and -xstrconst to make --cflags usable for Sun Forte C++
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \ for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*' \ DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
Xa xstrconst "xc99=none" Xa xstrconst "xc99=none" \
unroll2 ip mp restrict
do do
# The first option we might strip will always have a space before it because # The first option we might strip will always have a space before it because
# we set -I$pkgincludedir as the first option # we set -I$pkgincludedir as the first option
...@@ -121,7 +122,7 @@ done ...@@ -121,7 +122,7 @@ done
cflags=`echo "$cflags"|sed -e 's/ *\$//'` cflags=`echo "$cflags"|sed -e 's/ *\$//'`
# Same for --libs(_r) # Same for --libs(_r)
for remove in lmtmalloc for remove in lmtmalloc static-libcxa i-static
do do
# We know the strings starts with a space # We know the strings starts with a space
libs=`echo "$libs"|sed -e "s/ -$remove */ /g"` libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
......
...@@ -1618,7 +1618,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1618,7 +1618,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db, const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag) uint port, const char *unix_socket,ulong client_flag)
{ {
char buff[NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+100]; char buff[NAME_LEN+USERNAME_LENGTH+100];
char *end,*host_info; char *end,*host_info;
my_socket sock; my_socket sock;
in_addr_t ip_addr; in_addr_t ip_addr;
...@@ -2063,7 +2063,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2063,7 +2063,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status, client_flag)); mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */ /* This needs to be changed as it's not useful with big packets */
if (user && user[0]) if (user && user[0])
strmake(end,user,USERNAME_BYTE_LENGTH); /* Max user name */ strmake(end,user,USERNAME_LENGTH); /* Max user name */
else else
read_user_name((char*) end); read_user_name((char*) end);
...@@ -2093,7 +2093,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2093,7 +2093,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Add database if needed */ /* Add database if needed */
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
{ {
end= strmake(end, db, NAME_BYTE_LEN) + 1; end= strmake(end, db, NAME_LEN) + 1;
mysql->db= my_strdup(db,MYF(MY_WME)); mysql->db= my_strdup(db,MYF(MY_WME));
db= 0; db= 0;
} }
......
...@@ -2640,11 +2640,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, ...@@ -2640,11 +2640,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
while ((Str = str_list++)) while ((Str = str_list++))
{ {
if (Str->host.length > HOSTNAME_LENGTH || if (Str->host.length > HOSTNAME_LENGTH ||
system_charset_info->cset->charpos(system_charset_info, Str->user.length > USERNAME_LENGTH)
Str->user.str,
Str->user.str +
Str->user.length,
USERNAME_LENGTH) < Str->user.length)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1; result= -1;
......
...@@ -902,8 +902,8 @@ static int check_connection(THD *thd) ...@@ -902,8 +902,8 @@ static int check_connection(THD *thd)
char *user= end; char *user= end;
char *passwd= strend(user)+1; char *passwd= strend(user)+1;
char *db= passwd; char *db= passwd;
char db_buff[NAME_BYTE_LEN + 1]; // buffer to store db in utf8 char db_buff[NAME_LEN + 1]; // buffer to store db in utf8
char user_buff[USERNAME_BYTE_LENGTH + 1]; // buffer to store user in utf8 char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors; uint dummy_errors;
/* /*
......
...@@ -1413,7 +1413,7 @@ char *get_field(MEM_ROOT *mem, Field *field) ...@@ -1413,7 +1413,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool check_db_name(char *name) bool check_db_name(char *name)
{ {
uint name_length= 0; // name length in symbols char *start= name;
/* Used to catch empty names and names with end space */ /* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE; bool last_char_is_space= TRUE;
...@@ -1430,7 +1430,6 @@ bool check_db_name(char *name) ...@@ -1430,7 +1430,6 @@ bool check_db_name(char *name)
name+system_charset_info->mbmaxlen); name+system_charset_info->mbmaxlen);
if (len) if (len)
{ {
name_length++;
name += len; name += len;
continue; continue;
} }
...@@ -1438,13 +1437,12 @@ bool check_db_name(char *name) ...@@ -1438,13 +1437,12 @@ bool check_db_name(char *name)
#else #else
last_char_is_space= *name==' '; last_char_is_space= *name==' ';
#endif #endif
name_length++;
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR || if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR) *name == FN_EXTCHAR)
return 1; return 1;
name++; name++;
} }
return (last_char_is_space || name_length > NAME_LEN); return last_char_is_space || (uint) (name - start) > NAME_LEN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment