version: make IsSandboxedMacOS handle the IPNExtension binary too

It was previously only invoked from the CLI, which only runs from the
main .app. However, starting with #6022 we also invoke it from the
network extension.

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita 2022-11-15 16:55:27 -08:00 committed by Mihai Parparita
parent 235309adc4
commit 6d48a54b3d

View File

@ -31,8 +31,9 @@ func OS() string {
} }
// IsSandboxedMacOS reports whether this process is a sandboxed macOS // IsSandboxedMacOS reports whether this process is a sandboxed macOS
// process. It is true for the Mac App Store and macsys (System // process (either the app or the extension). It is true for the Mac App Store
// Extension) version on macOS, and false for tailscaled-on-macOS. // and macsys (System Extension) version on macOS, and false for
// tailscaled-on-macOS.
func IsSandboxedMacOS() bool { func IsSandboxedMacOS() bool {
if runtime.GOOS != "darwin" { if runtime.GOOS != "darwin" {
return false return false
@ -41,7 +42,7 @@ func IsSandboxedMacOS() bool {
return true return true
} }
exe, _ := os.Executable() exe, _ := os.Executable()
return strings.HasSuffix(exe, "/Contents/MacOS/Tailscale") return strings.HasSuffix(exe, "/Contents/MacOS/Tailscale") || strings.HasSuffix(exe, "/Contents/MacOS/IPNExtension")
} }
var isMacSysExt syncs.AtomicValue[bool] var isMacSysExt syncs.AtomicValue[bool]