diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-29 10:02:59 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-29 10:02:59 +0200 |
commit | 94acfb1c5f349ede619639e8cb84f2e3d3c28efe (patch) | |
tree | cc2e85a8197a64bb91826442b7218c6f4cb38ed7 /runtime | |
parent | a3ff7eaf859cd6e91f68421b70c4a46d5a41ff2c (diff) | |
download | rsyslog-94acfb1c5f349ede619639e8cb84f2e3d3c28efe.tar.gz rsyslog-94acfb1c5f349ede619639e8cb84f2e3d3c28efe.tar.xz rsyslog-94acfb1c5f349ede619639e8cb84f2e3d3c28efe.zip |
ability to load proper select netstrm driver
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/glbl.c | 2 | ||||
-rw-r--r-- | runtime/netstrms.c | 15 | ||||
-rw-r--r-- | runtime/nssel.c | 22 | ||||
-rw-r--r-- | runtime/rsyslog.h | 3 |
4 files changed, 26 insertions, 16 deletions
diff --git a/runtime/glbl.c b/runtime/glbl.c index 7b584d30..58605bb0 100644 --- a/runtime/glbl.c +++ b/runtime/glbl.c @@ -40,7 +40,7 @@ /* some defaults */ #ifndef DFLT_NETSTRM_DRVR -# define DFLT_NETSTRM_DRVR ((uchar*)"lmnsd_ptcp") +# define DFLT_NETSTRM_DRVR ((uchar*)"ptcp") #endif /* static data */ diff --git a/runtime/netstrms.c b/runtime/netstrms.c index caded8a4..dc9d0b69 100644 --- a/runtime/netstrms.c +++ b/runtime/netstrms.c @@ -23,6 +23,7 @@ * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution. */ #include "config.h" +#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <errno.h> @@ -55,13 +56,15 @@ DEFobjCurrIf(netstrm) static rsRetVal loadDrvr(netstrms_t *pThis) { - uchar *pDrvrName; DEFiRet; + uchar *pBaseDrvrName; + uchar szDrvrName[48]; /* 48 shall be large enough */ - pDrvrName = pThis->pDrvrName; - if(pDrvrName == NULL) /* if no drvr name is set, use system default */ - pDrvrName = glbl.GetDfltNetstrmDrvr(); -RUNLOG_VAR("%s", pDrvrName); + pBaseDrvrName = pThis->pDrvrName; + if(pBaseDrvrName == NULL) /* if no drvr name is set, use system default */ + pBaseDrvrName = glbl.GetDfltNetstrmDrvr(); + if(snprintf((char*)szDrvrName, sizeof(szDrvrName), "lmnsd_%s", pBaseDrvrName) == sizeof(szDrvrName)) + ABORT_FINALIZE(RS_RET_DRVRNAME_TOO_LONG); pThis->Drvr.ifVersion = nsdCURR_IF_VERSION; /* The pDrvrName+2 below is a hack to obtain the object name. It @@ -70,7 +73,7 @@ RUNLOG_VAR("%s", pDrvrName); * 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)); + CHKiRet(obj.UseObj(__FILE__, szDrvrName+2, szDrvrName, (void*) &pThis->Drvr)); finalize_it: RETiRet; } diff --git a/runtime/nssel.c b/runtime/nssel.c index 5333fc75..793da9dc 100644 --- a/runtime/nssel.c +++ b/runtime/nssel.c @@ -54,18 +54,25 @@ DEFobjCurrIf(glbl) /* load our low-level driver. This must be done before any * driver-specific functions (allmost all...) can be carried * out. Note that the driver's .ifIsLoaded is correctly - * initialized by calloc() and we depend on that. - * rgerhards, 2008-04-18 + * initialized by calloc() and we depend on that. Please note that + * we do some name-mangeling. We know that each nsd driver also needs + * a nssel driver. So we simply append "sel" to the nsd driver name: This, + * of course, means that the driver name must match these rules, but that + * shouldn't be a real problem. + * rgerhards, 2008-04-28 */ static rsRetVal loadDrvr(nssel_t *pThis) { - uchar *pDrvrName; DEFiRet; + uchar *pBaseDrvrName; + uchar szDrvrName[48]; /* 48 shall be large enough */ - pDrvrName = pThis->pDrvrName; - if(pDrvrName == NULL) /* if no drvr name is set, use system default */ - pDrvrName = glbl.GetDfltNetstrmDrvr(); + pBaseDrvrName = pThis->pDrvrName; + if(pBaseDrvrName == NULL) /* if no drvr name is set, use system default */ + pBaseDrvrName = glbl.GetDfltNetstrmDrvr(); + if(snprintf((char*)szDrvrName, sizeof(szDrvrName), "lmnsdsel_%s", pBaseDrvrName) == sizeof(szDrvrName)) + ABORT_FINALIZE(RS_RET_DRVRNAME_TOO_LONG); pThis->Drvr.ifVersion = nsdCURR_IF_VERSION; /* The pDrvrName+2 below is a hack to obtain the object name. It @@ -74,8 +81,7 @@ loadDrvr(nssel_t *pThis) * 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)); - CHKiRet(obj.UseObj(__FILE__, "nsdsel_gtls", "lmnsdsel_gtls", (void*) &pThis->Drvr)); + CHKiRet(obj.UseObj(__FILE__, szDrvrName+2, szDrvrName, (void*) &pThis->Drvr)); finalize_it: RETiRet; } diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index 771ad0bb..41f4f0c2 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -219,7 +219,8 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_GNUTLS_ERR = -2078, /**< (unexpected) error in GnuTLS call */ RS_RET_MAX_SESS_REACHED = -2079, /**< max nbr of sessions reached, can not create more */ RS_RET_MAX_LSTN_REACHED = -2080, /**< max nbr of listeners reached, can not create more */ - RS_RET_INVAID_DRVR_MODE= -2081, /**< tried to set mode not supported by driver */ + RS_RET_INVAID_DRVR_MODE = -2081, /**< tried to set mode not supported by driver */ + RS_RET_DRVRNAME_TOO_LONG = -2082, /**< driver name too long - should never happen */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ |