1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

After merge fixes.

Note that mix_innodb_myisam_binlog and union fails after this patch (Will be fixed shortly by maintaners of this code)


client/mysql.cc:
  After merge fix
include/mysql.h:
  Some additions to MYSQL_BIND for cleaner prepared statement code
libmysql/libmysql.c:
  mysql_prepare_result -> mysql_get_metadata()
  Added test for offset overflow when using mysql_fetch_column()
  Cleaned up mysql_fetch_column()
  Optimized fetch_result() usage
mysql-test/r/func_group.result:
  Updated results after merge
mysql-test/r/func_test.result:
  Updated results after merge
mysql-test/r/grant.result:
  Updated results after merge
mysql-test/r/loaddata.result:
  Updated results after merge
mysql-test/r/lowercase_table.result:
  Updated results after merge
mysql-test/r/mix_innodb_myisam_binlog.result:
  Updated results after merge (note that this is still not correct; Need patch to mysqld to fix this properly)
mysql-test/r/myisam.result:
  Updated results after merge
mysql-test/r/range.result:
  Updated results after merge
mysql-test/r/rpl_loaddata.result:
  Updated results after merge
mysql-test/r/rpl_loaddata_rule_m.result:
  Updated results after merge
mysql-test/r/rpl_loaddata_rule_s.result:
  Updated results after merge
mysql-test/r/rpl_log.result:
  Updated results after merge
mysql-test/r/union.result:
  Updated results after merge
mysql-test/t/lowercase_table.test:
  Update after merge
mysql-test/t/myisam.test:
  Update after merge
mysql-test/t/union.test:
  Update after merge
sql-bench/compare-results.sh:
  Fix for now output format
sql/field.h:
  Added is_null_in_record() to make ha_innodb.cc code more general
sql/ha_innodb.cc:
  Removed some functions that uses inernal (private) MySQL information
sql/item_cmpfunc.cc:
  After merge fix
sql/log_event.cc:
  After merge fix; (Some code should be checked by Guilhem)
sql/opt_range.cc:
  Simple optimzation and after merge fixes
sql/slave.cc:
  After merge fix
sql/sql_acl.cc:
  After merge fix + code cleanup
sql/sql_select.cc:
  After merge fix
sql/sql_show.cc:
  After merge fix
sql/sql_table.cc:
  After merge fix
  Cleanup of mysql_checksum_table()
sql/sql_union.cc:
  After merge fixes.
  Note that after this the union test still fails; Will be fixed shortly...
tests/client_test.c:
  mysql_prepare_result() -> mysql_get_metadata()
This commit is contained in:
unknown
2003-09-11 19:06:23 +03:00
parent c9d1bdfac3
commit dd0d199ebe
32 changed files with 259 additions and 434 deletions

View File

@@ -532,36 +532,13 @@ static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b)
/*
Prepare crypted scramble to be sent to the client
*/
Seek ACL entry for a user, check password, SSL cypher, and if
everything is OK, update THD user data and USER_RESOURCES struct.
void prepare_scramble(THD *thd, ACL_USER *acl_user,char* prepared_scramble)
{
/* Binary password format to be used for generation*/
char bin_password[SCRAMBLE41_LENGTH];
/* Generate new long scramble for the thread */
create_random_string(SCRAMBLE41_LENGTH,&thd->rand,thd->scramble);
thd->scramble[SCRAMBLE41_LENGTH]=0;
/* Get binary form, First 4 bytes of prepared scramble is salt */
get_hash_and_password(acl_user->salt,acl_user->pversion,prepared_scramble,
(unsigned char*) bin_password);
/* Store "*" as identifier for old passwords */
if (!acl_user->pversion)
prepared_scramble[0]='*';
/* Finally encrypt password to get prepared scramble */
password_crypt(thd->scramble, prepared_scramble+4, bin_password,
SCRAMBLE41_LENGTH);
}
/*
Seek ACL entry for a user, check password, SSL cypher, and if
everything is OK, update THD user data and USER_RESOURCES struct.
IMPLEMENTATION
This function does not check if the user has any sensible privileges:
only user's existence and validity is checked.
Note, that entire operation is protected by acl_cache_lock.
IMPLEMENTATION
This function does not check if the user has any sensible privileges:
only user's existence and validity is checked.
Note, that entire operation is protected by acl_cache_lock.
SYNOPSIS
acl_getroot()
@@ -578,7 +555,7 @@ void prepare_scramble(THD *thd, ACL_USER *acl_user,char* prepared_scramble)
SCRAMBLE_LENGTH_323, SCRAMBLE_LENGTH
'thd' and 'mqh' are updated on success; other params are IN.
RETURN VALUE
RETURN VALUE
0 success: thd->priv_user, thd->priv_host, thd->master_access, mqh are
updated
1 user not found or authentification failure
@@ -616,29 +593,29 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh,
for (uint i=0 ; i < acl_users.elements ; i++)
{
ACL_USER *acl_user= dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user || !strcmp(thd->user, acl_user->user))
ACL_USER *acl_user_tmp= dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user_tmp->user || !strcmp(thd->user, acl_user_tmp->user))
{
if (compare_hostname(&acl_user->host, thd->host, thd->ip))
if (compare_hostname(&acl_user_tmp->host, thd->host, thd->ip))
{
/* check password: it should be empty or valid */
if (passwd_len == acl_user->salt_len)
if (passwd_len == acl_user_tmp->salt_len)
{
if (acl_user->salt_len == 0 ||
acl_user->salt_len == SCRAMBLE_LENGTH &&
check_scramble(passwd, thd->scramble, acl_user->salt) == 0 ||
if (acl_user_tmp->salt_len == 0 ||
acl_user_tmp->salt_len == SCRAMBLE_LENGTH &&
check_scramble(passwd, thd->scramble, acl_user_tmp->salt) == 0 ||
check_scramble_323(passwd, thd->scramble,
(ulong *) acl_user->salt) == 0)
(ulong *) acl_user_tmp->salt) == 0)
{
acl_user= acl_user;
acl_user= acl_user_tmp;
res= 0;
}
}
else if (passwd_len == SCRAMBLE_LENGTH &&
acl_user->salt_len == SCRAMBLE_LENGTH_323)
acl_user_tmp->salt_len == SCRAMBLE_LENGTH_323)
res= -1;
else if (passwd_len == SCRAMBLE_LENGTH_323 &&
acl_user->salt_len == SCRAMBLE_LENGTH)
acl_user_tmp->salt_len == SCRAMBLE_LENGTH)
res= 2;
/* linear search complete: */
break;
@@ -2472,7 +2449,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
{
my_printf_error(ER_WRONG_USAGE, ER(ER_WRONG_USAGE), MYF(0),
"DB GRANT","GLOBAL PRIVILEGES");
result= 1;
result= -1;
}
}
}
@@ -3113,7 +3090,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write())
{
error=-1;
error= -1;
goto end;
}
}
@@ -3171,7 +3148,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
protocol->store(db.ptr(),db.length(),db.charset());
if (protocol->write())
{
error=-1;
error= -1;
goto end;
}
}
@@ -3421,7 +3398,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
{
if (!(acl_user= check_acl_user(user_name, &counter)))
{
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; No such user",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3429,7 +3406,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if ((acl_user->access & ~0))
{
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Global privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3452,7 +3429,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != acl_dbs.elements)
{
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Database privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;
@@ -3475,7 +3452,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
}
if (counter != column_priv_hash.records)
{
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'",
sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Table privileges exists",
user_name->user.str,
user_name->host.str);
result= -1;