Commit d77ab077 authored by unknown's avatar unknown

Compare hostnames case insensitive

Accept zero dates without warnings


Docs/manual.texi:
  ChangeLog
sql/sql_acl.cc:
  Compare hostnames case insensitive
sql/time.cc:
  Accept zero dates without warnings
parent 5a77b168
......@@ -50453,6 +50453,12 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed bug where @code{GRANT}/@code{REVOKE} failed if hostname was given in
not matching case.
@item
Don't give warning in @code{LOAD DATA INFILE} when setting a
@code{timestamp} to a string of '0'.
@item
One didn't get an error message if mysqld couldn't open the privilege tables.
@item
@code{SET PASSWORD FOR ...} closed the connection in case of errors (bug
......@@ -643,7 +643,8 @@ static void acl_update_user(const char *user, const char *host,
!strcmp(user,acl_user->user))
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname && !strcmp(host,acl_user->host.hostname))
acl_user->host.hostname &&
!my_strcasecmp(host,acl_user->host.hostname))
{
acl_user->access=privileges;
if (mqh->bits & 1)
......@@ -732,7 +733,7 @@ static void acl_update_db(const char *user, const char *host, const char *db,
!strcmp(user,acl_db->user))
{
if (!acl_db->host.hostname && !host[0] ||
acl_db->host.hostname && !strcmp(host,acl_db->host.hostname))
acl_db->host.hostname && !my_strcasecmp(host,acl_db->host.hostname))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
......@@ -1666,7 +1667,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
{
if (exact)
{
if ((host && !strcmp(host,grant_table->host)) ||
if ((host && !my_strcasecmp(host,grant_table->host)) ||
(ip && !strcmp(ip,grant_table->host)))
return grant_table;
}
......@@ -2723,7 +2724,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!(host=acl_user->host.hostname))
host="%";
if (!strcmp(lex_user->user.str,user) &&
!strcmp(lex_user->host.str,host))
!my_strcasecmp(lex_user->host.str,host))
break;
}
if (counter == acl_users.elements)
......@@ -2870,7 +2871,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!strcmp(lex_user->host.str,host))
!my_strcasecmp(lex_user->host.str,host))
{
want_access=acl_db->access;
if (want_access)
......@@ -2929,7 +2930,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!strcmp(lex_user->host.str,host))
!my_strcasecmp(lex_user->host.str,host))
{
want_access=grant_table->privs;
if ((want_access | grant_table->cols) != 0)
......
......@@ -429,6 +429,7 @@ timestamp_type
str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
{
uint field_length,year_length,digits,i,number_of_fields,date[7];
uint not_zero_date;
const char *pos;
const char *end=str+length;
DBUG_ENTER("str_to_TIME");
......@@ -446,6 +447,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
digits= (uint) (pos-str);
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
field_length=year_length-1;
not_zero_date= 0;
for (i=0 ; i < 6 && str != end && isdigit(*str) ; i++)
{
uint tmp_value=(uint) (uchar) (*str++ - '0');
......@@ -455,6 +457,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
str++;
}
date[i]=tmp_value;
not_zero_date|= tmp_value;
if (i == 2 && str != end && *str == 'T')
str++; // ISO8601: CCYYMMDDThhmmss
else if ( i != 5 ) // Skip inter-field delimiters
......@@ -478,6 +481,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
while (str++ != end && isdigit(str[0]) && field_length--)
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
date[6]=tmp_value;
not_zero_date|= tmp_value;
}
else
date[6]=0;
......@@ -491,7 +495,20 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
date[2] > 31 || date[3] > 23 || date[4] > 59 || date[5] > 59 ||
!fuzzy_date && (date[1] == 0 || date[2] == 0))
{
current_thd->cuted_fields++;
/* Only give warning for a zero date if there is some garbage after */
if (!not_zero_date) // If zero date
{
for (; str != end ; str++)
{
if (!isspace(*str))
{
not_zero_date= 1; // Give warning
break;
}
}
}
if (not_zero_date)
current_thd->cuted_fields++;
DBUG_RETURN(TIMESTAMP_NONE);
}
if (str != end && current_thd->count_cuted_fields)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment