mirror of
https://github.com/MariaDB/server.git
synced 2025-09-06 19:08:06 +03:00
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.0
into gw.mysql.r18.ru:/usr/home/ram/work/4.0.b6564
This commit is contained in:
@@ -150,3 +150,9 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
|
|||||||
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
|
||||||
delete from mysql.user where user='test11';
|
delete from mysql.user where user='test11';
|
||||||
delete from mysql.db where user='test11';
|
delete from mysql.db where user='test11';
|
||||||
|
create database db6123;
|
||||||
|
grant usage on db6123.* to test6123 identified by 'magic123';
|
||||||
|
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
|
||||||
|
host db user select_priv insert_priv
|
||||||
|
delete from mysql.user where user='test6123';
|
||||||
|
drop database db6123;
|
||||||
|
@@ -105,3 +105,12 @@ flush privileges;
|
|||||||
show grants for test11@localhost;
|
show grants for test11@localhost;
|
||||||
delete from mysql.user where user='test11';
|
delete from mysql.user where user='test11';
|
||||||
delete from mysql.db where user='test11';
|
delete from mysql.db where user='test11';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#6123: GRANT USAGE inserts useless Db row
|
||||||
|
#
|
||||||
|
create database db6123;
|
||||||
|
grant usage on db6123.* to test6123 identified by 'magic123';
|
||||||
|
select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
|
||||||
|
delete from mysql.user where user='test6123';
|
||||||
|
drop database db6123;
|
||||||
|
@@ -68,7 +68,12 @@ static const char *f_extensions[]= { ".cnf", 0 };
|
|||||||
|
|
||||||
static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
|
static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
|
||||||
const char *dir, const char *config_file,
|
const char *dir, const char *config_file,
|
||||||
const char *ext, TYPELIB *group);
|
TYPELIB *group);
|
||||||
|
|
||||||
|
static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
||||||
|
const char *dir, const char *ext,
|
||||||
|
const char *config_file,
|
||||||
|
TYPELIB *group);
|
||||||
|
|
||||||
static char *remove_end_comment(char *ptr);
|
static char *remove_end_comment(char *ptr);
|
||||||
|
|
||||||
@@ -164,15 +169,16 @@ int load_defaults(const char *conf_file, const char **groups,
|
|||||||
goto err;
|
goto err;
|
||||||
if (forced_default_file)
|
if (forced_default_file)
|
||||||
{
|
{
|
||||||
if ((error= search_default_file(&args, &alloc, "",
|
if ((error= search_default_file_with_ext(&args, &alloc, "", "",
|
||||||
forced_default_file, "", &group)) < 0)
|
forced_default_file,
|
||||||
|
&group)) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if (dirname_length(conf_file))
|
else if (dirname_length(conf_file))
|
||||||
{
|
{
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
for (ext= (char**) f_extensions; *ext; *ext++)
|
||||||
if ((error= search_default_file(&args, &alloc, NullS, conf_file,
|
if ((error= search_default_file(&args, &alloc, NullS, conf_file,
|
||||||
*ext, &group)) < 0)
|
&group)) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -180,33 +186,31 @@ int load_defaults(const char *conf_file, const char **groups,
|
|||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
char system_dir[FN_REFLEN];
|
char system_dir[FN_REFLEN];
|
||||||
GetWindowsDirectory(system_dir,sizeof(system_dir));
|
GetWindowsDirectory(system_dir,sizeof(system_dir));
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
if ((search_default_file(&args, &alloc, system_dir, conf_file, &group)))
|
||||||
if ((search_default_file(&args, &alloc, system_dir, conf_file,
|
goto err;
|
||||||
*ext, &group)))
|
|
||||||
goto err;
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__EMX__) || defined(OS2)
|
#if defined(__EMX__) || defined(OS2)
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
{
|
||||||
if (getenv("ETC") &&
|
const char *etc;
|
||||||
(search_default_file(&args, &alloc, getenv("ETC"), conf_file,
|
if ((etc= getenv("ETC")) &&
|
||||||
*ext, &group)) < 0)
|
(search_default_file(&args, &alloc, etc, conf_file,
|
||||||
goto err;
|
&group)) < 0)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for (dirs=default_directories ; *dirs; dirs++)
|
for (dirs=default_directories ; *dirs; dirs++)
|
||||||
{
|
{
|
||||||
if (**dirs)
|
if (**dirs)
|
||||||
{
|
{
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
if (search_default_file(&args, &alloc, *dirs, conf_file,
|
||||||
if (search_default_file(&args, &alloc, *dirs, conf_file,
|
&group) < 0)
|
||||||
*ext, &group) < 0)
|
goto err;
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
else if (defaults_extra_file)
|
else if (defaults_extra_file)
|
||||||
{
|
{
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
|
||||||
if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
|
&group) < 0)
|
||||||
*ext, &group) < 0)
|
goto err; /* Fatal error */
|
||||||
goto err; /* Fatal error */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,11 +271,28 @@ void free_defaults(char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
||||||
|
const char *dir,
|
||||||
|
const char *config_file, TYPELIB *group)
|
||||||
|
{
|
||||||
|
char **ext;
|
||||||
|
|
||||||
|
for (ext= (char**) f_extensions; *ext; *ext++)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
if ((error= search_default_file_with_ext(args, alloc, dir, *ext,
|
||||||
|
config_file, group)) < 0)
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open a configuration file (if exists) and read given options from it
|
Open a configuration file (if exists) and read given options from it
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
search_default_file()
|
search_default_file_with_ext()
|
||||||
args Store pointer to found options here
|
args Store pointer to found options here
|
||||||
alloc Allocate strings in this object
|
alloc Allocate strings in this object
|
||||||
dir directory to read
|
dir directory to read
|
||||||
@@ -286,9 +307,10 @@ void free_defaults(char **argv)
|
|||||||
2 File is not a regular file (Warning)
|
2 File is not a regular file (Warning)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
||||||
const char *dir, const char *config_file,
|
const char *dir, const char *ext,
|
||||||
const char *ext, TYPELIB *group)
|
const char *config_file,
|
||||||
|
TYPELIB *group)
|
||||||
{
|
{
|
||||||
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
|
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -482,7 +504,7 @@ static char *remove_end_comment(char *ptr)
|
|||||||
void print_defaults(const char *conf_file, const char **groups)
|
void print_defaults(const char *conf_file, const char **groups)
|
||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
bool have_ext=fn_ext(conf_file)[0] != 0;
|
my_bool have_ext= fn_ext(conf_file)[0] != 0;
|
||||||
#endif
|
#endif
|
||||||
char name[FN_REFLEN], **ext;
|
char name[FN_REFLEN], **ext;
|
||||||
const char **dirs;
|
const char **dirs;
|
||||||
@@ -495,16 +517,24 @@ void print_defaults(const char *conf_file, const char **groups)
|
|||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
GetWindowsDirectory(name,sizeof(name));
|
GetWindowsDirectory(name,sizeof(name));
|
||||||
if (have_ext)
|
if (!have_ext)
|
||||||
|
{
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
for (ext= (char**) f_extensions; *ext; *ext++)
|
||||||
printf("%s\\%s%s ", name, conf_file, *ext);
|
printf("%s\\%s%s ", name, conf_file, *ext);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
printf("%s\\%s ", name, conf_file);
|
printf("%s\\%s ", name, conf_file);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__EMX__) || defined(OS2)
|
#if defined(__EMX__) || defined(OS2)
|
||||||
for (ext= (char**) f_extensions; *ext; *ext++)
|
{
|
||||||
if (getenv("ETC"))
|
const char *etc;
|
||||||
printf("%s\\%s%s ", getenv("ETC"), conf_file, *ext);
|
|
||||||
|
if ((etc= getenv("ETC")))
|
||||||
|
{
|
||||||
|
for (ext= (char**) f_extensions; *ext; *ext++)
|
||||||
|
printf("%s\\%s%s ", etc, conf_file, *ext);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for (dirs=default_directories ; *dirs; dirs++)
|
for (dirs=default_directories ; *dirs; dirs++)
|
||||||
{
|
{
|
||||||
|
@@ -1587,7 +1587,7 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||||||
goto table_error; /* purecov: deadcode */
|
goto table_error; /* purecov: deadcode */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((error=table->file->write_row(table->record[0])))
|
else if (rights && (error=table->file->write_row(table->record[0])))
|
||||||
{
|
{
|
||||||
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
|
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
|
||||||
goto table_error; /* purecov: deadcode */
|
goto table_error; /* purecov: deadcode */
|
||||||
@@ -1597,6 +1597,7 @@ static int replace_db_table(TABLE *table, const char *db,
|
|||||||
if (old_row_exists)
|
if (old_row_exists)
|
||||||
acl_update_db(combo.user.str,combo.host.str,db,rights);
|
acl_update_db(combo.user.str,combo.host.str,db,rights);
|
||||||
else
|
else
|
||||||
|
if (rights)
|
||||||
acl_insert_db(combo.user.str,combo.host.str,db,rights);
|
acl_insert_db(combo.user.str,combo.host.str,db,rights);
|
||||||
table->file->index_end();
|
table->file->index_end();
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
Reference in New Issue
Block a user