--- ../mysql-5.0.bk-orig/./sql/sql_acl.cc Fri Mar 23 11:12:09 2007 +++ ./sql/sql_acl.cc Wed May 23 16:20:01 2007 @@ -4344,10 +4343,16 @@ if (!(user=acl_db->user)) user= ""; if (!(host=acl_db->host.hostname)) host= ""; + /* + here could be decided to only show GRANTS for the hostname in excact case. + This would be in line with create/revoke grants, and show only one line + On the other hand, the user has the combination of both grants, so they + should display + */ if (!strcmp(lex_user->user.str,user) && !my_strcasecmp(system_charset_info, lex_user->host.str, host)) { want_access=acl_db->access; if (want_access) @@ -4379,11 +4384,12 @@ append_identifier(thd, &db, acl_db->db, strlen(acl_db->db)); db.append (STRING_WITH_LEN(".* TO '")); db.append(lex_user->user.str, lex_user->user.length, system_charset_info); db.append (STRING_WITH_LEN("'@'")); - db.append(lex_user->host.str, lex_user->host.length, + // host and lex_user->host are equal except for case + db.append(host, lex_user->host.length, system_charset_info); db.append ('\''); if (want_access & GRANT_ACL) db.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend(); @@ -4407,10 +4413,16 @@ if (!(user=grant_table->user)) user= ""; if (!(host= grant_table->host.hostname)) host= ""; + /* + here could be decided to only show GRANTS for the hostname in excact case. + This would be in line with create/revoke grants, and show only one line + On the other hand, the user has the combination of both grants, so they + should display + */ if (!strcmp(lex_user->user.str,user) && !my_strcasecmp(system_charset_info, lex_user->host.str, host)) { ulong table_access= grant_table->privs; if ((table_access | grant_table->cols) != 0) @@ -4487,11 +4499,12 @@ strlen(grant_table->tname)); global.append(STRING_WITH_LEN(" TO '")); global.append(lex_user->user.str, lex_user->user.length, system_charset_info); global.append(STRING_WITH_LEN("'@'")); - global.append(lex_user->host.str,lex_user->host.length, + // host and lex_user->host are equal except for case + global.append(host, lex_user->host.length, system_charset_info); global.append('\''); if (table_access & GRANT_ACL) global.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend(); @@ -4543,10 +4556,16 @@ if (!(user=grant_proc->user)) user= ""; if (!(host= grant_proc->host.hostname)) host= ""; + /* + here could be decided to only show GRANTS for the hostname in excact case. + This would be in line with create/revoke grants, and show only one line + On the other hand, the user has the combination of both grants, so they + should display + */ if (!strcmp(lex_user->user.str,user) && !my_strcasecmp(system_charset_info, lex_user->host.str, host)) { ulong proc_access= grant_proc->privs; if (proc_access != 0) @@ -4586,11 +4605,12 @@ strlen(grant_proc->tname)); global.append(STRING_WITH_LEN(" TO '")); global.append(lex_user->user.str, lex_user->user.length, system_charset_info); global.append(STRING_WITH_LEN("'@'")); - global.append(lex_user->host.str,lex_user->host.length, + // host and lex_user->host are equal except for case + global.append(host,lex_user->host.length, system_charset_info); global.append('\''); if (proc_access & GRANT_ACL) global.append(STRING_WITH_LEN(" WITH GRANT OPTION")); protocol->prepare_for_resend();