Merged from 4.1
This commit is contained in:
commit
f7c01cfb76
@ -568,7 +568,14 @@ open_or_create_log_file(
|
||||
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
|
||||
OS_LOG_FILE, &ret);
|
||||
if (ret == FALSE) {
|
||||
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS) {
|
||||
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
|
||||
#ifdef UNIV_AIX
|
||||
/* AIX 5.1 after security patch ML7 may have errno set
|
||||
to 0 here, which causes our function to return 100;
|
||||
work around that AIX problem */
|
||||
&& os_file_get_last_error(FALSE) != 100
|
||||
#endif
|
||||
) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error in creating or opening %s\n", name);
|
||||
|
||||
@ -728,7 +735,14 @@ open_or_create_data_files(
|
||||
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
|
||||
|
||||
if (ret == FALSE && os_file_get_last_error(FALSE) !=
|
||||
OS_FILE_ALREADY_EXISTS) {
|
||||
OS_FILE_ALREADY_EXISTS
|
||||
#ifdef UNIV_AIX
|
||||
/* AIX 5.1 after security patch ML7 may have
|
||||
errno set to 0 here, which causes our function
|
||||
to return 100; work around that AIX problem */
|
||||
&& os_file_get_last_error(FALSE) != 100
|
||||
#endif
|
||||
) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error in creating or opening %s\n",
|
||||
name);
|
||||
|
4
mysql-test/include/have_cp1250_ch.inc
Normal file
4
mysql-test/include/have_cp1250_ch.inc
Normal file
@ -0,0 +1,4 @@
|
||||
-- require r/have_cp1250_ch.require
|
||||
disable_query_log;
|
||||
show collation like "cp1250_czech_cs";
|
||||
enable_query_log;
|
@ -87,3 +87,42 @@ drop table t1;
|
||||
SELECT '0x8000000000000001'+0;
|
||||
'0x8000000000000001'+0
|
||||
0
|
||||
create table t1 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
create table t2 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
insert into t1 values(17156792991891826145, 1);
|
||||
insert into t1 values( 9223372036854775807, 2);
|
||||
insert into t2 values(17156792991891826145, 3);
|
||||
insert into t2 values( 9223372036854775807, 4);
|
||||
select * from t1;
|
||||
value64 value32
|
||||
9223372036854775807 2
|
||||
17156792991891826145 1
|
||||
select * from t2;
|
||||
value64 value32
|
||||
9223372036854775807 4
|
||||
17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=17156792991891826145;
|
||||
value64 value32 value64 value32
|
||||
17156792991891826145 1 17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=t1.value64;
|
||||
value64 value32 value64 value32
|
||||
17156792991891826145 1 17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=9223372036854775807;
|
||||
value64 value32 value64 value32
|
||||
9223372036854775807 2 9223372036854775807 4
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=t1.value64;
|
||||
value64 value32 value64 value32
|
||||
9223372036854775807 2 9223372036854775807 4
|
||||
drop table t1, t2;
|
||||
|
9
mysql-test/r/ctype_cp1250_ch.result
Normal file
9
mysql-test/r/ctype_cp1250_ch.result
Normal file
@ -0,0 +1,9 @@
|
||||
SHOW COLLATION LIKE 'cp1250_czech_cs';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
cp1250_czech_cs cp1250 34 Yes 2
|
||||
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
||||
a length(a) a='' a=' ' a=' '
|
||||
0 1 1 1
|
||||
DROP TABLE t1;
|
@ -233,3 +233,19 @@ drop user mysqltest_B@'%';
|
||||
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql'
|
||||
drop user mysqltest_B@'%';
|
||||
drop user mysqltest_3@localhost;
|
||||
create database mysqltest_1;
|
||||
create table mysqltest_1.t1 (i int);
|
||||
insert into mysqltest_1.t1 values (1),(2),(3);
|
||||
GRANT ALL ON mysqltest_1.t1 TO mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
show grants for current_user();
|
||||
Grants for mysqltest_1@127.0.0.0/255.0.0.0
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.0/255.0.0.0'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest_1`.`t1` TO 'mysqltest_1'@'127.0.0.0/255.0.0.0'
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
2
|
||||
3
|
||||
REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
drop table mysqltest_1.t1;
|
||||
drop database mysqltest_1;
|
||||
|
2
mysql-test/r/have_cp1250_ch.require
Normal file
2
mysql-test/r/have_cp1250_ch.require
Normal file
@ -0,0 +1,2 @@
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
cp1250_czech_cs cp1250 34 Yes 2
|
@ -477,27 +477,6 @@ CREATE TABLE `t1` (
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES ('ÄÖÜß');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` char(10) default NULL
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES ('Ž™šá');
|
||||
|
@ -93,3 +93,15 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
@ -71,3 +71,36 @@ drop table t1;
|
||||
# atof() behaviour is different of different systems. to be fixed in 4.1
|
||||
SELECT '0x8000000000000001'+0;
|
||||
|
||||
# Test for BUG#8562: joins over BIGINT UNSIGNED value + constant propagation
|
||||
create table t1 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
|
||||
create table t2 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
|
||||
insert into t1 values(17156792991891826145, 1);
|
||||
insert into t1 values( 9223372036854775807, 2);
|
||||
insert into t2 values(17156792991891826145, 3);
|
||||
insert into t2 values( 9223372036854775807, 4);
|
||||
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=17156792991891826145;
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=t1.value64;
|
||||
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=9223372036854775807;
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=t1.value64;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
|
12
mysql-test/t/ctype_cp1250_ch.test
Normal file
12
mysql-test/t/ctype_cp1250_ch.test
Normal file
@ -0,0 +1,12 @@
|
||||
-- source include/have_cp1250_ch.inc
|
||||
|
||||
SHOW COLLATION LIKE 'cp1250_czech_cs';
|
||||
|
||||
#
|
||||
# Bugs: #8840: Empty string comparison and character set 'cp1250'
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
||||
DROP TABLE t1;
|
@ -246,3 +246,17 @@ connection default;
|
||||
drop user mysqltest_B@'%';
|
||||
drop user mysqltest_3@localhost;
|
||||
#
|
||||
# Bug #3309: Test IP addresses with netmask
|
||||
create database mysqltest_1;
|
||||
create table mysqltest_1.t1 (i int);
|
||||
insert into mysqltest_1.t1 values (1),(2),(3);
|
||||
GRANT ALL ON mysqltest_1.t1 TO mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
connect (n1,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection n1;
|
||||
show grants for current_user();
|
||||
select * from t1;
|
||||
disconnect n1;
|
||||
connection default;
|
||||
REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
|
||||
drop table mysqltest_1.t1;
|
||||
drop database mysqltest_1;
|
||||
|
@ -158,7 +158,14 @@ drop database mysqldump_test_db;
|
||||
CREATE TABLE t1 (a CHAR(10));
|
||||
INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
|
||||
#
|
||||
# Bug#8063: make test mysqldump [ fail ]
|
||||
# We cannot tes this command because its output depends
|
||||
# on --default-character-set incompiled into "mysqldump" program.
|
||||
# If the future we can move this command into a separate test with
|
||||
# checking that "mysqldump" is compiled with "latin1"
|
||||
#
|
||||
#--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
|
||||
|
@ -121,3 +121,18 @@ eval alter table t1 index directory="$MYSQL_TEST_DIR/var/log";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test specifying DATA DIRECTORY that is the same as what would normally
|
||||
# have been chosen. (Bug #8707)
|
||||
#
|
||||
disable_query_log;
|
||||
eval create table t1 (i int) data directory = "$MYSQL_TEST_DIR/var/master-data/test/";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
disable_query_log;
|
||||
eval create table t1 (i int) index directory = "$MYSQL_TEST_DIR/var/master-data/test/";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
@ -32,6 +32,7 @@ File my_create_with_symlink(const char *linkname, const char *filename,
|
||||
int tmp_errno;
|
||||
/* Test if we should create a link */
|
||||
int create_link;
|
||||
char abs_linkname[FN_REFLEN];
|
||||
DBUG_ENTER("my_create_with_symlink");
|
||||
|
||||
if (my_disable_symlinks)
|
||||
@ -42,7 +43,11 @@ File my_create_with_symlink(const char *linkname, const char *filename,
|
||||
filename= linkname;
|
||||
}
|
||||
else
|
||||
create_link= (linkname && strcmp(linkname,filename));
|
||||
{
|
||||
if (linkname)
|
||||
my_realpath(&abs_linkname, linkname, MYF(0));
|
||||
create_link= (linkname && strcmp(abs_linkname,filename));
|
||||
}
|
||||
|
||||
if (!(MyFlags & MY_DELETE_OLD))
|
||||
{
|
||||
|
@ -5344,7 +5344,8 @@ void Dbtc::execTC_COMMITREQ(Signal* signal)
|
||||
const Uint32 transId1 = regApiPtr->transid[0];
|
||||
const Uint32 transId2 = regApiPtr->transid[1];
|
||||
Uint32 errorCode = 0;
|
||||
|
||||
|
||||
regApiPtr->m_exec_flag = 1;
|
||||
switch (regApiPtr->apiConnectstate) {
|
||||
case CS_STARTED:
|
||||
tcConnectptr.i = regApiPtr->firstTcConnect;
|
||||
@ -6073,11 +6074,17 @@ int Dbtc::releaseAndAbort(Signal* signal)
|
||||
UintR TnoLoops = tcConnectptr.p->noOfNodes;
|
||||
|
||||
apiConnectptr.p->counter++;
|
||||
bool prevAlive = false;
|
||||
for (Uint32 Ti = 0; Ti < TnoLoops ; Ti++) {
|
||||
localHostptr.i = tcConnectptr.p->tcNodedata[Ti];
|
||||
ptrCheckGuard(localHostptr, chostFilesize, hostRecord);
|
||||
if (localHostptr.p->hostStatus == HS_ALIVE) {
|
||||
jam();
|
||||
if (prevAlive) {
|
||||
// if previous is alive, its LQH forwards abort to this node
|
||||
jam();
|
||||
continue;
|
||||
}
|
||||
/* ************< */
|
||||
/* ABORT < */
|
||||
/* ************< */
|
||||
@ -6087,15 +6094,16 @@ int Dbtc::releaseAndAbort(Signal* signal)
|
||||
signal->theData[2] = apiConnectptr.p->transid[0];
|
||||
signal->theData[3] = apiConnectptr.p->transid[1];
|
||||
sendSignal(tblockref, GSN_ABORT, signal, 4, JBB);
|
||||
return 1;
|
||||
prevAlive = true;
|
||||
} else {
|
||||
jam();
|
||||
signal->theData[0] = tcConnectptr.i;
|
||||
signal->theData[1] = apiConnectptr.p->transid[0];
|
||||
signal->theData[2] = apiConnectptr.p->transid[1];
|
||||
signal->theData[3] = hostptr.i;
|
||||
signal->theData[3] = localHostptr.i;
|
||||
signal->theData[4] = ZFALSE;
|
||||
sendSignal(cownref, GSN_ABORTED, signal, 5, JBB);
|
||||
prevAlive = false;
|
||||
}//if
|
||||
}//for
|
||||
return 1;
|
||||
|
@ -344,6 +344,71 @@ err:
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
|
||||
int runLateCommit(NDBT_Context* ctx, NDBT_Step* step){
|
||||
int result = NDBT_OK;
|
||||
int loops = ctx->getNumLoops();
|
||||
int records = ctx->getNumRecords();
|
||||
NdbRestarter restarter;
|
||||
HugoOperations hugoOps(*ctx->getTab());
|
||||
Ndb* pNdb = GETNDB(step);
|
||||
|
||||
int i = 0;
|
||||
while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){
|
||||
g_info << i << ": ";
|
||||
|
||||
if(hugoOps.startTransaction(pNdb) != 0)
|
||||
return NDBT_FAILED;
|
||||
|
||||
if(hugoOps.pkUpdateRecord(pNdb, 1) != 0)
|
||||
return NDBT_FAILED;
|
||||
|
||||
if(hugoOps.execute_NoCommit(pNdb) != 0)
|
||||
return NDBT_FAILED;
|
||||
|
||||
Uint32 transNode= hugoOps.getTransaction()->getConnectedNodeId();
|
||||
int id = i % restarter.getNumDbNodes();
|
||||
int nodeId;
|
||||
while((nodeId = restarter.getDbNodeId(id)) == transNode)
|
||||
id = (id + 1) % restarter.getNumDbNodes();
|
||||
|
||||
ndbout << "Restart node " << nodeId << endl;
|
||||
|
||||
restarter.restartOneDbNode(nodeId,
|
||||
/** initial */ false,
|
||||
/** nostart */ true,
|
||||
/** abort */ true);
|
||||
|
||||
restarter.waitNodesNoStart(&nodeId, 1);
|
||||
|
||||
int res;
|
||||
if(i & 1)
|
||||
res= hugoOps.execute_Commit(pNdb);
|
||||
else
|
||||
res= hugoOps.execute_Rollback(pNdb);
|
||||
|
||||
ndbout_c("res= %d", res);
|
||||
|
||||
hugoOps.closeTransaction(pNdb);
|
||||
|
||||
restarter.startNodes(&nodeId, 1);
|
||||
restarter.waitNodesStarted(&nodeId, 1);
|
||||
|
||||
if(i & 1)
|
||||
{
|
||||
if(res != 286)
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(res != 0)
|
||||
return NDBT_FAILED;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return NDBT_OK;
|
||||
}
|
||||
|
||||
NDBT_TESTSUITE(testNodeRestart);
|
||||
TESTCASE("NoLoad",
|
||||
"Test that one node at a time can be stopped and then restarted "\
|
||||
@ -600,6 +665,12 @@ TESTCASE("CommittedRead",
|
||||
STEP(runDirtyRead);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
TESTCASE("LateCommit",
|
||||
"Test commit after node failure"){
|
||||
INITIALIZER(runLoadTable);
|
||||
STEP(runLateCommit);
|
||||
FINALIZER(runClearTable);
|
||||
}
|
||||
NDBT_TESTSUITE_END(testNodeRestart);
|
||||
|
||||
int main(int argc, const char** argv){
|
||||
|
@ -69,6 +69,10 @@ max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -n CommittedRead T1
|
||||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -n LateCommit T1
|
||||
|
||||
max-time: 2500
|
||||
cmd: testNodeRestart
|
||||
args: -n Terror T6 T13
|
||||
|
@ -272,10 +272,7 @@ foreach my $rdb ( @db_desc ) {
|
||||
my $negated;
|
||||
if ($rdb->{t_regex}) {
|
||||
$t_regex = $rdb->{t_regex}; ## assign temporary regex
|
||||
$negated = $t_regex =~ tr/~//d; ## remove and count
|
||||
## negation operator: we
|
||||
## don't allow ~ in table
|
||||
## names
|
||||
$negated = $t_regex =~ s/^~//; ## note and remove negation operator
|
||||
|
||||
$t_regex = qr/$t_regex/; ## make regex string from
|
||||
## user regex
|
||||
@ -820,6 +817,16 @@ sub get_list_of_tables {
|
||||
});
|
||||
|
||||
my @dbh_tables = eval { $dbh->tables() };
|
||||
|
||||
## Remove quotes around table names
|
||||
my $quote = $dbh->get_info(29); # SQL_IDENTIFIER_QUOTE_CHAR
|
||||
if ($quote) {
|
||||
foreach (@dbh_tables) {
|
||||
s/^$quote(.*)$quote$/$1/;
|
||||
s/$quote$quote/$quote/g;
|
||||
}
|
||||
}
|
||||
|
||||
$dbh->disconnect();
|
||||
return @dbh_tables;
|
||||
}
|
||||
|
@ -1242,6 +1242,8 @@ public:
|
||||
The following class is used to optimize comparing of date and bigint columns
|
||||
We need to save the original item, to be able to set the field to the
|
||||
original value in 'opt_range'.
|
||||
An instance of Item_int_with_ref may refer to a signed or an unsigned
|
||||
integer.
|
||||
*/
|
||||
|
||||
class Item_int_with_ref :public Item_int
|
||||
@ -1256,6 +1258,11 @@ public:
|
||||
{
|
||||
return ref->save_in_field(field, no_conversions);
|
||||
}
|
||||
Item *new_item()
|
||||
{
|
||||
return (ref->unsigned_flag)? new Item_uint(ref->name, ref->max_length) :
|
||||
new Item_int(ref->name, ref->max_length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1928,7 +1928,8 @@ static byte* get_key_column(GRANT_COLUMN *buff,uint *length,
|
||||
class GRANT_NAME :public Sql_alloc
|
||||
{
|
||||
public:
|
||||
char *host,*db, *user, *tname, *hash_key, *orig_host;
|
||||
acl_host_and_ip host;
|
||||
char *db, *user, *tname, *hash_key;
|
||||
ulong privs;
|
||||
ulong sort;
|
||||
uint key_length;
|
||||
@ -1960,12 +1961,10 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
|
||||
:privs(p)
|
||||
{
|
||||
/* Host given by user */
|
||||
orig_host= strdup_root(&memex,h);
|
||||
/* Convert empty hostname to '%' for easy comparison */
|
||||
host= orig_host[0] ? orig_host : (char*) "%";
|
||||
update_hostname(&host, strdup_root(&memex, h));
|
||||
db = strdup_root(&memex,d);
|
||||
user = strdup_root(&memex,u);
|
||||
sort= get_sort(3,host,db,user);
|
||||
sort= get_sort(3,host.hostname,db,user);
|
||||
tname= strdup_root(&memex,t);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
@ -1989,17 +1988,12 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
|
||||
|
||||
GRANT_NAME::GRANT_NAME(TABLE *form)
|
||||
{
|
||||
orig_host= host= get_field(&memex, form->field[0]);
|
||||
update_hostname(&host, get_field(&memex, form->field[0]));
|
||||
db= get_field(&memex,form->field[1]);
|
||||
user= get_field(&memex,form->field[2]);
|
||||
if (!user)
|
||||
user= (char*) "";
|
||||
if (!orig_host)
|
||||
{
|
||||
orig_host= (char*) "";
|
||||
host= (char*) "%";
|
||||
}
|
||||
sort= get_sort(3, orig_host, db, user);
|
||||
sort= get_sort(3, host.hostname, db, user);
|
||||
tname= get_field(&memex,form->field[3]);
|
||||
if (!db || !tname)
|
||||
{
|
||||
@ -2042,7 +2036,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
|
||||
{
|
||||
uint key_prefix_len;
|
||||
KEY_PART_INFO *key_part= col_privs->key_info->key_part;
|
||||
col_privs->field[0]->store(orig_host,(uint) strlen(orig_host),
|
||||
col_privs->field[0]->store(host.hostname,(uint) strlen(host.hostname),
|
||||
system_charset_info);
|
||||
col_privs->field[1]->store(db,(uint) strlen(db), system_charset_info);
|
||||
col_privs->field[2]->store(user,(uint) strlen(user), system_charset_info);
|
||||
@ -2128,17 +2122,12 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
|
||||
{
|
||||
if (exact)
|
||||
{
|
||||
if ((host &&
|
||||
!my_strcasecmp(system_charset_info, host, grant_name->host)) ||
|
||||
(ip && !strcmp(ip,grant_name->host)))
|
||||
if (compare_hostname(&grant_table->host, host, ip))
|
||||
return grant_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((host && !wild_case_compare(system_charset_info,
|
||||
host,grant_name->host)) ||
|
||||
(ip && !wild_case_compare(system_charset_info,
|
||||
ip,grant_name->host))) &&
|
||||
if (compare_hostname(&grant_table->host, host, ip) &&
|
||||
(!found || found->sort < grant_name->sort))
|
||||
found=grant_name; // Host ok
|
||||
}
|
||||
@ -3227,7 +3216,7 @@ my_bool grant_init(THD *org_thd)
|
||||
|
||||
if (check_no_resolve)
|
||||
{
|
||||
if (hostname_requires_resolving(mem_check->host))
|
||||
if (hostname_requires_resolving(mem_check->host.hostname))
|
||||
{
|
||||
sql_print_warning("'procs_priv' entry '%s %s@%s' "
|
||||
"ignored in --skip-name-resolve mode.",
|
||||
@ -3541,10 +3530,7 @@ bool check_grant_db(THD *thd,const char *db)
|
||||
idx);
|
||||
if (len < grant_table->key_length &&
|
||||
!memcmp(grant_table->hash_key,helping,len) &&
|
||||
(thd->host && !wild_case_compare(system_charset_info,
|
||||
thd->host,grant_table->host) ||
|
||||
(thd->ip && !wild_case_compare(system_charset_info,
|
||||
thd->ip,grant_table->host))))
|
||||
compare_hostname(&grant_table->host, thd->host, thd->ip))
|
||||
{
|
||||
error=0; // Found match
|
||||
break;
|
||||
@ -3964,7 +3950,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
|
||||
|
||||
if (!strcmp(lex_user->user.str,user) &&
|
||||
!my_strcasecmp(system_charset_info, lex_user->host.str,
|
||||
grant_table->orig_host))
|
||||
grant_table->host.hostname))
|
||||
{
|
||||
ulong table_access= grant_table->privs;
|
||||
if ((table_access | grant_table->cols) != 0)
|
||||
@ -5035,7 +5021,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
counter);
|
||||
if (!(user=grant_table->user))
|
||||
user= "";
|
||||
if (!(host=grant_table->host))
|
||||
if (!(host=grant_table->host.hostname))
|
||||
host= "";
|
||||
|
||||
if (!strcmp(lex_user->user.str,user) &&
|
||||
|
@ -416,7 +416,7 @@ static struct wordvalue doubles[] = {
|
||||
#define NEXT_CMP_VALUE(src, p, pass, value, len) \
|
||||
while (1) { \
|
||||
if (IS_END(p, src, len)) { \
|
||||
if (pass == 0) { p = src; pass++; } \
|
||||
if (pass == 0 && len > 0) { p= src; pass++; } \
|
||||
else { value = 0; break; } \
|
||||
} \
|
||||
value = ((pass == 0) ? _sort_order_win1250ch1[*p] \
|
||||
|
Loading…
x
Reference in New Issue
Block a user