summaryrefslogtreecommitdiffstats
path: root/runtime/netstrm.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-18 18:29:02 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-18 18:29:02 +0200
commit2069ab114e2aac9c243aff72042912cac7ef6126 (patch)
tree19bd5df7fb640b754ec6b91954d0153ed0f2eac5 /runtime/netstrm.c
parent032b9c1f64691e868b14e6d271ebfc2d093b0c66 (diff)
downloadrsyslog-2069ab114e2aac9c243aff72042912cac7ef6126.tar.gz
rsyslog-2069ab114e2aac9c243aff72042912cac7ef6126.tar.xz
rsyslog-2069ab114e2aac9c243aff72042912cac7ef6126.zip
first working TLS-enabled plain TCP sender
implemented a first working version of a TLS-enabled plain TCP sender (but, of course, the implementation is insecure as it is)
Diffstat (limited to 'runtime/netstrm.c')
-rw-r--r--runtime/netstrm.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/runtime/netstrm.c b/runtime/netstrm.c
index 274a92d7..a304ada4 100644
--- a/runtime/netstrm.c
+++ b/runtime/netstrm.c
@@ -84,18 +84,22 @@ loadDrvr(netstrm_t *pThis)
uchar *pDrvrName;
DEFiRet;
- pDrvrName = pThis->pDrvrName;
- if(pDrvrName == NULL) /* if no drvr name is set, use system default */
- pDrvrName = glbl.GetDfltNetstrmDrvr();
-
- pThis->Drvr.ifVersion = nsdCURR_IF_VERSION;
- /* The pDrvrName+2 below is a hack to obtain the object name. It
- * safes us to have yet another variable with the name without "lm" in
- * front of it. If we change the module load interface, we may re-think
- * about this hack, but for the time being it is efficient and clean
- * enough. -- rgerhards, 2008-04-18
- */
- CHKiRet(obj.UseObj(__FILE__, pDrvrName+2, pDrvrName, (void*) &pThis->Drvr));
+ if(pThis->Drvr.ifIsLoaded == 0) {
+ pDrvrName = pThis->pDrvrName;
+ if(pDrvrName == NULL) { /* if no drvr name is set, use system default */
+ pDrvrName = glbl.GetDfltNetstrmDrvr();
+ pThis->pDrvrName = (uchar*)strdup((char*)pDrvrName); // TODO: use set method once it exists
+ }
+
+ pThis->Drvr.ifVersion = nsdCURR_IF_VERSION;
+ /* The pDrvrName+2 below is a hack to obtain the object name. It
+ * safes us to have yet another variable with the name without "lm" in
+ * front of it. If we change the module load interface, we may re-think
+ * about this hack, but for the time being it is efficient and clean
+ * enough. -- rgerhards, 2008-04-18
+ */
+ CHKiRet(obj.UseObj(__FILE__, pDrvrName+2, pDrvrName, (void*) &pThis->Drvr));
+ }
finalize_it:
RETiRet;
}
@@ -111,6 +115,13 @@ BEGINobjDestruct(netstrm) /* be sure to specify the object type also in END and
CODESTARTobjDestruct(netstrm)
if(pThis->pDrvrData != NULL)
iRet = pThis->Drvr.Destruct(&pThis->pDrvrData);
+
+ /* driver can only be released after all data has been destructed */
+ if(pThis->Drvr.ifIsLoaded == 1) {
+ obj.ReleaseObj(__FILE__, pThis->pDrvrName+2, pThis->pDrvrName, (void*) &pThis->Drvr);
+ }
+ if(pThis->pDrvrName != NULL)
+ free(pThis->pDrvrName);
ENDobjDestruct(netstrm)