From nobody Mon Feb 9 05:59:05 2026 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533256110882546.3651195572655; Thu, 2 Aug 2018 17:28:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E3BC8CA9; Fri, 3 Aug 2018 00:28:28 +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 C76411691A; Fri, 3 Aug 2018 00:28: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 EE5A44A460; Fri, 3 Aug 2018 00:28:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w730SLT1008734 for ; Thu, 2 Aug 2018 20:28:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id B857AD3CD3; Fri, 3 Aug 2018 00:28:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1B38D3CF0 for ; Fri, 3 Aug 2018 00:28:20 +0000 (UTC) Received: from mail-qt0-f176.google.com (mail-qt0-f176.google.com [209.85.216.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38B933082148 for ; Fri, 3 Aug 2018 00:28:19 +0000 (UTC) Received: by mail-qt0-f176.google.com with SMTP id z8-v6so4398259qto.9 for ; Thu, 02 Aug 2018 17:28:19 -0700 (PDT) Received: from bebop.8.8.8.8 ([2804:7f5:d180:27f9:da3e:68ff:d0f:a057]) by smtp.gmail.com with ESMTPSA id l188-v6sm1497519qke.83.2018.08.02.17.28.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Aug 2018 17:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hxFcl9KsRAlKevkYFzNC4nIDgGBF1L+ltsVtxRwQyb0=; b=rq2/dIU9oHA0vvNv5OVSk6OG+1P9/KMu+Nea12buKWhOG/BsGeo7EiqDLm+dZEJpCN pjX3l29zt3nV7Reg7XJOMvRZWUfwUF0ogSPWpzfEaBfeuwMkPGJQ9A87h989kp0CM/xu aQoukzP/hBq6TWfFSkI/dWpo9hxbtOByUfXC8rHllzVXr/6EQa+XCRmkwfSKMkXBvpXD MzJfoNzbf6DwGQU2Cxda+CCwCyxbMBX0HXT0c8IkdXERFLDau3al8eBvE6n4pqz6Pz86 PbCBqYsAR8Y7VsVBthskGOAPZxh+fHPTQpIttXXIiDTeXC1pUeBUdLx/vfnGvtuT7TE7 0svA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hxFcl9KsRAlKevkYFzNC4nIDgGBF1L+ltsVtxRwQyb0=; b=ZUnSn3+HIVU9oRUYcQFtVPICwGkmwcnkzyXDj5NKm1Cmz4TVQHpJ6WxQTOhmPg1v4R 3vUeb/QyYF4bJqKWawKrIrx4Mp1S7/27i4K1cCeE/UQKQ/2WMA+6KUuUSmKFRVO8fz1R J0eAqdMVkVR6vaFUugotDLlO5sLZ+sQxgy2hWVmL5i+tU6irIsWAB7LCvmtaS6LbnCU6 e6eet3arE+eAOLHRQMNMVTzF5yVe7h7I3wui/Cm39rxsNcg+hD9pTacsvOnyK0E+0hUk dtGVmG6rObBJfoeZG2BliTFEp1HPl97x31HTGt0sadrr9OyNjphtYl5b6h8B4tqdlwWr 5LHg== X-Gm-Message-State: AOUpUlGw/O73+JJfwE6nkqRYUejzXnaWLQZVGQDMnN3v5DMHAFYHZ3GT D/Och9xxHnXaur4UKbj+2lMPeMVG X-Google-Smtp-Source: AAOMgpe/yfJ0dHKeRSRowm30wHWASum+eK+n7FPhEjDnCH1Qq3mOl8QTapnAVVqZa6ZSwt26xY7ptQ== X-Received: by 2002:ac8:2fa1:: with SMTP id l30-v6mr1799754qta.150.1533256097985; Thu, 02 Aug 2018 17:28:17 -0700 (PDT) From: Marcos Paulo de Souza To: libvir-list@redhat.com Date: Thu, 2 Aug 2018 21:27:51 -0300 Message-Id: <20180803002755.7269-2-marcos.souza.org@gmail.com> In-Reply-To: <20180803002755.7269-1-marcos.souza.org@gmail.com> References: <20180803002755.7269-1-marcos.souza.org@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 03 Aug 2018 00:28:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 03 Aug 2018 00:28:19 +0000 (UTC) for IP:'209.85.216.176' DOMAIN:'mail-qt0-f176.google.com' HELO:'mail-qt0-f176.google.com' FROM:'marcos.souza.org@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.176 mail-qt0-f176.google.com 209.85.216.176 mail-qt0-f176.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: Marcos Paulo de Souza Subject: [libvirt] [PATCH 1/5] virauth.c: Check for valid auth callback 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 03 Aug 2018 00:28:28 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of adding the same check for every drivers, execute the checks in virAuthGetUsername and virAuthGetPassword. These funtions are called when user is not set in the URI. Signed-off-by: Marcos Paulo de Souza --- src/util/virauth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/virauth.c b/src/util/virauth.c index 8c450b6b31..759b8f0cd3 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -198,6 +198,12 @@ virAuthGetUsername(virConnectPtr conn, if (virAuthGetConfigFilePath(conn, &path) < 0) return NULL; =20 + if (!auth || !auth->cb) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Missing or invalid auth pointer")); + return NULL; + } + return virAuthGetUsernamePath(path, auth, servicename, defaultUsername, hostname); } @@ -262,5 +268,11 @@ virAuthGetPassword(virConnectPtr conn, if (virAuthGetConfigFilePath(conn, &path) < 0) return NULL; =20 + if (!auth || !auth->cb) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Missing or invalid auth pointer")); + return NULL; + } + return virAuthGetPasswordPath(path, auth, servicename, username, hostn= ame); } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list