Skip to content

Commit

Permalink
Land #13886, post/multi/manage/sudo support password with shell metac…
Browse files Browse the repository at this point in the history
…haracters
  • Loading branch information
bcoles committed Jul 23, 2020
2 parents bbb683f + 6be25a0 commit 2379194
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/post/multi/manage/sudo.rb
Expand Up @@ -98,8 +98,7 @@ def askpass_sudo(password)
# Need to timeout in case there's a blocking prompt after all
::Timeout.timeout(120) do
vprint_status "Writing the SUDO_ASKPASS script: #{askpass_sh}"
cmd_exec("echo \\#\\!/bin/sh > #{askpass_sh}") # Cursed csh
cmd_exec("echo echo #{password} >> #{askpass_sh}")
write_file(askpass_sh, "#!/bin/sh\necho '#{password}'\n")
vprint_status "Setting executable bit."
cmd_exec("chmod +x #{askpass_sh}")
vprint_status "Setting environment variable."
Expand Down

0 comments on commit 2379194

Please sign in to comment.