From: Daan De Meyer Date: Tue, 21 Oct 2025 19:38:18 +0000 (+0200) Subject: vmspawn: Use machine_credential_add() X-Git-Tag: v259-rc1~262^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac0a248ee63ec049c53a220767ad5f10f1d2c6df;p=thirdparty%2Fsystemd.git vmspawn: Use machine_credential_add() --- diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c index c6d52cccb7f..735d733f245 100644 --- a/src/vmspawn/vmspawn.c +++ b/src/vmspawn/vmspawn.c @@ -2441,7 +2441,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { } if (arg_forward_journal) { - _cleanup_free_ char *listen_address = NULL, *cred = NULL; + _cleanup_free_ char *listen_address = NULL; if (!GREEDY_REALLOC(children, n_children + 1)) return log_oom(); @@ -2459,11 +2459,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { pidref_done(&child); children[n_children++] = TAKE_PTR(source); - cred = strjoin("journal.forward_to_socket:", listen_address); - if (!cred) - return log_oom(); - - r = machine_credential_set(&arg_credentials, cred); + r = machine_credential_add(&arg_credentials, "journal.forward_to_socket", listen_address, SIZE_MAX); if (r < 0) return r; } @@ -2509,13 +2505,14 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { /* on distros that provide their own sshd@.service file we need to provide a dropin which * picks up our public key credential */ - r = machine_credential_set( + r = machine_credential_add( &arg_credentials, - "systemd.unit-dropin.sshd-vsock@.service:" + "systemd.unit-dropin.sshd-vsock@.service", "[Service]\n" "ExecStart=\n" "ExecStart=-sshd -i -o 'AuthorizedKeysFile=%d/ssh.ephemeral-authorized_keys-all .ssh/authorized_keys'\n" - "ImportCredential=ssh.ephemeral-authorized_keys-all\n"); + "ImportCredential=ssh.ephemeral-authorized_keys-all\n", + SIZE_MAX); if (r < 0) return log_error_errno(r, "Failed to set credential systemd.unit-dropin.sshd-vsock@.service: %m"); }