mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-20 14:20:42 +01:00
- loading default values as done yesterday *is* clean (I've just reviewed
the code again)
- moved omfile-specifc global variables (for cfsysline settings) from
syslogd.c to omfile.c
This commit is contained in:
parent
4922cc6469
commit
0eab6e11e9
@ -19,6 +19,8 @@ Version 1.17.6 (rgerhards), 2007-07-3?
|
||||
thanks to mildew for catching this.
|
||||
- added configuration file command $DebugPrintModuleList and
|
||||
$DebugPrintCfSysLineHandlerList
|
||||
- fixed an invalid value for the MARK timer - unfortunately, there was
|
||||
a testing aid left in place. This resulted in quite frequent MARK messages
|
||||
---------------------------------------------------------------------------
|
||||
Version 1.17.5 (rgerhards), 2007-07-30
|
||||
- continued to work on output module modularization
|
||||
|
||||
@ -548,10 +548,7 @@ rsRetVal regCfSysLineHdlr(uchar *pCmdName, ecslCmdHdrlType eType, rsRetVal (*pHd
|
||||
}
|
||||
} else {
|
||||
/* command already exists, are we allowed to chain? */
|
||||
#if 0
|
||||
iRet = RS_RET_NOT_IMPLEMENTED; // TODO: implement it!
|
||||
goto finalize_it;
|
||||
#endif
|
||||
/* TODO: check permission to chain */
|
||||
CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) {
|
||||
cslcDestruct(pThis);
|
||||
goto finalize_it;
|
||||
|
||||
1
msg.c
1
msg.c
@ -1446,7 +1446,6 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
|
||||
/* skip to the start of the substring (can't do pointer arithmetic
|
||||
* because the whole string might be smaller!!)
|
||||
*/
|
||||
// ++iFrom; /* nbr of chars to skip! */
|
||||
while(*pRes && iFrom) {
|
||||
--iFrom;
|
||||
++pRes;
|
||||
|
||||
12
omfile.c
12
omfile.c
@ -56,6 +56,18 @@
|
||||
*/
|
||||
DEF_OMOD_STATIC_DATA
|
||||
|
||||
/* globals for default values */
|
||||
static int iDynaFileCacheSize = 10; /* max cache for dynamic files */
|
||||
static int fCreateMode = 0644; /* mode to use when creating files */
|
||||
static int fDirCreateMode = 0644; /* mode to use when creating files */
|
||||
static int bFailOnChown; /* fail if chown fails? */
|
||||
static uid_t fileUID; /* UID to be used for newly created files */
|
||||
static uid_t fileGID; /* GID to be used for newly created files */
|
||||
static uid_t dirUID; /* UID to be used for newly created directories */
|
||||
static uid_t dirGID; /* GID to be used for newly created directories */
|
||||
static int bCreateDirs; /* auto-create directories for dynaFiles: 0 - no, 1 - yes */
|
||||
/* end globals for default values */
|
||||
|
||||
typedef struct _instanceData {
|
||||
char f_fname[MAXFNAME];/* file or template name (display only) */
|
||||
short fd; /* file descriptor for (current) file */
|
||||
|
||||
@ -149,7 +149,7 @@ void endutent(void)
|
||||
* Adjust the size of a variable to prevent a buffer overflow
|
||||
* should _PATH_DEV ever contain something different than "/dev/".
|
||||
*/
|
||||
static void wallmsg(uchar* pMsg, instanceData *pData)
|
||||
static srRetVal wallmsg(uchar* pMsg, instanceData *pData)
|
||||
{
|
||||
|
||||
char p[sizeof(_PATH_DEV) + UNAMESZ];
|
||||
@ -162,7 +162,7 @@ static void wallmsg(uchar* pMsg, instanceData *pData)
|
||||
assert(pMsg != NULL);
|
||||
|
||||
if (reenter++)
|
||||
return;
|
||||
return RS_RET_OK;
|
||||
|
||||
/* open the user login file */
|
||||
setutent();
|
||||
@ -241,14 +241,14 @@ static void wallmsg(uchar* pMsg, instanceData *pData)
|
||||
/* close the user login file */
|
||||
endutent();
|
||||
reenter = 0;
|
||||
return RS_RET_OK;
|
||||
}
|
||||
|
||||
|
||||
BEGINdoAction
|
||||
CODESTARTdoAction
|
||||
dprintf("\n");
|
||||
/* TODO: change wallmsg so that it returns iRet */
|
||||
wallmsg(ppString[0], pData);
|
||||
iRet = wallmsg(ppString[0], pData);
|
||||
ENDdoAction
|
||||
|
||||
|
||||
|
||||
37
syslogd.c
37
syslogd.c
@ -194,11 +194,6 @@
|
||||
(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DB
|
||||
#include "mysql/mysql.h"
|
||||
#include "mysql/errmsg.h"
|
||||
#endif
|
||||
|
||||
#include "srUtils.h"
|
||||
#include "stringbuf.h"
|
||||
#include "syslogd-types.h"
|
||||
@ -381,21 +376,12 @@ int funix[MAXFUNIX] = { -1, }; /* read-only after startup */
|
||||
#define TABLE_ALLPRI 0xFF /* Value to indicate all priorities in f_pmask */
|
||||
#define LOG_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* mark "facility" */
|
||||
|
||||
/* This table lists the directive lines:
|
||||
/* definitions used for doNameLine to differentiate between different command types
|
||||
* (with otherwise identical code). This is a left-over from the previous config
|
||||
* system. It stays, because it is still useful. So do not wonder why it looks
|
||||
* somewhat strange (at least its name). -- rgerhards, 2007-08-01
|
||||
*/
|
||||
static const char *directive_name_list[] = {
|
||||
"template",
|
||||
"outchannel",
|
||||
"allowedsender",
|
||||
"filecreatemode",
|
||||
"umask",
|
||||
"dynafilecachesize"
|
||||
};
|
||||
/* ... and their definitions: */
|
||||
enum eDirective { DIR_TEMPLATE = 0, DIR_OUTCHANNEL = 1,
|
||||
DIR_ALLOWEDSENDER = 2, DIR_FILECREATEMODE = 3,
|
||||
DIR_DIRCREATEMODE = 4,
|
||||
DIR_UMASK = 5, DIR_DYNAFILECACHESIZE = 6};
|
||||
enum eDirective { DIR_TEMPLATE = 0, DIR_OUTCHANNEL = 1, DIR_ALLOWEDSENDER = 2};
|
||||
|
||||
/* The following global variables are used for building
|
||||
* tag and host selector lines during startup and config reload.
|
||||
@ -462,7 +448,6 @@ union sockunion {
|
||||
#define LIST_DELIMITER ':' /* delimiter between two hosts */
|
||||
|
||||
struct filed *Files = NULL; /* read-only after init() (but beware of sigusr1!) */
|
||||
// TODO: REMOVE! struct filed consfile; /* initialized on startup, used during actions - maybe NON THREAD-SAFE */
|
||||
|
||||
struct code {
|
||||
char *c_name;
|
||||
@ -536,7 +521,7 @@ char *LocalDomain; /* our local domain name - read-only after startup */
|
||||
int *finet = NULL; /* Internet datagram sockets, first element is nbr of elements
|
||||
* read-only after init(), but beware of restart! */
|
||||
static char *LogPort = "514"; /* port number for INET connections */
|
||||
static int MarkInterval = 5;//20 * 60; /* interval between marks in seconds - read-only after startup */
|
||||
static int MarkInterval = 20 * 60; /* interval between marks in seconds - read-only after startup */
|
||||
int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both), set via cmdline */
|
||||
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
|
||||
static int MarkSeq = 0; /* mark sequence number - modified in domark() only */
|
||||
@ -561,7 +546,7 @@ static int Initialized = 0; /* set when we have initialized ourselves
|
||||
|
||||
extern int errno;
|
||||
|
||||
/* support for simple textual representatio of FIOP names
|
||||
/* support for simple textual representation of FIOP names
|
||||
* rgerhards, 2005-09-27
|
||||
*/
|
||||
static char* getFIOPName(unsigned iFIOP)
|
||||
@ -3473,11 +3458,7 @@ static rsRetVal doNameLine(uchar **pp, void* pVal)
|
||||
eDir = (enum eDirective) pVal; /* this time, it actually is NOT a pointer! */
|
||||
|
||||
if(getSubString(&p, szName, sizeof(szName) / sizeof(char), ',') != 0) {
|
||||
char errMsg[128];
|
||||
snprintf(errMsg, sizeof(errMsg)/sizeof(char),
|
||||
"Invalid $%s line: could not extract name - line ignored",
|
||||
directive_name_list[eDir]);
|
||||
logerror(errMsg);
|
||||
logerror("Invalid config line: could not extract name - line ignored");
|
||||
ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
}
|
||||
if(*p == ',')
|
||||
@ -3897,7 +3878,7 @@ static void init()
|
||||
* think about the whole situation when we implement loadable plugins.
|
||||
* rgerhards, 2007-07-31
|
||||
*/
|
||||
cfsysline("ResetConfigVariables");
|
||||
cfsysline((uchar*)"ResetConfigVariables");
|
||||
|
||||
/* open the configuration file */
|
||||
if((iRet = processConfFile(ConfFile)) != RS_RET_OK) {
|
||||
|
||||
11
syslogd.h
11
syslogd.h
@ -81,8 +81,6 @@ void getCurrTime(struct syslogTime *t);
|
||||
int formatTimestampToMySQL(struct syslogTime *ts, char* pDst, size_t iLenDst);
|
||||
int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
|
||||
int formatTimestamp3164(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
|
||||
void iovCreate(selector_t *f);
|
||||
char *iovAsString(selector_t *f);
|
||||
void untty(void);
|
||||
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName);
|
||||
rsRetVal cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts);
|
||||
@ -104,15 +102,6 @@ extern char **StripDomains;
|
||||
extern char *LocalDomain;
|
||||
extern int bDropMalPTRMsgs;
|
||||
extern struct AllowedSenders *pAllowedSenders_TCP;
|
||||
extern int fCreateMode;
|
||||
extern int fDirCreateMode;
|
||||
extern int bFailOnChown;
|
||||
extern uid_t fileUID;
|
||||
extern uid_t fileGID;
|
||||
extern uid_t dirUID;
|
||||
extern uid_t dirGID;
|
||||
extern int bCreateDirs;
|
||||
extern int iDynaFileCacheSize;
|
||||
extern char ctty[];
|
||||
extern int bModMySQLLoaded;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user