#4022 "Events" and "Trigger" menu items don't show up

3.3.7
works-for-me
None
3
2014-03-18
2013-07-15
No

Related to #3566, there is a problem with the "Events" and "Trigger" menu items on older MySQL servers.

The method currentUserHasPrivilege() checks the privilege for TRIGGER and EVENT with a given database -- in my case "ni154268_3_ch".

This replacements:
$db = str_replace(array('%', '_'), array('\%', '_'), $db);
...
self::sqlAddSlashes($db)

will result in this string: "ni154268\_3\_ch".

On MySQL 5.5x this is fine, but on MySQL 5.1.69, this does not work. If I remove the slashes and submit the resulting query, all works fine. So I think this is a compatibility issue with an old MySQL server version and can be fixed in currentUserHasPrivilege().

Discussion

  • Marc Delisle

    Marc Delisle - 2013-08-03

    With phpMyAdmin 4.0.4.2 and MySQL 5.1.71, I cannot reproduce your problem. I'm using mysqlnd and the mysqli extension, and an unprivileged user who has all privileges to the ni154268_3_ch database.
    Of course, in the mysql.db table, the Db column contains ni154268_3_ch to express a non-wildcard privilege.

     
  • Marc Delisle

    Marc Delisle - 2013-08-03
    • status: open --> works-for-me
    • assigned_to: Marc Delisle
     
  • baf

    baf - 2014-03-18
    --- libraries/Util.class.php.org    2014-03-18 10:52:07.000000000 +0100
    +++ libraries/Util.class.php    2014-03-18 10:51:27.000000000 +0100
    @@ -3816,6 +3816,11 @@ class PMA_Util
          */
         public static function currentUserHasPrivilege($priv, $db = null, $tbl = null)
         {
    +   // TRIGGER privilege was added in MySQL 5.1.6.
    +   // Before MySQL 5.1.6, the SUPER privilege was required to create or drop triggers.
    +   if ($priv == "TRIGGER" && PMA_MYSQL_INT_VERSION < 50160) {
    +       $priv = "SUPER";
    +   }
    
             // Get the username for the current user in the format
             // required to use in the information schema database.
    
     
    Last edit: baf 2014-03-18

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks