diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-08-14 08:07:18 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-08-14 08:07:18 +0000 |
commit | 21b62571654c1e7380368875d9151b922bce6edb (patch) | |
tree | fd3984d01eeac5981c2e28628e5ac288e3766f56 | |
parent | 4884ef844c8f5c4c6e61fca17a3edeca95cdb03c (diff) | |
download | rsyslog-21b62571654c1e7380368875d9151b922bce6edb.tar.gz rsyslog-21b62571654c1e7380368875d9151b922bce6edb.tar.xz rsyslog-21b62571654c1e7380368875d9151b922bce6edb.zip |
added some code to support the forward-compatibilty directive $ModLoad
MySQL - this is now internally translated to the right name Needs to be
revisited, but is clean enough for now.
-rw-r--r-- | syslogd.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -3760,6 +3760,7 @@ finalize_it: * As of now, it is a dummy, that will later evolve into the * loader for plug-ins. * rgerhards, 2007-07-21 + * varmojfekoj added support for dynamically loadable modules on 2007-08-13 */ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal) { @@ -3767,6 +3768,7 @@ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal) uchar szName[512]; uchar szPath[512]; uchar errMsg[1024]; + uchar *pModName; void *pModHdlr, *pModInit; assert(pp != NULL); @@ -3777,10 +3779,22 @@ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal) ABORT_FINALIZE(RS_RET_NOT_FOUND); } + /* this below is a quick and dirty hack to provide compatibility with the + * $ModLoad MySQL forward compatibility statement. TODO: clean this up + * For the time being, it is clean enough, it just needs to be done + * differently when we have a full design for loadable plug-ins. For the + * time being, we just mangle the names a bit. + * rgerhards, 2007-08-14 + */ + if(!strcmp((char*) szName, "MySQL")) + pModName = (uchar*) "ommysql.so"; + else + pModName = szName; + dbgprintf("Requested to load module '%s'\n", szName); strncpy((char *) szPath, ModDir, sizeof(szPath)); - strncat((char *) szPath, (char *) szName, sizeof(szPath) - strlen(szPath) - 1); + strncat((char *) szPath, (char *) pModName, sizeof(szPath) - strlen(szPath) - 1); 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'; @@ -3794,7 +3808,7 @@ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal) dlclose(pModHdlr); ABORT_FINALIZE(RS_RET_ERR); } - if((iRet = doModInit(pModInit, (uchar*) szName, pModHdlr)) != RS_RET_OK) + if((iRet = doModInit(pModInit, (uchar*) pModName, pModHdlr)) != RS_RET_OK) return iRet; skipWhiteSpace(pp); /* skip over any whitespace */ |