]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine: validate root directory over varlink
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 13 Sep 2025 00:28:24 +0000 (01:28 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 7 Oct 2025 09:48:58 +0000 (11:48 +0200)
Use strict validation to reject invalid directories as the D-Bus
API already does

Follow-up for 5b44c81ff868a4d1b78a74e4770f7a8b2f1d0f91

(cherry picked from commit 44e3c4c8bc031706a236acf9a8d6e5e7c5e2fd0a)

src/machine/machine-varlink.c

index 0566cb8bbae277638a83d47f9863e2f794523e95..6d7215d45dd942106642ad8e85fa82e4ab906772 100644 (file)
@@ -133,7 +133,7 @@ int vl_method_register(sd_varlink *link, sd_json_variant *parameters, sd_varlink
                 { "class",             SD_JSON_VARIANT_STRING,        dispatch_machine_class,   offsetof(Machine, class),                SD_JSON_MANDATORY },
                 { "leader",            _SD_JSON_VARIANT_TYPE_INVALID, machine_leader,           offsetof(Machine, leader),               SD_JSON_STRICT    },
                 { "leaderProcessId",   SD_JSON_VARIANT_OBJECT,        machine_leader,           offsetof(Machine, leader),               SD_JSON_STRICT    },
-                { "rootDirectory",     SD_JSON_VARIANT_STRING,        json_dispatch_path,       offsetof(Machine, root_directory),       0                 },
+                { "rootDirectory",     SD_JSON_VARIANT_STRING,        json_dispatch_path,       offsetof(Machine, root_directory),       SD_JSON_STRICT    },
                 { "ifIndices",         SD_JSON_VARIANT_ARRAY,         machine_ifindices,        0,                                       0                 },
                 { "vSockCid",          _SD_JSON_VARIANT_TYPE_INVALID, machine_cid,              offsetof(Machine, vsock_cid),            0                 },
                 { "sshAddress",        SD_JSON_VARIANT_STRING,        sd_json_dispatch_string,  offsetof(Machine, ssh_address),          SD_JSON_STRICT    },