diff -r 5eecce5314d6 -r 279f343bbf6c src/server/safs/init.c --- a/src/server/safs/init.c Wed Jul 31 11:35:57 2013 +0200 +++ b/src/server/safs/init.c Wed Jul 31 13:02:06 2013 +0200 @@ -104,5 +104,26 @@ } } + // if exists, execute nsapi_module_init + void *sym = dlsym(lib, "nsapi_module_init"); + if(sym) { + /* + * We remove shlib and funcs from the pblock. The module init function + * gets all remaining parameters. + */ + pblock_remove("shlib", pb); + pblock_remove("funcs", pb); + + FuncPtr init_func = (FuncPtr)sym; + int ret = init_func(pb, NULL, NULL); + if(ret != REQ_PROCEED && ret != REQ_NOACTION) { + log_ereport( + LOG_FAILURE, + "nsapi_module_init for module %s failed", + shlib); + return REQ_ABORTED; + } + } + return REQ_PROCEED; }