]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
login: fix ReleaseSession.Id dispatch flag in io.systemd.Login Varlink handler
authornoxiouz <atiurin@proton.me>
Mon, 2 Mar 2026 10:04:37 +0000 (10:04 +0000)
committernoxiouz <atiurin@proton.me>
Mon, 2 Mar 2026 10:06:39 +0000 (10:06 +0000)
The ReleaseSession method's Id field is declared as nullable (?string) in
the IDL, allowing callers to omit it so that the method releases the
caller's own session via session_is_self(NULL). The SD_JSON_MANDATORY flag
in the dispatch table contradicts this and makes omitting Id return -EINVAL
("Invalid argument", parameter "Id") instead.

Drop the flag so omitting Id is treated as passing NULL.

Fixes: 2baca6c22b2d75b8ba2d0bd8a9e7f4a8579752ed
src/login/logind-varlink.c

index a1fdac01c907b96ddcca62a8955467cf53a57ee1..ae2e32d3fafa132b42e6caa5d25b6312af65c333 100644 (file)
@@ -308,7 +308,7 @@ static int vl_method_release_session(sd_varlink *link, sd_json_variant *paramete
         } p;
 
         static const sd_json_dispatch_field dispatch_table[] = {
-                { "Id", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, voffsetof(p, id), SD_JSON_MANDATORY },
+                { "Id", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, voffsetof(p, id), 0 },
                 {}
         };