paths: remove wasm file, no-op stubs, make OS-specific funcs consistent
Some OS-specific funcs were defined in init. Another used build tags and required all other OSes to stub it out. Another one could just be in the portable file. Simplify it a bit, removing a file and some stubs in the process. Updates #5794 Change-Id: I51df8772cc60a9335ac4c1dc0ab59b8a0d236961 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
d58ba59fd5
commit
a5dcc4c87b
@@ -12,7 +12,11 @@ import (
|
||||
"tailscale.com/util/winutil"
|
||||
)
|
||||
|
||||
// ensureStateDirPerms applies a restrictive ACL to the directory specified by dirPath.
|
||||
func init() {
|
||||
ensureStateDirPerms = ensureStateDirPermsWindows
|
||||
}
|
||||
|
||||
// ensureStateDirPermsWindows applies a restrictive ACL to the directory specified by dirPath.
|
||||
// It sets the following security attributes on the directory:
|
||||
// Owner: The user for the current process;
|
||||
// Primary Group: The primary group for the current process;
|
||||
@@ -26,7 +30,7 @@ import (
|
||||
//
|
||||
// However, any directories and/or files created within this
|
||||
// directory *do* inherit the ACL that we are setting.
|
||||
func ensureStateDirPerms(dirPath string) error {
|
||||
func ensureStateDirPermsWindows(dirPath string) error {
|
||||
fi, err := os.Stat(dirPath)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -94,9 +98,3 @@ func ensureStateDirPerms(dirPath string) error {
|
||||
return windows.SetNamedSecurityInfo(dirPath, windows.SE_FILE_OBJECT, flags,
|
||||
sids.User, sids.PrimaryGroup, dacl, nil)
|
||||
}
|
||||
|
||||
// LegacyStateFilePath returns the legacy path to the state file when it was stored under the
|
||||
// current user's %LocalAppData%.
|
||||
func LegacyStateFilePath() string {
|
||||
return filepath.Join(os.Getenv("LocalAppData"), "Tailscale", "server-state.conf")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user