Skip to content

Merge 3.6.x #759

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 4 commits into from
Sep 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2015-09-22 - Supported Release 3.6.1
### Summary
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.

#### Bugfixes
- Loosen the regex in mysql_user munging so the username is not unintentionally truncated.
- Use `warning()` not `warn()`
- Metadata had inadvertantly dropped 3.3.x support
- Some 3.3.x compatibility issues in `mysqltuner` were corrected

## 2015-08-10 - Supported Release 3.6.0
### Summary
This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances.
Expand Down
9 changes: 7 additions & 2 deletions lib/puppet/type/mysql_grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def initialize(*args)
# If at least one special char is used, string must be quoted

# http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-]+)/.match(value)
if matches = /^(['`"])((?!\1).)*\1@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[2]
host_part = matches[3]
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-]+)/.match(value)
elsif matches = /^([0-9a-zA-Z$_]*)@([\w%\.:\-\/]+)$/.match(value)
user_part = matches[1]
host_part = matches[2]
elsif matches = /^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$/.match(value)
Expand All @@ -87,6 +87,11 @@ def initialize(*args)
end
end
end

munge do |value|
matches = /^((['`"]?).*\2)@(.+)$/.match(value)
"#{matches[1]}@#{matches[3].downcase}"
end
end

newproperty(:options, :array_matching => :all) do
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/type/mysql_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# If at least one special char is used, string must be quoted

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

munge do |value|
matches = /^((['`"]?).*\2)@([\w%\.:\-]+)/.match(value)
matches = /^((['`"]?).*\2)@(.+)$/.match(value)
"#{matches[1]}@#{matches[3].downcase}"
end
end
Expand Down
12 changes: 6 additions & 6 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "puppetlabs-mysql",
"version": "3.6.0",
"version": "3.6.1",
"author": "Puppet Labs",
"summary": "Installs, configures, and manages the MySQL service.",
"license": "Apache-2.0",
"source": "git://github.com/puppetlabs/puppetlabs-mysql.git",
"project_page": "http://github.com/puppetlabs/puppetlabs-mysql",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -81,9 +85,5 @@
"version_requirement": ">= 3.0.0 < 5.0.0"
}
],
"description": "Mysql module",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"},
{"name":"nanliu/staging","version_requirement":">= 1.0.1 < 2.0.0"}
]
"description": "Mysql module"
}
10 changes: 10 additions & 0 deletions spec/unit/puppet/type/mysql_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
end
end

context 'using [email protected]/255.255.255.0' do
before :each do
@user = Puppet::Type.type(:mysql_user).new(:name => '[email protected]/255.255.255.0', :password_hash => 'pass')
end

it 'should create the user with the netmask' do
expect(@user[:name]).to eq('[email protected]/255.255.255.0')
end
end

context 'using allo_wed$char@localhost' do
before :each do
@user = Puppet::Type.type(:mysql_user).new(:name => 'allo_wed$char@localhost', :password_hash => 'pass')
Expand Down