Skip to content

Commit 468986d

Browse files
committed
Merge pull request #623 from mhaskel/FM-2111
Fix issues introduced in #612
2 parents 2f9820c + a611686 commit 468986d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/puppet/type/mysql_grant.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def initialize(*args)
6464
# If at least one special char is used, string must be quoted
6565

6666
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
67-
if matches = /^(['`"])((?!\1).)+\1@([\w%\.:]+)$/.match(value)
67+
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-]+)/.match(value)
6868
user_part = matches[2]
6969
host_part = matches[3]
70-
elsif matches = /^([0-9a-zA-Z$_]+)@([\w%\.:]+)$/.match(value)
70+
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value)
7171
user_part = matches[1]
7272
host_part = matches[2]
7373
elsif matches = /^(?:(?!['`"]).*)([^0-9a-zA-Z$_]).*@.+$/.match(value)

lib/puppet/type/mysql_user.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# If at least one special char is used, string must be quoted
1414

1515
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
16-
if matches = /^(['`"])((?:(?!\1).)+)\1@([\w%\.:]+)$/.match(value)
16+
if matches = /^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-]+)/.match(value)
1717
user_part = matches[2]
1818
host_part = matches[3]
19-
elsif matches = /^([0-9a-zA-Z$_]+)@([\w%\.:]+)$/.match(value)
19+
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value)
2020
user_part = matches[1]
2121
host_part = matches[2]
2222
elsif matches = /^(?:(?!['`"]).*)([^0-9a-zA-Z$_]).*@.+$/.match(value)
@@ -30,7 +30,7 @@
3030
end
3131

3232
munge do |value|
33-
matches = /^((['`"]?).+\2)@([\w%\.:]+)$/.match(value)
33+
matches = /^((['`"]?).*\2)@([\w%\.:\-]+)/.match(value)
3434
"#{matches[1]}@#{matches[3].downcase}"
3535
end
3636
end

0 commit comments

Comments
 (0)