aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/sid77
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/sid77')
-rw-r--r--vendor/github.com/sid77/drop/LICENSE21
-rw-r--r--vendor/github.com/sid77/drop/README.md22
-rw-r--r--vendor/github.com/sid77/drop/drop.go35
-rw-r--r--vendor/github.com/sid77/drop/syscall/setre.go17
-rw-r--r--vendor/github.com/sid77/drop/syscall/setres.go17
5 files changed, 0 insertions, 112 deletions
diff --git a/vendor/github.com/sid77/drop/LICENSE b/vendor/github.com/sid77/drop/LICENSE
deleted file mode 100644
index 37004bf..0000000
--- a/vendor/github.com/sid77/drop/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016 Marco Bonetti
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/sid77/drop/README.md b/vendor/github.com/sid77/drop/README.md
deleted file mode 100644
index ef71e5f..0000000
--- a/vendor/github.com/sid77/drop/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# drop
-
-An easy way for dropping privileges in Go.
-
-
-```
-import "github.com/sid77/drop"
-
-// privileged code here
-// ...
-
-if err := drop.DropPrivileges("some user"); err != nil {
- log.Fatal(err)
-}
-
-// unprivileged code here
-// ...
-```
-
-drop will take care of calling `setre{s}[g,u]id()` depending on the platform it's being run on.
-
-Beware that if Go coroutines are created *before* dropping the program privileges, some of them may retain the original permissions. This is a [limitation of the Go runtime itself](https://github.com/golang/go/issues/1435).
diff --git a/vendor/github.com/sid77/drop/drop.go b/vendor/github.com/sid77/drop/drop.go
deleted file mode 100644
index 0fb64a9..0000000
--- a/vendor/github.com/sid77/drop/drop.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package drop
-
-import (
- "os/user"
- "strconv"
-
- "github.com/sid77/drop/syscall"
-)
-
-func DropPrivileges(runAsUser string) (err error) {
- usr, err := user.Lookup(runAsUser)
- if err != nil {
- return err
- }
-
- gid, err := strconv.Atoi(usr.Gid)
- if err != nil {
- return err
- }
-
- uid, err := strconv.Atoi(usr.Uid)
- if err != nil {
- return err
- }
-
- if err = syscall.Setgid(gid); err != nil {
- return err
- }
-
- if err = syscall.Setuid(uid); err != nil {
- return err
- }
-
- return nil
-}
diff --git a/vendor/github.com/sid77/drop/syscall/setre.go b/vendor/github.com/sid77/drop/syscall/setre.go
deleted file mode 100644
index ecf5ea9..0000000
--- a/vendor/github.com/sid77/drop/syscall/setre.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +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
deleted file mode 100644
index afe43b9..0000000
--- a/vendor/github.com/sid77/drop/syscall/setres.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +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
-}