User Manager and database with dot "." in database name
It appears the user manager will allow you set permissions for a user to a database correctly, however it wont show you the permissions later if the database has a dot in the name.
Looking at the source of usermanger.pas around line 499. I think the regular expression is simply not expecting the result I am getting from the show grants user@host. I have hidden detail in the lines below, but as you can see you from regex, only one matches.
Grants for user@localhost
GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD '*****************************************'
GRANT ALL PRIVILEGES ON `database.name`.* TO 'user'@'localhost'
GRANT ALL PRIVILEGES ON `database.name`.* TO 'user'@'localhost'
I am trying to fix the regular expression.. but maybe there is a better way to query the information?
Grants for user@localhost
GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD '*****************************************'
GRANT ALL PRIVILEGES ON `database.name`.* TO 'user'@'localhost'
GRANT ALL PRIVILEGES ON `database.name`.* TO 'user'@'localhost'
I am trying to fix the regular expression.. but maybe there is a better way to query the information?
This may help, but you should look at your matches offset
^GRANT\s+(.+)(\s+|PRIVILEGES)?ON\s+((TABLE|FUNCTION|PROCEDURE|ON)\s+)?`?(.*?)`?\sTO\s'(.*?)'@'(.*?)'($|(\s+IDENTIFIED\s+BY\s+(PASSWORD)?\s+''?([^'']+)''?)?(\s+.+)?$)
it may also not be as safe as yours, as you understand the different database's in play. Hope it helps in some small way since I don't understand the language you have coded it in.
^GRANT\s+(.+)(\s+|PRIVILEGES)?ON\s+((TABLE|FUNCTION|PROCEDURE|ON)\s+)?`?(.*?)`?\sTO\s'(.*?)'@'(.*?)'($|(\s+IDENTIFIED\s+BY\s+(PASSWORD)?\s+''?([^'']+)''?)?(\s+.+)?$)
it may also not be as safe as yours, as you understand the different database's in play. Hope it helps in some small way since I don't understand the language you have coded it in.
Code modification/commit
056322c
from ansgar.becker,
12 years ago,
revision 7.0.0.4392
Expect dots in database and table names, when parsing SHOW GRANTS results. See http://www.heidisql.com/forum.php?t=12640
Do never use ".*?" - that means "probably 0 of any char, but probably 0 of these chars". If you insert question marks at random positions you will get ambiguous matches.
However, I modified the regex so it expects an unquoted "*", or a must-quoted identifier. This way, I can proceed to the next backtick, and dots are included in identifiers. Please update to r4392.
However, I modified the regex so it expects an unquoted "*", or a must-quoted identifier. This way, I can proceed to the next backtick, and dots are included in identifiers. Please update to r4392.
Please login to leave a reply, or register at first.