From nobody Mon May 6 02:26:18 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; dkim=fail; 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 151574832120383.94187751966933; Fri, 12 Jan 2018 01:12:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3C2C3C28; Fri, 12 Jan 2018 09:11:58 +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 367106A97D; Fri, 12 Jan 2018 09:11:57 +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 9904318033D9; Fri, 12 Jan 2018 09:11:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0C9BqOL020032 for ; Fri, 12 Jan 2018 04:11:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A75E7555F; Fri, 12 Jan 2018 09:11:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92A3E75556 for ; Fri, 12 Jan 2018 09:11:48 +0000 (UTC) Received: from m15-112.126.com (m15-112.126.com [220.181.15.112]) by mx1.redhat.com (Postfix) with ESMTP id AA5A374878 for ; Fri, 12 Jan 2018 09:11:37 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp2 (Coremail) with SMTP id DMmowADX52e4e1haYfmUAg--.27895S2; Fri, 12 Jan 2018 17:11:27 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=Rd4fIoSG3sCZQHl0u5 Ckm/1F0+jaG/GjgmZBKjGJZ+s=; b=qOTNJ0xo7feLJju27GE2GcmGdWS3I4BgYL V/RlXBJ6E7QPuuZqzXFGRO2TZ/YBIlewD6j4OLl6PXHY1nFDpRflezdXOFEOUk/P Vtm7nHaCfemoE7vmXXbqtjOWKDS6mG1xV3SPhJA5T9S8noqorEvc+kgK6Fqwa0jI 0UCQghumo= From: Chen Hanxiao To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 17:09:10 +0800 Message-Id: <20180112090910.32009-1-chen_han_xiao@126.com> X-CM-TRANSID: DMmowADX52e4e1haYfmUAg--.27895S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kw15Jr1rJr17Gr45uF45ZFb_yoW8ury3pF 9xCa4FkrW8JF1fArZ2ya4xJFy5Jr1kJr15WFsrua9rZr18CrWDCrsakryIgrWDJ3s5Aa1S 9F98CasY9w1kWr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UCYL9UUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbitADLrlpD4mQa1gAAsC X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 12 Jan 2018 09:11:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 12 Jan 2018 09:11:47 +0000 (UTC) for IP:'220.181.15.112' DOMAIN:'m15-112.126.com' HELO:'m15-112.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 1.99 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.112 m15-112.126.com 220.181.15.112 m15-112.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 12 Jan 2018 09:11:59 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao As the description of daemon/libvirtd.conf, setting key_file, cert_file or key_file will override the default value. But if we set any one of them, we need to set all the rest of them. This patch set default value to them as daemon/libvirtd.conf described. Signed-off-by: Chen Hanxiao --- daemon/libvirtd.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 6d3b83355..93983f63b 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -493,19 +493,28 @@ daemonSetupNetworking(virNetServerPtr srv, config->cert_file || config->key_file) { if (!config->ca_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No CA certificate path set to match = server key/cert")); - goto cleanup; + VIR_WARN("Using default path for ca_file"); + if (VIR_STRDUP(config->ca_file, LIBVIRT_CACERT) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No CA certificate path set to ma= tch server key/cert")); + goto cleanup; + } } if (!config->cert_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No server certificate path set to ma= tch server key")); - goto cleanup; + VIR_WARN("Using default path for cert_file"); + if (VIR_STRDUP(config->cert_file, LIBVIRT_SERVERCERT) = < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No server certificate path set t= o match server key")); + goto cleanup; + } } if (!config->key_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No server key path set to match serv= er cert")); - goto cleanup; + VIR_WARN("Using default path for key_file"); + if (VIR_STRDUP(config->key_file, LIBVIRT_SERVERKEY) < = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No server key path set to match = server cert")); + goto cleanup; + } } VIR_DEBUG("Using CA=3D'%s' cert=3D'%s' key=3D'%s'", config->ca_file, config->cert_file, config->key_= file); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list