From 94868f6bad507de95e29aaa302f8845ac6471d34 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 5 Apr 2025 15:28:52 -0400 Subject: [PATCH] Bump peercred-mini --- daemon/2server.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/daemon/2server.go b/daemon/2server.go index efc3935..ba94a03 100644 --- a/daemon/2server.go +++ b/daemon/2server.go @@ -83,15 +83,15 @@ func handleConn(conn net.Conn) { ucred := peercred.Get(conn) // check if the RPC call is coming from an identical binary and from the same user - callingBinPath := pidToPath(ucred.PID()) - if ucred.UserID() == strconv.Itoa(os.Getuid()) && bytes.Equal(getFileHash(callingBinPath), daemonHash) { + callingBinPath := pidToPath(ucred.PID) + if ucred.UID == strconv.Itoa(os.Getuid()) && bytes.Equal(getFileHash(callingBinPath), daemonHash) { // valid client; hand off the connection to the RPC server rpc.ServeConn(conn) } else { // invalid client; close the connection w/o a response, // log the client's path, and kill the daemon conn.Close() - log.Printf("Request received from invalid client: PID(%d), UID(%s), Path(%s)", ucred.PID(), ucred.UserID(), callingBinPath) // TODO log to file + log.Printf("Request received from invalid client: PID(%d), UID(%s), Path(%s)", ucred.PID, ucred.UID, callingBinPath) // TODO log to file os.Exit(2) } } diff --git a/go.mod b/go.mod index 1fb8558..065378a 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module rcw go 1.24.2 -require github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d +require github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41 require github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032 // indirect diff --git a/go.sum b/go.sum index 8f7891a..a316f87 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d h1:Uio9uhJuKLp8+c/C3TUrsC9Vd93hBK5oRcm2+o8+DvI= -github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d/go.mod h1:cH3916WNofkve4MeeK56H0whuUUVf57iYht3nsUyEh8= +github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41 h1:wUMbTEwPIf6bqLCAUmJ58uuYu6OX0iGa6S6NjYUXGPA= +github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41/go.mod h1:cH3916WNofkve4MeeK56H0whuUUVf57iYht3nsUyEh8= github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032 h1:4qzc09ysQhkyI2oN7pLbZMQP+qHq2TlVRCkMSmbl8m8= github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032/go.mod h1:U89aT1yaUAbs+9Dp9i1lZ2+5GsRNYk0l42+d1wykDBA=