From e3cdba838618c83e87910150d6f292d06ba65b9b Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 19 Aug 2003 09:36:48 +0000 Subject: [PATCH] * scdaemon.c, scdaemon.h: New option --pcsc-driver. * apdu.c (apdu_open_reader): Use that option here instead of a hardcoded one. --- scd/ChangeLog | 6 ++++++ scd/apdu.c | 6 ++++++ scd/scdaemon.c | 10 +++++++++- scd/scdaemon.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/scd/ChangeLog b/scd/ChangeLog index a1cb11e0b..821b074a2 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,9 @@ +2003-08-19 Werner Koch + + * scdaemon.c, scdaemon.h: New option --pcsc-driver. + * apdu.c (apdu_open_reader): Use that option here instead of a + hardcoded one. + 2003-08-18 Werner Koch * Makefile.am: Add OPENSC_LIBS to all programs. diff --git a/scd/apdu.c b/scd/apdu.c index 978d9ae3d..0d6ad9a85 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -798,6 +798,12 @@ apdu_open_reader (const char *portstr) { void *handle; + if (!opt.pcsc_driver || !*opt.pcsc_driver) + { + log_error ("no PC/SC driver has been specified\n"); + return -1; + } + handle = dlopen ("libpcsclite.so", RTLD_LAZY); if (!handle) { diff --git a/scd/scdaemon.c b/scd/scdaemon.c index af813b57d..49036e045 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -70,6 +70,7 @@ enum cmd_and_opt_values oBatch, oReaderPort, octapiDriver, + opcscDriver, oDisableOpenSC, aTest }; @@ -94,7 +95,8 @@ static ARGPARSE_OPTS opts[] = { { oNoDetach, "no-detach" ,0, N_("do not detach from the console")}, { oLogFile, "log-file" ,2, N_("use a log file for the server")}, { oReaderPort, "reader-port", 2, N_("|N|connect to reader at port N")}, - { octapiDriver, "ctapi-driver", 2, N_("NAME|use NAME as ctAPI driver")}, + { octapiDriver, "ctapi-driver", 2, N_("NAME|use NAME as ct-API driver")}, + { opcscDriver, "pcsc-driver", 2, N_("NAME|use NAME as PC/SC driver")}, { oDisableOpenSC, "disable-opensc", 0, #ifdef HAVE_OPENSC N_("Do not use the OpenSC layer") @@ -266,6 +268,11 @@ main (int argc, char **argv ) may_coredump = disable_core_dumps (); + /* Set default options. */ + opt.pcsc_driver = NULL; /* We can't use libpcsclite due to license + conflicts. */ + + shell = getenv ("SHELL"); if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") ) csh_style = 1; @@ -379,6 +386,7 @@ main (int argc, char **argv ) case oReaderPort: app_set_default_reader_port (pargs.r.ret_str); break; case octapiDriver: opt.ctapi_driver = pargs.r.ret_str; break; + case opcscDriver: opt.pcsc_driver = pargs.r.ret_str; break; case oDisableOpenSC: opt.disable_opensc = 1; break; default : pargs.err = configfp? 1:2; break; diff --git a/scd/scdaemon.h b/scd/scdaemon.h index 20e2fa768..3671c7394 100644 --- a/scd/scdaemon.h +++ b/scd/scdaemon.h @@ -54,6 +54,7 @@ struct { int batch; /* batch mode */ const char *homedir; /* configuration directory name */ const char *ctapi_driver; /* Library to access the ctAPI. */ + const char *pcsc_driver; /* Library to access the PC/SC system. */ int disable_opensc; /* Disable the sue of the OpenSC framework. */ } opt;