[dovecot-cvs] dovecot/src/lib module-dir.c, 1.31, 1.32 module-dir.h, 1.8, 1.9

tss at dovecot.org tss at dovecot.org
Thu Feb 22 14:36:10 UTC 2007


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

Modified Files:
	module-dir.c module-dir.h 
Log Message:
Don't compare to PACKAGE_VERSION in lib/ core directly, rather make
module_dir_load() have the version string as parameter. Plugin version
checks can be skipped with version_ignore=yes.



Index: module-dir.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/module-dir.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- module-dir.c	22 Feb 2007 14:25:20 -0000	1.31
+++ module-dir.c	22 Feb 2007 14:36:07 -0000	1.32
@@ -83,11 +83,12 @@
 }
 
 static struct module *
-module_load(const char *path, const char *name, bool require_init_funcs)
+module_load(const char *path, const char *name, bool require_init_funcs,
+	    const char *version)
 {
 	void *handle;
 	struct module *module;
-	const char *const *version;
+	const char *const *module_version;
 
 	handle = dlopen(path, RTLD_GLOBAL | RTLD_NOW);
 	if (handle == NULL) {
@@ -100,10 +101,12 @@
 	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) {
+	module_version = version == NULL ? NULL :
+		get_symbol(module, t_strconcat(name, "_version", NULL), TRUE);
+	if (module_version != NULL &&
+	    strcmp(*module_version, version) != 0) {
 		i_error("Module is for different version %s: %s",
-			*version, path);
+			*module_version, path);
 		module_free(module);
 		return NULL;
 	}
@@ -183,7 +186,7 @@
 }
 
 struct module *module_dir_load(const char *dir, const char *module_names,
-			       bool require_init_funcs)
+			       bool require_init_funcs, const char *version)
 {
 	DIR *dirp;
 	struct dirent *d;
@@ -256,7 +259,7 @@
 		else {
 			path = t_strconcat(dir, "/", name, NULL);
 			module = module_load(path, stripped_name,
-					     require_init_funcs);
+					     require_init_funcs, version);
 			if (module == NULL && module_names_arr != NULL)
 				exit(FATAL_DEFAULT);
 		}

Index: module-dir.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/module-dir.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- module-dir.h	16 Feb 2007 13:12:15 -0000	1.8
+++ module-dir.h	22 Feb 2007 14:36:08 -0000	1.9
@@ -12,9 +12,10 @@
 };
 
 /* Load modules in given directory. module_names is a space separated list of
-   module names to load, or NULL to load everything. */
+   module names to load, or NULL to load everything. If version is non-NULL and
+   the module contains a version symbol, fail the load if they're different. */
 struct module *module_dir_load(const char *dir, const char *module_names,
-			       bool require_init_funcs);
+			       bool require_init_funcs, const char *version);
 /* Call init() in all modules */
 void module_dir_init(struct module *modules);
 /* Call deinit() in all modules and mark them NULL so module_dir_unload()



More information about the dovecot-cvs mailing list