>>>>> "Alex" == Alex Vorobiev <sasha@stripped> writes:
Alex> feature or bug?
Alex> the ref. manual mentions 2 ways of setting passwords, one via the grant
Alex> statement, another one via editing the user table.
Alex> the following
Alex> grant all on *.* to root@localhost identified by 'test'
Alex> changes root's pass to 'test', leaving, however, the password field in the
Alex> user table blank.
Alex> if i subsequently issue
Alex> mysqladmin reload -p (having specified the new passw)
Alex> as root, the root password will be reset to blank. i understand that
Alex> reload is redundant after grant, but i am trying to understand the logic
Alex> of this behavior.
<cut>
Hi!
This was fixed in 3.23. Here is a patch for 3.22:
*** /my/monty/master/mysql-3.22.24/sql/sql_acl.cc Sat Apr 3 15:44:01 1999
--- ./sql_acl.cc Thu Jul 29 03:41:28 1999
***************
*** 885,891 ****
char password[17];
DBUG_ENTER("replace_user_table");
! if (combo.password.str)
make_scrambled_password(password,combo.password.str);
else
password[0]=0;
--- 885,891 ----
char password[17];
DBUG_ENTER("replace_user_table");
! if (combo.password.str && combo.password.str[0])
make_scrambled_password(password,combo.password.str);
else
password[0]=0;
***************
*** 933,939 ****
We should NEVER delete from the user table, as a uses can still
use mysqld even if he doesn't have any privileges in the user table!
*/
! if (rights != old_rights &&
(error=ha_update(table,table->record[1],table->record[0])))
{ // This should never happen
ha_error(table,error,MYF(0)); /* purecov: deadcode */
--- 933,939 ----
We should NEVER delete from the user table, as a uses can still
use mysqld even if he doesn't have any privileges in the user table!
*/
! if (cmp_record(table,1) &&
(error=ha_update(table,table->record[1],table->record[0])))
{ // This should never happen
ha_error(table,error,MYF(0)); /* purecov: deadcode */
***************
*** 1535,1540 ****
--- 1535,1541 ----
/* open the mysql.tables_priv and mysql.columns_priv tables */
+ bzero((char*) &tables,sizeof(tables));
tables[0].name=tables[0].real_name="user";
tables[1].name=tables[1].real_name="tables_priv";
tables[2].name=tables[2].real_name="columns_priv";
***************
*** 1543,1552 ****
tables[1].next=((column_priv ||
(revoke && ((rights & COL_ACLS) || columns.elements)))
? tables+2 : 0);
- tables[2].next=0;
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
tables[0].db=tables[1].db=tables[2].db="mysql";
- tables[0].table=tables[1].table=tables[2].table=0;
if (open_tables(thd,tables))
{ // Should never happen
--- 1544,1551 ----
***************
*** 1784,1796 ****
thd->current_tablenr=0;
thd->open_tables=0;
thd->db=my_strdup("mysql",MYF(0));
tables[0].name=tables[0].real_name="tables_priv";
tables[1].name=tables[1].real_name="columns_priv";
tables[0].next=tables+1;
- tables[1].next=0;
tables[0].lock_type=tables[1].lock_type=TL_READ;
tables[0].db=tables[1].db=thd->db;
- tables[0].table=tables[1].table=0;
if (open_tables(thd,tables))
{ // No grant tables
--- 1783,1794 ----
thd->current_tablenr=0;
thd->open_tables=0;
thd->db=my_strdup("mysql",MYF(0));
+ bzero((char*) &tables,sizeof(tables));
tables[0].name=tables[0].real_name="tables_priv";
tables[1].name=tables[1].real_name="columns_priv";
tables[0].next=tables+1;
tables[0].lock_type=tables[1].lock_type=TL_READ;
tables[0].db=tables[1].db=thd->db;
if (open_tables(thd,tables))
{ // No grant tables
Yours,
Monty
PS: Sorry for the late reply, but I have been vacation!