From nobody Sun Apr 28 07:41:42 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495634975104141.60653435051324; Wed, 24 May 2017 07:09:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 150C161D02; Wed, 24 May 2017 14:09:33 +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 9530091727; Wed, 24 May 2017 14:09:32 +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 7C5894BB7F; Wed, 24 May 2017 14:09:31 +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 v4OE9T3U017007 for ; Wed, 24 May 2017 10:09:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BE7FAEA62; Wed, 24 May 2017 14:09:29 +0000 (UTC) Received: from caroline.brq.redhat.com (dhcp129-198.brq.redhat.com [10.34.129.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00D7BAEA6B for ; Wed, 24 May 2017 14:09:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 150C161D02 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 150C161D02 From: Martin Kletzander To: libvir-list@redhat.com Date: Wed, 24 May 2017 16:09:25 +0200 Message-Id: <3a29e6c85e2845e1a082a5e5949554c8295ed1cb.1495634965.git.mkletzan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] audit: Fix the output message for shmem X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 24 May 2017 14:09:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After some discussion on and off the linux-audit mailing list, we should use different fields for the audit messages. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1218603 Signed-off-by: Martin Kletzander --- src/conf/domain_audit.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 2d9ff5e3ffea..1e667af73c4f 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -983,15 +983,13 @@ virDomainAuditShmem(virDomainObjPtr vm, char uuidstr[VIR_UUID_STRING_BUFLEN]; char *vmname =3D virAuditEncode("vm", vm->def->name); const char *srcpath =3D virDomainAuditChardevPath(&def->server.chr); - char *src =3D virAuditEncode("server", VIR_AUDIT_STR(srcpath)); - char *shmem =3D virAuditEncode("shmem", VIR_AUDIT_STR(def->name)); const char *virt =3D virDomainVirtTypeToString(vm->def->virtType); - char *size =3D NULL; + char *shmpath =3D NULL; virUUIDFormat(vm->def->uuid, uuidstr); - if (!vmname || !src || !shmem || - virAsprintfQuiet(&size, "%llu", def->size) < 0) { + if (!vmname || + virAsprintfQuiet(&shmpath, "/dev/shm/%s", def->name) < 0) { VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -1002,14 +1000,18 @@ virDomainAuditShmem(virDomainObjPtr vm, virt =3D "?"; } - VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, - "virt=3D%s resrc=3Dshmem reason=3D%s %s uuid=3D%s size=3D%s = %s %s", - virt, reason, vmname, uuidstr, size, shmem, src); + if (def->server.enabled) { + VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, + "virt=3D%s resrc=3Divshmem-socket reason=3D%s %s uuid=3D= %s path=3D%s", + virt, reason, vmname, uuidstr, VIR_AUDIT_STR(srcpath)); + } else { + VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, + "virt=3D%s resrc=3Dshmem reason=3D%s %s uuid=3D%s size= =3D%llu path=3D%s", + virt, reason, vmname, uuidstr, def->size, VIR_AUDIT_STR(= shmpath)); + } cleanup: VIR_FREE(vmname); - VIR_FREE(src); - VIR_FREE(size); - VIR_FREE(shmem); + VIR_FREE(shmpath); return; } --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list