mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-17 22:10:41 +01:00
some cleanup
This commit is contained in:
parent
c7b246e3b6
commit
cebbf6d44e
2
msg.c
2
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 */
|
||||
|
||||
1
net.c
1
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)
|
||||
|
||||
6
omfwd.c
6
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 */
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user