Commit 6aef4237 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Fixed bug in previous patch when using a libc with static nss

parent 8a5ef8dc
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <signal.h> #include <signal.h>
#include <violite.h> #include <violite.h>
const char *VER= "12.13"; const char *VER= "12.14";
/* Don't try to make a nice table if the data is too big */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #define MAX_COLUMN_LENGTH 1024
...@@ -476,7 +476,8 @@ static struct my_option my_long_options[] = ...@@ -476,7 +476,8 @@ static struct my_option my_long_options[] =
{"ignore-space", 'i', "Ignore space after function names.", 0, 0, 0, {"ignore-space", 'i', "Ignore space after function names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_local_infile,
(gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep, {"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
(gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host, {"host", 'h', "Connect to host.", (gptr*) &current_host,
...@@ -609,7 +610,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -609,7 +610,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case OPT_LOCAL_INFILE: case OPT_LOCAL_INFILE:
using_opt_local_infile=1; using_opt_local_infile=1;
opt_local_infile= test(!argument || atoi(argument)>0);
break; break;
case OPT_TEE: case OPT_TEE:
if (argument == disabled_my_option) if (argument == disabled_my_option)
......
...@@ -454,6 +454,8 @@ fi ...@@ -454,6 +454,8 @@ fi
NOINST_LDFLAGS= NOINST_LDFLAGS=
static_nss="" static_nss=""
STATIC_NSS_FLAGS=""
OTHER_LIBC_LIB=""
AC_ARG_WITH(other-libc, AC_ARG_WITH(other-libc,
[ --with-other-libc=DIR Link against libc and other standard libraries [ --with-other-libc=DIR Link against libc and other standard libraries
installed in the specified non-standard location installed in the specified non-standard location
...@@ -479,6 +481,7 @@ AC_ARG_WITH(other-libc, ...@@ -479,6 +481,7 @@ AC_ARG_WITH(other-libc,
# we need special flags, but we will have to add those later # we need special flags, but we will have to add those later
STATIC_NSS_FLAGS="-Wl,--start-group -lc -lnss_files -lnss_dns -lresolv \ STATIC_NSS_FLAGS="-Wl,--start-group -lc -lnss_files -lnss_dns -lresolv \
-Wl,--end-group" -Wl,--end-group"
OTHER_LIBC_LIB="-L$other_libc_lib"
static_nss=1 static_nss=1
else else
# this is a dirty hack. We if we detect static nss glibc in the special # this is a dirty hack. We if we detect static nss glibc in the special
...@@ -2390,7 +2393,7 @@ fi ...@@ -2390,7 +2393,7 @@ fi
if test "$static_nss" = "1" if test "$static_nss" = "1"
then then
LDFLAGS="$LDFLAGS -static -L$other_libc_lib " LDFLAGS="$LDFLAGS -static $OTHER_LIBC_LIB"
LIBS="$LIBS $STATIC_NSS_FLAGS" LIBS="$LIBS $STATIC_NSS_FLAGS"
fi fi
......
...@@ -139,7 +139,7 @@ select count(*) from t3 where n >= 4; ...@@ -139,7 +139,7 @@ select count(*) from t3 where n >= 4;
unlock tables; unlock tables;
#clean up #clean up
connection master; connection master;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
...@@ -741,11 +741,25 @@ static void acl_update_db(const char *user, const char *host, const char *db, ...@@ -741,11 +741,25 @@ static void acl_update_db(const char *user, const char *host, const char *db,
} }
/*
Insert a user/db/host combination into the global acl_cache
SYNOPSIS
acl_insert_db()
user User name
host Host name
db Database name
privileges Bitmap of privileges
NOTES
acl_cache->lock must be locked when calling this
*/
static void acl_insert_db(const char *user, const char *host, const char *db, static void acl_insert_db(const char *user, const char *host, const char *db,
ulong privileges) ulong privileges)
{ {
ACL_DB acl_db; ACL_DB acl_db;
/* The acl_cache mutex is locked by mysql_grant */ safe_mutex_assert_owner(&acl_cache->lock);
acl_db.user=strdup_root(&mem,user); acl_db.user=strdup_root(&mem,user);
update_hostname(&acl_db.host,strdup_root(&mem,host)); update_hostname(&acl_db.host,strdup_root(&mem,host));
acl_db.db=strdup_root(&mem,db); acl_db.db=strdup_root(&mem,db);
...@@ -1217,6 +1231,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, ...@@ -1217,6 +1231,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
char *password,empty_string[1]; char *password,empty_string[1];
char what= (revoke_grant) ? 'N' : 'Y'; char what= (revoke_grant) ? 'N' : 'Y';
DBUG_ENTER("replace_user_table"); DBUG_ENTER("replace_user_table");
safe_mutex_assert_owner(&acl_cache->lock);
password=empty_string; password=empty_string;
empty_string[0]=0; empty_string[0]=0;
...@@ -1240,7 +1255,6 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, ...@@ -1240,7 +1255,6 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
{ {
if (!create_user) if (!create_user)
{ {
THD *thd=current_thd;
if (what == 'N') if (what == 'N')
my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT), my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT),
MYF(0),combo.user.str,combo.host.str); MYF(0),combo.user.str,combo.host.str);
...@@ -1621,6 +1635,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip, ...@@ -1621,6 +1635,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
char helping [NAME_LEN*2+USERNAME_LENGTH+3]; char helping [NAME_LEN*2+USERNAME_LENGTH+3];
uint len; uint len;
GRANT_TABLE *grant_table,*found=0; GRANT_TABLE *grant_table,*found=0;
safe_mutex_assert_owner(&LOCK_grant);
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1; len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
for (grant_table=(GRANT_TABLE*) hash_search(&hash_tables,(byte*) helping, for (grant_table=(GRANT_TABLE*) hash_search(&hash_tables,(byte*) helping,
...@@ -1828,6 +1843,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ...@@ -1828,6 +1843,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
int error=0; int error=0;
ulong store_table_rights, store_col_rights; ulong store_table_rights, store_col_rights;
DBUG_ENTER("replace_table_table"); DBUG_ENTER("replace_table_table");
safe_mutex_assert_owner(&LOCK_grant);
strxmov(grantor, thd->user, "@", thd->host_or_ip, NullS); strxmov(grantor, thd->user, "@", thd->host_or_ip, NullS);
......
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