• unknown's avatar
    Fix for bug #6173 "One can circumvent missing UPDATE privilege if · b88150c9
    unknown authored
    he has SELECT and INSERT privileges for table with primary key"
    
    Now we set lex->duplicates= DUP_UPDATE right in parser if INSERT has
    ON DUPLICATE KEY UPDATE clause, this simplifies insert_precheck()
    function (this also fixes a bug) and some other code.
    
    
    mysql-test/r/grant2.result:
      Added test for bug #6173 "One can circumvent missing UPDATE privilege if
      he has SELECT and INSERT privileges for table with primary key"
    mysql-test/t/grant2.test:
      Added test for bug #6173 "One can circumvent missing UPDATE privilege if
      he has SELECT and INSERT privileges for table with primary key"
    sql/mysql_priv.h:
      insert_precheck() don't need "update" parameter any longer since
      now we set lex->duplicates to DUP_UPDATE if INSERT has ON DUPLICATE
      KEY UPDATE clause.
    sql/sql_parse.cc:
      insert_precheck() don't need "update" parameter any longer since
      now we set lex->duplicates to DUP_UPDATE if INSERT has ON DUPLICATE
      KEY UPDATE clause, so it can determine whenever it is needed to
      require UPDATE_ACL by itself. Also calling of mysql_insert() is
      simplified.
    sql/sql_prepare.cc:
      insert_precheck() don't need "update" parameter any longer since
      now we set lex->duplicates to DUP_UPDATE if INSERT has ON DUPLICATE
      KEY UPDATE clause, so it can determine whenever it is needed to
      require UPDATE_ACL by itself. Also calling of mysql_insert() is
      simplified.
    sql/sql_yacc.yy:
      It is better to set Lex->duplicates= DUP_UPDATE right in parser if we
      have INSERT with ON DUPLICATE KEY UPDATE clause, rather doing this later.
    b88150c9
grant2.test 2.03 KB