ipn/desktop: skip the extension when sessions can't be enumerated

Registering the session state callback enumerates the existing desktop
sessions, which fails for a tailscaled run by an unprivileged user
(WTSEnumerateSessions returns "No more data is available"). That was
reported as "init failed", which reads like a bug. Such a tailscaled has
no other users' sessions to track, so report it as skipping the extension,
the same way an unavailable session manager already is.

Updates #2791

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I7f9b1d3e5a7c9e1b3d5f7a9c1e3b5d7f9a1c3e5b
This commit is contained in:
Brad Fitzpatrick authored and Brad Fitzpatrick committed 2026-09-24 11:51:51 -07:00
1 parent 9020fdcd8a
commit 6612bed24d
1 file changed
+5 -1
+5 -1
View File
@@ -101,7 +101,11 @@ func (e *desktopSessionsExt) Init(host ipnext.Host) (err error) {
e.host = host
unregisterSessionCb, err := e.sm.RegisterStateCallback(e.updateDesktopSessionState)
if err != nil {
return fmt.Errorf("session callback registration failed: %w", err)
// Registering the callback enumerates the existing desktop
// sessions, which fails for a tailscaled run by an unprivileged
// user. That is not an error worth alarming about: such a
// tailscaled has no other users' sessions to track anyway.
return fmt.Errorf("%w: session callback registration failed: %w", ipnext.SkipExtension, err)
}
unregisterPolicyCb, err := e.sm.RegisterInitCallback(e.initUserPolicyStore)
if err != nil {