summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNigel Kersten <nigelk@google.com>2010-03-29 10:49:47 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit966b2690824c5c66059380eb762a2a83bfe7afe5 (patch)
tree365e723dc4fff82ffe1fa7da73d462e729aad0db /lib
parent49be54e5d4c5c19ec1f7e5e454666bb59ebfe88f (diff)
downloadpuppet-966b2690824c5c66059380eb762a2a83bfe7afe5.tar.gz
puppet-966b2690824c5c66059380eb762a2a83bfe7afe5.tar.xz
puppet-966b2690824c5c66059380eb762a2a83bfe7afe5.zip
Fixes #3419. OS X 10.6 Ruby doesn't set supplementary groups
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/suidmanager.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb
index a0a9178bb..424fb461b 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -1,4 +1,3 @@
-require 'facter'
require 'puppet/util/warnings'
require 'forwardable'
@@ -6,14 +5,39 @@ module Puppet::Util::SUIDManager
include Puppet::Util::Warnings
extend Forwardable
+ # Note groups= is handled specially due to a bug in OS X 10.6
to_delegate_to_process = [ :euid=, :euid, :egid=, :egid,
- :uid=, :uid, :gid=, :gid, :groups=, :groups ]
+ :uid=, :uid, :gid=, :gid, :groups ]
to_delegate_to_process.each do |method|
def_delegator Process, method
module_function method
end
+ def osx_maj_ver
+ return @osx_maj_ver unless @osx_maj_ver.nil?
+ require 'facter'
+ # 'kernel' is available without explicitly loading all facts
+ if Facter.value('kernel') != 'Darwin'
+ @osx_maj_ver = false
+ return @osx_maj_ver
+ end
+ # But 'macosx_productversion_major' requires it.
+ Facter.loadfacts
+ @osx_maj_ver = Facter.value('macosx_productversion_major')
+ return @osx_maj_ver
+ end
+ module_function :osx_maj_ver
+
+ def groups=(grouplist)
+ if osx_maj_ver == '10.6'
+ return true
+ else
+ return Process.groups = grouplist
+ end
+ end
+ module_function :groups=
+
if Facter['kernel'].value == 'Darwin'
# Cannot change real UID on Darwin so we set euid
alias :uid :euid