From nobody Tue May 13 18:52:30 2025 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534266508139666.228185743136; Tue, 14 Aug 2018 10:08:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12135F0CF3; Tue, 14 Aug 2018 17:08:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D0CAE17C00; Tue, 14 Aug 2018 17:08:25 +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 6ED7B38B7; Tue, 14 Aug 2018 17:08:25 +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 w7EH80YG003289 for ; Tue, 14 Aug 2018 13:08:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02C1F17C00; Tue, 14 Aug 2018 17:08:00 +0000 (UTC) Received: from unknown4CEB42C824F4.redhat.com (ovpn-116-168.phx2.redhat.com [10.3.116.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1DEF5D9C5 for ; Tue, 14 Aug 2018 17:07:59 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 14 Aug 2018 13:07:49 -0400 Message-Id: <20180814170756.19205-5-jferlan@redhat.com> In-Reply-To: <20180814170756.19205-1-jferlan@redhat.com> References: <20180814170756.19205-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/11] util: Alter virAuthGet*Path API return processing 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 14 Aug 2018 17:08:26 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If we never find the valid credtype in the list, then we'd return NULL without an error signaled forcing the caller to generate one that will probably be incorrect. Let's be specific. Signed-off-by: John Ferlan --- src/util/virauth.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/util/virauth.c b/src/util/virauth.c index a04abb613b..d706658135 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -191,10 +191,12 @@ virAuthGetUsernamePath(const char *path, if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) VIR_FREE(cred.result); =20 - break; + return cred.result; } =20 - return cred.result; + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Missing VIR_CRED_AUTHNAME credential type")); + return NULL; } =20 =20 @@ -267,10 +269,13 @@ virAuthGetPasswordPath(const char *path, if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) VIR_FREE(cred.result); =20 - break; + return cred.result; } =20 - return cred.result; + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Missing VIR_CRED_PASSPHRASE or VIR_CRED_NOECHOPROMPT= " + "credential type")); + return NULL; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list