Skip to content

Commit 1823c7c

Browse files
committed
Merge pull request #759 from mhaskel/merge_3.6.x
Merge 3.6.x
2 parents c17c465 + e1f4b83 commit 1823c7c

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2015-09-22 - Supported Release 3.6.1
2+
### Summary
3+
This is a security and bugfix release that fixes incorrect username truncation in the munge for the mysql_user type, incorrect function used in `mysql::server::backup` and fixes compatibility issues with PE 3.3.x.
4+
5+
#### Bugfixes
6+
- Loosen the regex in mysql_user munging so the username is not unintentionally truncated.
7+
- Use `warning()` not `warn()`
8+
- Metadata had inadvertantly dropped 3.3.x support
9+
- Some 3.3.x compatibility issues in `mysqltuner` were corrected
10+
111
## 2015-08-10 - Supported Release 3.6.0
212
### Summary
313
This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances.

lib/puppet/type/mysql_grant.rb

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

6767
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
68-
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-]+)/.match(value)
68+
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-\/]+)$/.match(value)
6969
user_part = matches[2]
7070
host_part = matches[3]
71-
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value)
71+
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-\/]+)$/.match(value)
7272
user_part = matches[1]
7373
host_part = matches[2]
7474
elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value)
@@ -87,6 +87,11 @@ def initialize(*args)
8787
end
8888
end
8989
end
90+
91+
munge do |value|
92+
matches = /^((['`"]?).*\2)@(.+)$/.match(value)
93+
"#{matches[1]}@#{matches[3].downcase}"
94+
end
9095
end
9196

9297
newproperty(:options, :array_matching => :all) do

lib/puppet/type/mysql_user.rb

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

1616
# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
17-
if matches = /^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-]+)/.match(value)
17+
if matches = /^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-\/]+)$/.match(value)
1818
user_part = matches[2]
1919
host_part = matches[3]
20-
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value)
20+
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-\/]+)$/.match(value)
2121
user_part = matches[1]
2222
host_part = matches[2]
2323
elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value)
@@ -38,7 +38,7 @@
3838
end
3939

4040
munge do |value|
41-
matches = /^((['`"]?).*\2)@([\w%\.:\-]+)/.match(value)
41+
matches = /^((['`"]?).*\2)@(.+)$/.match(value)
4242
"#{matches[1]}@#{matches[3].downcase}"
4343
end
4444
end

metadata.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"name": "puppetlabs-mysql",
3-
"version": "3.6.0",
3+
"version": "3.6.1",
44
"author": "Puppet Labs",
55
"summary": "Installs, configures, and manages the MySQL service.",
66
"license": "Apache-2.0",
77
"source": "git://github.com/puppetlabs/puppetlabs-mysql.git",
88
"project_page": "http://github.com/puppetlabs/puppetlabs-mysql",
99
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
10+
"dependencies": [
11+
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
12+
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
13+
],
1014
"operatingsystem_support": [
1115
{
1216
"operatingsystem": "RedHat",
@@ -81,9 +85,5 @@
8185
"version_requirement": ">= 3.0.0 < 5.0.0"
8286
}
8387
],
84-
"description": "Mysql module",
85-
"dependencies": [
86-
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
87-
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
88-
]
88+
"description": "Mysql module"
8989
}

spec/unit/puppet/type/mysql_user_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
end
5252
end
5353

54+
context 'using [email protected]/255.255.255.0' do
55+
before :each do
56+
@user = Puppet::Type.type(:mysql_user).new(:name => '[email protected]/255.255.255.0', :password_hash => 'pass')
57+
end
58+
59+
it 'should create the user with the netmask' do
60+
expect(@user[:name]).to eq('[email protected]/255.255.255.0')
61+
end
62+
end
63+
5464
context 'using allo_wed$char@localhost' do
5565
before :each do
5666
@user = Puppet::Type.type(:mysql_user).new(:name => 'allo_wed$char@localhost', :password_hash => 'pass')

0 commit comments

Comments
 (0)