Skip to content
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

[COOK-3078] Escape and quote password before using #57

Merged
merged 2 commits into from Jun 4, 2013

Conversation

Projects
None yet
3 participants
@vhata
Copy link
Contributor

commented May 29, 2013

The password is not quoted in the add_user command, so any password with spaces will fail with "invalid command" due to too many arguments. This adds quotes around the password, and of course escapes any quotes inside the password.

@@ -76,7 +76,8 @@ def user_has_permissions?(name, vhost, perm_list = nil)
if new_resource.password.nil? || new_resource.password.empty?
Chef::Application.fatal!("rabbitmq_user with action :add requires a non-nil/empty password.")
end
cmdStr = "rabbitmqctl add_user #{new_resource.user} #{new_resource.password}"
new_password = new_resource.password.gsub("'", "'\\\\''")

This comment has been minimized.

Copy link
@btm

btm Jun 3, 2013

Contributor

a comment here explaining why we need so much escaping would be good.

@vhata

This comment has been minimized.

Copy link
Contributor Author

commented Jun 3, 2013

@btm: I have added a hopefully useful comment

@jtimberman

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2013

@vhata NICE! Thanks :D

jtimberman added a commit that referenced this pull request Jun 4, 2013

Merge pull request #57 from yola/quoted_password
[COOK-3078] Escape and quote password before using

@jtimberman jtimberman merged commit 6b99c3f into rabbitmq:master Jun 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.