Commit 12c3e16d authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '5.5' into 10.0

parents 39dceaae 6e257274
......@@ -245,7 +245,8 @@ static void end_pager();
static void init_tee(const char *);
static void end_tee();
static const char* construct_prompt();
static char *get_arg(char *line, my_bool get_next_arg);
enum get_arg_mode { CHECK, GET, GET_NEXT};
static char *get_arg(char *line, get_arg_mode mode);
static void init_username();
static void add_int_to_prompt(int toadd);
static int get_result_width(MYSQL_RES *res);
......@@ -2257,7 +2258,7 @@ static COMMANDS *find_command(char *name)
if (!my_strnncoll(&my_charset_latin1, (uchar*) name, len,
(uchar*) commands[i].name, len) &&
(commands[i].name[len] == '\0') &&
(!end || commands[i].takes_params))
(!end || (commands[i].takes_params && get_arg(name, CHECK))))
{
index= i;
break;
......@@ -3177,7 +3178,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
char buff[256], *param;
CHARSET_INFO * new_cs;
strmake_buf(buff, line);
param= get_arg(buff, 0);
param= get_arg(buff, GET);
if (!param || !*param)
{
return put_info("Usage: \\C charset_name | charset charset_name",
......@@ -4263,12 +4264,12 @@ com_connect(String *buffer, char *line)
#ifdef EXTRA_DEBUG
tmp[1]= 0;
#endif
tmp= get_arg(buff, 0);
tmp= get_arg(buff, GET);
if (tmp && *tmp)
{
my_free(current_db);
current_db= my_strdup(tmp, MYF(MY_WME));
tmp= get_arg(buff, 1);
tmp= get_arg(buff, GET_NEXT);
if (tmp)
{
my_free(current_host);
......@@ -4371,7 +4372,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
char buff[256], *tmp;
strmake_buf(buff, line);
tmp= get_arg(buff, 0);
tmp= get_arg(buff, GET);
if (!tmp || !*tmp)
{
......@@ -4402,7 +4403,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
bzero(buff, sizeof(buff));
strmake_buf(buff, line);
tmp= get_arg(buff, 0);
tmp= get_arg(buff, GET);
if (!tmp || !*tmp)
{
put_info("USE must be followed by a database name", INFO_ERROR);
......@@ -4487,23 +4488,22 @@ com_nowarnings(String *buffer __attribute__((unused)),
}
/*
Gets argument from a command on the command line. If get_next_arg is
not defined, skips the command and returns the first argument. The
line is modified by adding zero to the end of the argument. If
get_next_arg is defined, then the function searches for end of string
first, after found, returns the next argument and adds zero to the
end. If you ever wish to use this feature, remember to initialize all
items in the array to zero first.
Gets argument from a command on the command line. If mode is not GET_NEXT,
skips the command and returns the first argument. The line is modified by
adding zero to the end of the argument. If mode is GET_NEXT, then the
function searches for end of string first, after found, returns the next
argument and adds zero to the end. If you ever wish to use this feature,
remember to initialize all items in the array to zero first.
*/
char *get_arg(char *line, my_bool get_next_arg)
static char *get_arg(char *line, get_arg_mode mode)
{
char *ptr, *start;
my_bool quoted= 0, valid_arg= 0;
bool short_cmd= false;
char qtype= 0;
ptr= line;
if (get_next_arg)
if (mode == GET_NEXT)
{
for (; *ptr; ptr++) ;
if (*(ptr + 1))
......@@ -4514,7 +4514,7 @@ char *get_arg(char *line, my_bool get_next_arg)
/* skip leading white spaces */
while (my_isspace(charset_info, *ptr))
ptr++;
if (*ptr == '\\') // short command was used
if ((short_cmd= *ptr == '\\')) // short command was used
ptr+= 2;
else
while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
......@@ -4527,24 +4527,28 @@ char *get_arg(char *line, my_bool get_next_arg)
if (*ptr == '\'' || *ptr == '\"' || *ptr == '`')
{
qtype= *ptr;
quoted= 1;
ptr++;
}
for (start=ptr ; *ptr; ptr++)
{
if (*ptr == '\\' && ptr[1]) // escaped character
if ((*ptr == '\\' && ptr[1]) || // escaped character
(!short_cmd && qtype && *ptr == qtype && ptr[1] == qtype)) // quote
{
// Remove the backslash
strmov_overlapp(ptr, ptr+1);
// Remove (or skip) the backslash (or a second quote)
if (mode != CHECK)
strmov_overlapp(ptr, ptr+1);
else
ptr++;
}
else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype))
else if (*ptr == (qtype ? qtype : ' '))
{
*ptr= 0;
qtype= 0;
if (mode != CHECK)
*ptr= 0;
break;
}
}
valid_arg= ptr != start;
return valid_arg ? start : NullS;
return ptr != start && !qtype ? start : NullS;
}
......
......@@ -575,9 +575,7 @@ static int dump_all_tablespaces();
static int dump_tablespaces_for_tables(char *db, char **table_names, int tables);
static int dump_tablespaces_for_databases(char** databases);
static int dump_tablespaces(char* ts_where);
static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
...);
static void print_comment(FILE *, my_bool, const char *, ...);
/*
Print the supplied message if in verbose mode
......@@ -655,6 +653,30 @@ static void short_usage(FILE *f)
}
/** returns a string fixed to be safely printed inside a -- comment
that is, any new line in it gets prefixed with --
*/
static const char *fix_for_comment(const char *ident)
{
static char buf[1024];
char c, *s= buf;
while ((c= *s++= *ident++))
{
if (s >= buf + sizeof(buf) - 10)
{
strmov(s, "...");
break;
}
if (c == '\n')
s= strmov(s, "-- ");
}
return buf;
}
static void write_header(FILE *sql_file, char *db_name)
{
if (opt_xml)
......@@ -677,8 +699,8 @@ static void write_header(FILE *sql_file, char *db_name)
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost",
db_name ? db_name : "");
fix_for_comment(current_host ? current_host : "localhost"),
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
);
......@@ -2224,7 +2246,8 @@ static uint dump_events_for_db(char *db)
/* nice comments */
print_comment(sql_file, 0,
"\n--\n-- Dumping events for database '%s'\n--\n", db);
"\n--\n-- Dumping events for database '%s'\n--\n",
fix_for_comment(db));
/*
not using "mysql_query_with_error_report" because we may have not
......@@ -2436,7 +2459,8 @@ static uint dump_routines_for_db(char *db)
/* nice comments */
print_comment(sql_file, 0,
"\n--\n-- Dumping routines for database '%s'\n--\n", db);
"\n--\n-- Dumping routines for database '%s'\n--\n",
fix_for_comment(db));
/*
not using "mysql_query_with_error_report" because we may have not
......@@ -2731,11 +2755,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (strcmp (table_type, "VIEW") == 0) /* view */
print_comment(sql_file, 0,
"\n--\n-- Temporary table structure for view %s\n--\n\n",
result_table);
fix_for_comment(result_table));
else
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
result_table);
fix_for_comment(result_table));
if (opt_drop)
{
......@@ -2977,7 +3001,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
result_table);
fix_for_comment(result_table));
if (opt_drop)
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table);
if (!opt_xml)
......@@ -3684,21 +3708,21 @@ static void dump_table(char *table, char *db)
{
print_comment(md_result_file, 0,
"\n--\n-- Dumping data for table %s\n--\n",
result_table);
fix_for_comment(result_table));
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
dynstr_append_checked(&query_string, result_table);
if (where)
{
print_comment(md_result_file, 0, "-- WHERE: %s\n", where);
print_comment(md_result_file, 0, "-- WHERE: %s\n", fix_for_comment(where));
dynstr_append_checked(&query_string, " WHERE ");
dynstr_append_checked(&query_string, where);
}
if (order_by)
{
print_comment(md_result_file, 0, "-- ORDER BY: %s\n", order_by);
print_comment(md_result_file, 0, "-- ORDER BY: %s\n", fix_for_comment(order_by));
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
......@@ -4208,7 +4232,7 @@ static int dump_tablespaces(char* ts_where)
if (first)
{
print_comment(md_result_file, 0, "\n--\n-- Logfile group: %s\n--\n",
row[0]);
fix_for_comment(row[0]));
fprintf(md_result_file, "\nCREATE");
}
......@@ -4277,7 +4301,8 @@ static int dump_tablespaces(char* ts_where)
first= 1;
if (first)
{
print_comment(md_result_file, 0, "\n--\n-- Tablespace: %s\n--\n", row[0]);
print_comment(md_result_file, 0, "\n--\n-- Tablespace: %s\n--\n",
fix_for_comment(row[0]));
fprintf(md_result_file, "\nCREATE");
}
else
......@@ -4481,7 +4506,8 @@ static int init_dumping(char *database, int init_func(char*))
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
print_comment(md_result_file, 0,
"\n--\n-- Current Database: %s\n--\n", qdatabase);
"\n--\n-- Current Database: %s\n--\n",
fix_for_comment(qdatabase));
/* Call the view or table specific function */
init_func(qdatabase);
......@@ -5672,7 +5698,7 @@ static my_bool get_view_structure(char *table, char* db)
print_comment(sql_file, 0,
"\n--\n-- Final view structure for view %s\n--\n\n",
result_table);
fix_for_comment(result_table));
/* Table might not exist if this view was dumped with --tab. */
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
......
......@@ -3373,10 +3373,6 @@ void do_exec(struct st_command *command)
#endif
#endif
/* exec command is interpreted externally and will not take newlines */
while(replace(&ds_cmd, "\n", 1, " ", 1) == 0)
;
DBUG_PRINT("info", ("Executing '%s' as '%s'",
command->first_argument, ds_cmd.str));
......
......@@ -12,6 +12,24 @@ before calling SSL_new();
*** end Note ***
yaSSL Release notes, version 2.4.2 (9/22/2016)
This release of yaSSL fixes a medium security vulnerability. A fix for
potential AES side channel leaks is included that a local user monitoring
the same CPU core cache could exploit. VM users, hyper-threading users,
and users where potential attackers have access to the CPU cache will need
to update if they utilize AES.
DSA padding fixes for unusual sizes is included as well. Users with DSA
certficiates should update.
yaSSL Release notes, version 2.4.0 (5/20/2016)
This release of yaSSL fixes the OpenSSL compatibility function
SSL_CTX_load_verify_locations() when using the path directory to allow
unlimited path sizes. Minor Windows build fixes are included.
No high level security fixes in this version but we always recommend
updating.
yaSSL Release notes, version 2.3.9b (2/03/2016)
This release of yaSSL fixes the OpenSSL compatibility function
X509_NAME_get_index_by_NID() to use the actual index of the common name
......
-----BEGIN CERTIFICATE-----
MIIDqzCCA2ugAwIBAgIJAMGqrgDU6DyhMAkGByqGSM44BAMwgY4xCzAJBgNVBAYT
MIIDrzCCA2+gAwIBAgIJAK1zRM7YFcNjMAkGByqGSM44BAM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NFl0tJJN5v
wx2gtNxJSwIsm8VRscqqFH2092b9ScH7VjLoqhx+bgA4XV7l1aNQME4wHQYDVR0O
BBYEFCCY5ONeqOL/KqR/SwbV5Ufb/IHHMB8GA1UdIwQYMBaAFCCY5ONeqOL/KqR/
SwbV5Ufb/IHHMAwGA1UdEwQFMAMBAf8wCQYHKoZIzjgEAwMvADAsAhQRYSCVN/Ge
agV3mffU3qNZ92fI0QIUPH7Jp+iASI7U1ocaYDc10qXGaGY=
-----END CERTIFICATE-----
......@@ -34,7 +34,7 @@
#include "rsa.h"
#define YASSL_VERSION "2.3.9b"
#define YASSL_VERSION "2.4.2"
#if defined(__cplusplus)
......
......@@ -162,7 +162,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
TaoCrypt::DSA_PrivateKey dsaKey;
dsaKey.Initialize(dsaSource);
if (rsaSource.GetError().What()) {
if (dsaSource.GetError().What()) {
// neither worked
ret = SSL_FAILURE;
}
......@@ -785,40 +785,67 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char name[MAX_PATH + 1]; // directory specification
strncpy(name, path, MAX_PATH - 3);
strncat(name, "\\*", 3);
const int DELIMITER_SZ = 2;
const int DELIMITER_STAR_SZ = 3;
int pathSz = (int)strlen(path);
int nameSz = pathSz + DELIMITER_STAR_SZ + 1; // plus 1 for terminator
char* name = NEW_YS char[nameSz]; // directory specification
memset(name, 0, nameSz);
strncpy(name, path, nameSz - DELIMITER_STAR_SZ - 1);
strncat(name, "\\*", DELIMITER_STAR_SZ);
hFind = FindFirstFile(name, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH;
if (hFind == INVALID_HANDLE_VALUE) {
ysArrayDelete(name);
return SSL_BAD_PATH;
}
do {
if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) {
strncpy(name, path, MAX_PATH - 2 - HALF_PATH);
strncat(name, "\\", 2);
strncat(name, FindFileData.cFileName, HALF_PATH);
if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
int curSz = (int)strlen(FindFileData.cFileName);
if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) {
ysArrayDelete(name);
// plus 1 for terminator
nameSz = pathSz + curSz + DELIMITER_SZ + 1;
name = NEW_YS char[nameSz];
}
memset(name, 0, nameSz);
strncpy(name, path, nameSz - curSz - DELIMITER_SZ - 1);
strncat(name, "\\", DELIMITER_SZ);
strncat(name, FindFileData.cFileName,
nameSz - pathSz - DELIMITER_SZ - 1);
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
}
} while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData));
ysArrayDelete(name);
FindClose(hFind);
#else // _WIN32
const int MAX_PATH = 260;
DIR* dir = opendir(path);
if (!dir) return SSL_BAD_PATH;
struct dirent* entry;
struct stat buf;
char name[MAX_PATH + 1];
const int DELIMITER_SZ = 1;
int pathSz = (int)strlen(path);
int nameSz = pathSz + DELIMITER_SZ + 1; //plus 1 for null terminator
char* name = NEW_YS char[nameSz]; // directory specification
while (ret == SSL_SUCCESS && (entry = readdir(dir))) {
strncpy(name, path, MAX_PATH - 1 - HALF_PATH);
strncat(name, "/", 1);
strncat(name, entry->d_name, HALF_PATH);
int curSz = (int)strlen(entry->d_name);
if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) {
ysArrayDelete(name);
nameSz = pathSz + DELIMITER_SZ + curSz + 1;
name = NEW_YS char[nameSz];
}
memset(name, 0, nameSz);
strncpy(name, path, nameSz - curSz - 1);
strncat(name, "/", DELIMITER_SZ);
strncat(name, entry->d_name, nameSz - pathSz - DELIMITER_SZ - 1);
if (stat(name, &buf) < 0) {
ysArrayDelete(name);
closedir(dir);
return SSL_BAD_STAT;
}
......@@ -827,6 +854,7 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
}
ysArrayDelete(name);
closedir(dir);
#endif
......
......@@ -60,6 +60,7 @@ private:
static const word32 Te[5][256];
static const word32 Td[5][256];
static const byte CTd4[256];
static const word32* Te0;
static const word32* Te1;
......@@ -80,11 +81,68 @@ private:
void ProcessAndXorBlock(const byte*, const byte*, byte*) const;
word32 PreFetchTe() const;
word32 PreFetchTd() const;
word32 PreFetchCTd4() const;
AES(const AES&); // hide copy
AES& operator=(const AES&); // and assign
};
#if defined(__x86_64__) || defined(_M_X64) || \
(defined(__ILP32__) && (__ILP32__ >= 1))
#define TC_CACHE_LINE_SZ 64
#else
/* default cache line size */
#define TC_CACHE_LINE_SZ 32
#endif
inline word32 AES::PreFetchTe() const
{
word32 x = 0;
/* 4 tables of 256 entries */
for (int i = 0; i < 4; i++) {
/* each entry is 4 bytes */
for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) {
x &= Te[i][j];
}
}
return x;
}
inline word32 AES::PreFetchTd() const
{
word32 x = 0;
/* 4 tables of 256 entries */
for (int i = 0; i < 4; i++) {
/* each entry is 4 bytes */
for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) {
x &= Td[i][j];
}
}
return x;
}
inline word32 AES::PreFetchCTd4() const
{
word32 x = 0;
int i;
for (i = 0; i < 256; i += TC_CACHE_LINE_SZ) {
x &= CTd4[i];
}
return x;
}
typedef BlockCipher<ENCRYPTION, AES, ECB> AES_ECB_Encryption;
typedef BlockCipher<DECRYPTION, AES, ECB> AES_ECB_Decryption;
......
......@@ -119,6 +119,9 @@ namespace TaoCrypt {
#ifdef _WIN32
#undef max // avoid name clash
#endif
// general MAX
template<typename T> inline
const T& max(const T& a, const T& b)
......
This diff is collapsed.
......@@ -1219,17 +1219,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32 rLen = GetLength(source);
if (rLen != 20) {
if (rLen == 21) { // zero at front, eat
while (rLen > 20 && source.remaining() > 0) { // zero's at front, eat
source.next();
--rLen;
}
else if (rLen == 19) { // add zero to front so 20 bytes
if (rLen < 20) { // add zero's to front so 20 bytes
word32 tmpLen = rLen;
while (tmpLen < 20) {
decoded[0] = 0;
decoded++;
tmpLen++;
}
else {
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded, source.get_buffer() + source.get_index(), rLen);
......@@ -1242,17 +1242,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32 sLen = GetLength(source);
if (sLen != 20) {
if (sLen == 21) {
source.next(); // zero at front, eat
while (sLen > 20 && source.remaining() > 0) {
source.next(); // zero's at front, eat
--sLen;
}
else if (sLen == 19) {
decoded[rLen] = 0; // add zero to front so 20 bytes
if (sLen < 20) { // add zero's to front so 20 bytes
word32 tmpLen = sLen;
while (tmpLen < 20) {
decoded[rLen] = 0;
decoded++;
tmpLen++;
}
else {
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen);
......
......@@ -172,6 +172,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
const Integer& q = key_.GetSubGroupOrder();
const Integer& g = key_.GetSubGroupGenerator();
const Integer& x = key_.GetPrivatePart();
byte* tmpPtr = sig; // initial signature output
Integer k(rng, 1, q - 1);
......@@ -187,22 +188,23 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
return (word32) -1;
int rSz = r_.ByteCount();
int tmpSz = rSz;
if (rSz == 19) {
sig[0] = 0;
sig++;
while (tmpSz++ < SHA::DIGEST_SIZE) {
*sig++ = 0;
}
r_.Encode(sig, rSz);
sig = tmpPtr + SHA::DIGEST_SIZE; // advance sig output to s
int sSz = s_.ByteCount();
tmpSz = sSz;
if (sSz == 19) {
sig[rSz] = 0;
sig++;
while (tmpSz++ < SHA::DIGEST_SIZE) {
*sig++ = 0;
}
s_.Encode(sig + rSz, sSz);
s_.Encode(sig, sSz);
return 40;
}
......
......@@ -1281,6 +1281,9 @@ int dsa_test()
if (!verifier.Verify(digest, decoded))
return -90;
if (!verifier.Verify(digest, signature))
return -91;
return 0;
}
......
......@@ -22,7 +22,6 @@
#define yaSSL_TEST_HPP
#include "runtime.hpp"
#include "openssl/ssl.h" /* openssl compatibility test */
#include "error.hpp"
#include <stdio.h>
#include <stdlib.h>
......@@ -56,6 +55,7 @@
#endif
#define SOCKET_T int
#endif /* _WIN32 */
#include "openssl/ssl.h" /* openssl compatibility test */
#ifdef _MSC_VER
......
......@@ -1004,19 +1004,19 @@ show grants;
Grants for user3@localhost
GRANT USAGE ON *.* TO 'user3'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
select * from information_schema.column_privileges where grantee like '%user%'
select * from information_schema.column_privileges where grantee like '\'user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' def mysqltest t1 f1 SELECT NO
select * from information_schema.table_privileges where grantee like '%user%'
select * from information_schema.table_privileges where grantee like '\'user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' def mysqltest t2 SELECT NO
select * from information_schema.schema_privileges where grantee like '%user%'
select * from information_schema.schema_privileges where grantee like '\'user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' def mysqltest SELECT NO
select * from information_schema.user_privileges where grantee like '%user%'
select * from information_schema.user_privileges where grantee like '\'user%'
order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' def USAGE NO
......
......@@ -512,6 +512,14 @@ DROP DATABASE connected_db;
create database `aa``bb````cc`;
DATABASE()
aa`bb``cc
DATABASE()
test
DATABASE()
aa`bb``cc
DATABASE()
test
DATABASE()
aa`bb``cc
drop database `aa``bb````cc`;
a
>>\ndelimiter\n<<
......
......@@ -3,3 +3,9 @@ a
1
End of tests
1
1
2
2
X
3
create database `mysqltest1
1tsetlqsym`;
use `mysqltest1
1tsetlqsym`;
create table `t1
1t` (`foobar
raboof` int);
create view `v1
1v` as select * from `t1
1t`;
create procedure sp() select * from `v1
1v`;
flush tables;
use test;
--
-- Current Database: `mysqltest1
-- 1tsetlqsym`
--
/*!40000 DROP DATABASE IF EXISTS `mysqltest1
1tsetlqsym`*/;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1
1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqltest1
1tsetlqsym`;
--
-- Table structure for table `t1
-- 1t`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1
1t` (
`foobar
raboof` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t1
-- 1t`
--
--
-- Temporary table structure for view `v1
-- 1v`
--
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1
1v` (
`foobar
raboof` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Dumping routines for database 'mysqltest1
-- 1tsetlqsym'
--
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
select * from `v1
1v` ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Current Database: `mysqltest1
-- 1tsetlqsym`
--
USE `mysqltest1
1tsetlqsym`;
--
-- Final view structure for view `v1
-- 1v`
--
/*!50001 DROP TABLE IF EXISTS `v1
1v`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = latin1 */;
/*!50001 SET character_set_results = latin1 */;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1
1v` AS select `t1
1t`.`foobar
raboof` AS `foobar
raboof` from `t1
1t` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
show tables from `mysqltest1
1tsetlqsym`;
Tables_in_mysqltest1
1tsetlqsym
t1
1t
v1
1v
drop database `mysqltest1
1tsetlqsym`;
......@@ -269,12 +269,6 @@ source database
echo message echo message
mysqltest: At line 1: Missing argument in exec
1
1
2
2
X
3
MySQL
"MySQL"
MySQL: The
......
......@@ -612,13 +612,13 @@ select * from information_schema.schema_privileges order by grantee;
select * from information_schema.user_privileges order by grantee;
show grants;
connection con4;
select * from information_schema.column_privileges where grantee like '%user%'
select * from information_schema.column_privileges where grantee like '\'user%'
order by grantee;
select * from information_schema.table_privileges where grantee like '%user%'
select * from information_schema.table_privileges where grantee like '\'user%'
order by grantee;
select * from information_schema.schema_privileges where grantee like '%user%'
select * from information_schema.schema_privileges where grantee like '\'user%'
order by grantee;
select * from information_schema.user_privileges where grantee like '%user%'
select * from information_schema.user_privileges where grantee like '\'user%'
order by grantee;
show grants;
connection default;
......
......@@ -586,8 +586,16 @@ DROP DATABASE connected_db;
# USE and names with backticks
#
--write_file $MYSQLTEST_VARDIR/tmp/backticks.sql
\u aa`bb``cc
SELECT DATABASE();
USE test
SELECT DATABASE();
USE aa`bb``cc
SELECT DATABASE();
USE test
SELECT DATABASE();
USE `aa``bb````cc`
SELECT DATABASE();
EOF
create database `aa``bb````cc`;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
......
......@@ -13,3 +13,12 @@
--echo
--echo End of tests
# Multi-line exec
exec $MYSQL \
test -e "select 1";
exec $MYSQL test -e "select
2";
let $query = select 3
as X;
exec $MYSQL test -e "$query";
#
# New lines in identifiers
#
# embedded server doesn't support external clients
--source include/not_embedded.inc
# cmd.exe doesn't like new lines on the command line
--source include/not_windows.inc
create database `mysqltest1
1tsetlqsym`;
use `mysqltest1
1tsetlqsym`;
create table `t1
1t` (`foobar
raboof` int);
create view `v1
1v` as select * from `t1
1t`;
create procedure sp() select * from `v1
1v`;
flush tables;
use test;
exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
1tsetlqsym';
exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
1tsetlqsym' | $MYSQL;
show tables from `mysqltest1
1tsetlqsym`;
drop database `mysqltest1
1tsetlqsym`;
......@@ -741,15 +741,6 @@ echo ;
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
# Multi-line exec
exec $MYSQL
test -e "select 1";
exec $MYSQL test -e "select
2";
let $query = select 3
as X;
exec $MYSQL test -e "$query";
# ----------------------------------------------------------------------------
# Test let command
# ----------------------------------------------------------------------------
......
......@@ -792,7 +792,7 @@ int
innobase_get_parent_fk_list(
THD* thd,
const char* path,
List<FOREIGN_KEY_INFO>* f_key_list);
List<FOREIGN_KEY_INFO>* f_key_list) __attribute__((unused));
/******************************************************************//**
Maps a MySQL trx isolation level code to the InnoDB isolation level code
......
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