Attached is the patch to just do (2) below. I believe that this
is the part that Brian wants to not call sc_ctx_detect_readers
Martin you had said you want to do this differently so I will
leave this up to you as to weither this is commited or not.



On 1/19/2011 5:46 PM, Douglas E. Engert wrote:
Attached is a patch to the cardmod code to do the following:

(1) Fix an uninitialized stricture by by using calloc
in stead of malloc. With out this it was having problems
with checking the status on the reader.

(2) Implement a change that this should work for Brian Thomas
that allows one to not detect the reader when creating
the sc_context. This uses the
SC_CONTEXT_PARAM_DONT_DETECT_READERS flag in the ctx_params

(The more I think about this, this should be the default
to not detect the readers during the sc_create_ctx, as
a flag on opensc.conf could control this instead.)

(3) Eliminate the storing of the SCARDCONTEXT and SCARDHANDLE
in the registry. Instead, cardmod.c will store them
in its VENDOR_SCPECIFIC structure, call sc_context_create
with the SC_CONTEXT_PARAM_DONT_DETECT_READERS flag set
in the ctx_params. It will then modify the ctx,
and then call sc_ctx_detect_readers that will call the
cardmod code in reader-pcsc.c that will use the SCARDCONTEXT
and SCARDHANDLE.

I can get this to work in Vista with certutil -SCinfo, but there
is some issue as is says it can not open the key. I think this
is an issue with using a 39 character key container name and a
constant for a serial number.

It does not work with login or runas. This may be the same issue
with after reading the certificate, it is not registering the
container so it can be used later.

The patch is against 0.12.0. and was built on Ubuntu.

I would hope Brian and François could look this over to see if it
should be committed.




_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

--

 Douglas E. Engert  <deeng...@anl.gov>
 Argonne National Laboratory
 9700 South Cass Avenue
 Argonne, Illinois  60439
 (630) 252-5444
Index: src/libopensc/ctx.c
===================================================================
--- src/libopensc/ctx.c (revision 5119)
+++ src/libopensc/ctx.c (working copy)
@@ -660,7 +660,8 @@
                free(opts.forced_card_driver);
        }
        del_drvs(&opts);
-       sc_ctx_detect_readers(ctx);
+       if (parm == NULL || (parm->flags & 
SC_CONTEXT_PARAM_DONT_DETECT_READERS) == 0)
+               sc_ctx_detect_readers(ctx);
        *ctx_out = ctx;
        return SC_SUCCESS;
 }
Index: src/libopensc/opensc.h
===================================================================
--- src/libopensc/opensc.h      (revision 5119)
+++ src/libopensc/opensc.h      (working copy)
@@ -676,6 +676,8 @@
  */
 int sc_establish_context(sc_context_t **ctx, const char *app_name);
 
+#define SC_CONTEXT_PARAM_DONT_DETECT_READERS 0x00000001
+
 /**
  * @struct sc_context_t initialization parameters
  * Structure to supply additional parameters, for example
@@ -688,7 +690,6 @@
         *  dependend configuration data). If NULL the name "default"
         *  will be used. */
        const char    *app_name;
-       /** flags, currently unused */
        unsigned long flags;
        /** mutex functions to use (optional) */
        sc_thread_context_t *thread_ctx;
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to