diff options
author | unknown <hf@deer.(none)> | 2004-01-07 21:30:15 +0400 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-01-07 21:30:15 +0400 |
commit | 582886a3e971df2766411cdfe57c8a09f3c2e6b6 (patch) | |
tree | d20819ba4aaa9081734e46a63958402010176176 /libmysqld/libmysqld.c | |
parent | 902c361910cdec368c5baec1be6079978a46f1a8 (diff) | |
download | mariadb-git-582886a3e971df2766411cdfe57c8a09f3c2e6b6.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
libmysqld/embedded_priv.h:
function's declarations trimmed
libmysqld/lib_sql.cc:
user/host names handling added
libmysqld/libmysqld.c:
user/host names handling added
sql/sql_class.cc:
we shouldn't free user/host names in embedded library
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r-- | libmysqld/libmysqld.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 69fdf14eca4..95f745aef5f 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -124,17 +124,14 @@ static inline int mysql_init_charset(MYSQL *mysql) return 0; } -int check_embedded_connection(MYSQL *mysql); - MYSQL * STDCALL mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag) { char *db_name; -#ifndef NO_EMBEDDED_ACCESS_CHECKS char name_buff[USERNAME_LENGTH]; -#endif + DBUG_ENTER("mysql_real_connect"); DBUG_PRINT("enter",("host: %s db: %s user: %s", host ? host : "(Null)", @@ -165,10 +162,10 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, if (!db || !db[0]) db=mysql->options.db; -#ifndef NO_EMBEDDED_ACCESS_CHECKS if (!user || !user[0]) user=mysql->options.user; +#ifndef NO_EMBEDDED_ACCESS_CHECKS if (!passwd) { passwd=mysql->options.password; @@ -177,16 +174,18 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, passwd=getenv("MYSQL_PWD"); /* get it from environment */ #endif } + mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL; +#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/ if (!user || !user[0]) { read_user_name(name_buff); - if (!name_buff[0]) + if (name_buff[0]) user= name_buff; } + if (!user) + user= ""; mysql->user=my_strdup(user,MYF(0)); - mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL; -#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/ port=0; unix_socket=0; @@ -196,10 +195,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, init_embedded_mysql(mysql, client_flag, db_name); -#ifndef NO_EMBEDDED_ACCESS_CHECKS if (check_embedded_connection(mysql)) goto error; -#endif if (mysql_init_charset(mysql)) goto error; |