distal-attribute
distal-attribute
distal-attribute
distal-attribute

User Manager and database with dot "." in database name

User, date Message
Written by mrforsythexeter
11 months ago
Category: General
26 posts since Wed, 24 Nov 10
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.
Written by ansgar
11 months ago
4789 posts since Fri, 07 Apr 06
Yes that's probably a limitation caused by my regular expression logic on the results of SHOW GRANTS FOR XYZ.
Written by mrforsythexeter
11 months ago
26 posts since Wed, 24 Nov 10
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?




Written by mrforsythexeter
11 months ago
26 posts since Wed, 24 Nov 10
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.
Written by jfalchMoney, Euro
11 months ago
352 posts since Sat, 17 Oct 09
hmm.
Written by ansgar
11 months ago
4789 posts since Fri, 07 Apr 06
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.
 

Please login to leave a reply, or register at first.