From patchwork Mon Oct 7 21:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 175436 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4849499ill; Mon, 7 Oct 2019 14:53:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdIKKtmXUttqbuLXnO/vgvKRppN/kafqL1s5BfNJ5uW6ducG2beHweBYoP/59Wp+8RQnv9 X-Received: by 2002:a92:d44e:: with SMTP id r14mr3905297ilm.8.1570485238060; Mon, 07 Oct 2019 14:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570485238; cv=none; d=google.com; s=arc-20160816; b=BExLER3f2ZsMrgDIB4s5+0jqIxdNaXjMuLqXIk6Os7um2Jx777e8T9vpSlHgrTvXkd /PXyB9/I4LMY3bhx6f+XTwD2NSe30ve51lj5M2uuBDARcboQVZTwsyLBaKRmrEZ8N/JR lhowNCDGkFJIen+vbOEgl0mDNbkDIppsJvahfj/MHKnYWHYPFP4G4JI2jjcgq34nuWON dCKma9phIXkv3HlqMSiOUKDj2/oBBUxVcIBBzbbJPVtcCml1aNj2Fbd5KWXwfpCqwKyx RKMuKOUbSml4Jxf3fMk/AnL/4oDSDhzQprDv55Mfvkr/pVoC5SlPv2c3RrMQVGxFYqbK 8YYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=lS0D2VW3Ix9j54Taj/gTpo7aYNoPvJtAI32XgvlNPA4=; b=MBQx62Q+LSDdbWYi90HE4kvZC4+cxMHJB7AeUH45mI/8onqqKTXnY+9pU2Bk4gUXkD RCxh2LfjMvNJp4mA9zvBSVqZam07LT9KbU2tua+K11HQ8KhrKX2v1OrcQcQ3uC0cBVO9 MQYyAW7ospmdr4/+X6Pqz+S7AdqIzNMEtNR1lPApJ9JuHUyyhJpgJHIw9BAKsXUx98WJ 1dj4zXbMCPYf0Smu+5788it6gDkkjGA78bSrOnY7uGuzY8AXxChs21opWOcZWEIvCp3K VUANDZUHXfo8BiYrY/AqxSv120PkyJdMcIUkdOARxXEoYQNapnHDkZJleHLmlkOxdgnJ Vhcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id n5si17876481ili.141.2019.10.07.14.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 14:53:58 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 E1123309DEE2; Mon, 7 Oct 2019 21:53:56 +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 B6E226012C; Mon, 7 Oct 2019 21:53:56 +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 7B4C74EEB8; Mon, 7 Oct 2019 21:53:56 +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 x97Loshu015149 for ; Mon, 7 Oct 2019 17:50:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64C9D5C231; Mon, 7 Oct 2019 21:50:54 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from worklaptop.redhat.com (ovpn-123-156.rdu2.redhat.com [10.10.123.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id E77505C224; Mon, 7 Oct 2019 21:50:51 +0000 (UTC) From: Cole Robinson To: libvir-list@redhat.com Date: Mon, 7 Oct 2019 17:49:37 -0400 Message-Id: <06d363e9487fc7e7417d1305917c9b20989c4237.1570482718.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 23/30] security: dac: break out SetImageLabelRelative 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: , 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.45]); Mon, 07 Oct 2019 21:53:57 +0000 (UTC) This will be used for recursing into externalDataStore Signed-off-by: Cole Robinson --- src/security/security_dac.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Daniel Henrique Barboza diff --git a/src/security/security_dac.c b/src/security/security_dac.c index befa388791..326b9b1a3c 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -934,15 +934,16 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr, static int -virSecurityDACSetImageLabel(virSecurityManagerPtr mgr, - virDomainDefPtr def, - virStorageSourcePtr src, - virSecurityDomainImageLabelFlags flags) +virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + virStorageSourcePtr parent, + virSecurityDomainImageLabelFlags flags) { virStorageSourcePtr n; for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { - if (virSecurityDACSetImageLabelInternal(mgr, def, n, src) < 0) + if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0) return -1; if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN)) @@ -952,6 +953,14 @@ virSecurityDACSetImageLabel(virSecurityManagerPtr mgr, return 0; } +static int +virSecurityDACSetImageLabel(virSecurityManagerPtr mgr, + virDomainDefPtr def, + virStorageSourcePtr src, + virSecurityDomainImageLabelFlags flags) +{ + return virSecurityDACSetImageLabelRelative(mgr, def, src, src, flags); +} static int virSecurityDACRestoreImageLabelSingle(virSecurityManagerPtr mgr,