Skip to content

Commit

Permalink
Merge pull request #13809 from jwdean/main
Browse files Browse the repository at this point in the history
Adding double-quotes around path for Windows 'secedit' command line
  • Loading branch information
johnmccrae committed Jul 11, 2023
2 parents 58ed264 + 72fd888 commit 13f8685
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/chef/resource/windows_security_policy.rb
Expand Up @@ -118,13 +118,13 @@ class WindowsSecurityPolicy < Chef::Resource
file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
file.close
file_path = file.path.tr("/", "\\")
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
else
policy_line = "#{security_option} = #{security_value}"
file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
file.close
file_path = file.path.tr("/", "\\")
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
end
shell_out!(cmd)
file.unlink
Expand Down

0 comments on commit 13f8685

Please sign in to comment.