diff options
author | hf@deer.(none) <> | 2004-01-07 21:30:15 +0400 |
---|---|---|
committer | hf@deer.(none) <> | 2004-01-07 21:30:15 +0400 |
commit | 334856444774152ac68464408f8d0fd1bc5f4002 (patch) | |
tree | d20819ba4aaa9081734e46a63958402010176176 /libmysqld/lib_sql.cc | |
parent | 2e7a5d3e7452040dafe37aacfb7786d380fee0c9 (diff) | |
download | mariadb-git-334856444774152ac68464408f8d0fd1bc5f4002.tar.gz |
Fix for 1224 (USER() CURRENT_USER() functions in embedded library)
Now we return user@host for USER() in embedded library
CURRENT_USER returns empty string if library compiled with
NO_EMBEDDED_ACCESS_CHECKS
Diffstat (limited to 'libmysqld/lib_sql.cc')
-rw-r--r-- | libmysqld/lib_sql.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 5f478fc8041..2d451d6cecd 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -478,7 +478,17 @@ void *create_embedded_thd(int client_flag, char *db) return thd; } -#ifndef NO_EMBEDDED_ACCESS_CHECKS +#ifdef NO_EMBEDDED_ACCESS_CHECKS +int check_embedded_connection(MYSQL *mysql) +{ + THD *thd= (THD*)mysql->thd; + thd->host= (char*)my_localhost; + thd->host_or_ip= thd->host; + thd->user= mysql->user; + return 0; +} + +#else int check_embedded_connection(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; @@ -486,9 +496,13 @@ int check_embedded_connection(MYSQL *mysql) char scramble_buff[SCRAMBLE_LENGTH]; int passwd_len; - thd->host= mysql->options.client_ip ? - mysql->options.client_ip : (char*)my_localhost; - thd->ip= thd->host; + if (mysql->options.client_ip) + { + thd->host= mysql->options.client_ip; + thd->ip= thd->host; + } + else + thd->host= (char*)my_localhost; thd->host_or_ip= thd->host; if (acl_check_host(thd->host,thd->ip)) |