From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F853C433E0 for ; Mon, 21 Dec 2020 17:14:26 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4835B22BF3 for ; Mon, 21 Dec 2020 17:14:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4835B22BF3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=containers-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F265587270; Mon, 21 Dec 2020 17:14:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H+XdOW+mR+Dz; Mon, 21 Dec 2020 17:14:24 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id B41D486968; Mon, 21 Dec 2020 17:14:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id ABC20C1825; Mon, 21 Dec 2020 17:14:24 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3EEA0C0893 for ; Mon, 21 Dec 2020 17:14:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2C308875A1 for ; Mon, 21 Dec 2020 17:14:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j5rTw3IPdTC3 for ; Mon, 21 Dec 2020 17:14:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by hemlock.osuosl.org (Postfix) with ESMTPS id B5EE48768C for ; Mon, 21 Dec 2020 17:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608570859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=BrlwuJ7Wsdax0BBfkanmGMtk6GKetW4Dz1RxeSTSf6U=; b=UNuS+nbSJ3TNPmTYGVKgLzi/i7WVhq5GXxNE2hEvDFNp83xAWqQxgRyVQ2m9BmMlxiw4tX ahgQJmE7AmAtwZhbFGHZldka/DzTst4K4VLa8P+bYd0sdUJgdQnsOepMhmP/bxuy7jWnfx TSnZyQUybQH3hETeGZsJXA7AitDPeaE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-ozhqscUFOcChKRkRG-yYlA-1; Mon, 21 Dec 2020 12:14:15 -0500 X-MC-Unique: ozhqscUFOcChKRkRG-yYlA-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C391107B46E; Mon, 21 Dec 2020 17:14:13 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9DC45D9CA; Mon, 21 Dec 2020 17:14:02 +0000 (UTC) From: Richard Guy Briggs To: Linux Containers List , Linux-Audit Mailing List , LKML Subject: [PATCH ghau51/ghau40 v10 07/11] signal_info: only print context if it is available. Date: Mon, 21 Dec 2020 12:12:47 -0500 Message-Id: <20201221171251.2610890-8-rgb@redhat.com> In-Reply-To: <20201221171251.2610890-1-rgb@redhat.com> References: <20201221171251.2610890-1-rgb@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Cc: Richard Guy Briggs , Eric Paris , mpatel@redhat.com, Neil Horman X-BeenThere: containers@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux Containers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: containers-bounces@lists.linux-foundation.org Sender: "Containers" Signed-off-by: Richard Guy Briggs --- src/auditd-event.c | 20 +++++++++++++++----- src/auditd-reconfig.c | 2 -- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/auditd-event.c b/src/auditd-event.c index e6b2a961f02b..800f4d83bc83 100644 --- a/src/auditd-event.c +++ b/src/auditd-event.c @@ -1323,13 +1323,16 @@ static void reconfigure(struct auditd_event *e) const char *ctx = nconf->sender_ctx; struct timeval tv; char txt[MAX_AUDIT_MESSAGE_LENGTH]; + int txt_len; char date[40]; unsigned int seq_num; int need_size_check = 0, need_reopen = 0, need_space_check = 0; - snprintf(txt, sizeof(txt), - "config change requested by pid=%d auid=%u subj=%s", - pid, uid, ctx); + txt_len = snprintf(txt, sizeof(txt), + "config change requested by pid=%d auid=%u", pid, uid); + if (ctx) + snprintf(txt + txt_len, sizeof(txt) - txt_len, + " subj=%s", ctx); audit_msg(LOG_NOTICE, "%s", txt); /* Do the reconfiguring. These are done in a specific @@ -1578,8 +1581,15 @@ static void reconfigure(struct auditd_event *e) e->reply.type = AUDIT_DAEMON_CONFIG; e->reply.len = snprintf(e->reply.msg.data, MAX_AUDIT_MESSAGE_LENGTH-2, - "%s: op=reconfigure state=changed auid=%u pid=%d subj=%s res=success", - date, uid, pid, ctx ); + "%s: op=reconfigure state=changed auid=%u pid=%d", + date, uid, pid); + if (ctx) + e->reply.len += snprintf(e->reply.msg.data + e->reply.len, + MAX_AUDIT_MESSAGE_LENGTH-2 - e->reply.len, + " subj=%s", ctx); + e->reply.len += snprintf(e->reply.msg.data + e->reply.len, + MAX_AUDIT_MESSAGE_LENGTH-2 - e->reply.len, + " res=success"); e->reply.message = e->reply.msg.data; free((char *)ctx); } diff --git a/src/auditd-reconfig.c b/src/auditd-reconfig.c index f5b00e6d1dc7..1af402526c4e 100644 --- a/src/auditd-reconfig.c +++ b/src/auditd-reconfig.c @@ -106,8 +106,6 @@ static void *config_thread_main(void *arg) if (e->reply.len > 24) new_config.sender_ctx = strdup(e->reply.signal_info->ctx); - else - new_config.sender_ctx = strdup("?"); memcpy(e->reply.msg.data, &new_config, sizeof(new_config)); e->reply.conf = (struct daemon_conf *)e->reply.msg.data; e->reply.type = AUDIT_DAEMON_RECONFIG; -- 2.18.4 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers