Commit f3af0d7c authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Status query on killed mysql connection results in segmentation fault (Bug #738)

Added MAX_PASSWORD_LENGTH. This increased master-slave passwords to 32 bytes (Bug #766)
Fixed server crash on purge master logs or show master logs when binlog is off. (Bug #733)
parent 3f4f339f
...@@ -2329,7 +2329,8 @@ com_status(String *buffer __attribute__((unused)), ...@@ -2329,7 +2329,8 @@ com_status(String *buffer __attribute__((unused)),
(void) mysql_fetch_row(result); // Read eof (void) mysql_fetch_row(result); // Read eof
} }
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_)) if (mysql.net.vio && mysql.net.vio->ssl_ &&
SSL_get_cipher(mysql.net.vio->ssl_))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n", tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
SSL_get_cipher(mysql.net.vio->ssl_)); SSL_get_cipher(mysql.net.vio->ssl_));
else else
......
...@@ -1282,12 +1282,12 @@ then ...@@ -1282,12 +1282,12 @@ then
AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]); AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]);
fi fi
AC_MSG_RESULT("yes") AC_MSG_RESULT("yes")
# Hack for SCO UnixWare 7.1 # Hack for SCO UnixWare 7.1.x
# #
elif test "$with_named_thread" = "no" elif test "$with_named_thread" = "no"
then then
AC_MSG_RESULT("no") AC_MSG_RESULT("no")
AC_MSG_CHECKING("SCO UnixWare 7.1 native threads") AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads")
if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
then then
if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
...@@ -1310,11 +1310,11 @@ then ...@@ -1310,11 +1310,11 @@ then
AC_MSG_CHECKING("for gcc") AC_MSG_CHECKING("for gcc")
if expr "$CC" : ".*gcc.*" if expr "$CC" : ".*gcc.*"
then then
CC="$CC -pthread -DUNIXWARE_7"; CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -pthread -DUNIXWARE_7"; CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
else else
CC="$CC -Kthread -DUNIXWARE_7"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -Kthread -DUNIXWARE_7"; CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
fi fi
else else
{ echo "configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; { echo "configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual." 1>&2; exit 1; };
...@@ -1350,10 +1350,11 @@ then ...@@ -1350,10 +1350,11 @@ then
AC_MSG_CHECKING("for gcc") AC_MSG_CHECKING("for gcc")
if expr "$CC" : ".*gcc.*" if expr "$CC" : ".*gcc.*"
then then
{ echo "configure: error: On SCO UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
else else
CC="$CC -Kthread -DUNIXWARE_7"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -Kthread -DUNIXWARE_7"; CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
fi fi
AC_MSG_RESULT("yes") AC_MSG_RESULT("yes")
else else
...@@ -1385,7 +1386,8 @@ then ...@@ -1385,7 +1386,8 @@ then
AC_MSG_CHECKING("for gcc") AC_MSG_CHECKING("for gcc")
if expr "$CC" : ".*gcc.*" if expr "$CC" : ".*gcc.*"
then then
{ echo "configure: error: On OpenUNIX8 and UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
else else
CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
......
...@@ -149,10 +149,6 @@ double my_ulonglong2double(unsigned long long A); ...@@ -149,10 +149,6 @@ double my_ulonglong2double(unsigned long long A);
C_MODE_END C_MODE_END
#endif /* _AIX */ #endif /* _AIX */
#ifdef UNIXWARE_7
#define pthread_attr_setstacksize(A,B) /* setting stack breaks things */
#endif
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */ #ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF
#endif #endif
......
...@@ -59,6 +59,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -59,6 +59,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define ACL_CACHE_SIZE 256 #define ACL_CACHE_SIZE 256
#define HASH_PASSWORD_LENGTH 16 #define HASH_PASSWORD_LENGTH 16
#define MAX_PASSWORD_LENGTH 32
#define HOST_CACHE_SIZE 128 #define HOST_CACHE_SIZE 128
#define MAX_ACCEPT_RETRY 10 // Test accept this many times #define MAX_ACCEPT_RETRY 10 // Test accept this many times
#define MAX_FIELDS_BEFORE_HASH 32 #define MAX_FIELDS_BEFORE_HASH 32
......
...@@ -250,15 +250,15 @@ Log_event* next_event(RELAY_LOG_INFO* rli); ...@@ -250,15 +250,15 @@ Log_event* next_event(RELAY_LOG_INFO* rli);
typedef struct st_master_info typedef struct st_master_info
{ {
char master_log_name[FN_REFLEN]; char master_log_name[FN_REFLEN];
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1];
my_off_t master_log_pos; my_off_t master_log_pos;
File fd; // we keep the file open, so we need to remember the file pointer File fd; // we keep the file open, so we need to remember the file pointer
IO_CACHE file; IO_CACHE file;
/* the variables below are needed because we can change masters on the fly */ /* the variables below are needed because we can change masters on the fly */
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
char password[HASH_PASSWORD_LENGTH+1];
pthread_mutex_t data_lock,run_lock; pthread_mutex_t data_lock,run_lock;
pthread_cond_t data_cond,start_cond,stop_cond; pthread_cond_t data_cond,start_cond,stop_cond;
THD *io_thd; THD *io_thd;
...@@ -271,12 +271,11 @@ typedef struct st_master_info ...@@ -271,12 +271,11 @@ typedef struct st_master_info
int events_till_abort; int events_till_abort;
#endif #endif
bool inited; bool inited;
enum enum_binlog_formats old_format; /* master binlog is in 3.23 format */ enum enum_binlog_formats old_format; /* binlog is in 3.23 format */
volatile bool abort_slave, slave_running; volatile bool abort_slave, slave_running;
volatile ulong slave_run_id; volatile ulong slave_run_id;
bool ignore_stop_event; bool ignore_stop_event;
st_master_info() st_master_info()
:fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT), :fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT),
abort_slave(0),slave_running(0), slave_run_id(0) abort_slave(0),slave_running(0), slave_run_id(0)
......
...@@ -267,9 +267,13 @@ int purge_master_logs(THD* thd, const char* to_log) ...@@ -267,9 +267,13 @@ int purge_master_logs(THD* thd, const char* to_log)
{ {
char search_file_name[FN_REFLEN]; char search_file_name[FN_REFLEN];
const char* errmsg = 0; const char* errmsg = 0;
int res;
if (!mysql_bin_log.is_open())
goto end;
mysql_bin_log.make_log_name(search_file_name, to_log); mysql_bin_log.make_log_name(search_file_name, to_log);
int res = mysql_bin_log.purge_logs(thd, search_file_name); res = mysql_bin_log.purge_logs(thd, search_file_name);
switch(res) { switch(res) {
case 0: break; case 0: break;
...@@ -292,9 +296,9 @@ binlog purge"; break; ...@@ -292,9 +296,9 @@ binlog purge"; break;
send_error(&thd->net, 0, errmsg); send_error(&thd->net, 0, errmsg);
return 1; return 1;
} }
else
send_ok(&thd->net);
end:
send_ok(&thd->net);
return 0; return 0;
} }
...@@ -886,7 +890,7 @@ int change_master(THD* thd, MASTER_INFO* mi) ...@@ -886,7 +890,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
if (lex_mi->log_file_name) if (lex_mi->log_file_name)
strmake(mi->master_log_name, lex_mi->log_file_name, strmake(mi->master_log_name, lex_mi->log_file_name,
sizeof(mi->master_log_name)); sizeof(mi->master_log_name)-1);
if (lex_mi->pos) if (lex_mi->pos)
{ {
mi->master_log_pos= lex_mi->pos; mi->master_log_pos= lex_mi->pos;
...@@ -895,11 +899,11 @@ int change_master(THD* thd, MASTER_INFO* mi) ...@@ -895,11 +899,11 @@ int change_master(THD* thd, MASTER_INFO* mi)
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
if (lex_mi->host) if (lex_mi->host)
strmake(mi->host, lex_mi->host, sizeof(mi->host)); strmake(mi->host, lex_mi->host, sizeof(mi->host)-1);
if (lex_mi->user) if (lex_mi->user)
strmake(mi->user, lex_mi->user, sizeof(mi->user)); strmake(mi->user, lex_mi->user, sizeof(mi->user)-1);
if (lex_mi->password) if (lex_mi->password)
strmake(mi->password, lex_mi->password, sizeof(mi->password)); strmake(mi->password, lex_mi->password, sizeof(mi->password)-1);
if (lex_mi->port) if (lex_mi->port)
mi->port = lex_mi->port; mi->port = lex_mi->port;
if (lex_mi->connect_retry) if (lex_mi->connect_retry)
...@@ -1137,7 +1141,6 @@ int show_binlog_info(THD* thd) ...@@ -1137,7 +1141,6 @@ int show_binlog_info(THD* thd)
int show_binlogs(THD* thd) int show_binlogs(THD* thd)
{ {
const char *errmsg;
IO_CACHE *index_file; IO_CACHE *index_file;
char fname[FN_REFLEN]; char fname[FN_REFLEN];
NET* net = &thd->net; NET* net = &thd->net;
...@@ -1148,8 +1151,8 @@ int show_binlogs(THD* thd) ...@@ -1148,8 +1151,8 @@ int show_binlogs(THD* thd)
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
//TODO: Replace with ER() error message //TODO: Replace with ER() error message
errmsg= "You are not using binary logging"; send_error(net, 0, "You are not using binary logging");
goto err_with_msg; return 1;
} }
field_list.push_back(new Item_empty_string("Log_name", 255)); field_list.push_back(new Item_empty_string("Log_name", 255));
...@@ -1174,8 +1177,6 @@ int show_binlogs(THD* thd) ...@@ -1174,8 +1177,6 @@ int show_binlogs(THD* thd)
send_eof(net); send_eof(net);
return 0; return 0;
err_with_msg:
send_error(net, 0, errmsg);
err: err:
mysql_bin_log.unlock_index(); mysql_bin_log.unlock_index();
return 1; return 1;
......
...@@ -6,7 +6,7 @@ typedef struct st_slave_info ...@@ -6,7 +6,7 @@ typedef struct st_slave_info
uint32 rpl_recovery_rank, master_id; uint32 rpl_recovery_rank, master_id;
char host[HOSTNAME_LENGTH+1]; char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1]; char user[USERNAME_LENGTH+1];
char password[HASH_PASSWORD_LENGTH+1]; char password[MAX_PASSWORD_LENGTH+1];
uint16 port; uint16 port;
THD* thd; THD* thd;
} SLAVE_INFO; } SLAVE_INFO;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
strmake(dst,src,length) moves length characters, or until end, of src to strmake(dst,src,length) moves length characters, or until end, of src to
dst and appends a closing NUL to dst. dst and appends a closing NUL to dst.
Note that is strlen(src) >= length then dst[length] will be set to \0 Note that if strlen(src) >= length then dst[length] will be set to \0
strmake() returns pointer to closing null strmake() returns pointer to closing null
*/ */
......
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