From nobody Sun Feb 8 11:59:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566487157; cv=none; d=zoho.com; s=zohoarc; b=Tb7a00ctkTWHqUWLMog7WoHQapLs6BFkrECLS4IoDu561DxZSr2Mm5ntyMm4BEIvMvV2sT6XqMmncDIzpDOGr6XWek2qsW9ImF2xhb8ZkEjP6rnuupp6RAzB+e9oKu+z3B2E87zC4cpDTE+NkunX5vWUI/G0HNFMQeRjdU3zWuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566487157; h=Content-Type:Content-Transfer-Encoding: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=3mQxEIwOmC54rsmGE/UnXPHAV4hoiLpBVYx6fHnYhys=; b=VmoW+WZLvYYfMuLm8ubHHVQy+XWScCdWJGvQZc+wVLTLOA+H2nYs229G3uWa1UGPTLgCxtIBuFlNEYeo5qrk86WRvc+afpOvINP6wbC15Aqlvj4LUgyQ8XBzhT+fmkmrHGJt1HIP9T0Fnhv+QEAXZC6VP9HPAnItWn6bzsKLEP8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1566487157599678.4277688875821; Thu, 22 Aug 2019 08:19:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 227E2309B69A; Thu, 22 Aug 2019 15:19:16 +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 F13785B69A; Thu, 22 Aug 2019 15:19:15 +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 A335F180BA99; Thu, 22 Aug 2019 15:19:14 +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 x7MFJDZs027936 for ; Thu, 22 Aug 2019 11:19:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id E76606092D; Thu, 22 Aug 2019 15:19:13 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7190960925 for ; Thu, 22 Aug 2019 15:19:13 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 22 Aug 2019 17:19:06 +0200 Message-Id: <3a17cbd2688fc05cb3ecb95f0e313f64b155f150.1566486921.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] security_selinux: DropvirSecuritySELinuxSetFileconOptional() 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 22 Aug 2019 15:19:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There is no real difference between virSecuritySELinuxSetFilecon() and virSecuritySELinuxSetFileconOptional(). Drop the latter in favour of the former. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/security/security_selinux.c | 53 ++++++++++++++------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 35385f4a23..0d9790829e 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1419,15 +1419,6 @@ virSecuritySELinuxSetFileconHelper(virSecurityManage= rPtr mgr, } =20 =20 -static int -virSecuritySELinuxSetFileconOptional(virSecurityManagerPtr mgr, - const char *path, - const char *tcon, - bool remember) -{ - return virSecuritySELinuxSetFileconHelper(mgr, path, tcon, true, remem= ber); -} - static int virSecuritySELinuxSetFilecon(virSecurityManagerPtr mgr, const char *path, @@ -1884,28 +1875,28 @@ virSecuritySELinuxSetImageLabelInternal(virSecurity= ManagerPtr mgr, parent_seclabel->label, remembe= r); } else if (!parent || parent =3D=3D src) { if (src->shared) { - ret =3D virSecuritySELinuxSetFileconOptional(mgr, - src->path, - data->file_context, - remember); + ret =3D virSecuritySELinuxSetFilecon(mgr, + src->path, + data->file_context, + remember); } else if (src->readonly) { - ret =3D virSecuritySELinuxSetFileconOptional(mgr, - src->path, - data->content_conte= xt, - remember); + ret =3D virSecuritySELinuxSetFilecon(mgr, + src->path, + data->content_context, + remember); } else if (secdef->imagelabel) { - ret =3D virSecuritySELinuxSetFileconOptional(mgr, - src->path, - secdef->imagelabel, - remember); + ret =3D virSecuritySELinuxSetFilecon(mgr, + src->path, + secdef->imagelabel, + remember); } else { ret =3D 0; } } else { - ret =3D virSecuritySELinuxSetFileconOptional(mgr, - src->path, - data->content_context, - remember); + ret =3D virSecuritySELinuxSetFilecon(mgr, + src->path, + data->content_context, + remember); } =20 if (ret =3D=3D 1 && !disk_seclabel) { @@ -2045,14 +2036,14 @@ virSecuritySELinuxSetSCSILabel(virSCSIDevicePtr dev, return 0; =20 if (virSCSIDeviceGetShareable(dev)) - return virSecuritySELinuxSetFileconOptional(mgr, file, - data->file_context, tr= ue); + return virSecuritySELinuxSetFilecon(mgr, file, + data->file_context, true); else if (virSCSIDeviceGetReadonly(dev)) - return virSecuritySELinuxSetFileconOptional(mgr, file, - data->content_context,= true); + return virSecuritySELinuxSetFilecon(mgr, file, + data->content_context, true); else - return virSecuritySELinuxSetFileconOptional(mgr, file, - secdef->imagelabel, tr= ue); + return virSecuritySELinuxSetFilecon(mgr, file, + secdef->imagelabel, true); } =20 static int --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list