Commit 80bb699f authored by unknown's avatar unknown

Merge rolltop.ignatz42.dyndns.org:/mnt/storeage/mysql-5.0-maint_21527

into  rolltop.ignatz42.dyndns.org:/mnt/storeage/mysql-5.1-new-maint_21527


include/mysql.h:
  Auto merged
include/mysql_com.h:
  Auto merged
sql-common/client.c:
  Auto merged
client/mysqldump.c:
  manual merge
mysql-test/r/mysqldump.result:
  manual merge
mysql-test/t/mysqldump.test:
  manual merge
parents 68ced7fb e88121ea
......@@ -430,7 +430,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
int string_value);
static int dump_selected_tables(char *db, char **table_names, int tables);
static int dump_all_tables_in_db(char *db);
static int init_dumping(char *);
static int init_dumping_views(char *);
static int init_dumping_tables(char *);
static int init_dumping(char *, int init_func(char*));
static int dump_databases(char **);
static int dump_all_databases();
static char *quote_name(const char *name, char *buff, my_bool force);
......@@ -2905,31 +2907,36 @@ static int dump_databases(char **db_names)
} /* dump_databases */
static int init_dumping(char *database)
/*
View Specific database initalization.
SYNOPSIS
init_dumping_views
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_views(char *qdatabase)
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
return 0;
} /* init_dumping_views */
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (!path && !opt_xml)
{
if (opt_databases || opt_alldbs)
{
/*
length of table name * 2 (if name contains quotes), 2 quotes and 0
*/
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
/*
Table Specific database initalization.
SYNOPSIS
init_dumping_tables
qdatabase quoted name of the database
RETURN VALUES
0 Success.
1 Failure.
*/
int init_dumping_tables(char *qdatabase)
{
if (!opt_create_db)
{
char qbuf[256];
......@@ -2964,6 +2971,40 @@ static int init_dumping(char *database)
}
}
}
return 0;
} /* init_dumping_tables */
static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (!path && !opt_xml)
{
if (opt_databases || opt_alldbs)
{
/*
length of table name * 2 (if name contains quotes), 2 quotes and 0
*/
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
/* Call the view or table specific function */
init_func(qdatabase);
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
......@@ -2997,7 +3038,7 @@ static int dump_all_tables_in_db(char *database)
if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
return 0;
if (init_dumping(database))
if (init_dumping(database, init_dumping_tables))
return 1;
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
......@@ -3075,23 +3116,8 @@ static my_bool dump_all_views_in_db(char *database)
uint numrows;
char table_buff[NAME_LEN*2+3];
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
if (init_dumping(database, init_dumping_views))
return 1;
}
if (opt_databases || opt_alldbs)
{
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables)
......@@ -3186,7 +3212,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db))
if (init_dumping(db, init_dumping_tables))
DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0);
......
......@@ -165,7 +165,6 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
my_bool ssl_verify_server_cert; /* if to verify server cert */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
......
......@@ -138,8 +138,10 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
......
......@@ -434,7 +434,7 @@ USE `mysqldump_test_db`;
drop database mysqldump_test_db;
CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 '');
INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
......@@ -479,7 +479,7 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES ('');
INSERT INTO `t1` VALUES ('Ž™šá');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
......@@ -502,7 +502,7 @@ CREATE TABLE `t1` (
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES ('');
INSERT INTO `t1` VALUES ('Ž™šá');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
......@@ -1676,11 +1676,11 @@ create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1;
a b
Osnabrck Kln
Osnabrück Köln
test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
select * from t1;
a b
Osnabrck Kln
Osnabrück Köln
drop table t1;
create table `t1` (
t1_name varchar(255) default null,
......@@ -2925,7 +2925,22 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
use mysqldump_myDB;
create view v1 (c1) as select * from t1;
use mysqldump_myDB;
drop view v1;
drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
End of 5.0 tests
use test;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
......
......@@ -153,7 +153,7 @@ drop database mysqldump_test_db;
# if it is explicitely set.
CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 '');
INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
#
# Bug#8063: make test mysqldump [ fail ]
......@@ -1326,8 +1326,37 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
--echo End of 5.0 tests
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
use mysqldump_myDB;
create view v1 (c1) as select * from t1;
# Backup should not fail.
--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql
# Clean up
connection root;
use mysqldump_myDB;
drop view v1;
drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
--echo End of 5.0 tests
use test;
#
# Added for use-thread option
#
......
......@@ -1509,7 +1509,6 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql->options.ssl_ca= strdup_if_not_null(ca);
mysql->options.ssl_capath= strdup_if_not_null(capath);
mysql->options.ssl_cipher= strdup_if_not_null(cipher);
mysql->options.ssl_verify_server_cert= FALSE; /* Off by default */
#endif /* HAVE_OPENSSL */
DBUG_RETURN(0);
}
......@@ -2198,7 +2197,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_PRINT("info", ("IO layer change done!"));
/* Verify server cert */
if (mysql->options.ssl_verify_server_cert &&
if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
ssl_verify_server_cert(mysql->net.vio, mysql->host))
{
set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
......@@ -2945,7 +2944,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql->reconnect= *(my_bool *) arg;
break;
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
mysql->options.ssl_verify_server_cert= *(my_bool *) arg;
if (!arg || test(*(uint*) arg))
mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
else
mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
break;
default:
DBUG_RETURN(1);
......
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