summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/imtcp/imtcp.c15
-rw-r--r--syslogd.c73
-rw-r--r--syslogd.h1
-rw-r--r--tcpsyslog.c24
4 files changed, 44 insertions, 69 deletions
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index ef0912e9..8639baf3 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -241,6 +241,14 @@ ENDdbgPrintInstInfo
BEGINmodExit
CODESTARTmodExit
+ /* Close the TCP inet socket. */
+ if(sockTCPLstn != NULL && *sockTCPLstn) {
+ deinit_tcp_listener();
+ }
+#ifdef USE_GSSAPI
+ if(bEnableTCP & ALLOWEDMETHOD_GSS)
+ TCPSessGSSDeinit();
+#endif
ENDmodExit
@@ -251,7 +259,12 @@ ENDqueryEtryPt
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
- //bOmitLocalLogging = 0;
+#if defined(USE_GSSAPI)
+ if (gss_listen_service_name != NULL) {
+ free(gss_listen_service_name);
+ gss_listen_service_name = NULL;
+ }
+#endif
return RS_RET_OK;
}
diff --git a/syslogd.c b/syslogd.c
index f0742ae6..a6fc28bb 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -377,16 +377,6 @@ int repeatinterval[] = { 30, 60 }; /* # of secs before flush */
#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \
(f)->f_repeatcount = MAXREPEAT; \
}
-#ifdef SYSLOG_INET
-union sockunion {
- struct sockinet {
- u_char si_len;
- u_char si_family;
- } su_si;
- struct sockaddr_in su_sin;
- struct sockaddr_in6 su_sin6;
-};
-#endif
#define LIST_DELIMITER ':' /* delimiter between two hosts */
@@ -588,12 +578,6 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
pModDir = NULL;
}
iMainMsgQueueSize = 10000;
-#if defined(SYSLOG_INET) && defined(USE_GSSAPI)
- if (gss_listen_service_name != NULL) {
- free(gss_listen_service_name);
- gss_listen_service_name = NULL;
- }
-#endif
return RS_RET_OK;
}
@@ -1052,30 +1036,6 @@ int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, c
#endif /* #ifdef SYSLOG_INET */
-/* code to free all sockets within a socket table.
- * A socket table is a descriptor table where the zero
- * element has the count of elements. This is used for
- * listening sockets. The socket table itself is also
- * freed.
- * A POINTER to this structure must be provided, thus
- * double indirection!
- * rgerhards, 2007-06-28
- */
-void freeAllSockets(int **socks)
-{
- assert(socks != NULL);
- assert(*socks != NULL);
- while(**socks) {
- dbgprintf("Closing socket %d.\n", (*socks)[**socks]);
- close((*socks)[**socks]);
- (**socks)--;
- }
- free(*socks);
- socks = NULL;
-}
-
-
-
/*******************************************************************
* BEGIN CODE-LIBLOGGING *
@@ -3473,14 +3433,6 @@ static void die(int sig)
#ifdef SYSLOG_INET
/* Close the UDP inet socket. */
closeUDPListenSockets();
- /* Close the TCP inet socket. */
- if(sockTCPLstn != NULL && *sockTCPLstn) {
- deinit_tcp_listener();
- }
-#ifdef USE_GSSAPI
- if(bEnableTCP & ALLOWEDMETHOD_GSS)
- TCPSessGSSDeinit();
-#endif
#endif
/* rger 2005-02-22
@@ -4391,8 +4343,9 @@ init(void)
/* create message queue */
pMsgQueue = queueInit();
if(pMsgQueue == NULL) {
- errno = 0; /* TODO: check if that is possible without threads - I think we must give up... */
- logerror("error: could not create message queue - running single-threaded!\n");
+ errno = 0; /* no queue is fatal, we need to give up in that case... */
+ fprintf(stderr, "fatal error: could not create message queue - rsyslogd can not run!\n");
+ exit(1);
}
startWorker();
@@ -4400,7 +4353,7 @@ init(void)
Initialized = 1;
/* the output part and the queue is now ready to run. So it is a good time
- * now to start the inputs. Please note that the net code above should be
+ * to start the inputs. Please note that the net code above should be
* shuffled to down here once we have everything in input modules.
* rgerhards, 2007-12-14
*/
@@ -4415,17 +4368,8 @@ init(void)
*/
snprintf(bufStartUpMsg, sizeof(bufStartUpMsg)/sizeof(char),
" [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \
- "\" x-pid=\"%d\"][x-configInfo udpReception=\"%s\" " \
- "udpPort=\"%s\" tcpReception=\"%s\" tcpPort=\"%s\"]" \
- " restart",
- (int) myPid,
-#ifdef SYSLOG_INET
- AcceptRemote ? "Yes" : "No", LogPort,
- bEnableTCP ? "Yes" : "No", TCPLstnPort
-#else
- "No", "0", "No", "0"
-#endif /* #ifdef SYSLOG_INET */
- );
+ "\" x-pid=\"%d\"] restart",
+ (int) myPid);
logmsgInternal(LOG_SYSLOG|LOG_INFO, bufStartUpMsg, ADDDATE);
memset(&sigAct, 0, sizeof (sigAct));
@@ -5440,7 +5384,6 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds)
socklen_t socklen;
uchar fromHost[NI_MAXHOST];
uchar fromHostFQDN[NI_MAXHOST];
- int iTCPSess;
ssize_t l;
#endif /* #ifdef SYSLOG_INET */
@@ -5520,9 +5463,6 @@ static void mainloop(void)
int i;
int maxfds;
int nfds;
-#ifdef SYSLOG_INET
- int iTCPSess;
-#endif /* #ifdef SYSLOG_INET */
while(!bFinished){
errno = 0;
@@ -5672,7 +5612,6 @@ static rsRetVal loadBuildInModules(void)
NULL, &bDebugPrintCfSysLineHandlerList, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"moddir", 0, eCmdHdlrGetWord, NULL, &pModDir, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL));
-#endif
finalize_it:
return iRet;
diff --git a/syslogd.h b/syslogd.h
index 1b3130a5..aa4331e9 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -55,7 +55,6 @@ void logerrorSz(char *type, char *errMsg);
void logerrorInt(char *type, int iErr);
void printchopped(char *hname, char *msg, int len, int fd, int iSourceType);
-void freeAllSockets(int **socks);
int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, const char *pszFromHost);
void getCurrTime(struct syslogTime *t);
int formatTimestampToMySQL(struct syslogTime *ts, char* pDst, size_t iLenDst);
diff --git a/tcpsyslog.c b/tcpsyslog.c
index f4a94bb8..5493a664 100644
--- a/tcpsyslog.c
+++ b/tcpsyslog.c
@@ -82,6 +82,30 @@ static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL;
char *gss_listen_service_name = NULL;
#endif
+
+/* code to free all sockets within a socket table.
+ * A socket table is a descriptor table where the zero
+ * element has the count of elements. This is used for
+ * listening sockets. The socket table itself is also
+ * freed.
+ * A POINTER to this structure must be provided, thus
+ * double indirection!
+ * rgerhards, 2007-06-28
+ */
+static void freeAllSockets(int **socks)
+{
+ assert(socks != NULL);
+ assert(*socks != NULL);
+ while(**socks) {
+ dbgprintf("Closing socket %d.\n", (*socks)[**socks]);
+ close((*socks)[**socks]);
+ (**socks)--;
+ }
+ free(*socks);
+ socks = NULL;
+}
+
+
/* configure TCP listener settings. This is called during command
* line parsing. The argument following -t is supplied as an argument.
* The format of this argument is