From nobody Fri May 3 21:15:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500673644401294.4207257672816; Fri, 21 Jul 2017 14:47:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 104805AFC9; Fri, 21 Jul 2017 21:47:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1575117485; Fri, 21 Jul 2017 21:47:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E48CB1805979; Fri, 21 Jul 2017 21:47:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6LLlDZa006870 for ; Fri, 21 Jul 2017 17:47:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DD7B5C3FD; Fri, 21 Jul 2017 21:47:13 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-46.phx2.redhat.com [10.3.117.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94D8877539 for ; Fri, 21 Jul 2017 21:47:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 104805AFC9 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 104805AFC9 From: John Ferlan To: libvir-list@redhat.com Date: Fri, 21 Jul 2017 17:47:08 -0400 Message-Id: <20170721214708.24550-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Fix bug assuming usage of default UUID for certificate passphrase X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Jul 2017 21:47:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If an environment specific _tls_x509_cert_dir is provided, then do not VIR_STRDUP the defaultTLSx509secretUUID as that would be for the "default" environment and not the vnc, spice, chardev, or migrate environments. If the environment needs a secret to decode it's certificate, then it must provide the secret. If the secrets happen to be the same, then configuration would use the same UUID as the default (but we cannot assume that nor can we assume that the secret would be necessary). Signed-off-by: John Ferlan --- While responding to a different patch today regarding Veritas and usage of a default environment w/ or w/o secrets I realized that the existing logic has a flaw in "assuming" that someone would want to use the default secret. What if they defined their own environment without a secret? Then the code would create a secret object to pass to QEMU which would think it needs to use it to decode the server certificate (but it doesn't), so it would seemingly fail the start. I assume based on the lack of complaints about this that everyone just uses the default environment! src/qemu/qemu_conf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index c4714ed..a7a2aaa 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -526,14 +526,18 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, goto cleanup; = \ if (rv =3D=3D 0) = \ cfg->val## TLSx509verify =3D cfg->defaultTLSx509verify; = \ - if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", = \ - &cfg->val## TLSx509certdir) < 0) = \ + if ((rv =3D virConfGetValueString(conf, #val "_tls_x509_cert_dir",= \ + &cfg->val## TLSx509certdir)) < 0) = \ goto cleanup; = \ if (virConfGetValueString(conf, = \ #val "_tls_x509_secret_uuid", = \ &cfg->val## TLSx509secretUUID) < 0) = \ goto cleanup; = \ - if (!cfg->val## TLSx509secretUUID && = \ + /* Only if a *tls_x509_cert_dir wasn't found (e.g. rv =3D=3D 0), s= hould \ + * we copy the defaultTLSx509secretUUID. If this environment needs= \ + * a passphrase to decode the certificate, then it should provide = \ + * it's own secretUUID for that. */ = \ + if (rv =3D=3D 0 && !cfg->val## TLSx509secretUUID && = \ cfg->defaultTLSx509secretUUID) { = \ if (VIR_STRDUP(cfg->val## TLSx509secretUUID, = \ cfg->defaultTLSx509secretUUID) < 0) = \ --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list