From 4028762f4a81a59ccc6d6e5662fa7e341fc74336 Mon Sep 17 00:00:00 2001 From: sid77 Date: Sun, 21 Aug 2016 02:00:41 +0200 Subject: First attempt at dropping privileges --- vendor/github.com/sid77/drop/syscall/setre.go | 17 +++++++++++++++++ vendor/github.com/sid77/drop/syscall/setres.go | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 vendor/github.com/sid77/drop/syscall/setre.go create mode 100644 vendor/github.com/sid77/drop/syscall/setres.go (limited to 'vendor/github.com/sid77/drop/syscall') diff --git a/vendor/github.com/sid77/drop/syscall/setre.go b/vendor/github.com/sid77/drop/syscall/setre.go new file mode 100644 index 0000000..ecf5ea9 --- /dev/null +++ b/vendor/github.com/sid77/drop/syscall/setre.go @@ -0,0 +1,17 @@ +// +build !linux + +package syscall + +import ( + "syscall" +) + +func Setuid(uid int) error { + err := syscall.Setreuid(uid, uid) + return err +} + +func Setgid(gid int) error { + err := syscall.Setregid(gid, gid) + return err +} diff --git a/vendor/github.com/sid77/drop/syscall/setres.go b/vendor/github.com/sid77/drop/syscall/setres.go new file mode 100644 index 0000000..afe43b9 --- /dev/null +++ b/vendor/github.com/sid77/drop/syscall/setres.go @@ -0,0 +1,17 @@ +// +build linux + +package syscall + +import ( + "syscall" +) + +func Setuid(uid int) error { + err := syscall.Setresuid(uid, uid, uid) + return err +} + +func Setgid(gid int) error { + err := syscall.Setresgid(gid, gid, gid) + return err +} -- cgit v1.2.3