summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--msg.c2
-rw-r--r--net.c1
-rw-r--r--omfwd.c6
-rw-r--r--plugins/imklog/imklog.c2
-rw-r--r--plugins/imudp/imudp.c16
-rw-r--r--syslogd.c4
-rw-r--r--syslogd.h2
-rw-r--r--tcpsyslog.c2
-rw-r--r--threads.c1
9 files changed, 21 insertions, 15 deletions
diff --git a/msg.c b/msg.c
index 4169220f..f13c6e8e 100644
--- a/msg.c
+++ b/msg.c
@@ -1469,7 +1469,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
++iCurrFld;
}
}
- dbgprintf("field requested %d, field found %d\n", pTpe->data.field.iToPos, iCurrFld);
+ dbgprintf("field requested %d, field found %d\n", pTpe->data.field.iToPos, (int) iCurrFld);
if(iCurrFld == pTpe->data.field.iToPos) {
/* field found, now extract it */
diff --git a/net.c b/net.c
index 132a154f..d5785e48 100644
--- a/net.c
+++ b/net.c
@@ -865,7 +865,6 @@ int *create_udp_socket(uchar *hostname, uchar *pszPort, int bIsServer)
int error, maxs, *s, *socks, on = 1;
int sockflags;
-dbgprintf("create_udp_socket('%s', '%s', %d);\n", hostname, pszPort, bIsServer);
assert(!((pszPort == NULL) && (hostname == NULL)));
memset(&hints, 0, sizeof(hints));
if(bIsServer)
diff --git a/omfwd.c b/omfwd.c
index d026cde1..122dfba1 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -305,7 +305,7 @@ static int TCPSendGSSInit(instanceData *pData)
strcpy(out_tok.value, base);
strcat(out_tok.value, "@");
strcat(out_tok.value, pData->f_hname);
- dbgprintf("GSS-API service name: %s\n", out_tok.value);
+ dbgprintf("GSS-API service name: %s\n", (char*) out_tok.value);
tok_ptr = GSS_C_NO_BUFFER;
context = &pData->gss_context;
@@ -350,7 +350,7 @@ static int TCPSendGSSInit(instanceData *pData)
goto fail;
if (out_tok.length != 0) {
- dbgprintf("GSS-API Sending init_sec_context token (length: %d)\n", out_tok.length);
+ dbgprintf("GSS-API Sending init_sec_context token (length: %ld)\n", (long) out_tok.length);
if (send_token(s, &out_tok) < 0) {
goto fail;
}
@@ -618,7 +618,7 @@ static int TCPSend(instanceData *pData, char *msg, size_t len)
} else {
# endif
lenSend = send(pData->sock, msg, len, 0);
- dbgprintf("TCP sent %d bytes, requested %d, msg: '%s'\n", lenSend, len,
+ dbgprintf("TCP sent %d bytes, requested %ld, msg: '%s'\n", lenSend, (long) len,
bIsCompressed ? "***compressed***" : msg);
if((unsigned)lenSend == len) {
/* all well */
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 26b6a069..72960e1c 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -108,7 +108,7 @@ extern int ksyslog(int type, char *buf, int len);
/* Write a message to the message queue.
* returns -1 if it fails, something else otherwise
*/
-static rsRetVal writeSyslogV(int iPRI, const char *szFmt, va_list va)// __attribute__((format(printf,2, 3)));
+static rsRetVal writeSyslogV(int iPRI, const char *szFmt, va_list va)
{
DEFiRet;
int iChars;
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index fdddf9eb..127ec2fd 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -34,6 +34,7 @@
#include <netdb.h>
#include "rsyslog.h"
#include "syslogd.h"
+#include "net.h"
#include "cfsysline.h"
#include "module-template.h"
@@ -46,7 +47,11 @@ TERM_SYNC_TYPE(eTermSync_NONE)
DEF_IMOD_STATIC_DATA
static int *udpLstnSocks = NULL; /* Internet datagram sockets, first element is nbr of elements
* read-only after init(), but beware of restart! */
-static uchar *pszBindAddr = NULL; /* IP to bind socket to */
+static uchar *pszBindAddr = NULL; /* IP to bind socket to */
+static uchar *pRcvBuf = NULL; /* receive buffer (for a single packet). We use a global and alloc
+ * it so that we can check available memory in willRun() and request
+ * termination if we can not get it. -- rgerhards, 2007-12-27
+ */
typedef struct _instanceData {
} instanceData;
@@ -128,7 +133,6 @@ BEGINrunInput
socklen_t socklen;
uchar fromHost[NI_MAXHOST];
uchar fromHostFQDN[NI_MAXHOST];
- char line[MAXLINE +1];
ssize_t l;
CODESTARTrunInput
/* this is an endless loop - it is terminated when the thread is
@@ -172,7 +176,7 @@ CODESTARTrunInput
for (i = 0; nfds && i < *udpLstnSocks; i++) {
if (FD_ISSET(udpLstnSocks[i+1], &readfds)) {
socklen = sizeof(frominet);
- l = recvfrom(udpLstnSocks[i+1], line, MAXLINE - 1, 0,
+ l = recvfrom(udpLstnSocks[i+1], (char*) pRcvBuf, MAXLINE - 1, 0,
(struct sockaddr *)&frominet, &socklen);
if (l > 0) {
if(cvthname(&frominet, fromHost, fromHostFQDN) == RS_RET_OK) {
@@ -186,7 +190,7 @@ CODESTARTrunInput
*/
if(isAllowedSender(pAllowedSenders_UDP,
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
- printchopped((char*)fromHost, line, l, udpLstnSocks[i+1], 1);
+ printchopped((char*)fromHost, (char*) pRcvBuf, l, udpLstnSocks[i+1], 1);
} else {
dbgprintf("%s is not an allowed sender\n", (char*)fromHostFQDN);
if(option_DisallowWarning) {
@@ -218,10 +222,14 @@ BEGINwillRun
CODESTARTwillRun
PrintAllowedSenders(1); /* UDP */
+ if((pRcvBuf = malloc(MAXLINE * sizeof(char))) == NULL) {
+ ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
+ }
/* if we could not set up any listners, there is no point in running... */
if(udpLstnSocks == NULL)
iRet = RS_RET_NO_RUN;
+finalize_it:
ENDwillRun
diff --git a/syslogd.c b/syslogd.c
index 77e430cf..e2efa1bc 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -1345,8 +1345,8 @@ void printchopped(char *hname, char *msg, int len, int fd, int bParseHost)
int ret;
iLenDefBuf = MAXLINE;
ret = uncompress((uchar *) deflateBuf, &iLenDefBuf, (uchar *) msg+1, len-1);
- dbgprintf("Compressed message uncompressed with status %d, length: new %d, old %d.\n",
- ret, iLenDefBuf, len-1);
+ dbgprintf("Compressed message uncompressed with status %d, length: new %ld, old %d.\n",
+ ret, (long) iLenDefBuf, len-1);
/* Now check if the uncompression worked. If not, there is not much we can do. In
* that case, we log an error message but ignore the message itself. Storing the
* compressed text is dangerous, as it contains control characters. So we do
diff --git a/syslogd.h b/syslogd.h
index 655c01fc..40efdb81 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -49,7 +49,7 @@
#define ADDDATE 0x004 /* add a date to the message */
#define MARK 0x008 /* this message is a mark */
-void dbgprintf(char *, ...);
+void dbgprintf(char *, ...) __attribute__((format(printf, 1, 2)));
void logerror(char *type);
void logerrorSz(char *type, char *errMsg);
void logerrorInt(char *type, int iErr);
diff --git a/tcpsyslog.c b/tcpsyslog.c
index 66ce9ce9..b07b2fb8 100644
--- a/tcpsyslog.c
+++ b/tcpsyslog.c
@@ -924,7 +924,7 @@ int TCPSessGSSAccept(int fd)
if (maj_stat != GSS_S_COMPLETE)
display_status("displaying name", maj_stat, min_stat);
else
- dbgprintf("GSS-API Accepted connection from: %s\n", recv_tok.value);
+ dbgprintf("GSS-API Accepted connection from: %s\n", (char*) recv_tok.value);
gss_release_name(&min_stat, &client);
gss_release_buffer(&min_stat, &recv_tok);
diff --git a/threads.c b/threads.c
index 4b86534d..38e86195 100644
--- a/threads.c
+++ b/threads.c
@@ -79,7 +79,6 @@ static rsRetVal thrdConstruct(thrdInfo_t **ppThis)
static rsRetVal thrdDestruct(thrdInfo_t *pThis)
{
assert(pThis != NULL);
-dbgprintf("thrdDestruct, pThis: %lx\n", pThis);
if(pThis->bIsActive == 1) {
thrdTerminate(pThis);