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

vhata
Copy link
Contributor

@vhata vhata 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("'", "'\\\\''")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@vhata
Copy link
Contributor Author

vhata commented Jun 3, 2013

@btm: I have added a hopefully useful comment

@jtimberman
Copy link

@vhata NICE! Thanks :D

jtimberman pushed a commit that referenced this pull request Jun 4, 2013
[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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants