Skip to content

Commit

Permalink
Merge pull request #6 from lomik/master
Browse files Browse the repository at this point in the history
Revert to reduce privileges via StartProcess

Setuid working bad in golang. Discussion: https://code.google.com/p/go/issues/detail?id=1435
  • Loading branch information
sevlyar committed Mar 21, 2015
2 parents 04162ff + 205ceae commit 5841a79
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions daemon_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func (d *Context) parent() (child *os.Process, err error) {
Env: d.Env,
Files: d.files(),
Sys: &syscall.SysProcAttr{
//Chroot: d.Chroot,
Credential: d.Credential,
Setsid: true,
},
}
Expand Down Expand Up @@ -247,18 +249,6 @@ func (d *Context) child() (err error) {
if len(d.Chroot) > 0 {
err = syscall.Chroot(d.Chroot)
}
if d.Credential != nil {
if d.Credential.Gid > 0 {
if err = syscall.Setgid(int(d.Credential.Gid)); err != nil {
return
}
}
if d.Credential.Uid > 0 {
if err = syscall.Setuid(int(d.Credential.Uid)); err != nil {
return
}
}
}

return
}
Expand Down

0 comments on commit 5841a79

Please sign in to comment.