sameuser: log the uid/remoteUID when they are not matching (#2535)

Updates https://github.com/golang/vscode-go/issues/1555
This commit is contained in:
Hyang-Ah Hana Kim
2021-06-15 09:36:39 -04:00
committed by GitHub
parent 688f94a4f8
commit 1ecdb3be05

View File

@ -1,4 +1,5 @@
//+build linux //go:build linux
// +build linux
package sameuser package sameuser
@ -56,7 +57,11 @@ func sameUserForHexLocalAddr(filename, hexaddr string) (bool, error) {
if localAddr != hexaddr { if localAddr != hexaddr {
continue continue
} }
return uid == int(remoteUID), nil same := uid == int(remoteUID)
if !same && logflags.Any() {
log.Printf("connection from different user (remote: %d, local: %d) detected: %v", remoteUID, uid, line)
}
return same, nil
} }
return false, &errConnectionNotFound{filename} return false, &errConnectionNotFound{filename}
} }