X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fdynamic.cpp;h=8e63b7d03ee0729738a9a12cd677087cbad969be;hb=59b1a8955142935b02af6446005ab47fc7c3fc8c;hp=1dfb823c67404b379cba2c742dc5775e5bf42e94;hpb=fc725b7e8fbe3f449a12012d9e5b92a57e723370;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 1dfb823c6..8e63b7d03 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -37,6 +37,11 @@ extern ServerConfig* Config; DLLManager::DLLManager(char *fname) { + if (!strstr(fname,".so")) + { + err = "This doesn't look like a module file to me..."; + return; + } #ifdef STATIC_LINK this->staticname[0] = '\0'; log(DEBUG,"Loading core-compiled module '%s'",fname); @@ -69,9 +74,14 @@ DLLManager::DLLManager(char *fname) // shared libraries are mmap()ed and not doing this causes // segfaults. FILE* x = fopen(fname,"rb"); + if (!x) + { + err = "Module file not found or cannot access, game over man!"; + return; + } char tmpfile_template[255]; char buffer[65536]; - snprintf(tmpfile_template, 255, "/tmp/inspircd_file.so.%d.XXXXXXXXXX",getpid()); + snprintf(tmpfile_template, 255, "%s/inspircd_file.so.%d.XXXXXXXXXX",Config->TempDir,getpid()); int fd = mkstemp(tmpfile_template); while (!feof(x)) {