Use RGerhards name in omusrmsg header

AI-Agent: Codex 2025-06
This commit is contained in:
Rainer Gerhards 2025-06-13 16:48:43 +02:00
parent 0a51099539
commit d143efc334
No known key found for this signature in database
GPG Key ID: 0CB6B2A8BE80B499
2 changed files with 63 additions and 22 deletions

View File

@ -1,12 +1,15 @@
/* omusrmsg.c /**
* This is the implementation of the build-in output module for sending * @file omusrmsg.c
* user messages. * @brief Implementation of the built-in user message output module.
* *
* NOTE: read comments in module-template.h to understand how this file * This module provides message delivery to logged-in users. Depending on
* works! * configuration it can either send messages to specific user terminals or
* broadcast them using a "wall" style interface.
* *
* File begun on 2007-07-20 by RGerhards (extracted from syslogd.c, which at the * NOTE: read comments in module-template.h to understand how this file works!
* time of the fork from sysklogd was under BSD license) *
* File begun on 2007-07-20 by Rainer Gerhards (extracted from syslogd.c,
* which at the time of the fork from sysklogd was under BSD license).
* *
* Copyright 2007-2025 Adiscon GmbH. * Copyright 2007-2025 Adiscon GmbH.
* *
@ -225,6 +228,16 @@ void endutent(void)
#endif /* #ifdef OS_BSD */ #endif /* #ifdef OS_BSD */
/**
* Send a message to a specific terminal device.
*
* The function builds the full device path from the supplied tty name
* and writes the message using non-blocking I/O so that a blocked
* terminal does not stall the caller.
*
* @param tty terminal name (e.g. "pts/0")
* @param pMsg message text to send
*/
static void sendwallmsg(const char *tty, uchar* pMsg) static void sendwallmsg(const char *tty, uchar* pMsg)
{ {
uchar szErr[512]; uchar szErr[512];
@ -265,17 +278,17 @@ static void sendwallmsg(const char *tty, uchar* pMsg)
} }
} }
/* WALLMSG -- Write a message to the world at large /**
* Write a message to the world at large.
* *
* Write the specified message to either the entire * The message can either be broadcast to all logged-in users or sent only
* world, or a list of approved users. * to the set configured in @a pData. The implementation avoids forking a
* helper process and instead performs delivery on the caller's thread.
* *
* rgerhards, 2005-10-19: applying the following sysklogd patch: * @param[in] pMsg message text to deliver
* Tue May 4 16:52:01 CEST 2004: Solar Designer <solar@openwall.com> * @param[in] pData per-action configuration
* Adjust the size of a variable to prevent a buffer overflow *
* should _PATH_DEV ever contain something different than "/dev/". * @return rsRetVal
* rgerhards, 2008-07-04: changing the function to no longer use fork() but
* continue run on its thread instead.
*/ */
static rsRetVal wallmsg(uchar* pMsg, instanceData *pData) static rsRetVal wallmsg(uchar* pMsg, instanceData *pData)
{ {
@ -403,6 +416,16 @@ ENDdoAction
static void static void
/**
* Parse a comma separated list of usernames.
*
* The user list is copied into the instance data. Whitespace is skipped
* and overly long names are reported via the error log. If more than
* MAXUNAMES users are specified, excess entries are ignored.
*
* @param[in] pData Instance configuration to populate
* @param[in] usrs comma separated list of users
*/
populateUsers(instanceData *pData, es_str_t *usrs) populateUsers(instanceData *pData, es_str_t *usrs)
{ {
int i; int i;

View File

@ -1,9 +1,14 @@
/* omusrmsg.c /**
* These are the definitions for the build-in user message output module. * @file omusrmsg.h
* @brief Interface for the built-in user message output module.
* *
* File begun on 2007-07-13 by RGerhards * This header exposes the initialization routine for the `omusrmsg`
* module. The module implements delivery of log messages directly to
* logged-in users (either individually or via "wall" style broadcast).
* *
* Copyright 20072-2012 Adiscon GmbH. * File begun on 2007-07-13 by Rainer Gerhards.
*
* Copyright 2007-2012 Adiscon GmbH.
* *
* This file is part of rsyslog. * This file is part of rsyslog.
* *
@ -25,8 +30,21 @@
#define OMUSRMSG_H_INCLUDED 1 #define OMUSRMSG_H_INCLUDED 1
/* prototypes */ /* prototypes */
rsRetVal modInitUsrMsg(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, /**
rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()), modInfo_t*); * Initialize the omusrmsg module.
*
* @param[in] iIFVersRequested interface version requested by the core
* @param[out] ipIFVersProvided the interface version actually provided
* @param[out] pQueryEtryPt receives module entry points
* @param[in] pHostQueryEtryPt callback used to query host entry points
* @param[in] pModInfo pointer to the module information block
*
* @return rsRetVal standard return code
*/
rsRetVal modInitUsrMsg(int iIFVersRequested __attribute__((unused)),
int *ipIFVersProvided,
rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()),
modInfo_t *pModInfo);
#endif /* #ifndef OMUSRMSG_H_INCLUDED */ #endif /* #ifndef OMUSRMSG_H_INCLUDED */
/* vi:set ai: /* vi:set ai: