Skip to content

The old regex requires something after the 'host' part. Fix this. #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2014

Conversation

maxenced
Copy link
Contributor

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns

GRANT SELECT ON `database`.* TO 'user'@'%'

which does not match (\s.*)$ .
This small patch fixes this making last block optional (thanks to ?).

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns
"GRANT SELECT ON `database`.* TO 'user'@'%'" which does not match (\s.*)$ .
This small patch fixes this making last bloc optional (thanks to '?').
@cmurphy
Copy link
Contributor

cmurphy commented Oct 27, 2014

@igalic you agree?

igalic added a commit that referenced this pull request Oct 28, 2014
The old regex requires something after the 'host' part. Fix this.
@igalic igalic merged commit 8540e26 into puppetlabs:master Oct 28, 2014
@igalic
Copy link
Contributor

igalic commented Oct 28, 2014

i do. (had to update the bit above several times, to make it readable to me, sorry about that ;)

@maxenced
Copy link
Contributor Author

sorry for the wrong formatting of my initial comment, and thanks for merging :)

@igalic
Copy link
Contributor

igalic commented Oct 28, 2014

no worries about that, most of the time when i reformat something here, it's because i need colour and monotype to parse code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants