I added a new option to the card driver definitions:
ignore_version_check. It would be possible to add it to the official
version? I am searching for alternatives for solving the problem not
for me but for all the spanish users of opensc.
--- src/libopensc/ctx.c.old 2009-07-23 10:57:46.000000000 +0200
+++ src/libopensc/ctx.c 2010-03-22 15:04:11.896761289 +0100
@@ -316,6 +316,33 @@ static const char *find_library(sc_conte
return libname;
}
+/**
+ * load ignore_version parameter for the given driver
+ */
+
+static const char *get_ignore_version(sc_context_t *ctx, const char
*name, int type)
+{
+ int i;
+ scconf_block **blocks, *blk;
+ int ignore_version=0;
+
+ for (i = 0; ctx->conf_blocks[i]; i++) {
+ blocks = scconf_find_blocks(ctx->conf,
ctx->conf_blocks[i],
+ (type==0) ? "reader_driver" : "card_driver",
name);
+ if (!blocks)
+ continue;
+ blk = blocks[0];
+ free(blocks);
+ if (blk == NULL)
+ continue;
+ ignore_version = scconf_get_bool(blk,
"ignore_version", name);
+ break;
+ }
+
+ return ignore_version;
+}
+
+
/**
* load card/reader driver modules
@@ -336,12 +363,14 @@ static void *load_dynamic_driver(sc_cont
void *(**tmodi)(const char *) = &modinit;
const char *(*modversion)(void) = NULL;
const char *(**tmodv)(void) = &modversion;
+ int ignore_version_check=0;
if (name == NULL) { /* should not occurr, but... */
sc_error(ctx,"No module specified\n",name);
return NULL;
}
libname = find_library(ctx, name, type);
+
if (libname == NULL)
return NULL;
handle = lt_dlopen(libname);
@@ -358,13 +387,17 @@ static void *load_dynamic_driver(sc_cont
lt_dlclose(handle);
return NULL;
}
- /* verify module version */
- version = modversion();
- /* XXX: We really need to have ABI version for each interface */
- if (version == NULL || strncmp(version, PACKAGE_VERSION,
strlen(PACKAGE_VERSION)) != 0) {
- sc_error(ctx,"dynamic library '%s': invalid module
version\n",libname);
- lt_dlclose(handle);
- return NULL;
+ ignore_version_check = get_ignore_version(ctx, name, type);
+ if (! ignore_version_check){
+ /* verify module version */
+ version = modversion();
+ /* XXX: We really need to have ABI version for each interface */
+
+ if (version == NULL || strncmp(version,
PACKAGE_VERSION, strlen(PACKAGE_VERSION)) != 0) {
+ sc_error(ctx,"dynamic library '%s': invalid
module version %s != %s
%d\n",libname,version,PACKAGE_VERSION,ignore_version_check);
+ lt_dlclose(handle);
+ return NULL;
+ }
}
*dll = handle;
sc_debug(ctx, "successfully loaded %s driver '%s'\n",
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel