Hello,

"Douglas E. Engert" <deeng...@anl.gov> a écrit sur 09/02/2011 22:22:14 :

> [image supprimée] 
> 
> Additional Cardmod changes needed
> 
> Douglas E. Engert 
> 
> A :
> 
> francois.leblanc, OpenSC-devel
> 
> 09/02/2011 22:23
> 
> François,
> 
> Please try the cardmod code that is now in SVN. It now works with login 
to AD,
> can detect changes of a card in the reader as well as the other changes
> as outlined in the commit comments.
> 

Ok I hope to have some time testing your improvement, and test it.

Thank you for your great work.


> If the CARDMOD_LOW_LEVEL_DEBUG  is defined, see line #97
> it will try and write out the the file "c:\tmp\cardmod.log.txt" even 
before
> sc_create_context has been called. This has shown a lot more detail
> about what is really going on within the code, including when DllMain
> is called, and by what modules. The file must be modifiable be everyone.
> 
> I built this using the mingw build package in the SVN on Ubuntu, and had
> to copy SCardErr.h, WinSCard.h, WinSmCrd.h, bcrypt.h and cardmod.h files
> from the Microsoft SDK and CNG SDK, with lowercase names to the 
build\include.
> 
> I have not tried building using Visual studio.
> 
> There are still a lot of changes that could be made. The reader-pcsc.c
> code could be merged to have a cardmod mode. the ctx->app_name could be 
used
> to detect cardmod mode.
> 
> I think there is a possible race condition in the code as it stand now,
> if two threads try and create contexts at the same time. This might
> occur if there are two reader with two cards at the same time when a 
login
> is attempted.  sc_get_cardmod_driver copies the pcsc_drv->ops over its
> own cardmod_ops. These structures are static...
> 
> For example, looking at cardmod_ops.lock.
> 
>    thread 1  calls sc_get_cardmod_driver 
> cardmod_ops.lock == undetermined.
>    thread 1  #1901  cardmod_ops = *(pcsc_drv->ops); 
> cardmod_ops.lock == pcsc_lock
>    thread 1  #1907  cardmod_ops.lock = NULL;         cardmod_ops.lock = 
NULL
> 
>    thread 2  calls sc_get_cardmod_driver             cardmod_ops.lock = 
NULL
>    thread 2  #1901  cardmod_ops = *(pcsc_drv->ops); 
> cardmod_ops.lock == pcsc_lock
> 
>    thread 1 does a lock operation and ends up using pcsc_lock !!!
> 
>    thread 2  #1907  cardmod_ops.lock = NULL;         cardmod_ops.lock = 
NULL
> 

Yes, We have to study this point.

> 
> -- 
> 
> 
>   Douglas E. Engert  <deeng...@anl.gov>
>   Argonne National Laboratory
>   9700 South Cass Avenue
>   Argonne, Illinois  60439
>   (630) 252-5444

Regards,
François.

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

Reply via email to