Explorar o código

srdb1 Check if the module is loaded, so the error message makes sense in case of missing module

If a module use a default database and it's not loaded, currently
Kamailio complains that the module doesn't implement an API function
instead of actually telling the Kamailian that the module is not loaded.
This patch modifies that behaviour.
Olle E. Johansson %!s(int64=10) %!d(string=hai) anos
pai
achega
c1a1a1bb05
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      lib/srdb1/db.c

+ 4 - 0
lib/srdb1/db.c

@@ -199,6 +199,10 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
 		tmp = name;
 	}
 
+	if (!find_module_by_name(tmp)) {
+		LM_ERR("Module %s not found. Missing loadmodule? \n", tmp);
+		goto error;
+	}
 	dbind = (db_bind_api_f)find_mod_export(tmp, "db_bind_api", 0, 0);
 	if(dbind != NULL)
 	{