Skip to content

Commit

Permalink
hotfix: only cd into / when dropping privs.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsdeleo committed May 6, 2010
1 parent 5c16bbe commit 13c2cea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion chef/lib/chef/application.rb
Expand Up @@ -47,7 +47,6 @@ def initialize

# Always switch to a readable directory. Keeps subsequent Dir.chdir() {}
# from failing due to permissions when launched as a less privileged user.
Dir.chdir("/")
end

# Reconfigure the application. You'll want to override and super this method.
Expand Down
2 changes: 2 additions & 0 deletions chef/lib/chef/daemon.rb
Expand Up @@ -121,6 +121,8 @@ def remove_pid_file
# Change process user/group to those specified in Chef::Config
#
def change_privilege
Dir.chdir("/")

if Chef::Config[:user] and Chef::Config[:group]
Chef::Log.info("About to change privilege to #{Chef::Config[:user]}:#{Chef::Config[:group]}")
_change_privilege(Chef::Config[:user], Chef::Config[:group])
Expand Down
2 changes: 2 additions & 0 deletions chef/lib/chef/knife/cookbook_upload.rb
Expand Up @@ -38,6 +38,8 @@ class CookbookUpload < Knife
:description => "Upload all cookbooks, rather than just a single cookbook"

def run
Chef::Log.debug "Uploading cookbooks from #{config[:cookbook_path]}"

if config[:cookbook_path]
Chef::Config[:cookbook_path] = config[:cookbook_path]
else
Expand Down

0 comments on commit 13c2cea

Please sign in to comment.