diff options
| author | Dave Cheney <dave@cheney.net> | 2014-06-24 09:16:24 +1000 |
|---|---|---|
| committer | Dave Cheney <dave@cheney.net> | 2014-06-24 09:16:24 +1000 |
| commit | 343b4ba8c1ad8a29b6dd19cb101273b57a26c9b0 (patch) | |
| tree | a0062a10abbfe5366d3999ac0320b74d69c62e5e /src/pkg/syscall/syscall_linux.go | |
| parent | 7d8da7dc4d6f7800aababcc054b71a1cda47cc93 (diff) | |
| download | go-343b4ba8c1ad8a29b6dd19cb101273b57a26c9b0.tar.xz | |
syscall: disable Setuid/Setgid on linux
Update #1435
This proposal disables Setuid and Setgid on all linux platforms.
Issue 1435 has been open for a long time, and it is unlikely to be addressed soon so an argument was made by a commenter
https://code.google.com/p/go/issues/detail?id=1435#c45
That these functions should made to fail rather than succeed in their broken state.
LGTM=ruiu, iant
R=iant, ruiu
CC=golang-codereviews
https://golang.org/cl/106170043
Diffstat (limited to 'src/pkg/syscall/syscall_linux.go')
| -rw-r--r-- | src/pkg/syscall/syscall_linux.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index cdba97d2e7..138a695fd3 100644 --- a/src/pkg/syscall/syscall_linux.go +++ b/src/pkg/syscall/syscall_linux.go @@ -807,7 +807,20 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri //sysnb Setpgid(pid int, pgid int) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tv *Timeval) (err error) -//sysnb Setuid(uid int) (err error) + +// issue 1435. +// On linux Setuid and Setgid only affects the current thread, not the process. +// This does not match what most callers expect so we must return an error +// here rather than letting the caller think that the call succeeded. + +func Setuid(uid int) (err error) { + return EOPNOTSUPP +} + +func Setgid(uid int) (err error) { + return EOPNOTSUPP +} + //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) //sys Symlink(oldpath string, newpath string) (err error) |
