Commit 0c0a170f authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fix that SHOW STATUS works with SSL.

Add 4.0 commands to SHOW STATUS.
parent 6aeb40bd
...@@ -22819,6 +22819,7 @@ snapshot. ...@@ -22819,6 +22819,7 @@ snapshot.
listing of slaves currently registered with the master (Master) listing of slaves currently registered with the master (Master)
@item @code{SHOW SLAVE STATUS} @tab Provides status information on essential parameters of the slave thread. (Slave) @item @code{SHOW SLAVE STATUS} @tab Provides status information on essential parameters of the slave thread. (Slave)
@item @code{SHOW MASTER LOGS} @tab Only available starting in Version @item @code{SHOW MASTER LOGS} @tab Only available starting in Version
3.23.28. Lists the binary logs on the master. You should use this 3.23.28. Lists the binary logs on the master. You should use this
command prior to @code{PURGE MASTER LOGS TO} to find out how far you command prior to @code{PURGE MASTER LOGS TO} to find out how far you
...@@ -900,7 +900,7 @@ explain select a,b,c from t1; ...@@ -900,7 +900,7 @@ explain select a,b,c from t1;
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4 t1 ALL NULL NULL NULL NULL 4
drop table t1; drop table t1;
create table t1 (testint int not null default 1); create table t1 (testint int not null default 1) type=innodb;
desc t1; desc t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
testint int(11) 1 testint int(11) 1
......
...@@ -3147,16 +3147,21 @@ struct show_var_st status_vars[]= { ...@@ -3147,16 +3147,21 @@ struct show_var_st status_vars[]= {
{"Com_create_index", (char*) (com_stat+(uint) SQLCOM_CREATE_INDEX),SHOW_LONG}, {"Com_create_index", (char*) (com_stat+(uint) SQLCOM_CREATE_INDEX),SHOW_LONG},
{"Com_create_table", (char*) (com_stat+(uint) SQLCOM_CREATE_TABLE),SHOW_LONG}, {"Com_create_table", (char*) (com_stat+(uint) SQLCOM_CREATE_TABLE),SHOW_LONG},
{"Com_delete", (char*) (com_stat+(uint) SQLCOM_DELETE),SHOW_LONG}, {"Com_delete", (char*) (com_stat+(uint) SQLCOM_DELETE),SHOW_LONG},
{"Com_delete_multi", (char*) (com_stat+(uint) SQLCOM_DELETE_MULTI),SHOW_LONG},
{"Com_drop_db", (char*) (com_stat+(uint) SQLCOM_DROP_DB),SHOW_LONG}, {"Com_drop_db", (char*) (com_stat+(uint) SQLCOM_DROP_DB),SHOW_LONG},
{"Com_drop_function", (char*) (com_stat+(uint) SQLCOM_DROP_FUNCTION),SHOW_LONG}, {"Com_drop_function", (char*) (com_stat+(uint) SQLCOM_DROP_FUNCTION),SHOW_LONG},
{"Com_drop_index", (char*) (com_stat+(uint) SQLCOM_DROP_INDEX),SHOW_LONG}, {"Com_drop_index", (char*) (com_stat+(uint) SQLCOM_DROP_INDEX),SHOW_LONG},
{"Com_drop_table", (char*) (com_stat+(uint) SQLCOM_DROP_TABLE),SHOW_LONG}, {"Com_drop_table", (char*) (com_stat+(uint) SQLCOM_DROP_TABLE),SHOW_LONG},
{"Com_flush", (char*) (com_stat+(uint) SQLCOM_FLUSH),SHOW_LONG}, {"Com_flush", (char*) (com_stat+(uint) SQLCOM_FLUSH),SHOW_LONG},
{"Com_grant", (char*) (com_stat+(uint) SQLCOM_GRANT),SHOW_LONG}, {"Com_grant", (char*) (com_stat+(uint) SQLCOM_GRANT),SHOW_LONG},
{"Com_ha_close", (char*) (com_stat+(uint) SQLCOM_HA_OPEN),SHOW_LONG},
{"Com_ha_open", (char*) (com_stat+(uint) SQLCOM_HA_OPEN),SHOW_LONG},
{"Com_ha_read", (char*) (com_stat+(uint) SQLCOM_HA_READ),SHOW_LONG},
{"Com_insert", (char*) (com_stat+(uint) SQLCOM_INSERT),SHOW_LONG}, {"Com_insert", (char*) (com_stat+(uint) SQLCOM_INSERT),SHOW_LONG},
{"Com_insert_select", (char*) (com_stat+(uint) SQLCOM_INSERT_SELECT),SHOW_LONG}, {"Com_insert_select", (char*) (com_stat+(uint) SQLCOM_INSERT_SELECT),SHOW_LONG},
{"Com_kill", (char*) (com_stat+(uint) SQLCOM_KILL),SHOW_LONG}, {"Com_kill", (char*) (com_stat+(uint) SQLCOM_KILL),SHOW_LONG},
{"Com_load", (char*) (com_stat+(uint) SQLCOM_LOAD),SHOW_LONG}, {"Com_load", (char*) (com_stat+(uint) SQLCOM_LOAD),SHOW_LONG},
{"Com_load_master_data", (char*) (com_stat+(uint) SQLCOM_LOAD_MASTER_DATA),SHOW_LONG},
{"Com_load_master_table", (char*) (com_stat+(uint) SQLCOM_LOAD_MASTER_TABLE),SHOW_LONG}, {"Com_load_master_table", (char*) (com_stat+(uint) SQLCOM_LOAD_MASTER_TABLE),SHOW_LONG},
{"Com_lock_tables", (char*) (com_stat+(uint) SQLCOM_LOCK_TABLES),SHOW_LONG}, {"Com_lock_tables", (char*) (com_stat+(uint) SQLCOM_LOCK_TABLES),SHOW_LONG},
{"Com_optimize", (char*) (com_stat+(uint) SQLCOM_OPTIMIZE),SHOW_LONG}, {"Com_optimize", (char*) (com_stat+(uint) SQLCOM_OPTIMIZE),SHOW_LONG},
...@@ -3171,6 +3176,7 @@ struct show_var_st status_vars[]= { ...@@ -3171,6 +3176,7 @@ struct show_var_st status_vars[]= {
{"Com_rollback", (char*) (com_stat+(uint) SQLCOM_ROLLBACK),SHOW_LONG}, {"Com_rollback", (char*) (com_stat+(uint) SQLCOM_ROLLBACK),SHOW_LONG},
{"Com_select", (char*) (com_stat+(uint) SQLCOM_SELECT),SHOW_LONG}, {"Com_select", (char*) (com_stat+(uint) SQLCOM_SELECT),SHOW_LONG},
{"Com_set_option", (char*) (com_stat+(uint) SQLCOM_SET_OPTION),SHOW_LONG}, {"Com_set_option", (char*) (com_stat+(uint) SQLCOM_SET_OPTION),SHOW_LONG},
{"Com_show_binlog_events", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOG_EVENTS),SHOW_LONG},
{"Com_show_binlogs", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOGS),SHOW_LONG}, {"Com_show_binlogs", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOGS),SHOW_LONG},
{"Com_show_create", (char*) (com_stat+(uint) SQLCOM_SHOW_CREATE),SHOW_LONG}, {"Com_show_create", (char*) (com_stat+(uint) SQLCOM_SHOW_CREATE),SHOW_LONG},
{"Com_show_databases", (char*) (com_stat+(uint) SQLCOM_SHOW_DATABASES),SHOW_LONG}, {"Com_show_databases", (char*) (com_stat+(uint) SQLCOM_SHOW_DATABASES),SHOW_LONG},
...@@ -3178,9 +3184,11 @@ struct show_var_st status_vars[]= { ...@@ -3178,9 +3184,11 @@ struct show_var_st status_vars[]= {
{"Com_show_grants", (char*) (com_stat+(uint) SQLCOM_SHOW_GRANTS),SHOW_LONG}, {"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_keys", (char*) (com_stat+(uint) SQLCOM_SHOW_KEYS),SHOW_LONG},
{"Com_show_logs", (char*) (com_stat+(uint) SQLCOM_SHOW_LOGS),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_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_MASTER_STAT),SHOW_LONG},
{"Com_show_new_master", (char*) (com_stat+(uint) SQLCOM_SHOW_NEW_MASTER),SHOW_LONG},
{"Com_show_open_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_OPEN_TABLES),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_processlist", (char*) (com_stat+(uint) SQLCOM_SHOW_PROCESSLIST),SHOW_LONG},
{"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG},
{"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG}, {"Com_show_slave_stat", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
{"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),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_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG},
......
...@@ -55,7 +55,7 @@ enum enum_sql_command { ...@@ -55,7 +55,7 @@ enum enum_sql_command {
SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS, SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS,
SQLCOM_SHOW_OPEN_TABLES, SQLCOM_LOAD_MASTER_DATA, SQLCOM_SHOW_OPEN_TABLES, SQLCOM_LOAD_MASTER_DATA,
SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ, SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ,
SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_MULTI_DELETE, SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI,
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER,
SQLCOM_END SQLCOM_END
}; };
......
...@@ -1691,7 +1691,7 @@ mysql_execute_command(void) ...@@ -1691,7 +1691,7 @@ mysql_execute_command(void)
select_lex->options); select_lex->options);
break; break;
} }
case SQLCOM_MULTI_DELETE: case SQLCOM_DELETE_MULTI:
{ {
TABLE_LIST *aux_tables=(TABLE_LIST *)thd->lex.auxilliary_table_list.first; TABLE_LIST *aux_tables=(TABLE_LIST *)thd->lex.auxilliary_table_list.first;
TABLE_LIST *auxi; TABLE_LIST *auxi;
......
...@@ -1180,65 +1180,85 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables) ...@@ -1180,65 +1180,85 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
/* First group - functions relying on CTX */ /* First group - functions relying on CTX */
case SHOW_SSL_CTX_SESS_ACCEPT: case SHOW_SSL_CTX_SESS_ACCEPT:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_accept(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_accept(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_ACCEPT_GOOD: case SHOW_SSL_CTX_SESS_ACCEPT_GOOD:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_accept_good(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_accept_good(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_CONNECT_GOOD: case SHOW_SSL_CTX_SESS_CONNECT_GOOD:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_connect_good(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_connect_good(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE: case SHOW_SSL_CTX_SESS_ACCEPT_RENEGOTIATE:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_accept_renegotiate(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_accept_renegotiate(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE: case SHOW_SSL_CTX_SESS_CONNECT_RENEGOTIATE:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_connect_renegotiate(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_connect_renegotiate(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_CB_HITS: case SHOW_SSL_CTX_SESS_CB_HITS:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_cb_hits(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_cb_hits(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_HITS: case SHOW_SSL_CTX_SESS_HITS:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_hits(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_hits(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_CACHE_FULL: case SHOW_SSL_CTX_SESS_CACHE_FULL:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_cache_full(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_cache_full(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_MISSES: case SHOW_SSL_CTX_SESS_MISSES:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_misses(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_misses(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_TIMEOUTS: case SHOW_SSL_CTX_SESS_TIMEOUTS:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_timeouts(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_timeouts(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_NUMBER: case SHOW_SSL_CTX_SESS_NUMBER:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_number(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_number(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_CONNECT: case SHOW_SSL_CTX_SESS_CONNECT:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_connect(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_connect(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_SESS_GET_CACHE_SIZE: case SHOW_SSL_CTX_SESS_GET_CACHE_SIZE:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_sess_get_cache_size(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_sess_get_cache_size(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_GET_VERIFY_MODE: case SHOW_SSL_CTX_GET_VERIFY_MODE:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_get_verify_mode(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_get_verify_mode(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_GET_VERIFY_DEPTH: case SHOW_SSL_CTX_GET_VERIFY_DEPTH:
net_store_data(&packet2,(uint32) net_store_data(&packet2,(uint32)
SSL_CTX_get_verify_depth(ssl_acceptor_fd->ssl_context_)); (!ssl_acceptor_fd ? 0 :
SSL_CTX_get_verify_depth(ssl_acceptor_fd->ssl_context_)));
break; break;
case SHOW_SSL_CTX_GET_SESSION_CACHE_MODE: case SHOW_SSL_CTX_GET_SESSION_CACHE_MODE:
if (!ssl_acceptor_fd)
{
net_store_data(&packet2,"NONE" );
break;
}
switch(SSL_CTX_get_session_cache_mode(ssl_acceptor_fd->ssl_context_)) switch(SSL_CTX_get_session_cache_mode(ssl_acceptor_fd->ssl_context_))
{ {
case SSL_SESS_CACHE_OFF: case SSL_SESS_CACHE_OFF:
...@@ -1286,23 +1306,28 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables) ...@@ -1286,23 +1306,28 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
SSL_get_verify_depth(thd->net.vio->ssl_):0)); SSL_get_verify_depth(thd->net.vio->ssl_):0));
break; break;
case SHOW_SSL_GET_CIPHER: case SHOW_SSL_GET_CIPHER:
net_store_data(&packet2, thd->net.vio->ssl_ ? SSL_get_cipher(thd->net.vio->ssl_) : ""); net_store_data(&packet2, thd->net.vio->ssl_ ?
SSL_get_cipher(thd->net.vio->ssl_) : "");
break;
case SHOW_SSL_GET_CIPHER_LIST: case SHOW_SSL_GET_CIPHER_LIST:
if(thd->net.vio->ssl_) if (thd->net.vio->ssl_)
{ {
char buf[1024]=""; char buf[1024], *pos;
for (int i=0; ; i++) pos=buf;
for (int i=0 ; i++ ;)
{ {
const char *p=SSL_get_cipher_list(thd->net.vio->ssl_,i); const char *p=SSL_get_cipher_list(thd->net.vio->ssl_,i);
if (p == NULL) if (p == NULL)
break; break;
if (i != 0) pos=strmov(pos, p);
strcat(buf,":"); *pos++= ':';
strcat(buf,p);
DBUG_PRINT("info",("cipher to add: %s,%s",p,buf));
} }
if (pos != buf)
pos--; // Remove last ':'
*pos=0;
net_store_data(&packet2, buf); net_store_data(&packet2, buf);
} else }
else
net_store_data(&packet2, ""); net_store_data(&packet2, "");
break; break;
......
...@@ -2406,7 +2406,7 @@ single_multi: ...@@ -2406,7 +2406,7 @@ single_multi:
| table_wild_list | table_wild_list
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_MULTI_DELETE; lex->sql_command = SQLCOM_DELETE_MULTI;
mysql_init_select(lex); mysql_init_select(lex);
lex->select->select_limit=HA_POS_ERROR; lex->select->select_limit=HA_POS_ERROR;
lex->auxilliary_table_list.elements=0; lex->auxilliary_table_list.elements=0;
......
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