mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
ssh/tailssh: add Plan 9 support for Tailscale SSH
Updates #5794 Change-Id: I7b05cd29ec02085cb503bbcd0beb61bf455002ac Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
6f75647c0e
commit
b3953ce0c4
@@ -19,6 +19,10 @@ import (
|
||||
// an error. It will first try to use the 'id' command to get the group IDs,
|
||||
// and if that fails, it will fall back to the user.GroupIds method.
|
||||
func GetGroupIds(user *user.User) ([]string, error) {
|
||||
if runtime.GOOS == "plan9" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if runtime.GOOS != "linux" {
|
||||
return user.GroupIds()
|
||||
}
|
||||
|
@@ -54,9 +54,18 @@ func lookup(usernameOrUID string, std lookupStd, wantShell bool) (*user.User, st
|
||||
// Skip getent entirely on Non-Unix platforms that won't ever have it.
|
||||
// (Using HasPrefix for "wasip1", anticipating that WASI support will
|
||||
// move beyond "preview 1" some day.)
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "js" || runtime.GOARCH == "wasm" {
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "js" || runtime.GOARCH == "wasm" || runtime.GOOS == "plan9" {
|
||||
var shell string
|
||||
if wantShell && runtime.GOOS == "plan9" {
|
||||
shell = "/bin/rc"
|
||||
}
|
||||
if runtime.GOOS == "plan9" {
|
||||
if u, err := user.Current(); err == nil {
|
||||
return u, shell, nil
|
||||
}
|
||||
}
|
||||
u, err := std(usernameOrUID)
|
||||
return u, "", err
|
||||
return u, shell, err
|
||||
}
|
||||
|
||||
// No getent on Gokrazy. So hard-code the login shell.
|
||||
@@ -78,6 +87,16 @@ func lookup(usernameOrUID string, std lookupStd, wantShell bool) (*user.User, st
|
||||
return u, shell, nil
|
||||
}
|
||||
|
||||
if runtime.GOOS == "plan9" {
|
||||
return &user.User{
|
||||
Uid: "0",
|
||||
Gid: "0",
|
||||
Username: "glenda",
|
||||
Name: "Glenda",
|
||||
HomeDir: "/",
|
||||
}, "/bin/rc", nil
|
||||
}
|
||||
|
||||
// Start with getent if caller wants to get the user shell.
|
||||
if wantShell {
|
||||
return userLookupGetent(usernameOrUID, std)
|
||||
|
Reference in New Issue
Block a user