mirror of
https://github.com/rwinkhart/peercred-mini.git
synced 2026-08-28 04:46:43 -04:00
Rename creds.UserID() to creds.UID()
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
Tailscale Inc
|
Original: Tailscale Inc
|
||||||
|
Minimized version w/FreeBSD PID support: Randall Winkhart
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021 AUTHORS All rights reserved.
|
// Copyright (c) 2021-2024 AUTHORS All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -16,14 +16,14 @@ type Creds struct {
|
|||||||
uid string
|
uid string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PID returns the process ID associated with the other side of the connection.
|
||||||
func (c *Creds) PID() (pid int) {
|
func (c *Creds) PID() (pid int) {
|
||||||
return c.pid
|
return c.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserID returns the userid (or Windows SID) that owns the other side
|
// UID returns the userid (or Windows SID) that owns the other side of the connection.
|
||||||
// of the connection.
|
|
||||||
// The returned string is suitable to passing to os/user.LookupId.
|
// The returned string is suitable to passing to os/user.LookupId.
|
||||||
func (c *Creds) UserID() (uid string) {
|
func (c *Creds) UID() (uid string) {
|
||||||
return c.uid
|
return c.uid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func TestUnixSock(t *testing.T) {
|
|||||||
t.Fatalf("Get: %v", err)
|
t.Fatalf("Get: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
uid := creds.UserID()
|
uid := creds.UID()
|
||||||
if uid == "" {
|
if uid == "" {
|
||||||
t.Errorf("no UID")
|
t.Errorf("no UID")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user