diff options
author | unknown <dlenev@mysql.com> | 2004-12-23 22:16:43 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2004-12-23 22:16:43 +0300 |
commit | 19ffa6a4ecdf30ca0d6071777a06b6d297a49529 (patch) | |
tree | 833ec7a7c4a9d9dce41d8f8ad1b5e7641f1eee81 /sql/sql_acl.cc | |
parent | 05c65b91ef50641ba52706cf58918a21be258ee8 (diff) | |
parent | 4a5ca0bc638b2e09bca1fc0b9b8bee02590c6e08 (diff) | |
download | mariadb-git-19ffa6a4ecdf30ca0d6071777a06b6d297a49529.tar.gz |
Manual merge of changes making GRANTs, which change SSL attributes and/or
user limits to behave well on 5.0 tables, into 4.1 tree.
mysql-test/r/grant.result:
Auto merged
mysql-test/t/grant.test:
Auto merged
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index bfecec90237..36629656c11 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1505,6 +1505,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 ; @@ -1513,56 +1514,62 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, if (priv & rights) // set requested privileges (*tmp_field)->store(&what, 1, &my_charset_latin1); } - rights=get_access(table,3); + 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, &my_charset_latin1); - table->field[25]->store("", 0, &my_charset_latin1); - table->field[26]->store("", 0, &my_charset_latin1); - table->field[27]->store("", 0, &my_charset_latin1); + table->field[next_field]->store("ANY", 3, &my_charset_latin1); + table->field[next_field+1]->store("", 0, &my_charset_latin1); + table->field[next_field+2]->store("", 0, &my_charset_latin1); + table->field[next_field+3]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_X509: - table->field[24]->store("X509",4, &my_charset_latin1); - table->field[25]->store("", 0, &my_charset_latin1); - table->field[26]->store("", 0, &my_charset_latin1); - table->field[27]->store("", 0, &my_charset_latin1); + table->field[next_field]->store("X509", 4, &my_charset_latin1); + table->field[next_field+1]->store("", 0, &my_charset_latin1); + table->field[next_field+2]->store("", 0, &my_charset_latin1); + table->field[next_field+3]->store("", 0, &my_charset_latin1); break; case SSL_TYPE_SPECIFIED: - table->field[24]->store("SPECIFIED",9, &my_charset_latin1); - table->field[25]->store("", 0, &my_charset_latin1); - table->field[26]->store("", 0, &my_charset_latin1); - table->field[27]->store("", 0, &my_charset_latin1); + table->field[next_field]->store("SPECIFIED", 9, &my_charset_latin1); + table->field[next_field+1]->store("", 0, &my_charset_latin1); + table->field[next_field+2]->store("", 0, &my_charset_latin1); + table->field[next_field+3]->store("", 0, &my_charset_latin1); if (thd->lex->ssl_cipher) - table->field[25]->store(thd->lex->ssl_cipher, - strlen(thd->lex->ssl_cipher), &my_charset_latin1); + table->field[next_field+1]->store(thd->lex->ssl_cipher, + strlen(thd->lex->ssl_cipher), + &my_charset_latin1); if (thd->lex->x509_issuer) - table->field[26]->store(thd->lex->x509_issuer, - strlen(thd->lex->x509_issuer), &my_charset_latin1); + table->field[next_field+2]->store(thd->lex->x509_issuer, + strlen(thd->lex->x509_issuer), + &my_charset_latin1); if (thd->lex->x509_subject) - table->field[27]->store(thd->lex->x509_subject, - strlen(thd->lex->x509_subject), &my_charset_latin1); + table->field[next_field+3]->store(thd->lex->x509_subject, + strlen(thd->lex->x509_subject), + &my_charset_latin1); break; case SSL_TYPE_NOT_SPECIFIED: break; case SSL_TYPE_NONE: - table->field[24]->store("", 0, &my_charset_latin1); - table->field[25]->store("", 0, &my_charset_latin1); - table->field[26]->store("", 0, &my_charset_latin1); - table->field[27]->store("", 0, &my_charset_latin1); + table->field[next_field]->store("", 0, &my_charset_latin1); + table->field[next_field+1]->store("", 0, &my_charset_latin1); + table->field[next_field+2]->store("", 0, &my_charset_latin1); + table->field[next_field+3]->store("", 0, &my_charset_latin1); 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) |