summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-05 16:55:13 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-05 16:55:13 +0000
commitf9105d514134152094dfd02cab5113650dc53f76 (patch)
treef3bda1c8ec41af8933554ddd8390d5fc00fd2767
parent1560e84ff87dafd0d8b4fef3294a7a412e95b1c3 (diff)
downloadrsyslog-f9105d514134152094dfd02cab5113650dc53f76.tar.gz
rsyslog-f9105d514134152094dfd02cab5113650dc53f76.tar.xz
rsyslog-f9105d514134152094dfd02cab5113650dc53f76.zip
changed module loader to automatically add ".so" suffix if not specified
(over time, this shall also ease portability of config files)
-rw-r--r--ChangeLog3
-rw-r--r--modules.c21
-rw-r--r--plugins/imgssapi/imgssapi.c2
-rw-r--r--plugins/imtcp/imtcp.c2
4 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a19edd3..79603a59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 3.12.1 (rgerhards), 2008-03-??
+- changed module loader to automatically add ".so" suffix if not
+ specified (over time, this shall also ease portability of config
+ files)
- bugfix: actions were not correctly retried; caused message loss
- improved debugging support; debug runtime options can now be set via
an environment variable
diff --git a/modules.c b/modules.c
index 40e3b080..ffedc644 100644
--- a/modules.c
+++ b/modules.c
@@ -436,6 +436,7 @@ Load(uchar *pModName)
uchar errMsg[1024];
uchar *pModNameBase;
uchar *pModNameDup;
+ uchar *pExtension;
void *pModHdlr, *pModInit;
modInfo_t *pModInfo;
@@ -457,12 +458,32 @@ Load(uchar *pModName)
}
free(pModNameDup);
+ /* now build our load module name */
if(*pModName == '/') {
*szPath = '\0'; /* we do not need to append the path - its already in the module name */
} else {
strncpy((char *) szPath, (pModDir == NULL) ? _PATH_MODDIR : (char*) pModDir, sizeof(szPath));
}
+
+ /* ... add actual name ... */
strncat((char *) szPath, (char *) pModName, sizeof(szPath) - strlen((char*) szPath) - 1);
+
+ /* now see if we have an extension and, if not, append ".so" */
+ for(pExtension = pModNameBase ; *pExtension && *pExtension != '.' ; ++pExtension)
+ /*DO NOTHING*/;
+
+ if(*pExtension != '.') {
+ /* we do not have an extension and so need to add ".so"
+ * TODO: I guess this is highly importable, so we should change the
+ * algo over time... -- rgerhards, 2008-03-05
+ */
+ /* ... so now add the extension */
+ strncat((char *) szPath, ".so", sizeof(szPath) - strlen((char*) szPath) - 1);
+ }
+
+
+ /* complete load path constructed, so ... GO! */
+ dbgprintf("loading module '%s'\n", szPath);
if(!(pModHdlr = dlopen((char *) szPath, RTLD_NOW))) {
snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', dlopen: %s\n", szPath, dlerror());
errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0';
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index 04bbc2a9..fcaae3b1 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -687,7 +687,7 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
- CHKiRet(objUse(tcps_sess, "tcpsrv.so"));
+ CHKiRet(objUse(tcps_sess, "tcpsrv"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
CHKiRet(objUse(gssutil, "gssutil"));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index fea79d49..ca52d3c5 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -204,7 +204,7 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
- CHKiRet(objUse(tcps_sess, "tcpsrv.so"));
+ CHKiRet(objUse(tcps_sess, "tcpsrv"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
/* register config file handlers */