diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-09-22 17:31:31 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-09-28 15:36:22 -0700 |
commit | 3f99bd71811be182f9217d727ec0ca7755eec68d (patch) | |
tree | 14c4c82bf552978321e2baef23a09fec82f93a86 | |
parent | 6468f4ede9d96b8d83f107a8533a4ad6eb88c954 (diff) | |
download | puppet-3f99bd71811be182f9217d727ec0ca7755eec68d.tar.gz puppet-3f99bd71811be182f9217d727ec0ca7755eec68d.tar.xz puppet-3f99bd71811be182f9217d727ec0ca7755eec68d.zip |
Fix #4267 - Create a backup before dropping permissions
This change just forces a file to be written to the filebucket before we
drop the permissions necessary to do so.
-rw-r--r-- | lib/puppet/provider/ssh_authorized_key/parsed.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb index 82f6b8881..6a3855c0e 100644 --- a/lib/puppet/provider/ssh_authorized_key/parsed.rb +++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb @@ -61,6 +61,13 @@ require 'puppet/provider/parsedfile' Dir.mkdir(dir, dir_perm) File.chown(uid, nil, dir) end + + # ParsedFile usually calls backup_target much later in the flush process, + # but our SUID makes that fail to open filebucket files for writing. + # Fortunately, there's already logic to make sure it only ever happens once, + # so calling it here supresses the later attempt by our superclass's flush method. + self.class.backup_target(target) + Puppet::Util::SUIDManager.asuser(@resource.should(:user)) { super } File.chown(uid, nil, target) File.chmod(file_perm, target) |