From nobody Mon Feb 9 16:00:59 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=quarantine dis=quarantine) header.from=openvz.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17107531616921023.4913659204113; Mon, 18 Mar 2024 02:12:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 576991EC5; Mon, 18 Mar 2024 05:12:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 002151D23; Mon, 18 Mar 2024 05:03:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4777A1AA2; Sun, 17 Mar 2024 13:08:55 -0400 (EDT) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 301E01A6D for ; Sun, 17 Mar 2024 13:08:53 -0400 (EDT) Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=iris.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1rlty9-005kua-1D; Sun, 17 Mar 2024 18:08:44 +0100 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: "Denis V. Lunev" To: devel@lists.libvirt.org Subject: [PATCH 2/2] remote: properly initialize objects in ACL helpers Date: Sun, 17 Mar 2024 18:08:50 +0100 Message-Id: <20240317170850.61932-3-den@openvz.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240317170850.61932-1-den@openvz.org> References: <20240317170850.61932-1-den@openvz.org> MIME-Version: 1.0 X-MailFrom: den@openvz.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: Q3FOID6AZDE7LXD7B7VKQNB5XMPWMT3R X-Message-ID-Hash: Q3FOID6AZDE7LXD7B7VKQNB5XMPWMT3R X-Mailman-Approved-At: Mon, 18 Mar 2024 09:03:03 -0400 CC: den@openvz.org, Peter Krempa , Roman Grigoriev X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710753163446100001 Commit 2ecdf259299813c2c674377e22a0acbce5ccbbb2 is idealogically corrent, but unfortunately is incomplete. There are other similar objects in the module which are used also without proper initialization. This patch adds proper clauses to remoteRelayNetworkEventCheckACL remoteRelayStoragePoolEventCheckACL remoteRelayNodeDeviceEventCheckACL remoteRelaySecretEventCheckACL Signed-off-by: Denis V. Lunev CC: Peter Krempa CC: Roman Grigoriev --- src/remote/remote_daemon_dispatch.c | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 3172a632df..01f97bb345 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -180,21 +180,21 @@ static bool remoteRelayNetworkEventCheckACL(virNetServerClient *client, virConnectPtr conn, virNetworkPtr net) { - virNetworkDef def; + g_autoptr(virNetworkDef) def =3D g_new0(virNetworkDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; =20 /* For now, we just create a virNetworkDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - def.name =3D net->name; - memcpy(def.uuid, net->uuid, VIR_UUID_BUFLEN); + def->name =3D g_strdup(net->name); + memcpy(def->uuid, net->uuid, VIR_UUID_BUFLEN); =20 if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectNetworkEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectNetworkEventRegisterAnyCheckACL(conn, def); =20 cleanup: ignore_value(virIdentitySetCurrent(NULL)); @@ -206,21 +206,21 @@ remoteRelayStoragePoolEventCheckACL(virNetServerClien= t *client, virConnectPtr conn, virStoragePoolPtr pool) { - virStoragePoolDef def; + g_autoptr(virStoragePoolDef) def =3D g_new0(virStoragePoolDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; =20 /* For now, we just create a virStoragePoolDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - def.name =3D pool->name; - memcpy(def.uuid, pool->uuid, VIR_UUID_BUFLEN); + def->name =3D g_strdup(pool->name); + memcpy(def->uuid, pool->uuid, VIR_UUID_BUFLEN); =20 if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectStoragePoolEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectStoragePoolEventRegisterAnyCheckACL(conn, def); =20 cleanup: ignore_value(virIdentitySetCurrent(NULL)); @@ -232,20 +232,20 @@ remoteRelayNodeDeviceEventCheckACL(virNetServerClient= *client, virConnectPtr conn, virNodeDevicePtr dev) { - virNodeDeviceDef def; + g_autoptr(virNodeDeviceDef) def =3D g_new0(virNodeDeviceDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; =20 /* For now, we just create a virNodeDeviceDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - def.name =3D dev->name; + def->name =3D g_strdup(dev->name); =20 if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectNodeDeviceEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectNodeDeviceEventRegisterAnyCheckACL(conn, def); =20 cleanup: ignore_value(virIdentitySetCurrent(NULL)); @@ -257,22 +257,22 @@ remoteRelaySecretEventCheckACL(virNetServerClient *cl= ient, virConnectPtr conn, virSecretPtr secret) { - virSecretDef def; + g_autoptr(virSecretDef) def =3D g_new0(virSecretDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; =20 /* For now, we just create a virSecretDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - memcpy(def.uuid, secret->uuid, VIR_UUID_BUFLEN); - def.usage_type =3D secret->usageType; - def.usage_id =3D secret->usageID; + memcpy(def->uuid, secret->uuid, VIR_UUID_BUFLEN); + def->usage_type =3D secret->usageType; + def->usage_id =3D secret->usageID; =20 if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectSecretEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectSecretEventRegisterAnyCheckACL(conn, def); =20 cleanup: ignore_value(virIdentitySetCurrent(NULL)); --=20 2.40.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org