summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2004-12-23 21:11:31 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2004-12-23 21:11:31 +0200
commit8feedada9d6968545a6ce3eec44f93be5e313575 (patch)
tree3c9bb2bf56b2c4967e103dcf9bb1b0790477caf1 /sql
parent8ccfad7636811347b57d9e14e20a3b52b8941664 (diff)
parent4a5ca0bc638b2e09bca1fc0b9b8bee02590c6e08 (diff)
downloadmariadb-git-8feedada9d6968545a6ce3eec44f93be5e313575.tar.gz
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc56
1 files changed, 30 insertions, 26 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 67ca62357ec..1b55168695b 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1403,6 +1403,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
Field **tmp_field;
ulong priv;
+ uint next_field;
for (tmp_field= table->field+3, priv = SELECT_ACL;
*tmp_field && (*tmp_field)->real_type() == FIELD_TYPE_ENUM &&
((Field_enum*) (*tmp_field))->typelib->count == 2 ;
@@ -1411,56 +1412,59 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (priv & rights) // set requested privileges
(*tmp_field)->store(&what,1);
}
- rights=get_access(table,3,0);
+ rights= get_access(table, 3, &next_field);
DBUG_PRINT("info",("table->fields: %d",table->fields));
if (table->fields >= 31) /* From 4.0.0 we have more fields */
{
/* We write down SSL related ACL stuff */
switch (thd->lex.ssl_type) {
case SSL_TYPE_ANY:
- table->field[24]->store("ANY",3);
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
+ table->field[next_field]->store("ANY", 3);
+ table->field[next_field+1]->store("", 0);
+ table->field[next_field+2]->store("", 0);
+ table->field[next_field+3]->store("", 0);
break;
case SSL_TYPE_X509:
- table->field[24]->store("X509",4);
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
+ table->field[next_field]->store("X509", 4);
+ table->field[next_field+1]->store("", 0);
+ table->field[next_field+2]->store("", 0);
+ table->field[next_field+3]->store("", 0);
break;
case SSL_TYPE_SPECIFIED:
- table->field[24]->store("SPECIFIED",9);
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
+ table->field[next_field]->store("SPECIFIED", 9);
+ table->field[next_field+1]->store("", 0);
+ table->field[next_field+2]->store("", 0);
+ table->field[next_field+3]->store("", 0);
if (thd->lex.ssl_cipher)
- table->field[25]->store(thd->lex.ssl_cipher,
- strlen(thd->lex.ssl_cipher));
+ table->field[next_field+1]->store(thd->lex.ssl_cipher,
+ strlen(thd->lex.ssl_cipher));
if (thd->lex.x509_issuer)
- table->field[26]->store(thd->lex.x509_issuer,
- strlen(thd->lex.x509_issuer));
+ table->field[next_field+2]->store(thd->lex.x509_issuer,
+ strlen(thd->lex.x509_issuer));
if (thd->lex.x509_subject)
- table->field[27]->store(thd->lex.x509_subject,
- strlen(thd->lex.x509_subject));
+ table->field[next_field+3]->store(thd->lex.x509_subject,
+ strlen(thd->lex.x509_subject));
break;
case SSL_TYPE_NOT_SPECIFIED:
break;
case SSL_TYPE_NONE:
- table->field[24]->store("",0);
- table->field[25]->store("",0);
- table->field[26]->store("",0);
- table->field[27]->store("",0);
+ table->field[next_field]->store("", 0);
+ table->field[next_field+1]->store("", 0);
+ table->field[next_field+2]->store("", 0);
+ table->field[next_field+3]->store("", 0);
break;
}
+ /* Skip over SSL related fields to first user limits related field */
+ next_field+= 4;
+
USER_RESOURCES mqh = thd->lex.mqh;
if (mqh.bits & 1)
- table->field[28]->store((longlong) mqh.questions);
+ table->field[next_field]->store((longlong) mqh.questions);
if (mqh.bits & 2)
- table->field[29]->store((longlong) mqh.updates);
+ table->field[next_field+1]->store((longlong) mqh.updates);
if (mqh.bits & 4)
- table->field[30]->store((longlong) mqh.connections);
+ table->field[next_field+2]->store((longlong) mqh.connections);
mqh_used = mqh_used || mqh.questions || mqh.updates || mqh.connections;
}
if (old_row_exists)