From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509830; cv=none; d=zoho.com; s=zohoarc; b=ExjgX3EeQzUu6BkzwS14nyOINoKf0xG16hdspWEtd4qrBti5CFnimCmsDkmtE5DoRidQBLio2pt7R5nUUtdhRy5zZ8NK3PTjvmq8+Ct+b2ah84KX4MTp8LvIZGnueRdW53JUvQo4JoDueWFNjyTJ9FY0FZC6lsPcHQbEwMRbyiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509830; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XfkS25qkO5UOxwyPPbis0jc6TVy8NR2jRng5jwAwnjM=; b=alyiMTAXSs9VWZJeF3vH3hfuFJex2raoRPTxv/zFqvfVv/iNdagJ5LgzVCmbWl0ytzOljyGmc+9BrUXIsxmkYi1+ow2lKnS6qk4l+hPvPnV5414UT2CeV7RZylQC9naE+pQKLsIuk61wZn5NusNz3DdDYTGN9SOcTjC162PQ6Fo= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509830867369.24040189412347; Thu, 26 Sep 2019 07:57:10 -0700 (PDT) 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 1C34210CC1F1; Thu, 26 Sep 2019 14:57:09 +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 ECD8260A35; Thu, 26 Sep 2019 14:57:06 +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 D90BE1803518; Thu, 26 Sep 2019 14:57:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEv3WZ028774 for ; Thu, 26 Sep 2019 10:57:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 681D360A9F; Thu, 26 Sep 2019 14:57:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 463E66092D; Thu, 26 Sep 2019 14:57:03 +0000 (UTC) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 22E2551EE6; Thu, 26 Sep 2019 14:57:02 +0000 (UTC) Received: by mail-qt1-f181.google.com with SMTP id u22so3157744qtq.13; Thu, 26 Sep 2019 07:57:02 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:00 -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 :mime-version:content-transfer-encoding; bh=6zpK7rC8Ll6xDMXjr3hKNdT+ZyfxJnBgY7s2irdzrLI=; b=AH+Hv7d3ca/gXkIH/JbK5bgsrxspOfW6MN+oxdfbPlutffRwpbm+Xd6N7y0P1RBbAV jaKcbWUCLX3/wlgJSkh8+N88Aw8XvwcccBpXKrLxHClQY6aAZJRTcWp9AM8iaTJWjk5H ATAISPDNxGO7SXcSOoF/n51H7GNjuESoJNkQaCLltKG9HiotypYX12En3Ow5aaMZze/Q ZqyjZvYvGfQyk7yXL84+XNrlZAo7PMADe8ZjLx2fCq2P5vrXyMdJmYq/LAq/rFgaleIu Pu69yUrLOV5jwRHLLyYrtXJQ+5WVXXyOwW83XSrIClGtKZUR81jmZtz6vSdTXCImoXKi MQdg== 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:mime-version:content-transfer-encoding; bh=6zpK7rC8Ll6xDMXjr3hKNdT+ZyfxJnBgY7s2irdzrLI=; b=LRYmT1C0MifMrMT0rXbvoDg3hx6AHbY6MUD0yYjiCIMF6+JrUQT706U/fd18fsuyE6 6sW3HslU4ozDj4VHoB6bpjKKlZ1LqBclKRLMz3TaeP4Rro6/QUl5L1J/WwhfXNkXH8ph qT16tpW1uAv0NPz2GpMCWIUyoUhqQyEvtmjrc+Tbb48rEQoFRnon1KxGXcxhI7s6+xq6 QIvKhYMfreDtcwV1R9rAvV/eoH+4zHrpemL+Uo21XrF6FylL1CPhWUdnBYMdWsULtTMD nTU4M4+W1hPW/fxesTE//3fGkcu0Eo8swkaognInI+ybPs+o9gh7QBgOC/Yt/qb7e/Gq oxUA== X-Gm-Message-State: APjAAAVPhXpmF3Na/kC0ftv5rg8JM0w2UXUMZvwzYKgH6WEFqR3oHSas wpJY9K1tydLOOmI9eNN6nEjPDR7Y2EE= X-Google-Smtp-Source: APXvYqx9GCk3SHR3IuY03cikbiuUZVosys9IIdx3FmsqliFyyaSEpWBBL2u9gGWriB9GusL6EI7uJw== X-Received: by 2002:a0c:f712:: with SMTP id w18mr2992485qvn.244.1569509821283; Thu, 26 Sep 2019 07:57:01 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:36 -0300 Message-Id: <20190926145647.3478-2-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Sep 2019 14:57:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Sep 2019 14:57:02 +0000 (UTC) for IP:'209.85.160.181' DOMAIN:'mail-qt1-f181.google.com' HELO:'mail-qt1-f181.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.181 mail-qt1-f181.google.com 209.85.160.181 mail-qt1-f181.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 01/12] src/driver.c: add virConnectValidateURIPath() 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: , 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.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 26 Sep 2019 14:57:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The code to validate the URI path is repeated across several files. This patch creates a common validation code to be used across all of them. Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/driver.c | 26 ++++++++++++++++++++++++++ src/driver.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 31 insertions(+) diff --git a/src/driver.c b/src/driver.c index 5e8f68f6df..6b75622689 100644 --- a/src/driver.c +++ b/src/driver.c @@ -269,3 +269,29 @@ virSetConnectStorage(virConnectPtr conn) VIR_DEBUG("Override storage connection with %p", conn); return virThreadLocalSet(&connectStorage, conn); } + +bool +virConnectValidateURIPath(const char *uriPath, + const char *entityName, + bool privileged) +{ + if (privileged) { + if (STRNEQ(uriPath, "/system")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected %s URI path '%s', try " + "%s:///system"), + entityName, uriPath, entityName); + return false; + } + } else { + if (STRNEQ(uriPath, "/session")) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected %s URI path '%s', try " + "%s:///session"), + entityName, uriPath, entityName); + return false; + } + } + + return true; +} diff --git a/src/driver.h b/src/driver.h index f7d667a03c..68c0004d86 100644 --- a/src/driver.h +++ b/src/driver.h @@ -127,3 +127,7 @@ int virSetConnectNWFilter(virConnectPtr conn); int virSetConnectNodeDev(virConnectPtr conn); int virSetConnectSecret(virConnectPtr conn); int virSetConnectStorage(virConnectPtr conn); + +bool virConnectValidateURIPath(const char *uriPath, + const char *entityName, + bool privileged); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 287e63bffa..3668a531a4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1343,6 +1343,7 @@ virStreamClass; =20 =20 # driver.h +virConnectValidateURIPath; virGetConnectInterface; virGetConnectNetwork; virGetConnectNodeDev; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509851; cv=none; d=zoho.com; s=zohoarc; b=JBx0JP9EHHdBtS8c9M7Z2w5wD1Fu4MHjzIJavnLdnD0btI+7jTH5t+73XHoM95RJ8qW3XlUny0L+rffa2J8QDb782AVq0kpE1kV+iU2CKIo6HGdFdB1yoMca7gAbXMwPuhZRhH2UwhjijIFPdGS43o+URslMZR4eZILZzNunR0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509851; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wBMPq6dzqqEESTVtewBvR9uoxsELcKhivmIrw3ZzSLE=; b=JHix+qWZsl7qdrSl3oDbhjvYI1M8QpZcg73+fYiBdR4DuRvvbtmxptjmKXMKBCkx7VnfuKUz9+DvRJDr39fe/z9wt08TVdWcm5t9ZP4nMFls/omDcrG7On5VkE+kq5252fZMN1F3ng+S0H8FWxv9MQStBKXx/yO3oqX/kV9QbkM= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509851461154.08804249272066; Thu, 26 Sep 2019 07:57:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3F413082138; Thu, 26 Sep 2019 14:57:29 +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 8F8EE6012E; Thu, 26 Sep 2019 14:57:29 +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 58949206D0; Thu, 26 Sep 2019 14:57:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEv8dt028794 for ; Thu, 26 Sep 2019 10:57:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id D390F1C939; Thu, 26 Sep 2019 14:57:08 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61CB7196B2; Thu, 26 Sep 2019 14:57:04 +0000 (UTC) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 C1ABB306DBBB; Thu, 26 Sep 2019 14:57:03 +0000 (UTC) Received: by mail-qk1-f182.google.com with SMTP id y189so2031498qkc.3; Thu, 26 Sep 2019 07:57:03 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:02 -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 :mime-version:content-transfer-encoding; bh=X+NOx6HC2b3mekPEbdmC259c4dIepBAqtxfcGRibP/s=; b=YHbvjcUl6RYlzWRpz8P9YSfjnW6a92TkFmLufgcUnvr3xsR8ltWnlvVIpnBevqO41o 6swHL8ZNlQcg0L3sbIkBN5/PyYF2xxDfRvCCmf7NZgV7AjOHM/mRY/ODb7A0DHqBfvVU 4OZ+gVZmXrLgUCWyR9uMMZc2ZJyKzpujsR4nx3GJxqwLzocoCirMqbjjgsjAKYKpBBPQ aokei62FJdXl9S9v8mhE23FmSOk9DKIQqTtMYJkQaxtxWDTBagIU4bQENYniDqn7NsLe Eus6CumLnt9yD0mh0fyhkYI0wTBZg44sd/Ag4SxDIvALD1lzyeyDsAKvsXh4uQixQWMI PLBQ== 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:mime-version:content-transfer-encoding; bh=X+NOx6HC2b3mekPEbdmC259c4dIepBAqtxfcGRibP/s=; b=SxrAFtCDqxUjTDYSM/UefntiMZZE7hQKnTzNgU4dS+3ZwNQBQt2u4B4Xxm59TkZkkr 6iHkrNb4DF/iizmu2d8DCuJz7zd5QvXiYLdn86pGtxuGMCoNRAwWfLm/KSsw0uc8xuw9 dlhF8ZqQLymQ9/WAotBmyF7zhEaKrTWk2kBJEl8aUpI3k/dybSTYO4NplfajiG6gW5VD JHMJUa5g/u63pskjVic8InnbG0Md7kBN9f6yGvfiw9wLysGIGf1MHFIIYOOknyuyUiE7 fXrnMWhC0o+abq4ta7gtr8way5wjLEdGCU19x1xa9f8/Xgna2c7K0wsUncsbsxMMn+1h +eHA== X-Gm-Message-State: APjAAAXW+pI0KeZ0uV/4mJaE8OpYnNcmKbNuF+owskfcgsoxI9wecxTZ RWt59j6uJdr913frlYytchbRm7mEvA8= X-Google-Smtp-Source: APXvYqyIw+qq9GajTkXxbesnqYUQErlsziEEC2yE4RCZbSyv9Y3QFqwHF0WiCNHJcDzHoWXaYgFdVA== X-Received: by 2002:a37:708:: with SMTP id 8mr3653145qkh.210.1569509822931; Thu, 26 Sep 2019 07:57:02 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:37 -0300 Message-Id: <20190926145647.3478-3-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Sep 2019 14:57:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Sep 2019 14:57:03 +0000 (UTC) for IP:'209.85.222.182' DOMAIN:'mail-qk1-f182.google.com' HELO:'mail-qk1-f182.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.182 mail-qk1-f182.google.com 209.85.222.182 mail-qk1-f182.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 02/12] interface_backend_netcf.c: use virConnectValidateURIPath() 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: , 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 26 Sep 2019 14:57:30 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/interface/interface_backend_netcf.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interf= ace_backend_netcf.c index 9659e9fcf1..5ef8ac33db 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -200,21 +200,10 @@ netcfConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected interface URI path '%s', try inte= rface:///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected interface URI path '%s', try inte= rface:///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "interface", + driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509847; cv=none; d=zoho.com; s=zohoarc; b=Ix5NIrEQybT+lH/jB7zVoIXT5/fZ6DNQ05xfLLgi/Y7Eybr7srs4j7bIEYveOdg6WtSpS3xxiR4BYHAN0P+ST6hOOE7QVwgNwei+yoeLtcGl9ByOqgfT/2rBYs4NN0Eozb8YmoRMsN6xMlBLFqp0xuHiLFXJ5pMATU23mjgqyJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509847; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=e6PwcySTplA9bAdenEBDULkrJscbY0QhWhOfLb9WVGA=; b=cwN7pCgn7RnK4d9vQkq/KrpdFCsCxH8BUV8S2EeSDHIZJ6JxceEy94IUh2HvJYDqV3Wfi54Hhdvu9f3yLKSUooBIRYt5IeL0ly0snG+cyL7WvfU/xhoegiBgu3ooSUTPR9QZWFe9RiJZhbLlQ2ryMYWzmbV8Tdmtyc8pbjxHcI8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509847345758.270532234567; Thu, 26 Sep 2019 07:57:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9392C89810D; Thu, 26 Sep 2019 14:57:25 +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 6D8EE5C220; Thu, 26 Sep 2019 14:57: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 2C24818037CD; Thu, 26 Sep 2019 14:57:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEv9Ou028799 for ; Thu, 26 Sep 2019 10:57:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0913C600CE; Thu, 26 Sep 2019 14:57:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx21.extmail.prod.ext.phx2.redhat.com [10.5.110.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A44B5600C6; Thu, 26 Sep 2019 14:57:06 +0000 (UTC) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 8690118C4292; Thu, 26 Sep 2019 14:57:05 +0000 (UTC) Received: by mail-qk1-f178.google.com with SMTP id f16so2006984qkl.9; Thu, 26 Sep 2019 07:57:05 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:04 -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 :mime-version:content-transfer-encoding; bh=aNPJJ2nW1CmnhkDYHPJ7o2UA2mfUo2uHBlOXnr2X52g=; b=CfXeoX7NFVzOXWuzrdiFHBIQzspacfYDNd58JZDJ/eO5MUxCmLpMxwTfk+wdIWly/J RTERsywLPNeZGsktD5hzO6DPGOwsI71xX1M80rd7Mv0tAOCx+4Im7tlUJSNNL18osrBH Y6n2V6P6DZzdERiPsENFdthTFcbPX6Zm6q2FxmMs6nZMQ9soIGYv9lyJntrZLbzEX6no UZyeZL7B28OA7Bijdj1Fp2oUaeHC2vnGRuNfLsKSogU2sy0c6J3gP/ufn0CrIazEd1ZM cCxn17DquZamFyLSlUVHUKi0MjDHt0Md8VwOE57G7c/cfUJoUZp/cYt5zd45sQYKwVp3 VOJA== 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:mime-version:content-transfer-encoding; bh=aNPJJ2nW1CmnhkDYHPJ7o2UA2mfUo2uHBlOXnr2X52g=; b=O1bDNIi6xqZPmbVLTjDPq44v5FBGEF/dKCLnYdbQlJQDuuG1sUmFuy7qYPxctrzyYS K9LbE3ZZKV0a/11+b6xDOc9Nv3XGae0XAnFNu7qXcYbNjrdu2hpU52TNVG3ZjGrcTww0 Ur5cdkxzBqbCSfj5eVOl4FiUuoszHXxqYcEbZKXQrw98AWWAugvHyTniiehj8izqAAyh KfmDATdTHxlL8GqSiHjsuKZErDEMz3IySS5w3mmrQOwHDjcGe7lhHMsWqEg8/h25gaKb HnXulDiTCGHkY4k+bCt9/YKD0LerL8W8uZyGNW2uVItstrnkOFhzrYrvGD/s5edJlsGy z9Gw== X-Gm-Message-State: APjAAAUrgyc3Q/wixwgUJHYUGsNiW+WRqeplVFCwmxhkb9BeP/GPOmO9 /UHDadnEa80LtMuwjVEucyEZuaJVSV0= X-Google-Smtp-Source: APXvYqxFgrruKNqtl6jJ/abpeMcRLkxA0O0bEuxM0y4LiUg+071hqOK9bLHIVjv+zxEYwiVe+3oLwg== X-Received: by 2002:a37:a182:: with SMTP id k124mr3736606qke.354.1569509824634; Thu, 26 Sep 2019 07:57:04 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:38 -0300 Message-Id: <20190926145647.3478-4-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 26 Sep 2019 14:57:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 26 Sep 2019 14:57:05 +0000 (UTC) for IP:'209.85.222.178' DOMAIN:'mail-qk1-f178.google.com' HELO:'mail-qk1-f178.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.178 mail-qk1-f178.google.com 209.85.222.178 mail-qk1-f178.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.62 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 03/12] interface_backend_udev.c: use virConnectValidateURIPath() 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Thu, 26 Sep 2019 14:57:26 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/interface/interface_backend_udev.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interfa= ce_backend_udev.c index ddc3de5347..1684b8ed83 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -1250,21 +1250,10 @@ udevConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected interface URI path '%s', try inte= rface:///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected interface URI path '%s', try inte= rface:///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "interface", + driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509864; cv=none; d=zoho.com; s=zohoarc; b=QVlpCluVzoQdV6qCbrcPO8/JFmXOXwSIVvokPdD98rCD5/svMoU7wn8EEsqgYN8KJdw3AizmNEpXll9ylICdIGK8t4kI8bjTPPaFFg+xTkkYL5qNo9Z5A4cf9WGZPDIyEsgFzrt2SvuKiMx8C7JxN7bJoK86Tc3Y3IbgqIrSOlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509864; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FWbHi1HWkC+gNzece05Dpek3kY294OOKK0EF/fCPpXA=; b=G8I0tdI0XQ43EIaS0U0MOKWz01Hwgek0evSRTiXmrWAibbNTjOKWxRHE/U9+dYv+LpJ6T0UyP6qXb50s6B+Bh0qoQbjz5IqIRzS3cqOQ6+k64B1AC26GkSPxV1MvV3QLB+99n240veWGbmAwNZC59O808F72+tiP5OZUqF8SoNM= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509864691972.6864407145853; Thu, 26 Sep 2019 07:57:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3B7F3086E27; Thu, 26 Sep 2019 14:57:42 +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 C7B471001B2C; Thu, 26 Sep 2019 14:57:42 +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 8AC851803518; Thu, 26 Sep 2019 14:57:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEv9h8028804 for ; Thu, 26 Sep 2019 10:57:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1BD8660A9F; Thu, 26 Sep 2019 14:57:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12ED160923; Thu, 26 Sep 2019 14:57:09 +0000 (UTC) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 F2253306085E; Thu, 26 Sep 2019 14:57:07 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id w2so2035693qkf.2; Thu, 26 Sep 2019 07:57:07 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:06 -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 :mime-version:content-transfer-encoding; bh=MdwUhcEZaamVOHXrzW/zyFZIP1ktgOilvenvwCcgh88=; b=GygGEdGBgh+Xx63D9usMSNJSIOCunF/VtnsJKP4uJpfFUJwoCmb8Ptz7Vi2dPpVCUe v64xAp2uS/SfucBUXLOV6QJXBAVLtBITnnIdPxYJWxaWB9sHh/4wQsOB+2Rxw5mx3xWQ I3DkjtfoACxFPCSSFVdN+0jZv1c4eT+IdsuPvHvXx5J1wHou9BxYp48H2c0wpblXMKHk 0aR6esMCDJ6zMUN73yM1SFykB3oAvoxyxHlAF3NNVJwzUSSwJZ5NoZgEsJdl7AUp2ZMF 74U8YtL0Gf8yAQhz9xRtYsPZdiSc5vFu5kSUQZBwr/aLEek3wF4jT0DyPLI9fzwDRdm7 FVmg== 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:mime-version:content-transfer-encoding; bh=MdwUhcEZaamVOHXrzW/zyFZIP1ktgOilvenvwCcgh88=; b=jx+yB2u3aJtldsZSXz/zhq99h4lLSmgmU4ii9310Ovc3Cqyv6hPkZVeWbMAkonHvYW 6l4Yz6Q8lMp+q2NMxzYGIn9/U9b+pRF112hhmL5U1ICrDYHoVdkQpOT4iJKIW03Jpxfx 7+b4zgDtieC3E21aZ6Bott2NT6rndPuFgemfolmZsR5J3HryJtI7TVUcnsueqtzne8e+ RuzbfapdN2/8NfKdCZjtOeFp+bKA1bE5FhiaamU3wMw7m8KRltwtcGWCK2NPa6r+3+/v ZV5bPyEd3vLxUd33v+E/V2Rw4as3pupXZgn13A05w+CT1XJNeapglOzIKmHkU3MXincF DsIQ== X-Gm-Message-State: APjAAAUg2T17R3o5dQn1VqHmzvytw8aFuZRmmhQGni1OhxY667wS83Rd AmtppBbhxgwq5OJ55w37OJA7okkvUJg= X-Google-Smtp-Source: APXvYqwEmwXz8wO/Aqa4QCRp4Yndlww3pVDgzOFMH4FDO9OzjmhOhSek+lBD7oZn8qlf/dyoHGUBXA== X-Received: by 2002:a05:620a:140b:: with SMTP id d11mr3701820qkj.22.1569509827026; Thu, 26 Sep 2019 07:57:07 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:39 -0300 Message-Id: <20190926145647.3478-5-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Sep 2019 14:57:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 26 Sep 2019 14:57:08 +0000 (UTC) for IP:'209.85.222.174' DOMAIN:'mail-qk1-f174.google.com' HELO:'mail-qk1-f174.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.174 mail-qk1-f174.google.com 209.85.222.174 mail-qk1-f174.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 04/12] bridge_driver.c: virConnectValidateURIPath() 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 26 Sep 2019 14:57:43 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/network/bridge_driver.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c54be96407..c617bbb58f 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -938,21 +938,10 @@ networkConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (network_driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected network URI path '%s', try networ= k:///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected network URI path '%s', try networ= k:///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "network", + network_driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509859; cv=none; d=zoho.com; s=zohoarc; b=BtkgxrFE2BH2xIirfkdmp9oWGRlUeB1Ax98lgChrEWeBbhSiuIYa7Ouy68Y4bw2hWKMcW4KCqhopg/W74pXPBmu+LCOTytTpOBxb1iB17c1cK3FwtXT3pa4ApwHhoRLJEWXrnSDqUvB+kknBGRnaf+3SqLSC0EOjTap8d3YOIJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509859; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=o7kkfl6/KEUn1JpNYO0+OWu2DrJrCy2+I0db/l1s/CI=; b=Eyf9S9aCMXuEtsFfarOjZmSqUZ3eDXscVyOVha0Ub8KzTQrVDNEWSyJ8CmsVl4TSxQw6W/R4ZfDfKs6u/Q48dFdSXiJ9NAy9+TQQeQ37OdsrkntBFzYVzARDE/7XKDB5/ukDzWe1J9obrZBCT1dkmJ7V8GXmKwoK70tVF+CLFGc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509859879395.72637588880536; Thu, 26 Sep 2019 07:57:39 -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 0A62D10C0954; Thu, 26 Sep 2019 14:57:37 +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 D746460C44; Thu, 26 Sep 2019 14:57:36 +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 99C67149F8; Thu, 26 Sep 2019 14:57:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvA3J028820 for ; Thu, 26 Sep 2019 10:57:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3AAE1C92C; Thu, 26 Sep 2019 14:57:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C715B196B2; Thu, 26 Sep 2019 14:57:10 +0000 (UTC) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 A1383C08C321; Thu, 26 Sep 2019 14:57:09 +0000 (UTC) Received: by mail-qt1-f180.google.com with SMTP id m15so3248158qtq.2; Thu, 26 Sep 2019 07:57:09 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:08 -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 :mime-version:content-transfer-encoding; bh=Y+D1TcgVzIDnB5N1hzvWv6buMX6I0xmAAN3lRYFpKEQ=; b=ssxsdxq90Q3vL/JPektR8zYKPlPJxrCcn+oEidD5b1jVASMbKtz1tR/wO1pHBLl8mp M6SVOZjv2C8x+RCKxlOizAB7QQ69tEpjVQ77R/J0KAIAEk2NHPTi+2o0lLO3bV/2X7Jk zmuLlZpQm5dzQZs4OKNtpZViItAVGwFpZXTbsh8xLw60lHY+vdEXuXy9omheiiUQNfwY NenEU+0uqXv74KhV6bLBwrhgOuEzkVFKYzNZ4oAImHDlLqF39p6MbEdNKzyB4Ve0VOiy ozUShm/YkYbOQ+26pePlw2zp87OiyUQRqD+ZV4luXZR8SRTmn2HYy5AGMNxLgqQ1psO8 EGxA== 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:mime-version:content-transfer-encoding; bh=Y+D1TcgVzIDnB5N1hzvWv6buMX6I0xmAAN3lRYFpKEQ=; b=EkhMPRxkkFPHCAg8iVdjT8Gnw0++AqJ1Hmbetb1McEjR/PesyOx5zs69WlVwIw53pF Ay1lvwVbUrAsVceSbOBE0NvlSeHduxEJuP72IERMwKVCGPHgW7UAMWIa76rrEtBEBykh VuCPzKLrqalKg2lJRldywwncfV0Su9vO0Vh88c3ocOnkYkplRYJw4mptuFAm9NHZSxJX sbVlGiwWvgr8qRki43poR1tNRiCUdgRSfvFBvm+4+hayDFzAksDk1k3QwHKlIAl6YHNh 6R9Chf1U32RLWTzbZyL5lPFDEPuEwxV89AzaNgPpBx5728/LnLoZyDI424UUzKj/PVmN gwiQ== X-Gm-Message-State: APjAAAX/6aV4vAViW96BJfcjnkKxsjH7mLo5yuKUQMfmP07Pq/M1YtYm T3EWQ/F9lmxZuTQyiPqL1Q/Vw5EmXTQ= X-Google-Smtp-Source: APXvYqw82s8PBETBvDrwRqWjb4QGK/zxBAPQyOyqziDRB54zH27QK8L+QLOhUQUujJZlgamKsue3nw== X-Received: by 2002:ac8:53c3:: with SMTP id c3mr4216747qtq.273.1569509828869; Thu, 26 Sep 2019 07:57:08 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:40 -0300 Message-Id: <20190926145647.3478-6-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Sep 2019 14:57:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Sep 2019 14:57:09 +0000 (UTC) for IP:'209.85.160.180' DOMAIN:'mail-qt1-f180.google.com' HELO:'mail-qt1-f180.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.180 mail-qt1-f180.google.com 209.85.160.180 mail-qt1-f180.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 05/12] node_device_driver.c: use virConnectValidateURIPath() 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: , 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.6.2 (mx1.redhat.com [10.5.110.66]); Thu, 26 Sep 2019 14:57:37 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/node_device/node_device_driver.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 8fb00d0c86..578489c5be 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -58,21 +58,10 @@ nodeConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected nodedev URI path '%s', try nodede= v:///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected nodedev URI path '%s', try nodede= v:///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "nodedev", + driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509836; cv=none; d=zoho.com; s=zohoarc; b=Q7vAeBd8MYkWNqesXeScJr4AXNWSAhY/Q6wjh0Q56NjjJcfYBTzD8/t8EDyMMR6WtXEWS/aeuVckHI0xgTFSy5FVZ2Lwg1mmZKUISwIYv6AY5q1OH5BQZ138YfLcpQGsDnpVQkDmQ52xTBOaHn9awDqDE4M7gvmDnCR3TlWAFic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509836; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9wvoqlVr1WauJHXITZYemGaTgWR5pdM0V3Ofbm3gefM=; b=R2P5+4q55/7LbFD0yyus0jF590NTCwqIeMhxwf3tIaID9R3N/eHLUXJtXLNDwsV3st4r+OalrNh1sLg0TL63JTUPXDuHwoQ13Y6n0TThq1siDsP6a/rskm90R3ExixzbsOu7FPNb7r7WBz9om0OALHNtmCHQuaHrI7FTIbLMItk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509836292519.3144776943075; Thu, 26 Sep 2019 07:57:16 -0700 (PDT) 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 640DD308427D; Thu, 26 Sep 2019 14:57:14 +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 3DB4860923; Thu, 26 Sep 2019 14:57:14 +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 C8E18206CD; Thu, 26 Sep 2019 14:57:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvCEg028832 for ; Thu, 26 Sep 2019 10:57:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B22360126; Thu, 26 Sep 2019 14:57:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx22.extmail.prod.ext.phx2.redhat.com [10.5.110.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40A46600C6; Thu, 26 Sep 2019 14:57:12 +0000 (UTC) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 9B4D218CB8FA; Thu, 26 Sep 2019 14:57:11 +0000 (UTC) Received: by mail-qt1-f173.google.com with SMTP id n7so3213740qtb.6; Thu, 26 Sep 2019 07:57:11 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:10 -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 :mime-version:content-transfer-encoding; bh=+ZuapLMy6DwB4tMQxPFSqg+x78BNIak0EuVFqMCNH/Y=; b=k0Hww2Q9OVOaiwAzhL65HhlRKd5eWIUo3M4J9o7WOxPxmtGPgK91xibtSg7Q326aqX XxTtZfkbOdXb09c1Mcys1dX4D5RpqsK1yqiPkIoueFBTPoNmdiwu75Vi2UYG42TZuV+g C+wxJ2A541iY/dI9SEqQM/xBPv446afNj9kRJ+/JBS6HGgpFEjjZVYuxWx+KrfMkdcsb 26wsj/RReozdCQR1me/swKhkZ+nE6BePC/35HnhxnLR1s9lw1+6Xq8NMO/nhz492mYzv NgQFlu2+C+8k/XowfEC2HSsN+IR4xuTduZnMSMaPlRAuwJxs7YkRTP6jm12GW6bv9ET8 HcEA== 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:mime-version:content-transfer-encoding; bh=+ZuapLMy6DwB4tMQxPFSqg+x78BNIak0EuVFqMCNH/Y=; b=Bz9hFCS8DvlfFDmPbg9XNlB1vyasugfjaFZ8aW7URObYaScMovst0cGx4ES5rBclhD Ki3a6oGd6L4u4WjZcopENlhZSpZi5WUx1u2qgYkwDNis99KP44VEUGn2QIEMDeXQjk2i Cl3quhJ9Oq8WxfjGAJiDIoG6lulE4vLZXAWtgZXVXDm+/uhzX2PLgEAa06//lPFgeJKe z+6u033cS7mIE9ReWTcEV+BF8VGeNld10n7GbmkYqgKHvmhjEXMs/u7C0RZylDHiy5dt 7kguzOe4OdsnfSiUX7kn5GykyK2qfsoysMJRj1sg7htplMtLpBvt4+X6T3Jy9EJQ+U+p bwcA== X-Gm-Message-State: APjAAAWRnRgtK4Q9x9sYuTs9Om5mCJZ8/kx2O9Jke9yodDxjhocF3LLX +kMJlW27U9Xupas9LRCQpbBu/bDAi/A= X-Google-Smtp-Source: APXvYqw/fGmL8ColWhX/ogH9Qp7JS8yLYXf8sejvrpRzWo5lctklDT5rShpsRLy0z4zDKGIkSrMnBw== X-Received: by 2002:ac8:2dd8:: with SMTP id q24mr4380451qta.118.1569509830806; Thu, 26 Sep 2019 07:57:10 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:41 -0300 Message-Id: <20190926145647.3478-7-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Thu, 26 Sep 2019 14:57:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Thu, 26 Sep 2019 14:57:11 +0000 (UTC) for IP:'209.85.160.173' DOMAIN:'mail-qt1-f173.google.com' HELO:'mail-qt1-f173.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.173 mail-qt1-f173.google.com 209.85.160.173 mail-qt1-f173.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.63 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 06/12] secret_driver.c: use virConnectValidateURIPath() 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: , 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.40]); Thu, 26 Sep 2019 14:57:14 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/secret/secret_driver.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 7512a51c74..ed3bd3c751 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -552,21 +552,10 @@ secretConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected secret URI path '%s', try secret:= ///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected secret URI path '%s', try secret:= ///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "secret", + driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509876; cv=none; d=zoho.com; s=zohoarc; b=cGIJIA5e8YcLZxHN+zfLvyS6FBzmBerK1LD47QJ8JUszZQuot/tqfW0R7O9fdu0vgOXDdjV5L0DlvMLXDkwpsq+zdYIvTPEDXlyRDfCAVrrAoRU0dBsvGXwGIZE1KH7g0jIX58JayBd+uXA4cFNnIheH1nZD/BoSxzqSLVIdkC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509876; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=iGGqYqe0GSflKIQAdrUbVqnjXmNY9oiwZh/8FEDxWyk=; b=JFDD/Ju3/tNakU3HLGykDT2vzszmwb99qv7QY7xNWgUqDM9MINOXyZNOjbOBH1zviqeju9PIK0cLcGxG4j5lLKYWj/OXouBl5c7asCJwevcAdC9dQh90DsUim9yhXSw9kIAbHUudVEaQLDdwRSEYar6DT5ASUpWDOT/ZC/RDtvQ= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509876720683.4852751481347; Thu, 26 Sep 2019 07:57:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23A1B51EE9; Thu, 26 Sep 2019 14:57:55 +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 EE7E25C22C; Thu, 26 Sep 2019 14:57:54 +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 B03C51803518; Thu, 26 Sep 2019 14:57: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 x8QEvGlE028848 for ; Thu, 26 Sep 2019 10:57:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C8B95D9CD; Thu, 26 Sep 2019 14:57:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 490635D9C9; Thu, 26 Sep 2019 14:57:14 +0000 (UTC) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 9D4BD3078A3A; Thu, 26 Sep 2019 14:57:13 +0000 (UTC) Received: by mail-qt1-f171.google.com with SMTP id f7so3202679qtq.7; Thu, 26 Sep 2019 07:57:13 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:12 -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 :mime-version:content-transfer-encoding; bh=pcdGgeP8TtY/8Oo0u8gyog8k9Aa3Ueh4CHSbjYlSAyM=; b=AnvFTYsxVZ1oU1eEbnhwk/+pLWK6Psseo5vBuOkzdK96x2YZK8otkxV1mcZ1eU8KXc a1RcpsWaYKI7NmRuH+em198NZrj9yymPIoOLpYE1RjMkgsfeLzZ74m6Ruj/8G5qp/Zzd uC337RiKLb0rr+cuwy6g5xF4NGbQBlwyXtF5WjmkGxbRNrYzh4rD749PgI7HUz0amu5P fT8Rmz9X1EMOTz4WTenhXoZwbfB5RZIwrXWJGa6aklLAVK5XUaOyxSTlWArloaNeUYkW a6sZcsTGSuI8RMUNPuO2QurSHisZI0Ar1JMQlsVIZtA9Z6rgToSqm1O8L8ZPN3u3cWJ2 4w9A== 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:mime-version:content-transfer-encoding; bh=pcdGgeP8TtY/8Oo0u8gyog8k9Aa3Ueh4CHSbjYlSAyM=; b=ubG+MBKhw6oiAbxSB/4oeseV2GwPTw0bkRs3O4R7WVqvHLjY9ZMPiAjAZh7UQJQyog RQVIV33jAjbcbQ53b/5Su5lhu42iA+sr6mxY+Qt9xJMZSyCar347Yy60OjoIYJvygksW TP4HbtUIw3CxqBX6pbVugTnVEHLcEenCds3WM15+I/Ck/ANUPTm8gobb7SrhYwHhobb/ VrzOXAvvKjx/WkVX17ZNwsYPKyLIgVc+iamU0l8mwG4v1U/TxMq2WHE6X0IP0TMRLR16 Thpm75xJ7BPe62Yl9x9vQfUDuSLV4/kaotGpLZidD15DnjZC+V5oCJinOY5loqZpuhRY vIcQ== X-Gm-Message-State: APjAAAUDbIAmoNtzQOLemQHURdxtvwcVbaKqEh6KaXuQnLDTbFgSVID/ 3IGVepxzexa5ssba5Abkc+DiDWQuiMk= X-Google-Smtp-Source: APXvYqz6ZdVniqmziJ9OUull9aIrLHRjEPyEyAwhaJHO0Ujq8UjfYvjeXhfN3o30qV1VERzrTQ1BLQ== X-Received: by 2002:ac8:41ca:: with SMTP id o10mr4218161qtm.352.1569509832672; Thu, 26 Sep 2019 07:57:12 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:42 -0300 Message-Id: <20190926145647.3478-8-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 26 Sep 2019 14:57:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 26 Sep 2019 14:57:13 +0000 (UTC) for IP:'209.85.160.171' DOMAIN:'mail-qt1-f171.google.com' HELO:'mail-qt1-f171.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.160.171 mail-qt1-f171.google.com 209.85.160.171 mail-qt1-f171.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 07/12] storage_driver.c: use virConnectValidateURIPath() 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Sep 2019 14:57:55 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/storage/storage_driver.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index ce10b55ed0..d160ff34fe 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -411,21 +411,10 @@ storageConnectOpen(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (driver->privileged) { - if (STRNEQ(conn->uri->path, "/system")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected storage URI path '%s', try storag= e:///system"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected storage URI path '%s', try storag= e:///session"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "storage", + driver->privileged)) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509890; cv=none; d=zoho.com; s=zohoarc; b=cZsqwjmeIi/48b5cCP2atCubay4WEbaDqlklwVCJr2kwZA21Bi5YHdDpwmOdFVLH9SSdaGCHG5RQLMpsi7Emh9X9aa1Y8i/mdI3DBgZR3hiGKx3gmcvre3rhL468muWaa5VJm2j5oqyhwBxH7TXz8aVgH++JvC37udDQo3TmAIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509890; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lfkuo4CYwPDV/G+j8nO+y+01IQRdKBkMRkMwFkR9zeE=; b=LE1aRTV86gLyoZGTioqpK4dgcOxCtiv64lzq4KWMOpzDUhAfxOJ6dvbmUfhrUb4i+ipybHgBLv+CWF0dnxOO3c5B8kAiTqwyVtgGyNrYQDWxb8WPOaAcNdersILCpt2EOfL2GnRKWMgvNFj++bjwC6Ty5BXTNAb/QagJCuot9ow= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156950989023063.5853150132524; Thu, 26 Sep 2019 07:58:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9FD730BCB87; Thu, 26 Sep 2019 14:58:08 +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 82C6A1001B00; Thu, 26 Sep 2019 14:58:08 +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 3D120180B780; Thu, 26 Sep 2019 14:58:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvKev028864 for ; Thu, 26 Sep 2019 10:57:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F8A81001B12; Thu, 26 Sep 2019 14:57:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C0EC1001B05; Thu, 26 Sep 2019 14:57:17 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (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 64BD1307D9D0; Thu, 26 Sep 2019 14:57:15 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id w14so3188346qto.9; Thu, 26 Sep 2019 07:57:15 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:14 -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 :mime-version:content-transfer-encoding; bh=1QFkVgf/chQNzbL+u7a6bCiLPTEaSswo+XcNDWOsNV4=; b=riRedJhkxG8A5zEPQArD55ivHpVitWY4bLRvDHf2CDOLp4Et6PTI3kgnuCGRknd39t kiwtiqB4OOe89Vs/HVD4l6B8AaW7YOUchuhhgNAPY7ddxqCX6h2RsuD4qn0zgKj1e6Fo hrcaPEabQqRwglOG6zYwI2UOjoEyf0mvOYVJc1Mx8NNfZ9LiwcYIFjumwv0j3pd/s1z5 R6RWlYNnlu6bTF2znpRQeksDz12wx21fq29hkd/3HR8bW3AOFaPUfMW4nFokaRktCf0x vbA38ZIPoryZ7h3ynsdhPq/XRzXSLpVmVRBtfWUVB7RIz7q9P2ka3znKBzTsrolPDLCg PDgw== 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:mime-version:content-transfer-encoding; bh=1QFkVgf/chQNzbL+u7a6bCiLPTEaSswo+XcNDWOsNV4=; b=pDjjTfnF/3XIbewaIzqkmzX3lBjGGX8/aHaB4Cfwq0QS1sDRECsITEgUg8xkZnS4qF ltWGKXfH8ASebkn5VRBaP7Mqu8gyoZPvqNAGs3W/o8CVvvgaXkzA4Yn4NUCWtOI3WoRE jxMFvemKWq4IqCymN4fU5l4v7XTQJUKUpLLM35UCMrvea37o65UgoOGoYtGIXi56i713 vd07eT+wgBZS021lgq/a5LFKY1U97X0o/kxbW23MzWAVPoWf3m4I+cYhlqf6YN3AjrcD bjHyDwm2j6RdXIF8CYg9jNUxXKI3Lj2HPlH9TN9EbTi8eNdddPrt/StFBPst7hH/AKuI ZEOw== X-Gm-Message-State: APjAAAUFHCVzqPI1JBLacHFhH2TnktFfbY4o0RajhC0pEP6qgshaP+0m +ugIiFrOd6DMkMq//ItiRZtNV7dslEo= X-Google-Smtp-Source: APXvYqzWTmKvvEtSvSqb/U8BVRh3XisAGZjWnOikuSz+q5bxT1uNbvgW98quJaRZb6+/iRwweVwIEA== X-Received: by 2002:ac8:5143:: with SMTP id h3mr4354997qtn.26.1569509834501; Thu, 26 Sep 2019 07:57:14 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:43 -0300 Message-Id: <20190926145647.3478-9-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 26 Sep 2019 14:57:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 26 Sep 2019 14:57:15 +0000 (UTC) for IP:'209.85.160.193' DOMAIN:'mail-qt1-f193.google.com' HELO:'mail-qt1-f193.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.193 mail-qt1-f193.google.com 209.85.160.193 mail-qt1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 08/12] driver.c: change URI validation to handle QEMU and vbox case 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 26 Sep 2019 14:58:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The existing QEMU and vbox URI path validation consider that a privileged user can use both a "/system" and a "/session" URI. This differs from all the other drivers that forbids the root user to use "/session" URI. Let's update virConnectValidateURIPath() to handle these cases as exceptions, using the already existent 'entityName' value to handle "QEMU" and "vbox" differently. This allows us to use the validateURI function in these cases without changing the existing behavior of other drivers. Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/driver.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/driver.c b/src/driver.c index 6b75622689..ed2d943ddf 100644 --- a/src/driver.c +++ b/src/driver.c @@ -276,7 +276,19 @@ virConnectValidateURIPath(const char *uriPath, bool privileged) { if (privileged) { - if (STRNEQ(uriPath, "/system")) { + /* TODO: qemu and vbox drivers allow '/session' + * connections as root. This is not ideal, but changing + * these drivers to refuse privileged '/session' + * connections, like everyone else is already doing, can + * break existing applications. Until we decide what to do, + * for now we can handle them as exception in this validate + * function. + */ + bool compatSessionRoot =3D (STREQ(entityName, "qemu") || + STREQ(entityName, "vbox")) && + STREQ(uriPath, "/session"); + + if (STRNEQ(uriPath, "/system") && !compatSessionRoot) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected %s URI path '%s', try " "%s:///system"), --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509857; cv=none; d=zoho.com; s=zohoarc; b=L2O5ZXBB0KhQFjonxMWrR31jsUj5VqdNMVflA/wzsESgvypQrBbaNqgfzDmH8Nmd0YjBvvMBMauW6rIT/l9hduooPW1shXL4ceLgUQ4uBYvYL2DlMvRZ/3R+jgmzry2ChOI3PJp8cgz5uVQwGArUISpMf5bq4+IsajQQTdG/Cug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509857; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZkZzimPXoff/kob2+awx4FhtXPkW1VNY9MRyvgW8X6c=; b=mkijVbOFCxQ7up8qmzSAqGPE73s+UbV/HXIuR8m7/wCp/9L3Igvykj4SRFvSuC2rN/CBnENnqPXF+a9aIts33X6gko0bdyOlXOenL3Ft64IyRl8XoYupZKgbwD1xP04jUKt7aOzOxQMl4Tq0N4DLVzN7PmFP/fXJ87o/J5p3quA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509857588970.1544266272825; Thu, 26 Sep 2019 07:57:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0924C5AFE3; Thu, 26 Sep 2019 14:57:36 +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 D95685C221; Thu, 26 Sep 2019 14:57:35 +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 981C614B19; Thu, 26 Sep 2019 14:57:35 +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 x8QEvKkS028869 for ; Thu, 26 Sep 2019 10:57:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3288A5C22C; Thu, 26 Sep 2019 14:57:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx24.extmail.prod.ext.phx2.redhat.com [10.5.110.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4D885C21A; Thu, 26 Sep 2019 14:57:17 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 00BF610CC200; Thu, 26 Sep 2019 14:57:17 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id r5so3269041qtd.0; Thu, 26 Sep 2019 07:57:16 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:15 -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 :mime-version:content-transfer-encoding; bh=xj+sQHgcTxRc4399VX7nI86zjHnii3KrXY7lx3HjQMg=; b=fXm77Bq0GibHqxgimt4BkIPs7nK73nQpAboiFjoI7P4Ela5obu2bw4sGrHnToQq1Nu 8ysR3EpkgNKnu3ze8zXLJ/uAfH+WkQ8B8zJsZuBaIjLhvxYv0rc5yaUkvo+iEE7JOrQK tqe7BZWohfHQZro02AzU+4Tby2kk/YiEliE1Yt69kDpScpij4HPVNk5Df+AshRaiJniX afAV9096d8xafzCfmTlVPA3BGONvTfMz6kINRJj945C63PYeD34kwlfzA0+CRGv+WBbi zmpBWZGgUVAilqXZdOIo3fD3bkS3OmFDG3fAzOnIL/X4OgRNESlvb0+BfIYAMLXB9aHz IVDg== 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:mime-version:content-transfer-encoding; bh=xj+sQHgcTxRc4399VX7nI86zjHnii3KrXY7lx3HjQMg=; b=chy61VpRcATLDLkHKtmfOf+R7RCgb/ixNECCl4GGcRFeQW46suh73RwHZRcuVGVU40 v5QVmBo7/XOSWCz5NRzpm6pBsnnuth+uPUqCZLjHH8+/2ncDlps9Rf7ML+mZ3OmEn+Jx Gyf4loz/oKrNA+HSp43KIW13Zg/HacsFgMe5dkiwT/w9+ckcFpNmc1QSAUWcXfsk8JV2 l8KJTCUa6+7IEAJig3Fx5u4YoJgMRiRYrZn3feg3TmCQpVfexvcdkcHfEILHFHHs1NzV 0f6WKDMmH/9arN/ymgW5c1gJ3FxMOOUdixPkkJB7HgfSpLTL6JoxXKn5RJO3XT5kb/1t ea5Q== X-Gm-Message-State: APjAAAWq3vHWRBmlsHgDFypYrDMwK56uWHY4HmfiYiTqU/pVBiSvDO7k e93wMi/N+ge8742VQByU2HkK0UdhGs0= X-Google-Smtp-Source: APXvYqyvZ+neBv4HwWDCdr3OgY8wCKbuqLTlOSEQMEPweXoYOdBh5/p1jOw07wpZnVtuItuvcPkjnw== X-Received: by 2002:ac8:2af8:: with SMTP id c53mr4473368qta.344.1569509836176; Thu, 26 Sep 2019 07:57:16 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:44 -0300 Message-Id: <20190926145647.3478-10-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 26 Sep 2019 14:57:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 26 Sep 2019 14:57:17 +0000 (UTC) for IP:'209.85.160.195' DOMAIN:'mail-qt1-f195.google.com' HELO:'mail-qt1-f195.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.195 mail-qt1-f195.google.com 209.85.160.195 mail-qt1-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.65 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 09/12] qemu_driver.c: use virConnectValidateURIPath() 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Sep 2019 14:57:36 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0c65414a1a..cf9c06f274 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1295,22 +1295,10 @@ static virDrvOpenStatus qemuConnectOpen(virConnectP= tr conn, return VIR_DRV_OPEN_ERROR; } =20 - if (virQEMUDriverIsPrivileged(qemu_driver)) { - if (STRNEQ(conn->uri->path, "/system") && - STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected QEMU URI path '%s', try qemu:///s= ystem"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected QEMU URI path '%s', try qemu:///s= ession"), - conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, + "qemu", + virQEMUDriverIsPrivileged(qemu_driver))) + return VIR_DRV_OPEN_ERROR; =20 if (virConnectOpenEnsureACL(conn) < 0) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509869; cv=none; d=zoho.com; s=zohoarc; b=lNN//VBUTYHpzuUghrik2O45YrtrB06vPT43g68/MJkcHPyZSj35Watw6M35Ol2iububyKYS1I0yasatykWw5pgrflmL7+ZFtGWKmgr/ekW5oNI8VEkC1WUBJJjenBCB+hkGoinDT3sk63fX7VBZBcf48HxMrvbmYpKcdDD5K+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509869; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=I2GPp/WorDc8gSC7zWkrvS4LWAabDZ2gADWSpyq6vjc=; b=nkJD6JRHe8Z/2AuJqJo+IUe2Wii/kpw69daQ1/0S0T7wNxrKB09Hs1rkhDpKurkYV4Z5tkzt27lnEIRokXgFTQn+bvH1/ONUGfBb3SIGqlMisqGeYKExYCdOOKLHkjlZ1OVzRFc6382mIzplad8yTanPn9yTh/DFk9qmHfzUaus= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509869804331.25506076709587; Thu, 26 Sep 2019 07:57:49 -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 1A5D51DB0; Thu, 26 Sep 2019 14:57:48 +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 E2F2160C44; Thu, 26 Sep 2019 14:57:47 +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 A78CB180BA96; Thu, 26 Sep 2019 14:57:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvOHu028890 for ; Thu, 26 Sep 2019 10:57:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2277D60F9E; Thu, 26 Sep 2019 14:57:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx30.extmail.prod.ext.phx2.redhat.com [10.5.110.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE0DA60F88; Thu, 26 Sep 2019 14:57:19 +0000 (UTC) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 76CDD210B; Thu, 26 Sep 2019 14:57:18 +0000 (UTC) Received: by mail-qk1-f171.google.com with SMTP id y144so2017042qkb.7; Thu, 26 Sep 2019 07:57:18 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57: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 :mime-version:content-transfer-encoding; bh=BU0iQGc1S0P5Uat9Mv5QunKxue/pjQrAzhTy4NehCw4=; b=mDdo+2PiZx+QG5xmoiv/osbq58/q2sjuCPYn7apGxN6/kRX5CcdaFM4RVjYOaaTi8e dcEsqklhJDKxn1I63+E6SCKazY4jNQcOhUH6ferjk2ot1iMgUKfM+zFeVH31vre2Y02N olHVZDtjusmLcClgVLRIRMwgMWFjvhslYyq7Sh2j/J3ohzzdmadelgXuyAuPXnssk+WA 5nmfXW2Z9EOuol8dtUd0KD3YJLGAqBhiNP6FJ835BvnayMOU3XPY1WQb2cm41H57B/5f aqrkP6UgaMZPu0mUB7UyWf9fQbBaXyR3p9FkLQ4RZY75y/seUdle/b9SEOMzUz1ihtkM Qyzg== 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:mime-version:content-transfer-encoding; bh=BU0iQGc1S0P5Uat9Mv5QunKxue/pjQrAzhTy4NehCw4=; b=sCWQLORAYNdmMzA12X0yKpQkd7kLknJKg6dzu+fkejoD0gtchVsAtmk34v0xWe1Ugt gq6+KHBFPStgkesiQ07vmo0w8WQMi7rfwDqi1+YmtjFV2YfmNN1d9qf6ZLmHqcUQvbTO 1rvyf4e4qnkm3pTYZ6Ty81cYXQCXbWaQWJ1PB99GAWHS8EyN/K60E3diQOY+AqWeOALJ LJWq4UahJOSbaUGytNmnWqRP7vG1P1IohN2q56qClyRmSmKl4rGTk0SMkca9nkcKLcNH x675U4dYl898kUw5GOH5JmSwXqnF39VIJbKzl7Xv15BJBhlfHLHBRXF9CXJR1SpshKbu Nixw== X-Gm-Message-State: APjAAAXLuPbPgXRo9LMn+scyf7/Qjk8jsjcM0dIEKMCvlC6xXh7LG5Pp cbSdAtTOlBs/RcverZFJr7qWdvLzmfQ= X-Google-Smtp-Source: APXvYqyziMyr3WR007p8QnephMQHvk/KGSwObekGa864UzGXxnpPXTeWOqpqkMzbVXcF9KyuC/fvCg== X-Received: by 2002:a37:8586:: with SMTP id h128mr3706494qkd.253.1569509837679; Thu, 26 Sep 2019 07:57:17 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:45 -0300 Message-Id: <20190926145647.3478-11-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 26 Sep 2019 14:57:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 26 Sep 2019 14:57:18 +0000 (UTC) for IP:'209.85.222.171' DOMAIN:'mail-qk1-f171.google.com' HELO:'mail-qk1-f171.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.171 mail-qk1-f171.google.com 209.85.222.171 mail-qk1-f171.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.71 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 10/12] vbox_common.c: use virConnectValidateURIPath() 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: , 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.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 26 Sep 2019 14:57:48 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/vbox/vbox_common.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index ddabcb80ca..d3b8fb625f 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -517,20 +517,8 @@ vboxConnectOpen(virConnectPtr conn, =20 virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); =20 - if (uid !=3D 0) { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox= :///session)"), conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { /* root */ - if (STRNEQ(conn->uri->path, "/system") && - STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox= :///system)"), conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, "vbox", uid =3D=3D 0)) + return VIR_DRV_OPEN_ERROR; =20 if (!(driver =3D vboxGetDriverConnection())) return VIR_DRV_OPEN_ERROR; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509873; cv=none; d=zoho.com; s=zohoarc; b=h1CBSblJKVmk2fGaukTddRKKJnpqsQEyA3kascXoU5a+Rm4pHDEeJ7cgFq3JKrH9S9e7My5H9AhZghwS0PYjddMia8ycKWDg2z9msjP6HlkOF3d+cAyHTqkxZNYR4FwaGIO0yMssgYz4k4huCA6SDQqlVxj2/qINwmF/LR0Lei0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509873; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OW3KV8cU4HbiixYN5tUSg93K0rmfC+6qjb5IK6g/il8=; b=WefuJJddV5YNfpjzPVLjJ3M1/v1VUKwOTHYL96zUhzRsSixM5Zutbpaw0tpiEw40yQkz18/OXZbWsd7QSyZAApwBuyXz0FDGgH54btGBkPwDtVlPgqpAsMUzlJoThCdgiDVg2nh7OZ1xUMSnx+uztPxmGgwHyZa+ZDaeWyIE86M= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509873096734.152990021914; Thu, 26 Sep 2019 07:57:53 -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 518218D0FE; Thu, 26 Sep 2019 14:57:51 +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 28E0F60C44; Thu, 26 Sep 2019 14:57:51 +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 CADEA149FA; Thu, 26 Sep 2019 14:57:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvLxa028877 for ; Thu, 26 Sep 2019 10:57:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E8506012D; Thu, 26 Sep 2019 14:57:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx27.extmail.prod.ext.phx2.redhat.com [10.5.110.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 348AC600CE; Thu, 26 Sep 2019 14:57:21 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 836B2A44AD3; Thu, 26 Sep 2019 14:57:20 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id n7so3214458qtb.6; Thu, 26 Sep 2019 07:57:20 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:19 -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 :mime-version:content-transfer-encoding; bh=Fj9gBFFeucN0qcWh2dtToWli+nOYlydZH3LPZzljERI=; b=kLGJ/9qzMBUL59UnW16VqyB50EygNQBqvbqfzBA1mej6W8XrMDkWLySkyg8ftOu+pr 4m4MmmjAX3Teo/tc1OQ8I9d3mhGH9iE4tKkg6MVH9IAyjDsNZn81kY4aqrIgULGXtj3U B+r3J3L36juLsRnvHVOsFn7UR5frVy3JMSoSO6lHt+FcdhshJBHe/C5FsjbBWGFAWStd 1I0BAxuD7qvoZCa8xdLXQ97q+NLAzssmeh1muP2vEq/iYJJxK9+iYYTeg1wZjvPAryjD vqhRikxrorw3Fg54YwS5jkr7uMvnkJPTXt62GWQXH/NPsIhBBIPVOFQh9LFerrj41NhW gvBw== 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:mime-version:content-transfer-encoding; bh=Fj9gBFFeucN0qcWh2dtToWli+nOYlydZH3LPZzljERI=; b=JOfuzkozOIKSt4/NNM819SSXLx9NOmiY734FsC34XbPp8zBi8yFHl9JTued8GNdguO tjmrO4wTmgU7TXuk32LRO1ii5vPMz8N6v8Tyo0Zx61qVAcFjHqGWZupXq8w4D2VB3xU/ 2mZIENvd2Ebd2dNops75OLF0Pq6egSlcbqarfSh9KvUhT2VQ/IVNV24UuXaCPbc6el/l 7XKF2IVxHmw2CtawbJSoB3IW2EeJrLu6khjH0fo8ryLDf3cNS4Qk9zqOZM9pEBKl0Imi 1UZSn7NhVIm6kunivctNvMBjfbU49EG/Xy05EWPqCgdHc+TmSndX/GwbSSLRpOzwPheg EaaQ== X-Gm-Message-State: APjAAAUQwRoEBJzKJvChNu3c/JfyHbO+HkPoX7xSd4pK6cWrB1yr1KXX 2b9lA1OMJMp7BBNs2BxISnfeEtDNx2w= X-Google-Smtp-Source: APXvYqzMZE6Q75LvaBP6D3Hz3d6OCJZUo3H5PvAS8rl4fbhSrFmGWw/yO/78taYo/kzs26jcO5+e7Q== X-Received: by 2002:ad4:404b:: with SMTP id r11mr2993230qvp.58.1569509839541; Thu, 26 Sep 2019 07:57:19 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:46 -0300 Message-Id: <20190926145647.3478-12-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Thu, 26 Sep 2019 14:57:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Thu, 26 Sep 2019 14:57:20 +0000 (UTC) for IP:'209.85.160.195' DOMAIN:'mail-qt1-f195.google.com' HELO:'mail-qt1-f195.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.195 mail-qt1-f195.google.com 209.85.160.195 mail-qt1-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.68 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 11/12] vbox_driver.c: use virConnectValidateURIPath() 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: , 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.25]); Thu, 26 Sep 2019 14:57:51 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/vbox/vbox_driver.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index 1f31fa28df..d7e80828ab 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -58,20 +58,8 @@ static virDrvOpenStatus dummyConnectOpen(virConnectPtr c= onn, =20 virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); =20 - if (uid !=3D 0) { - if (STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox= :///session)"), conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } else { /* root */ - if (STRNEQ(conn->uri->path, "/system") && - STRNEQ(conn->uri->path, "/session")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox= :///system)"), conn->uri->path); - return VIR_DRV_OPEN_ERROR; - } - } + if (!virConnectValidateURIPath(conn->uri->path, "vbox", uid =3D=3D 0)) + return VIR_DRV_OPEN_ERROR; =20 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to initialize VirtualBox driver API")); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 12:51:34 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1569509902; cv=none; d=zoho.com; s=zohoarc; b=HUc5TDWsS/PKNNG76RfgzjPses81EvnrI2Txkela8zVfVh3U7Z4zzO0BRAQMvGVqh5Ha3/MoC2D4dOZeY03jVx+aR6mHzKR1sI8ec+qRIgLy4ymICqmXahfol0XWBlXcaeE57W8zn/CejXDR1RtfGRLjQ24dgTjDwcB1tOibE34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569509902; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zu13fMPj/8CUJ/dNUCis87Yp1cHGkEmidaVKYsX2Zko=; b=Nlhd8RZFXnj0vydCqvvUIyhIVARLoJWa90g1y+EHfmsHhNkFtKQ/FOIEKzcdD04CaIjiD/UeDV6nihv8OBpkJfIAcBhpGq13/ZmOqGtJQAE6IV1vW2DATNp5zWXpB97h0NzJBvNYQYoqp77qmYqbfhuzrFTBYrTWHCCOI13ceBw= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569509902731255.4971394619638; Thu, 26 Sep 2019 07:58:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FB28316D76A; Thu, 26 Sep 2019 14:58: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 D2EA71001B09; Thu, 26 Sep 2019 14:58:20 +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 846BE18037CA; Thu, 26 Sep 2019 14:58:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QEvNIh028885 for ; Thu, 26 Sep 2019 10:57:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id ABAFE1001B28; Thu, 26 Sep 2019 14:57:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0BED1001B05; Thu, 26 Sep 2019 14:57:23 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (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 8BE9A3082138; Thu, 26 Sep 2019 14:57:22 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id n7so3214606qtb.6; Thu, 26 Sep 2019 07:57:22 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:cd57:9a0c:bf:55c8:50dd]) by smtp.gmail.com with ESMTPSA id x12sm1346543qtb.32.2019.09.26.07.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 07:57:21 -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 :mime-version:content-transfer-encoding; bh=+GHRyIfwnGTNyJrICfvzYX5+UTE9MbxtUuQGG5+NhPs=; b=rtpaIw4C6Jb07yj9FWZuR54QFS3f2+meuh8fmTMd4YyAXtA4rkprzKrCwRZTYPnaDq tvXnpknJ83YM7MzxBds1X4/Q7AIGicRBGjBvop3JqOw0y/Eu7ul3kBm0MMBwFt2zxawY NZinBRGsCTZGGSThSCxJG+zt4yd7MQpZfoknSgJ8NrAB9JNgKr+ZUM+HG0uEEClkYD2z AjqXPVOi9OtvhpBdmNeMtd+J2dU6nt8IYIpjVjqLIh38/iSoaMr6C+coTVKHVf/z3ZMz dvENtavgsd6UTGIG9Z8gLToBpyauBSeEjZQZAhG0Ux4+39KsfAmxb9r5hVnLrAhZ3u7B paZw== 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:mime-version:content-transfer-encoding; bh=+GHRyIfwnGTNyJrICfvzYX5+UTE9MbxtUuQGG5+NhPs=; b=FoK240s/aNw/PYSSd+KcdYDqvpexCAClP6tndwEUmPI0taJAl4GK/zsomF1jNhT2IJ ncS1rz3weXSw/eEKXYXWOpUTv7xi97U529CmEDWsd3O+8aSzv26zU0ERUJfsUeq2qOjO 7KDm7Nl46Tsd376Wx4sxH83LMbtcEQtdorSs28VsDwVydTgCRs4Bg11kZ2jNbcEkAx9j USB3rLhqAej7BwmJudUB5hIvq225OrKCaAd550RXTYMHJfruQngsYXtA2OYb86QbW+95 balqFw5Ro0owb2IuBkCUa7IfTarV+BibWMjAiXg+65/1hqznzHPugp9Vky43UNLNvbah AcSg== X-Gm-Message-State: APjAAAW4L40iVp3qx6hkRfWwVON+MWGgMG7T5BJmlpuyior/XJaBlg/P Fg+XdcuQTaaamRexKs9AkK1VInb0fFo= X-Google-Smtp-Source: APXvYqx8coBVNxOxfFlbmLmctTx4lJtjkrUHL9y6nFRsRqEPZ7OmrCIM3FOqhr0eUWPwcB8BhadanQ== X-Received: by 2002:a05:6214:1189:: with SMTP id t9mr2998907qvv.89.1569509841552; Thu, 26 Sep 2019 07:57:21 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 11:56:47 -0300 Message-Id: <20190926145647.3478-13-danielhb413@gmail.com> In-Reply-To: <20190926145647.3478-1-danielhb413@gmail.com> References: <20190926145647.3478-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 26 Sep 2019 14:57:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 26 Sep 2019 14:57:22 +0000 (UTC) for IP:'209.85.160.194' DOMAIN:'mail-qt1-f194.google.com' HELO:'mail-qt1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.194 mail-qt1-f194.google.com 209.85.160.194 mail-qt1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 12/12] tests: add a test for driver.c:virConnectValidateURIPath() 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 26 Sep 2019 14:58:21 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza --- I've made this test file to make sure I wasn't messing up with the logic at patch 8. The idea of having this test seems okay, but probably I could do it shorter/cleaner. Feel free to discard it if it's not applicable or unnecessary. Adding this new file make the whole patch series, aimed at reduce code repetition and lines of code, add more lines than before. The irony is real. tests/Makefile.am | 7 +- tests/virdriverconnvalidatetest.c | 186 ++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 tests/virdriverconnvalidatetest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index d88ad7f686..c7f563d24d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -433,7 +433,8 @@ test_scripts +=3D $(libvirtd_test_scripts) =20 test_programs +=3D \ eventtest \ - virdrivermoduletest + virdrivermoduletest \ + virdriverconnvalidatetest else ! WITH_LIBVIRTD EXTRA_DIST +=3D $(libvirtd_test_scripts) endif ! WITH_LIBVIRTD @@ -1485,6 +1486,10 @@ if WITH_LIBVIRTD virdrivermoduletest_SOURCES =3D \ virdrivermoduletest.c testutils.h testutils.c virdrivermoduletest_LDADD =3D $(LDADDS) + +virdriverconnvalidatetest_SOURCES =3D \ + virdriverconnvalidatetest.c testutils.h testutils.c +virdriverconnvalidatetest_LDADD =3D $(LDADDS) endif WITH_LIBVIRTD =20 if WITH_LIBVIRTD diff --git a/tests/virdriverconnvalidatetest.c b/tests/virdriverconnvalidat= etest.c new file mode 100644 index 0000000000..599150dc08 --- /dev/null +++ b/tests/virdriverconnvalidatetest.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2019 IBM Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "testutils.h" +#include "virerror.h" +#include "viralloc.h" +#include "virlog.h" +#include "driver.h" + +#define VIR_FROM_THIS VIR_FROM_NONE + +VIR_LOG_INIT("tests.driverconnvalidatetest"); + +struct testDriverConnValidateData { + const char *uriPath; + const char *entityName; + bool privileged; + bool expectFailure; +}; + + +static int testDriverConnValidate(const void *args) +{ + const struct testDriverConnValidateData *data =3D args; + + bool ret =3D virConnectValidateURIPath(data->uriPath, + data->entityName, + data->privileged); + if (data->expectFailure) + ret =3D !ret; + + return ret ? 0 : -1; +} + + +static int +mymain(void) +{ + int ret =3D 0; + struct testDriverConnValidateData data; + +#define TEST_SUCCESS(name) \ + do { \ + data.expectFailure =3D false; \ + if (virTestRun("Test conn URI path validate ok " name, \ + testDriverConnValidate, &data) < 0) \ + ret =3D -1; \ + } while (0) + +#define TEST_FAIL(name) \ + do { \ + data.expectFailure =3D true; \ + if (virTestRun("Test conn URI path validate fail " name, \ + testDriverConnValidate, &data) < 0) \ + ret =3D -1; \ + } while (0) + + /* Validation should always succeed with privileged user + * and '/system' URI path + */ + data.uriPath =3D "/system"; + data.privileged =3D true; + + data.entityName =3D "interface"; + TEST_SUCCESS("interface privileged /system"); + + data.entityName =3D "network"; + TEST_SUCCESS("network privileged /system"); + + data.entityName =3D "nodedev"; + TEST_SUCCESS("nodedev privileged /system"); + + data.entityName =3D "secret"; + TEST_SUCCESS("secret privileged /system"); + + data.entityName =3D "storage"; + TEST_SUCCESS("storage privileged /system"); + + data.entityName =3D "qemu"; + TEST_SUCCESS("qemu privileged /system"); + + data.entityName =3D "vbox"; + TEST_SUCCESS("vbox privileged /system"); + + /* Fail URI path validation for all '/system' path with + * unprivileged user + */ + data.privileged =3D false; + + data.entityName =3D "interface"; + TEST_FAIL("interface unprivileged /system"); + + data.entityName =3D "network"; + TEST_FAIL("network unprivileged /system"); + + data.entityName =3D "nodedev"; + TEST_FAIL("nodedev unprivileged /system"); + + data.entityName =3D "secret"; + TEST_FAIL("secret unprivileged /system"); + + data.entityName =3D "storage"; + TEST_FAIL("storage unprivileged /system"); + + data.entityName =3D "qemu"; + TEST_FAIL("qemu unprivileged /system"); + + data.entityName =3D "vbox"; + TEST_FAIL("vbox unprivileged /system"); + + /* Validation should always succeed with unprivileged user + * and '/session' URI path + */ + data.uriPath =3D "/session"; + + data.entityName =3D "interface"; + TEST_SUCCESS("interface privileged /session"); + + data.entityName =3D "network"; + TEST_SUCCESS("network privileged /session"); + + data.entityName =3D "nodedev"; + TEST_SUCCESS("nodedev privileged /session"); + + data.entityName =3D "secret"; + TEST_SUCCESS("secret privileged /session"); + + data.entityName =3D "storage"; + TEST_SUCCESS("storage privileged /session"); + + data.entityName =3D "qemu"; + TEST_SUCCESS("qemu privileged /session"); + + data.entityName =3D "vbox"; + TEST_SUCCESS("vbox privileged /session"); + + /* Fail URI path validation for all '/session' path with + * privileged user + */ + data.privileged =3D true; + + data.entityName =3D "interface"; + TEST_FAIL("interface privileged /session"); + + data.entityName =3D "network"; + TEST_FAIL("network privileged /session"); + + data.entityName =3D "nodedev"; + TEST_FAIL("nodedev privileged /session"); + + data.entityName =3D "secret"; + TEST_FAIL("secret privileged /session"); + + data.entityName =3D "storage"; + TEST_FAIL("storage privileged /session"); + + /* ... except with qemu and vbox, where root can connect + * with both /system and /session + */ + data.entityName =3D "qemu"; + TEST_SUCCESS("qemu privileged /session"); + + data.entityName =3D "vbox"; + TEST_SUCCESS("vbox privileged /session"); + + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIR_TEST_MAIN(mymain) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list