masquerade 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,9 @@
1
1
  = Changelog
2
+
3
+ == Release 0.6.0 - April 15, 2011
4
+
5
+ * CHANGE: Change both uid+euid and gid+egid to switch user
6
+
2
7
  == Release 0.5.0 - April 15, 2011
3
8
 
4
9
  * FIX: Fatal bug
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
2
2
  require "rake"
3
3
  require "echoe"
4
4
 
5
- Echoe.new("masquerade", "0.5.0") do |p|
5
+ Echoe.new("masquerade", "0.6.0") do |p|
6
6
  p.description = "A user/group impersonator. Allows you to run a block of code as another user or group."
7
7
  p.summary = "A user/group impersonator. Allows you to run a block of code as another user or group"
8
8
  p.url = "http://rubygems.org/gems/masquerade"
data/lib/masquerade.rb CHANGED
@@ -50,6 +50,8 @@ module Masquerade
50
50
  begin
51
51
  current_euid = Process.euid
52
52
  current_egid = Process.egid
53
+ current_uid = Process.uid
54
+ current_gid = Process.gid
53
55
  if who.include? :group
54
56
  group_struct = nil
55
57
  if who[:group].kind_of? String
@@ -61,6 +63,7 @@ module Masquerade
61
63
  end
62
64
  # set the gid of the current process to that of the chosen group
63
65
  Process.egid = group_struct.gid
66
+ Process.gid = group_struct.gid
64
67
  end
65
68
  if who.include? :user
66
69
  user_struct = nil
@@ -73,11 +76,14 @@ module Masquerade
73
76
  end
74
77
  # set the uid of the current process to that of the chosen user
75
78
  Process.euid = user_struct.uid
79
+ Process.uid = user_struct.uid
76
80
  end
77
81
  # run the block
78
82
  response = yield who
79
83
  # restore process uid and gid
84
+ Process.uid = current_uid
80
85
  Process.euid = current_euid
86
+ Process.gid = current_gid
81
87
  Process.egid = current_egid
82
88
  return response
83
89
  rescue Errno::EPERM
data/masquerade.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{masquerade}
5
- s.version = "0.5.0"
5
+ s.version = "0.6.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Nitesh Goel"]
9
- s.date = %q{2011-04-15}
9
+ s.date = %q{2011-04-16}
10
10
  s.description = %q{A user/group impersonator. Allows you to run a block of code as another user or group.}
11
11
  s.email = %q{nitesh@wikinvest.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc", "lib/masquerade.rb"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masquerade
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nitesh Goel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-15 00:00:00 Z
18
+ date: 2011-04-16 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: A user/group impersonator. Allows you to run a block of code as another user or group.