Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1441195ybt; Sat, 27 Jun 2020 08:20:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKDKBgOp9NZXvoNFGVLn5XVD5F/MSI2S4y5dYkxjbWwKlVBHQKzU4MMx0dQ/+Fo0E/CghN X-Received: by 2002:a05:6402:719:: with SMTP id w25mr6774958edx.174.1593271258771; Sat, 27 Jun 2020 08:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593271258; cv=none; d=google.com; s=arc-20160816; b=1Fimk5iiQa/H3hwlzaEkinlEKaAot8zotVbjFhrvuhyyvMIaXA9NhPiIg6114nFdsw BjR6D+AvOueVz+mOOtMI+2fOuV/bQRzSA/4BHTfttTyy18ngGEhMHIcoJWO22mpnVhOI JSeqfb+JFf0/EWrTqHYbJfNtw2Vf9xjWDslQfwDn0E0WAJ9yKSBPydVorRKGf/gZM5F+ i3vigASHP/SBSe7+4Y32nZnewwSZalbJMgLlVhPaNI6HArQ5+8DiQYUjLm7DhIj0/rJA lTQ4XwT7HnsyoeCzZtDr1SY4VMIO/Fv7lrA/Ixth9J3hEkuBZBZzMxCaWkwmRiVsvt1R XIxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=pLA2ZYrXjaL3qNNgdGWEbBRjUO8cxQczAoaM3QLMn2M=; b=AfTAR/lUNtR+yJXsPYzjqNUGxKIqH6WvWPmSHte1+n2vu+sN7YZ/crCXrrbc28R2FR X+XeHniMLrGtxytuQncyIzV/54kVd31PRDpFSGrPTNU34lSKhvDhUUT4K/IGli4afcgU h6fR/nr5nG/g2iF2g6Zh4fbpa3VcVDb3wRzGoxzB3n6wYa8u6Uhd4YpdDMl9iDM36HAf s38P9YtUis8AubGtOXDUrll2dpRpkf/qZFQYRpGB/dsF2shcwWnyIugJK+x17ie0KiTe JOugdfCh/AEB6SUjxc1yQDZK9IyLsJzIRbro3QyRtUX4l1Lpub3VTg7S08doMYwWuiKo sSDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LQLB2DVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si553861eje.95.2020.06.27.08.20.36; Sat, 27 Jun 2020 08:20:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LQLB2DVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726832AbgF0PTk (ORCPT + 99 others); Sat, 27 Jun 2020 11:19:40 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49456 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725975AbgF0PTk (ORCPT ); Sat, 27 Jun 2020 11:19:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593271179; 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=pLA2ZYrXjaL3qNNgdGWEbBRjUO8cxQczAoaM3QLMn2M=; b=LQLB2DVLOmmWD9+IQjhgRTBbBwvNJMe3UJ3v1L6D3EGtMzFpenSgYFdLEpW6+adJ0KcfcI PvaHCA84HYQn0x36bS0FofeOrkwBmYBVMGTndETOZ4Ltl9DmFp1/tmMUm3zWjUfaiExc82 UOhuoiWYblgkgf4TRM43HBUoo5aF09M= 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-160-poHTuCxmNM2kPa9fbnWUcg-1; Sat, 27 Jun 2020 11:19:30 -0400 X-MC-Unique: poHTuCxmNM2kPa9fbnWUcg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A2881085937; Sat, 27 Jun 2020 15:19:29 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF0E160BF4; Sat, 27 Jun 2020 15:19:14 +0000 (UTC) From: Richard Guy Briggs To: containers@lists.linux-foundation.org, Linux-Audit Mailing List , LKML Cc: eparis@parisplace.org, Steve Grubb , omosnace@redhat.com, Paul Moore , nhorman@redhat.com, dwalsh@redhat.com, mpatel@redhat.com, Richard Guy Briggs Subject: [PATCH ghau51/ghau40 v9 07/11] signal_info: only print context if it is available. Date: Sat, 27 Jun 2020 11:18:07 -0400 Message-Id: <1593271091-30188-8-git-send-email-rgb@redhat.com> In-Reply-To: <1593271091-30188-1-git-send-email-rgb@redhat.com> References: <1593271091-30188-1-git-send-email-rgb@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 1.8.3.1