summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imklog/ksym.c62
-rw-r--r--plugins/imklog/linux.c3
-rw-r--r--plugins/imtcp/imtcp.c12
-rw-r--r--plugins/omgssapi/omgssapi.c23
4 files changed, 42 insertions, 58 deletions
diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c
index 1c2af124..34ce909e 100644
--- a/plugins/imklog/ksym.c
+++ b/plugins/imklog/ksym.c
@@ -138,7 +138,7 @@ static char *system_maps[] =
/* Function prototypes. */
-static char * FindSymbolFile(void);
+static char *FindSymbolFile(void);
static int AddSymbol(unsigned long, char*);
static void FreeSymbols(void);
static int CheckVersion(char *);
@@ -173,29 +173,28 @@ extern int InitKsyms(char *mapfile)
auto FILE *sym_file;
+ BEGINfunc
/* Check and make sure that we are starting with a clean slate. */
if ( num_syms > 0 )
FreeSymbols();
- /*
- * Search for and open the file containing the kernel symbols.
- */
- if ( mapfile != (char *) 0 ) {
- if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 )
+ /* Search for and open the file containing the kernel symbols. */
+ if ( mapfile != NULL ) {
+ if ( (sym_file = fopen(mapfile, "r")) == NULL )
{
imklogLogIntMsg(LOG_WARNING, "Cannot open map file: %s.", mapfile);
return(0);
}
} else {
- if ( (mapfile = FindSymbolFile()) == (char *) 0 ) {
+ if ( (mapfile = FindSymbolFile()) == NULL ) {
imklogLogIntMsg(LOG_WARNING, "Cannot find map file.");
dbgprintf("Cannot find map file.\n");
return(0);
}
- if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) {
+ if ( (sym_file = fopen(mapfile, "r")) == NULL ) {
imklogLogIntMsg(LOG_WARNING, "Cannot open map file.");
dbgprintf("Cannot open map file.\n");
return(0);
@@ -248,6 +247,7 @@ extern int InitKsyms(char *mapfile)
}
fclose(sym_file);
+ ENDfunc
return(1);
}
@@ -292,44 +292,42 @@ extern void DeinitKsyms(void)
**************************************************************************/
static char *FindSymbolFile(void)
{
- auto char *file = (char *) 0,
+ auto char *file = NULL,
**mf = system_maps;
-
auto struct utsname utsname;
static char mysymfile[100];
+ auto FILE *sym_file = NULL;
+ BEGINfunc
- auto FILE *sym_file = (FILE *) 0;
-
- if ( uname(&utsname) < 0 ) {
+ if(uname(&utsname) < 0) {
imklogLogIntMsg(LOG_ERR, "Cannot get kernel version information.");
return(0);
}
dbgprintf("Searching for symbol map.\n");
- for(mf = system_maps; *mf != (char *) 0 && file == (char *) 0; ++mf) {
-
+ for(mf = system_maps; *mf != NULL && file == NULL; ++mf) {
snprintf(mysymfile, sizeof(mysymfile), "%s-%s", *mf, utsname.release);
dbgprintf("Trying %s.\n", mysymfile);
- if ( (sym_file = fopen(mysymfile, "r")) != (FILE *) 0 ) {
- if (CheckMapVersion(mysymfile) == 1)
+ if((sym_file = fopen(mysymfile, "r")) != NULL) {
+ if(CheckMapVersion(mysymfile) == 1)
file = mysymfile;
fclose(sym_file);
}
- if (sym_file == (FILE *) 0 || file == (char *) 0) {
+ if(sym_file == NULL || file == NULL) {
sprintf (mysymfile, "%s", *mf);
dbgprintf("Trying %s.\n", mysymfile);
- if ( (sym_file = fopen(mysymfile, "r")) != (FILE *) 0 ) {
+ if((sym_file = fopen(mysymfile, "r")) != NULL ) {
if (CheckMapVersion(mysymfile) == 1)
file = mysymfile;
fclose(sym_file);
}
}
-
}
/* At this stage of the game we are at the end of the symbol tables. */
dbgprintf("End of search list encountered.\n");
+ ENDfunc
return(file);
}
@@ -464,7 +462,7 @@ static int CheckMapVersion(char *fname)
auto char type,
sym[512];
- if ( (sym_file = fopen(fname, "r")) != (FILE *) 0 ) {
+ if ( (sym_file = fopen(fname, "r")) != NULL ) {
/*
* At this point a map file was successfully opened. We
* now need to search this file and look for version
@@ -527,7 +525,7 @@ static int AddSymbol(unsigned long address, char *symbol)
/* Then the space for the symbol. */
sym_array[num_syms].name = (char *) malloc(strlen(symbol)*sizeof(char) + 1);
- if ( sym_array[num_syms].name == (char *) 0 )
+ if ( sym_array[num_syms].name == NULL )
return(0);
sym_array[num_syms].value = address;
@@ -566,13 +564,13 @@ char * LookupSymbol(unsigned long value, struct symbol *sym)
struct symbol ksym, msym;
if (!sym_array)
- return((char *) 0);
+ return(NULL);
last = sym_array[0].name;
ksym.offset = 0;
ksym.size = 0;
if ( value < sym_array[0].value )
- return((char *) 0);
+ return(NULL);
for(lp = 0; lp <= num_syms; ++lp) {
if ( sym_array[lp].value > value ) {
@@ -587,7 +585,7 @@ char * LookupSymbol(unsigned long value, struct symbol *sym)
name = LookupModuleSymbol(value, &msym);
if ( ksym.offset == 0 && msym.offset == 0 ) {
- return((char *) 0);
+ return(NULL);
}
if ( ksym.offset == 0 || msym.offset < 0 ||
@@ -602,7 +600,7 @@ char * LookupSymbol(unsigned long value, struct symbol *sym)
}
- return((char *) 0);
+ return(NULL);
}
/**************************************************************************
@@ -683,7 +681,7 @@ extern char *ExpandKadds(char *line, char *el)
* open for patches.
*/
if ( i_am_paranoid &&
- (strstr(line, "Oops:") != (char *) 0) && !InitMsyms() )
+ (strstr(line, "Oops:") != NULL) && !InitMsyms() )
imklogLogIntMsg(LOG_WARNING, "Cannot load kernel module symbols.\n");
@@ -692,7 +690,7 @@ extern char *ExpandKadds(char *line, char *el)
* messages in this line.
*/
if ( (num_syms == 0) ||
- (kp = strstr(line, "[<")) == (char *) 0 ) {
+ (kp = strstr(line, "[<")) == NULL ) {
#ifdef __sparc__
if (num_syms) {
/* On SPARC, register dumps do not have the [< >] characters in it.
@@ -780,7 +778,7 @@ extern char *ExpandKadds(char *line, char *el)
*elp++ = *sl++;
/* Now poised at a kernel delimiter. */
- if ( (kp = strstr(sl, ">]")) == (char *) 0 ) {
+ if ( (kp = strstr(sl, ">]")) == NULL ) {
strcpy(el, sl);
return(el);
}
@@ -788,7 +786,7 @@ extern char *ExpandKadds(char *line, char *el)
strncpy(num,sl+1,kp-sl-1);
num[kp-sl-1] = '\0';
value = strtoul(num, (char **) 0, 16);
- if ( (symbol = LookupSymbol(value, &sym)) == (char *) 0 )
+ if ( (symbol = LookupSymbol(value, &sym)) == NULL )
symbol = sl;
strcat(elp, symbol);
@@ -805,10 +803,10 @@ extern char *ExpandKadds(char *line, char *el)
strncat(elp, kp, value);
elp += value;
sl = kp + value;
- if ( (kp = strstr(sl, "[<")) == (char *) 0 )
+ if ( (kp = strstr(sl, "[<")) == NULL )
strcat(elp, sl);
}
- while ( kp != (char *) 0);
+ while ( kp != NULL);
dbgprintf("Expanded line: %s\n", el);
return(el);
diff --git a/plugins/imklog/linux.c b/plugins/imklog/linux.c
index 32cf70c4..8e4d3388 100644
--- a/plugins/imklog/linux.c
+++ b/plugins/imklog/linux.c
@@ -499,7 +499,8 @@ rsRetVal klogWillRun(void)
symbol_lookup = (InitKsyms(symfile) == 1);
symbol_lookup |= InitMsyms();
if (symbol_lookup == 0) {
- imklogLogIntMsg(LOG_WARNING, "cannot find any symbols, turning off symbol lookups\n");
+ dbgprintf("cannot find any symbols, turning off symbol lookups\n");
+ imklogLogIntMsg(LOG_WARNING, "cannot find any symbols, turning off symbol lookups");
}
}
}
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index b7f8f0b5..1e599d14 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -43,6 +43,7 @@
#include "cfsysline.h"
#include "module-template.h"
#include "net.h"
+#include "netstrm.h"
#include "tcpsrv.h"
MODULE_TYPE_INPUT
@@ -52,6 +53,7 @@ DEF_IMOD_STATIC_DATA
DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
DEFobjCurrIf(net)
+DEFobjCurrIf(netstrm)
/* Module static data */
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
@@ -70,7 +72,7 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((u
}
-static int*
+static rsRetVal
doOpenLstnSocks(tcpsrv_t *pSrv)
{
ISOBJ_TYPE_assert(pSrv, tcpsrv);
@@ -81,10 +83,12 @@ doOpenLstnSocks(tcpsrv_t *pSrv)
static int
doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf)
{
- int state;
+ ssize_t state;
assert(pSess != NULL);
- state = recv(pSess->sock, buf, lenBuf, 0);
+ state = lenBuf;
+ if(netstrm.Rcv(pSess->pStrm, (uchar*) buf, &state) != RS_RET_OK)
+ state = -1; // TODO: move this function to an iRet interface! 2008-04-23
return state;
}
@@ -172,6 +176,7 @@ CODESTARTmodExit
/* release objects we used */
objRelease(net, LM_NET_FILENAME);
+ objRelease(netstrm, LM_NETSTRM_FILENAME);
objRelease(tcps_sess, LM_TCPSRV_FILENAME);
objRelease(tcpsrv, LM_TCPSRV_FILENAME);
ENDmodExit
@@ -199,6 +204,7 @@ CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
CHKiRet(objUse(net, LM_NET_FILENAME));
+ CHKiRet(objUse(netstrm, LM_NETSTRM_FILENAME));
CHKiRet(objUse(tcps_sess, LM_TCPSRV_FILENAME));
CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c
index 3f6600ca..6d419de0 100644
--- a/plugins/omgssapi/omgssapi.c
+++ b/plugins/omgssapi/omgssapi.c
@@ -58,17 +58,6 @@
MODULE_TYPE_OUTPUT
-#define INET_SUSPEND_TIME 60
-/* equal to 1 minute - TODO: see if we can get rid of this now that we have
- * the retry intervals in the engine -- rgerhards, 2008-03-12
- */
-
-#define INET_RETRY_MAX 30 /* maximum of retries for gethostbyname() */
- /* was 10, changed to 30 because we reduced INET_SUSPEND_TIME by one third. So
- * this "fixes" some of implications of it (see comment on INET_SUSPEND_TIME).
- * rgerhards, 2005-07-26
- * TODO: this needs to be reviewed in spite of the new engine, too -- rgerhards, 2008-03-12
- */
/* internal structures
*/
@@ -86,11 +75,9 @@ typedef struct _instanceData {
eDestFORW_SUSP,
eDestFORW_UNKN
} eDestState;
- int iRtryCnt;
struct addrinfo *f_addr;
int compressionLevel; /* 0 - no compression, else level for zlib */
char *port;
- time_t ttSuspend; /* time selector was suspended */
tcpclt_t *pTCPClt; /* our tcpclt object */
gss_ctx_id_t gss_context;
OM_uint32 gss_flags;
@@ -174,8 +161,6 @@ CODESTARTdbgPrintInstInfo
ENDdbgPrintInstInfo
-/* CODE FOR SENDING TCP MESSAGES */
-
/* This function is called immediately before a send retry is attempted.
* It shall clean up whatever makes sense.
* rgerhards, 2007-12-28
@@ -207,9 +192,7 @@ static rsRetVal TCPSendGSSInit(void *pvData)
base = (gss_base_service_name == NULL) ? "host" : gss_base_service_name;
out_tok.length = strlen(pData->f_hname) + strlen(base) + 2;
- if ((out_tok.value = malloc(out_tok.length)) == NULL) {
- ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
- }
+ CHKmalloc(out_tok.value = malloc(out_tok.length));
strcpy(out_tok.value, base);
strcat(out_tok.value, "@");
strcat(out_tok.value, pData->f_hname);
@@ -371,7 +354,6 @@ static rsRetVal doTryResume(instanceData *pData)
getFwdSyslogPt(pData), &hints, &res)) == 0) {
dbgprintf("%s found, resuming.\n", pData->f_hname);
pData->f_addr = res;
- pData->iRtryCnt = 0;
pData->eDestState = eDestFORW;
} else {
iRet = RS_RET_SUSPENDED;
@@ -410,7 +392,6 @@ CODESTARTdoAction
case eDestFORW:
dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData), "tcp-gssapi");
- pData->ttSuspend = time(NULL);
psz = (char*) ppString[0];
l = strlen((char*) psz);
if (l > MAXLINE)
@@ -613,8 +594,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
hints.ai_socktype = SOCK_STREAM;
if( (error = getaddrinfo(pData->f_hname, getFwdSyslogPt(pData), &hints, &res)) != 0) {
pData->eDestState = eDestFORW_UNKN;
- pData->iRtryCnt = INET_RETRY_MAX;
- pData->ttSuspend = time(NULL);
} else {
pData->eDestState = eDestFORW;
pData->f_addr = res;