Commit b702e70b authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

Merge perch.ndb.mysql.com:/home/jonas/src/mysql-4.1

into  perch.ndb.mysql.com:/home/jonas/src/41-jonas
parents 1fc46c62 6a9a9e7e
drop table if exists t1;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
# These files are to be modified ONLY BY INNOBASE guys. #
# #
# Use innodb_mysql.[test|result] files instead. #
# #
# If nevertheless you need to make some changes here, please, forward #
# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com #
# (otherwise your changes may be erased). #
# #
#######################################################################
-- source include/have_innodb.inc
#
......
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -74,7 +74,7 @@ public:
/**
* Constructor / Destructor
*/
SocketServer(int maxSessions = 32);
SocketServer(unsigned maxSessions = ~(unsigned)0);
~SocketServer();
/**
......
......@@ -100,10 +100,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
}
{
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= (&addr)->sin_addr;
}
bool res = connect_server_impl(sockfd);
......@@ -173,10 +173,10 @@ Transporter::connect_client() {
}
{
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= (&addr)->sin_addr;
}
bool res = connect_client_impl(sockfd);
......
......@@ -27,7 +27,7 @@
#define DEBUG(x) ndbout << x << endl;
SocketServer::SocketServer(int maxSessions) :
SocketServer::SocketServer(unsigned maxSessions) :
m_sessions(10),
m_services(5)
{
......@@ -124,7 +124,7 @@ SocketServer::setup(SocketServer::Service * service,
DBUG_RETURN(false);
}
if (listen(sock, m_maxSessions) == -1){
if (listen(sock, m_maxSessions > 32 ? 32 : m_maxSessions) == -1){
DBUG_PRINT("error",("listen() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock);
......
......@@ -427,9 +427,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
return;
}
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r = getpeername(m_socket, &addr, &addrlen);
int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen);
if (r != 0 ) {
m_output->println(cmd);
m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r);
......@@ -441,7 +441,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){
BaseString error_string;
if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype,
&addr, &addrlen, error_string)){
(struct sockaddr*)&addr, &addrlen, error_string)){
const char *alias;
const char *str;
alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)
......
......@@ -906,13 +906,20 @@ static int check_connection(THD *thd)
*passwd++ : strlen(passwd);
db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
db + passwd_len + 1 : 0;
uint db_len= db ? strlen(db) : 0;
if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
{
inc_host_errors(&thd->remote.sin_addr);
return ER_HANDSHAKE_ERROR;
}
/* Since 4.1 all database names are stored in utf8 */
if (db)
{
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info,
db, strlen(db),
db, db_len,
thd->charset(), &dummy_errors)]= 0;
db= db_buff;
}
......@@ -1379,7 +1386,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
char *db, *tbl_name;
uint db_len= *(uchar*) packet;
if (db_len >= packet_length || db_len > NAME_LEN)
{
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
}
uint tbl_len= *(uchar*) (packet + db_len + 1);
if (db_len+tbl_len+2 > packet_length || tbl_len > NAME_LEN)
{
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
}
statistic_increment(com_other, &LOCK_status);
thd->enable_slow_log= opt_log_slow_admin_statements;
......
......@@ -630,6 +630,7 @@ fi
%attr(755, root, root) %{_bindir}/ndb_desc
%attr(755, root, root) %{_bindir}/ndb_show_tables
%attr(755, root, root) %{_bindir}/ndb_test_platform
%attr(755, root, root) %{_bindir}/ndb_config
%files ndb-extra
%defattr(-,root,root,0755)
......
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