[dovecot-cvs] dovecot/src/lib module-dir.c,1.30,1.31
tss at dovecot.org
tss at dovecot.org
Thu Feb 22 14:25:22 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv15046
Modified Files:
module-dir.c
Log Message:
If module contains a <module_name>_version string, fail if it doesn't match
PACKAGE_VERSION.
Index: module-dir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/module-dir.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- module-dir.c 16 Feb 2007 18:43:36 -0000 1.30
+++ module-dir.c 22 Feb 2007 14:25:20 -0000 1.31
@@ -87,6 +87,7 @@
{
void *handle;
struct module *module;
+ const char *const *version;
handle = dlopen(path, RTLD_GLOBAL | RTLD_NOW);
if (handle == NULL) {
@@ -99,6 +100,14 @@
module->name = i_strdup(name);
module->handle = handle;
+ version = get_symbol(module, t_strconcat(name, "_version", NULL), TRUE);
+ if (version != NULL && strcmp(*version, PACKAGE_VERSION) != 0) {
+ i_error("Module is for different version %s: %s",
+ *version, path);
+ module_free(module);
+ return NULL;
+ }
+
/* get our init func */
module->init = (void (*)(void))
get_symbol(module, t_strconcat(name, "_init", NULL),
More information about the dovecot-cvs
mailing list