[dovecot-cvs] dovecot/src/lib module-dir.c,1.19.2.7,1.19.2.8

tss at dovecot.org tss at dovecot.org
Thu Feb 22 14:25:18 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv15042

Modified Files:
      Tag: branch_1_0
	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.19.2.7
retrieving revision 1.19.2.8
diff -u -d -r1.19.2.7 -r1.19.2.8
--- module-dir.c	16 Feb 2007 18:43:38 -0000	1.19.2.7
+++ module-dir.c	22 Feb 2007 14:25:16 -0000	1.19.2.8
@@ -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