From: magnus.blaudd Date: May 7 2012 8:49am Subject: bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4925 to 4926) List-Archive: http://lists.mysql.com/commits/143745 Message-Id: <201205070849.q478nR77021433@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4926 magnus.blaudd@stripped 2012-05-07 [merge] Merge modified: storage/ndb/include/util/SocketAuthenticator.hpp storage/ndb/src/common/transporter/Transporter.cpp storage/ndb/src/common/transporter/Transporter.hpp storage/ndb/src/common/util/SocketAuthenticator.cpp storage/ndb/test/include/NdbTimer.hpp storage/ndb/test/tools/connect.cpp 4925 Pekka Nousiainen 2012-05-03 [merge] merge modified: storage/ndb/test/include/HugoTransactions.hpp storage/ndb/test/ndbapi/testUpgrade.cpp storage/ndb/test/src/HugoTransactions.cpp === modified file 'storage/ndb/include/util/SocketAuthenticator.hpp' --- a/storage/ndb/include/util/SocketAuthenticator.hpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/include/util/SocketAuthenticator.hpp 2012-05-07 07:38:13 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ #ifndef SOCKET_AUTHENTICATOR_HPP #define SOCKET_AUTHENTICATOR_HPP +#include + class SocketAuthenticator { public: @@ -29,8 +31,8 @@ public: class SocketAuthSimple : public SocketAuthenticator { - const char *m_passwd; - const char *m_username; + char *m_passwd; + char *m_username; public: SocketAuthSimple(const char *username, const char *passwd); virtual ~SocketAuthSimple(); === modified file 'storage/ndb/src/common/transporter/Transporter.cpp' --- a/storage/ndb/src/common/transporter/Transporter.cpp 2012-03-21 15:31:06 +0000 +++ b/storage/ndb/src/common/transporter/Transporter.cpp 2012-04-24 08:33:27 +0000 @@ -51,7 +51,6 @@ Transporter::Transporter(TransporterRegi DBUG_ENTER("Transporter::Transporter"); if (rHostName && strlen(rHostName) > 0){ strncpy(remoteHostName, rHostName, sizeof(remoteHostName)); - Ndb_getInAddr(&remoteHostAddress, rHostName); } else { === modified file 'storage/ndb/src/common/transporter/Transporter.hpp' --- a/storage/ndb/src/common/transporter/Transporter.hpp 2011-12-09 19:12:56 +0000 +++ b/storage/ndb/src/common/transporter/Transporter.hpp 2012-04-24 08:33:27 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -139,8 +139,6 @@ protected: */ char remoteHostName[256]; char localHostName[256]; - struct in_addr remoteHostAddress; - struct in_addr localHostAddress; int m_s_port; @@ -149,8 +147,6 @@ protected: const bool isServer; - unsigned createIndex; - int byteOrder; bool compressionUsed; bool checksumUsed; === modified file 'storage/ndb/src/common/util/SocketAuthenticator.cpp' --- a/storage/ndb/src/common/util/SocketAuthenticator.cpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/src/common/util/SocketAuthenticator.cpp 2012-05-07 07:38:13 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,15 +15,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include - -#include #include #include #include -#include - SocketAuthSimple::SocketAuthSimple(const char *username, const char *passwd) { if (username) m_username= strdup(username); @@ -38,9 +33,9 @@ SocketAuthSimple::SocketAuthSimple(const SocketAuthSimple::~SocketAuthSimple() { if (m_passwd) - free((void*)m_passwd); + free(m_passwd); if (m_username) - free((void*)m_username); + free(m_username); } bool SocketAuthSimple::client_authenticate(NDB_SOCKET_TYPE sockfd) @@ -48,11 +43,18 @@ bool SocketAuthSimple::client_authentica SocketOutputStream s_output(sockfd); SocketInputStream s_input(sockfd); + // Write username and password s_output.println("%s", m_username ? m_username : ""); s_output.println("%s", m_passwd ? m_passwd : ""); char buf[16]; - if (s_input.gets(buf, 16) == 0) return false; + + // Read authentication result + if (s_input.gets(buf, sizeof(buf)) == 0) + return false; + buf[sizeof(buf)-1]= 0; + + // Verify authentication result if (strncmp("ok", buf, 2) == 0) return true; @@ -61,25 +63,24 @@ bool SocketAuthSimple::client_authentica bool SocketAuthSimple::server_authenticate(NDB_SOCKET_TYPE sockfd) { - SocketOutputStream s_output(sockfd); SocketInputStream s_input(sockfd); char buf[256]; - if (s_input.gets(buf, 256) == 0) return false; - buf[255]= 0; - if (m_username) - free((void*)m_username); - m_username= strdup(buf); - - if (s_input.gets(buf, 256) == 0) return false; - buf[255]= 0; - if (m_passwd) - free((void*)m_passwd); - m_passwd= strdup(buf); + // Read username + if (s_input.gets(buf, sizeof(buf)) == 0) + return false; + buf[sizeof(buf)-1]= 0; + + // Read password + if (s_input.gets(buf, sizeof(buf)) == 0) + return false; + buf[sizeof(buf)-1]= 0; + // Write authentication result s_output.println("ok"); return true; } + === modified file 'storage/ndb/test/include/NdbTimer.hpp' --- a/storage/ndb/test/include/NdbTimer.hpp 2011-02-02 00:40:07 +0000 +++ b/storage/ndb/test/include/NdbTimer.hpp 2012-04-23 19:00:46 +0000 @@ -23,7 +23,7 @@ #include // -// Class used for measuring time and priting the results +// Class used for measuring time and printing the results // // Currently measures time in milliseconds // === modified file 'storage/ndb/test/tools/connect.cpp' --- a/storage/ndb/test/tools/connect.cpp 2011-09-13 09:08:04 +0000 +++ b/storage/ndb/test/tools/connect.cpp 2012-04-23 08:11:54 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,20 +27,18 @@ static int opt_drop = 1; static int opt_subloop = 5; static int opt_wait_all = 0; -typedef uchar* gptr; - static struct my_option my_long_options[] = { - NDB_STD_OPTS("ndb_desc"), + NDB_STD_OPTS("ndb_connect"), { "loop", 'l', "loops", - (gptr*) &opt_loop, (gptr*) &opt_loop, 0, + (uchar**) &opt_loop, (uchar**) &opt_loop, 0, GET_INT, REQUIRED_ARG, opt_loop, 0, 0, 0, 0, 0 }, { "sleep", 's', "Sleep (ms) between connection attempt", - (gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, + (uchar**) &opt_sleep, (uchar**) &opt_sleep, 0, GET_INT, REQUIRED_ARG, opt_sleep, 0, 0, 0, 0, 0 }, { "drop", 'd', "Drop event operations before disconnect (0 = no, 1 = yes, else rand", - (gptr*) &opt_drop, (gptr*) &opt_drop, 0, + (uchar**) &opt_drop, (uchar**) &opt_drop, 0, GET_INT, REQUIRED_ARG, opt_drop, 0, 0, 0, 0, 0 }, { "subscribe-loop", NDB_OPT_NOSHORT, "Loop in subscribe/unsubscribe", @@ -60,7 +58,7 @@ int main(int argc, char** argv){ load_defaults("my",load_default_groups,&argc,&argv); int ho_error; #ifndef DBUG_OFF - opt_debug= "d:t:O,/tmp/ndb_desc.trace"; + opt_debug= "d:t:O,/tmp/ndb_connect.trace"; #endif if ((ho_error=handle_options(&argc, &argv, my_long_options, ndb_std_get_one_option))) No bundle (reason: useless for push emails).