summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2004-12-30 21:18:45 +0300
committerunknown <dlenev@mysql.com>2004-12-30 21:18:45 +0300
commit15017480a7d7aba65df4fcab00a922aa8fc0cf01 (patch)
tree8031725e1eb6984d150355bfcb4816146b397b84 /sql
parent1ffd688a4a341157df30602a7f3c6d97f9a4e010 (diff)
parent4ba981e5214cfb3d7af1db1faa7d6cc79d2b2295 (diff)
downloadmariadb-git-15017480a7d7aba65df4fcab00a922aa8fc0cf01.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/dlenev/src/mysql-4.0-bg7297
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc3
-rw-r--r--sql/item_strfunc.cc10
-rw-r--r--sql/mysqld.cc15
-rw-r--r--sql/sql_acl.cc56
-rw-r--r--sql/sql_select.cc10
-rw-r--r--sql/sql_update.cc13
6 files changed, 55 insertions, 52 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index c36075207ed..69d9d885b8e 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -4702,7 +4702,8 @@ ha_innobase::external_lock(
if (prebuilt->select_lock_type != LOCK_NONE) {
if (thd->in_lock_tables &&
- thd->variables.innodb_table_locks) {
+ thd->variables.innodb_table_locks &&
+ (thd->options & OPTION_NOT_AUTOCOMMIT)) {
ulint error;
error = row_lock_table_for_mysql(prebuilt);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 53a9d3fe219..a852906ee2c 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2185,16 +2185,16 @@ String *Item_func_quote::val_str(String *str)
/*
We have to use realloc() instead of alloc() as we want to keep the
- old result in str
+ old result in arg
*/
- if (str->realloc(new_length))
+ if (arg->realloc(new_length))
goto null;
/*
As 'arg' and 'str' may be the same string, we must replace characters
from the end to the beginning
*/
- to= (char*) str->ptr() + new_length - 1;
+ to= (char*) arg->ptr() + new_length - 1;
*to--= '\'';
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
{
@@ -2222,9 +2222,9 @@ String *Item_func_quote::val_str(String *str)
}
}
*to= '\'';
- str->length(new_length);
+ arg->length(new_length);
null_value= 0;
- return str;
+ return arg;
null:
null_value= 1;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 768acd77c27..eae63c5deb3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -107,15 +107,6 @@ extern "C" { // Because of SCO 3.2V4.2
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
-#ifdef __STDC__
-#define my_fromhost(A) fromhost(A)
-#define my_hosts_access(A) hosts_access(A)
-#define my_eval_client(A) eval_client(A)
-#else
-#define my_fromhost(A) fromhost()
-#define my_hosts_access(A) hosts_access()
-#define my_eval_client(A) eval_client()
-#endif
#endif /* HAVE_LIBWRAP */
#ifdef HAVE_SYS_MMAN_H
@@ -3240,8 +3231,8 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
struct request_info req;
signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
- my_fromhost(&req);
- if (!my_hosts_access(&req))
+ fromhost(&req);
+ if (!hosts_access(&req))
{
/*
This may be stupid but refuse() includes an exit(0)
@@ -3249,7 +3240,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
clean_exit() - same stupid thing ...
*/
syslog(deny_severity, "refused connect from %s",
- my_eval_client(&req));
+ eval_client(&req));
/*
C++ sucks (the gibberish in front just translates the supplied
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)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2df0d45f8ed..eda4ce73186 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4951,10 +4951,7 @@ join_read_system(JOIN_TAB *tab)
table->file->print_error(error,MYF(0));
return 1;
}
- if (tab->on_expr)
- mark_as_null_row(tab->table);
- else
- table->null_row=1; // Why do this for inner join?
+ mark_as_null_row(tab->table);
empty_record(table); // Make empty record
return -1;
}
@@ -4984,10 +4981,7 @@ join_read_const(JOIN_TAB *tab)
}
if (error)
{
- if (tab->on_expr)
- mark_as_null_row(tab->table);
- else
- table->null_row=1;
+ mark_as_null_row(tab->table);
empty_record(table);
if (error != HA_ERR_KEY_NOT_FOUND)
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index cdcc90e8651..4f7e34ec74f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -465,21 +465,34 @@ int mysql_multi_update(THD *thd,
*/
for (tl= table_list ; tl ; tl=tl->next)
{
+ TABLE_LIST *save= tl->next;
TABLE *table= tl->table;
+ uint wants;
+ tl->next= 0;
if (update_map & table->map)
{
DBUG_PRINT("info",("setting table `%s` for update", tl->alias));
tl->lock_type= thd->lex.lock_option;
tl->updating= 1;
+ wants= UPDATE_ACL;
}
else
{
DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias));
tl->lock_type= TL_READ;
tl->updating= 0;
+ wants= SELECT_ACL;
}
if (!using_lock_tables)
tl->table->reginfo.lock_type= tl->lock_type;
+
+ if (check_access(thd, wants, tl->db, &tl->grant.privilege, 0, 0) ||
+ (grant_option && check_grant(thd, wants, tl, 0, 0)))
+ {
+ tl->next= save;
+ DBUG_RETURN(0);
+ }
+ tl->next= save;
}
/* Relock the tables with the correct modes */