mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/utils.rb (Utils::su): use setgid and setuid to
set real and effective IDs. and setup group access list by initgroups. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eb8ee5e401
commit
b2cf59aa1c
2 changed files with 14 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Sep 29 02:31:44 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* lib/webrick/utils.rb (Utils::su): use setgid and setuid to
|
||||
set real and effective IDs. and setup group access list by
|
||||
initgroups.
|
||||
|
||||
Mon Sep 27 18:25:13 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/xsd/charset.rb: XSD::Charset.is_ces did return always true under
|
||||
|
|
|
@ -26,16 +26,16 @@ module WEBrick
|
|||
end
|
||||
module_function :set_close_on_exec
|
||||
|
||||
def su(user, group=nil)
|
||||
def su(user)
|
||||
if defined?(Etc)
|
||||
pw = Etc.getpwnam(user)
|
||||
gr = group ? Etc.getgrnam(group) : pw
|
||||
Process::gid = gr.gid
|
||||
Process::egid = gr.gid
|
||||
Process::uid = pw.uid
|
||||
Process::euid = pw.uid
|
||||
end
|
||||
end
|
||||
Process::initgroups(user, pw.gid)
|
||||
Process::Sys::setgid(pw.gid)
|
||||
Process::Sys::setuid(pw.uid)
|
||||
else
|
||||
warn("WEBrick::Utils::su doesn't work on this platform")
|
||||
end
|
||||
end
|
||||
module_function :su
|
||||
|
||||
def getservername
|
||||
|
|
Loading…
Add table
Reference in a new issue