Skip to content

Commit 1a0f34e

Browse files
author
Alexander Nozdrin
committed
Manual merge from mysql-next-mr.
Conflicts: - sql/sys_vars.cc
2 parents 30b561b + 9ee5543 commit 1a0f34e

File tree

182 files changed

+4078
-882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+4078
-882
lines changed

.bzrignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,3 +3075,4 @@ dbug/tests
30753075
libmysqld/sys_vars.cc
30763076
libmysqld/keycaches.cc
30773077
client/dtoa.c
3078+
libmysqld/sql_audit.cc

client/mysql.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,7 +3612,8 @@ print_table_data_vertically(MYSQL_RES *result)
36123612
for (uint off=0; off < mysql_num_fields(result); off++)
36133613
{
36143614
field= mysql_fetch_field(result);
3615-
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
3615+
if (column_names)
3616+
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
36163617
if (cur[off])
36173618
{
36183619
unsigned int i;
@@ -4282,7 +4283,7 @@ char *get_arg(char *line, my_bool get_next_arg)
42824283
if (*ptr == '\\' && ptr[1]) // escaped character
42834284
{
42844285
// Remove the backslash
4285-
strmov(ptr, ptr+1);
4286+
strmov_overlapp(ptr, ptr+1);
42864287
}
42874288
else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype))
42884289
{

client/mysqldump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static struct my_option my_long_options[] =
290290
(uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
291291
NO_ARG, 0, 0, 0, 0, 0, 0},
292292
{"extended-insert", 'e',
293-
"Allows utilization of the new, much faster INSERT syntax.",
293+
"Use multiple-row INSERT syntax that include several VALUES lists.",
294294
(uchar**) &extended_insert, (uchar**) &extended_insert, 0, GET_BOOL, NO_ARG,
295295
1, 0, 0, 0, 0, 0},
296296
{"fields-terminated-by", OPT_FTB,
@@ -840,7 +840,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
840840
&err_ptr, &err_len);
841841
if (err_len)
842842
{
843-
strmake(buff, err_ptr, min(sizeof(buff), err_len));
843+
strmake(buff, err_ptr, min(sizeof(buff) - 1, err_len));
844844
fprintf(stderr, "Invalid mode to --compatible: %s\n", buff);
845845
exit(1);
846846
}
@@ -4630,7 +4630,7 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length,
46304630

46314631
for (; pos != end && *pos != ','; pos++) ;
46324632
var_len= (uint) (pos - start);
4633-
strmake(buff, start, min(sizeof(buff), var_len));
4633+
strmake(buff, start, min(sizeof(buff) - 1, var_len));
46344634
find= find_type(buff, lib, var_len);
46354635
if (!find)
46364636
{

configure.in

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ dnl Process this file with autoconf to produce a configure script.
1616
# along with this program; if not, write to the Free Software
1717
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1818

19-
AC_PREREQ(2.52)dnl Minimum Autoconf version required.
19+
# Minimum Autoconf version required.
20+
AC_PREREQ(2.59)
2021

21-
AC_INIT(sql/mysqld.cc)
22-
AC_CANONICAL_SYSTEM
23-
# The Docs Makefile.am parses this line!
24-
# remember to also update version.c in ndb
25-
#
22+
# Remember to also update version.c in ndb.
2623
# When changing major version number please also check switch statement
2724
# in client/mysqlbinlog.cc:check_master_version().
28-
AM_INIT_AUTOMAKE(mysql, 5.5.99-m3)
29-
AM_CONFIG_HEADER([include/config.h:config.h.in])
25+
AC_INIT([MySQL Server], [5.5.99-m3], [], [mysql])
26+
AC_CONFIG_SRCDIR([sql/mysqld.cc])
27+
AC_CANONICAL_SYSTEM
28+
# USTAR format gives us the possibility to store longer path names in
29+
# TAR files, the path name is split into two parts, a 155 chacater
30+
# first part and a 100 character second part.
31+
AM_INIT_AUTOMAKE([1.9 tar-ustar])
32+
LT_INIT
33+
LT_PREREQ([1.5.6])
34+
35+
AM_CONFIG_HEADER([include/config.h])
3036

3137
# Request support for automake silent-rules if available.
3238
# Default to verbose output. One can use the configure-time
@@ -46,12 +52,14 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
4652
# Remember that regexps needs to quote [ and ] since this is run through m4
4753
# We take some made up examples
4854
#
49-
# VERSION 5.1.40sp1-alpha 5.0.34a
50-
# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a
51-
# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34
52-
# MYSQL_BASE_VERSION 5.1 5.0
53-
# MYSQL_VERSION_ID 50140 50034
55+
# VERSION 5.1.40sp1-alpha 5.0.34a 5.5.1-m2
56+
# MYSQL_U_SCORE_VERSION 5.1.40sp1_alpha 5.0.34a 5.5.1_m2
57+
# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a 5.5.1
58+
# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 5.5.1
59+
# MYSQL_BASE_VERSION 5.1 5.0 5.5
60+
# MYSQL_VERSION_ID 50140 50034 50501
5461
#
62+
MYSQL_U_SCORE_VERSION=`echo $VERSION | sed -e "s|-|_|"`
5563
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
5664
MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
5765
MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
@@ -89,6 +97,7 @@ romanian russian serbian slovak spanish swedish ukrainian"
8997
#####
9098
#####
9199

100+
AC_SUBST(MYSQL_U_SCORE_VERSION)
92101
AC_SUBST(MYSQL_NO_DASH_VERSION)
93102
AC_SUBST(MYSQL_BASE_VERSION)
94103
AC_SUBST(MYSQL_VERSION_ID)

extra/yassl/taocrypt/include/asn.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ class CertDecoder : public BER_Decoder {
305305
bool ValidateSignature(SignerList*);
306306
bool ConfirmSignature(Source&);
307307
void GetKey();
308+
char* AddTag(char*, const char*, const char*, word32, word32);
308309
void GetName(NameType);
309310
void GetValidity();
310311
void GetDate(DateType);

extra/yassl/taocrypt/src/asn.cpp

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,45 @@ word32 CertDecoder::GetDigest()
652652
}
653653

654654

655+
char *CertDecoder::AddTag(char *ptr, const char *buf_end,
656+
const char *tag_name, word32 tag_name_length,
657+
word32 tag_value_length)
658+
{
659+
if (ptr + tag_name_length + tag_value_length > buf_end)
660+
return 0;
661+
662+
memcpy(ptr, tag_name, tag_name_length);
663+
ptr+= tag_name_length;
664+
665+
memcpy(ptr, source_.get_current(), tag_value_length);
666+
ptr+= tag_value_length;
667+
668+
return ptr;
669+
}
670+
671+
655672
// process NAME, either issuer or subject
656673
void CertDecoder::GetName(NameType nt)
657674
{
658675
if (source_.GetError().What()) return;
659676

660677
SHA sha;
661678
word32 length = GetSequence(); // length of all distinguished names
662-
assert (length < ASN_NAME_MAX);
679+
680+
if (length >= ASN_NAME_MAX)
681+
goto err;
663682
length += source_.get_index();
664683

665-
char* ptr = (nt == ISSUER) ? issuer_ : subject_;
666-
word32 idx = 0;
684+
char *ptr, *buf_end;
685+
686+
if (nt == ISSUER) {
687+
ptr= issuer_;
688+
buf_end= ptr + sizeof(issuer_) - 1; // 1 byte for trailing 0
689+
}
690+
else {
691+
ptr= subject_;
692+
buf_end= ptr + sizeof(subject_) - 1; // 1 byte for trailing 0
693+
}
667694

668695
while (source_.get_index() < length) {
669696
GetSet();
@@ -685,47 +712,36 @@ void CertDecoder::GetName(NameType nt)
685712
byte id = source_.next();
686713
b = source_.next(); // strType
687714
word32 strLen = GetLength(source_);
688-
bool copy = false;
689715

690-
if (id == COMMON_NAME) {
691-
memcpy(&ptr[idx], "/CN=", 4);
692-
idx += 4;
693-
copy = true;
694-
}
695-
else if (id == SUR_NAME) {
696-
memcpy(&ptr[idx], "/SN=", 4);
697-
idx += 4;
698-
copy = true;
699-
}
700-
else if (id == COUNTRY_NAME) {
701-
memcpy(&ptr[idx], "/C=", 3);
702-
idx += 3;
703-
copy = true;
704-
}
705-
else if (id == LOCALITY_NAME) {
706-
memcpy(&ptr[idx], "/L=", 3);
707-
idx += 3;
708-
copy = true;
709-
}
710-
else if (id == STATE_NAME) {
711-
memcpy(&ptr[idx], "/ST=", 4);
712-
idx += 4;
713-
copy = true;
714-
}
715-
else if (id == ORG_NAME) {
716-
memcpy(&ptr[idx], "/O=", 3);
717-
idx += 3;
718-
copy = true;
719-
}
720-
else if (id == ORGUNIT_NAME) {
721-
memcpy(&ptr[idx], "/OU=", 4);
722-
idx += 4;
723-
copy = true;
724-
}
725-
726-
if (copy) {
727-
memcpy(&ptr[idx], source_.get_current(), strLen);
728-
idx += strLen;
716+
switch (id) {
717+
case COMMON_NAME:
718+
if (!(ptr= AddTag(ptr, buf_end, "/CN=", 4, strLen)))
719+
goto err;
720+
break;
721+
case SUR_NAME:
722+
if (!(ptr= AddTag(ptr, buf_end, "/SN=", 4, strLen)))
723+
goto err;
724+
break;
725+
case COUNTRY_NAME:
726+
if (!(ptr= AddTag(ptr, buf_end, "/C=", 3, strLen)))
727+
goto err;
728+
break;
729+
case LOCALITY_NAME:
730+
if (!(ptr= AddTag(ptr, buf_end, "/L=", 3, strLen)))
731+
goto err;
732+
break;
733+
case STATE_NAME:
734+
if (!(ptr= AddTag(ptr, buf_end, "/ST=", 4, strLen)))
735+
goto err;
736+
break;
737+
case ORG_NAME:
738+
if (!(ptr= AddTag(ptr, buf_end, "/O=", 3, strLen)))
739+
goto err;
740+
break;
741+
case ORGUNIT_NAME:
742+
if (!(ptr= AddTag(ptr, buf_end, "/OU=", 4, strLen)))
743+
goto err;
744+
break;
729745
}
730746

731747
sha.Update(source_.get_current(), strLen);
@@ -739,23 +755,20 @@ void CertDecoder::GetName(NameType nt)
739755
source_.advance(oidSz + 1);
740756
word32 length = GetLength(source_);
741757

742-
if (email) {
743-
memcpy(&ptr[idx], "/emailAddress=", 14);
744-
idx += 14;
745-
746-
memcpy(&ptr[idx], source_.get_current(), length);
747-
idx += length;
748-
}
758+
if (email && !(ptr= AddTag(ptr, buf_end, "/emailAddress=", 14, length)))
759+
goto err;
749760

750761
source_.advance(length);
751762
}
752763
}
753-
ptr[idx++] = 0;
764+
*ptr= 0;
754765

755-
if (nt == ISSUER)
756-
sha.Final(issuerHash_);
757-
else
758-
sha.Final(subjectHash_);
766+
sha.Final(nt == ISSUER ? issuerHash_ : subjectHash_);
767+
768+
return;
769+
770+
err:
771+
source_.SetError(CONTENT_E);
759772
}
760773

761774

include/config-win.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ typedef SSIZE_T ssize_t;
190190
#define isnan(X) _isnan(X)
191191
#define finite(X) _finite(X)
192192

193-
#ifndef UNDEF_THREAD_HACK
193+
#ifndef MYSQL_CLIENT_NO_THREADS
194194
#define THREAD
195195
#endif
196196
#define VOID_SIGHANDLER

include/m_string.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
9292
extern char NEAR _dig_vec_upper[];
9393
extern char NEAR _dig_vec_lower[];
9494

95-
#ifdef BAD_STRING_COMPILER
96-
#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
97-
#else
95+
#ifndef strmov
9896
#define strmov_overlapp(A,B) strmov(A,B)
9997
#define strmake_overlapp(A,B,C) strmake(A,B,C)
10098
#endif
@@ -152,12 +150,11 @@ extern size_t strinstr(const char *str,const char *search);
152150
extern size_t r_strinstr(const char *str, size_t from, const char *search);
153151
extern char *strkey(char *dst,char *head,char *tail,char *flags);
154152
extern char *strmake(char *dst,const char *src,size_t length);
155-
#ifndef strmake_overlapp
156-
extern char *strmake_overlapp(char *dst,const char *src, size_t length);
157-
#endif
158153

159154
#ifndef strmov
160155
extern char *strmov(char *dst,const char *src);
156+
#else
157+
extern char *strmov_overlapp(char *dst,const char *src);
161158
#endif
162159
extern char *strnmov(char *dst,const char *src,size_t n);
163160
extern char *strsuff(const char *src,const char *suffix);

include/my_stacktrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
(defined(__alpha__) && defined(__GNUC__))
2424
#define HAVE_STACKTRACE 1
2525
#endif
26-
#elif defined(__WIN__) || defined(__sun)
26+
#elif defined(__WIN__) || defined(HAVE_PRINTSTACK)
2727
#define HAVE_STACKTRACE 1
2828
#endif
2929

libmysql/libmysql.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
409409
if (!passwd)
410410
passwd="";
411411

412-
/* Store user into the buffer */
412+
/*
413+
Store user into the buffer.
414+
Advance position as strmake returns a pointer to the closing NUL.
415+
*/
413416
end= strmake(end, user, USERNAME_LENGTH) + 1;
414417

415418
/* write scrambled password according to server capabilities */
@@ -897,7 +900,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
897900
{
898901
MYSQL_RES *result;
899902
MYSQL_FIELD *fields;
900-
char buff[257],*end;
903+
char buff[258],*end;
901904
DBUG_ENTER("mysql_list_fields");
902905
DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : ""));
903906

@@ -1903,7 +1906,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *stmt)
19031906

19041907
/* Store type of parameter in network buffer. */
19051908

1906-
static void store_param_type(char **pos, MYSQL_BIND *param)
1909+
static void store_param_type(unsigned char **pos, MYSQL_BIND *param)
19071910
{
19081911
uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0);
19091912
int2store(*pos, typecode);
@@ -2182,7 +2185,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
21822185
that is sent to the server.
21832186
*/
21842187
for (param= stmt->params; param < param_end ; param++)
2185-
store_param_type((char**) &net->write_pos, param);
2188+
store_param_type(&net->write_pos, param);
21862189
}
21872190

21882191
for (param= stmt->params; param < param_end; param++)

mysql-test/collections/default.experimental

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ main.information_schema # Bug#47449 2009-09-19 alik main.inform
1111
main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
1212
main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10
1313
main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically
14-
main.outfile_loaddata @solaris # bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
14+
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
1515
main.plugin # Bug#47146 Linking problem with example plugin when dtrace enabled
1616
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
1717
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
1818

1919
perfschema.tampered_perfschema_table1 @windows # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
2020
perfschema.tampered_perfschema_table1 @solaris # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
2121

22-
rpl.rpl_get_master_version_and_clock* # Bug#49191 2009-12-01 Daogang rpl_get_master_version_and_clock failed on PB2: COM_REGISTER_SLAVE failed
2322
rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically
2423
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
2524
rpl.rpl_innodb_bug28430* # Bug#46029

mysql-test/extra/rpl_tests/rpl_loaddata.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,18 @@ source include/diff_tables.inc;
237237

238238
-- sync_slave_with_master
239239

240+
# BUG#49479: LOAD DATA INFILE is binlogged without escaping field names
241+
-- source include/master-slave-reset.inc
242+
-- connection master
243+
use test;
244+
CREATE TABLE t1 (`key` TEXT, `text` TEXT);
245+
246+
LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ',';
247+
SELECT * FROM t1;
248+
249+
-- sync_slave_with_master
250+
-- connection master
251+
DROP TABLE t1;
252+
-- sync_slave_with_master
253+
240254
# End of 4.1 tests

0 commit comments

Comments
 (0)