Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5184:47e393c4eb4b HEAD
If module contains a <module_name>_version string, fail if it doesn't match
PACKAGE_VERSION.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 22 Feb 2007 16:25:20 +0200 |
parents | 68808a3021b0 |
children | 24f4a959a24c |
files | src/lib/module-dir.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/module-dir.c Thu Feb 22 16:10:05 2007 +0200 +++ b/src/lib/module-dir.c Thu Feb 22 16:25:20 2007 +0200 @@ -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),