- 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:
Rainer Gerhards 2007-08-01 07:26:46 +00:00
parent 4922cc6469
commit 0eab6e11e9
7 changed files with 28 additions and 48 deletions

View File

@ -19,6 +19,8 @@ Version 1.17.6 (rgerhards), 2007-07-3?
thanks to mildew for catching this. thanks to mildew for catching this.
- added configuration file command $DebugPrintModuleList and - added configuration file command $DebugPrintModuleList and
$DebugPrintCfSysLineHandlerList $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 Version 1.17.5 (rgerhards), 2007-07-30
- continued to work on output module modularization - continued to work on output module modularization

View File

@ -548,10 +548,7 @@ rsRetVal regCfSysLineHdlr(uchar *pCmdName, ecslCmdHdrlType eType, rsRetVal (*pHd
} }
} else { } else {
/* command already exists, are we allowed to chain? */ /* command already exists, are we allowed to chain? */
#if 0 /* TODO: check permission to chain */
iRet = RS_RET_NOT_IMPLEMENTED; // TODO: implement it!
goto finalize_it;
#endif
CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) { CHKiRet_Hdlr(cslcAddHdlr(pThis, eType, pHdlr, pData)) {
cslcDestruct(pThis); cslcDestruct(pThis);
goto finalize_it; goto finalize_it;

1
msg.c
View File

@ -1446,7 +1446,6 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
/* skip to the start of the substring (can't do pointer arithmetic /* skip to the start of the substring (can't do pointer arithmetic
* because the whole string might be smaller!!) * because the whole string might be smaller!!)
*/ */
// ++iFrom; /* nbr of chars to skip! */
while(*pRes && iFrom) { while(*pRes && iFrom) {
--iFrom; --iFrom;
++pRes; ++pRes;

View File

@ -56,6 +56,18 @@
*/ */
DEF_OMOD_STATIC_DATA 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 { typedef struct _instanceData {
char f_fname[MAXFNAME];/* file or template name (display only) */ char f_fname[MAXFNAME];/* file or template name (display only) */
short fd; /* file descriptor for (current) file */ short fd; /* file descriptor for (current) file */

View File

@ -149,7 +149,7 @@ void endutent(void)
* Adjust the size of a variable to prevent a buffer overflow * Adjust the size of a variable to prevent a buffer overflow
* should _PATH_DEV ever contain something different than "/dev/". * 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]; char p[sizeof(_PATH_DEV) + UNAMESZ];
@ -162,7 +162,7 @@ static void wallmsg(uchar* pMsg, instanceData *pData)
assert(pMsg != NULL); assert(pMsg != NULL);
if (reenter++) if (reenter++)
return; return RS_RET_OK;
/* open the user login file */ /* open the user login file */
setutent(); setutent();
@ -241,14 +241,14 @@ static void wallmsg(uchar* pMsg, instanceData *pData)
/* close the user login file */ /* close the user login file */
endutent(); endutent();
reenter = 0; reenter = 0;
return RS_RET_OK;
} }
BEGINdoAction BEGINdoAction
CODESTARTdoAction CODESTARTdoAction
dprintf("\n"); dprintf("\n");
/* TODO: change wallmsg so that it returns iRet */ iRet = wallmsg(ppString[0], pData);
wallmsg(ppString[0], pData);
ENDdoAction ENDdoAction

View File

@ -194,11 +194,6 @@
(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
#endif #endif
#ifdef WITH_DB
#include "mysql/mysql.h"
#include "mysql/errmsg.h"
#endif
#include "srUtils.h" #include "srUtils.h"
#include "stringbuf.h" #include "stringbuf.h"
#include "syslogd-types.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 TABLE_ALLPRI 0xFF /* Value to indicate all priorities in f_pmask */
#define LOG_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* mark "facility" */ #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[] = { enum eDirective { DIR_TEMPLATE = 0, DIR_OUTCHANNEL = 1, DIR_ALLOWEDSENDER = 2};
"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};
/* The following global variables are used for building /* The following global variables are used for building
* tag and host selector lines during startup and config reload. * tag and host selector lines during startup and config reload.
@ -462,7 +448,6 @@ union sockunion {
#define LIST_DELIMITER ':' /* delimiter between two hosts */ #define LIST_DELIMITER ':' /* delimiter between two hosts */
struct filed *Files = NULL; /* read-only after init() (but beware of sigusr1!) */ 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 { struct code {
char *c_name; 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 int *finet = NULL; /* Internet datagram sockets, first element is nbr of elements
* read-only after init(), but beware of restart! */ * read-only after init(), but beware of restart! */
static char *LogPort = "514"; /* port number for INET connections */ 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 family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both), set via cmdline */
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */ int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
static int MarkSeq = 0; /* mark sequence number - modified in domark() only */ 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; extern int errno;
/* support for simple textual representatio of FIOP names /* support for simple textual representation of FIOP names
* rgerhards, 2005-09-27 * rgerhards, 2005-09-27
*/ */
static char* getFIOPName(unsigned iFIOP) 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! */ eDir = (enum eDirective) pVal; /* this time, it actually is NOT a pointer! */
if(getSubString(&p, szName, sizeof(szName) / sizeof(char), ',') != 0) { if(getSubString(&p, szName, sizeof(szName) / sizeof(char), ',') != 0) {
char errMsg[128]; logerror("Invalid config line: could not extract name - line ignored");
snprintf(errMsg, sizeof(errMsg)/sizeof(char),
"Invalid $%s line: could not extract name - line ignored",
directive_name_list[eDir]);
logerror(errMsg);
ABORT_FINALIZE(RS_RET_NOT_FOUND); ABORT_FINALIZE(RS_RET_NOT_FOUND);
} }
if(*p == ',') if(*p == ',')
@ -3897,7 +3878,7 @@ static void init()
* think about the whole situation when we implement loadable plugins. * think about the whole situation when we implement loadable plugins.
* rgerhards, 2007-07-31 * rgerhards, 2007-07-31
*/ */
cfsysline("ResetConfigVariables"); cfsysline((uchar*)"ResetConfigVariables");
/* open the configuration file */ /* open the configuration file */
if((iRet = processConfFile(ConfFile)) != RS_RET_OK) { if((iRet = processConfFile(ConfFile)) != RS_RET_OK) {

View File

@ -81,8 +81,6 @@ void getCurrTime(struct syslogTime *t);
int formatTimestampToMySQL(struct syslogTime *ts, char* pDst, size_t iLenDst); int formatTimestampToMySQL(struct syslogTime *ts, char* pDst, size_t iLenDst);
int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf); int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
int formatTimestamp3164(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); void untty(void);
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName); 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); rsRetVal cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts);
@ -104,15 +102,6 @@ extern char **StripDomains;
extern char *LocalDomain; extern char *LocalDomain;
extern int bDropMalPTRMsgs; extern int bDropMalPTRMsgs;
extern struct AllowedSenders *pAllowedSenders_TCP; 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 char ctty[];
extern int bModMySQLLoaded; extern int bModMySQLLoaded;