We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Add more tests for conservative spawning.
Hongli Lai (Phusion) (author)
Wed May 07 06:27:30 -0700 2008
commit  35c6ae549a8545151aecc73975c7f8a0190e9fb0
tree    97e8d444a11a7cfbc89bdc5b4cbdbdf787003664
parent  815b8bd1796aff393b8c7dd0986c2fba4a1aa299
...
82
83
84
85
86
87
88
 
 
 
 
 
 
89
90
 
91
92
93
...
106
107
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
...
82
83
84
 
 
 
 
85
86
87
88
89
90
91
 
92
93
94
95
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
0
@@ -82,12 +82,14 @@ describe ApplicationSpawner do
0
   end
0
 end
0
 
0
-if Process.euid == ApplicationSpawner::ROOT_UID
0
- describe "ApplicationSpawner privilege lowering support" do
0
- include TestHelper
0
-
0
+
0
+Process.euid == ApplicationSpawner::ROOT_UID &&
0
+describe("ApplicationSpawner privilege lowering support") do
0
+ include TestHelper
0
+
0
+ describe "regular spawning" do
0
     it_should_behave_like "a spawner that supports lowering of privileges"
0
-
0
+
0
     def spawn_stub_application(options = {})
0
       options = {
0
         :lower_privilege => true,
0
@@ -106,4 +108,24 @@ if Process.euid == ApplicationSpawner::ROOT_UID
0
       end
0
     end
0
   end
0
+
0
+ describe "conservative spawning" do
0
+ it_should_behave_like "a spawner that supports lowering of privileges"
0
+
0
+ def spawn_stub_application(options = {})
0
+ options = {
0
+ :lower_privilege => true,
0
+ :lowest_user => CONFIG['lowest_user']
0
+ }.merge(options)
0
+ @spawner = ApplicationSpawner.new(@stub.app_root,
0
+ options[:lower_privilege],
0
+ options[:lowest_user])
0
+ begin
0
+ app = @spawner.spawn_application!
0
+ yield app
0
+ ensure
0
+ app.close if app
0
+ end
0
+ end
0
+ end
0
 end

Comments

    No one has commented yet.