aboutsummaryrefslogtreecommitdiff
path: root/git_hooks.go
diff options
context:
space:
mode:
Diffstat (limited to 'git_hooks.go')
-rw-r--r--git_hooks.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/git_hooks.go b/git_hooks.go
deleted file mode 100644
index 86300cb..0000000
--- a/git_hooks.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package main
-
-import (
- "errors"
- "fmt"
- "net"
- "os"
- "syscall"
-)
-
-var err_not_unixconn = errors.New("Not a unix connection")
-
-func hooks_handle_connection(conn net.Conn) (err error) {
- defer conn.Close()
-
- unix_conn, ok := conn.(*net.UnixConn)
- if !ok {
- return err_not_unixconn
- }
-
- fd, err := unix_conn.File()
- if err != nil {
- return err
- }
- defer fd.Close()
-
- ucred, err := get_ucred(fd)
- if err != nil {
- return err
- }
-
- pid := ucred.Pid
-
- _ = pid
-
- return nil
-}
-
-func get_ucred(fd *os.File) (*syscall.Ucred, error) {
- ucred, err := syscall.GetsockoptUcred(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
- if err != nil {
- return nil, fmt.Errorf("failed to get credentials: %v", err)
- }
- return ucred, nil
-}