- Added 'force_card_driver' option

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@579 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
jey 2002-04-19 20:07:56 +00:00
parent 79bf099f0d
commit 9c39ca7e61
3 changed files with 26 additions and 4 deletions

1
TODO
View File

@ -1,5 +1,4 @@
* Finish TCOS driver (Werner Koch?)
* Card driver forcing to config file
* Debian packaging
* GUI applications

View File

@ -68,14 +68,27 @@ app default {
# module = /usr/lib/opensc/drivers/card_customcos.so
# }
# Force using specific card driver
#
# If this option is present, OpenSC will use the supplied
# driver with all inserted cards.
#
# Default: autodetect
#
# force_card_driver = miocos;
# Below are the framework specific configuration blocks.
# PKCS #15
framework pkcs15 {
# Whether to use the cache files in the user's
# home directory.
# WARNING: This shouldn't be used in setuid root
#
# At the moment you have to 'teach' the card to the
# system by:
# pkcs15-tool -L
#
# WARNING: Caching shouldn't be used in setuid root
# applications.
# Default: false
#

View File

@ -72,6 +72,7 @@ struct _sc_ctx_options {
int rcount;
struct _sc_driver_entry cdrv[16];
int ccount;
char *forced_card_driver;
};
@ -175,6 +176,12 @@ static int load_parameters(struct sc_context *ctx, scconf_block *block,
else
ctx->error_file = stderr;
}
val = scconf_get_str(block, "force_card_driver", NULL);
if (val) {
if (opts->forced_card_driver)
free(opts->forced_card_driver);
opts->forced_card_driver = strdup(val);
}
list = scconf_find_list(block, "reader_drivers");
if (list != NULL)
del_drvs(opts, 0);
@ -313,9 +320,12 @@ int sc_establish_context(struct sc_context **ctx_out, const char *app_name)
#endif
load_reader_drivers(ctx, &opts);
load_card_drivers(ctx, &opts);
if (opts.forced_card_driver) {
sc_set_card_driver(ctx, opts.forced_card_driver);
free(opts.forced_card_driver);
}
del_drvs(&opts, 0);
del_drvs(&opts, 1);
if (ctx->reader_count == 0) {
sc_release_context(ctx);
return SC_ERROR_NO_READERS_FOUND;