From d8ca90a99e8fed561db245f3e972d893334604f8 Mon Sep 17 00:00:00 2001 From: Marin Ivanov Date: Mon, 25 Mar 2019 00:46:46 +0200 Subject: Allow to drop privileges my changing uid/gid This feature is only available for unix OSes and allow to setuid and setgid after creating a listening socket. --- setuid_windows.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 setuid_windows.go (limited to 'setuid_windows.go') diff --git a/setuid_windows.go b/setuid_windows.go new file mode 100644 index 0000000..63ccc73 --- /dev/null +++ b/setuid_windows.go @@ -0,0 +1,19 @@ +package main + +import ( + "errors" +) + +func setUID(uid uint16) error { + if uid != 0 { + return errors.New("unable to setuid on Windows") + } + return nil +} + +func setGID(uid uint16) error { + if uid != 0 { + return errors.New("unable to setgid on Windows") + } + return nil +} -- cgit v1.2.3