Hi,

I'm having one remaining problem with smartcard login: the remote
computer is sending an SCARD_IOCTRL_GETATTRIB method with
dwAttrId==SCARD_ATTR_DEVICE_FRIENDLY_NAME_W. This attribute is not
supported by PCSC/lite on my computer (running debian linux).

PCSC/lite supports one of SCARD_ATTR_DEVICE_FRIENDLY_NAME_A and
SCARD_ATTR_DEVICE_FRIENDLY_NAME_W, but not both. It supports the _A
variant only if UNICODE is not defined when building pcscd, and it
supports the _W variant only if UNICODE is defined, so in debian, I
guess it is built without UNICODE. I don't see why it shouldn't support
both in all builds, but the author doesn't want to do that (see
http://bugs.debian.org/617989)

The status returned from this query needs to be success for login to
succeed, but it doesn't seem to matter much what string is returned. The
below patch (which goes on top of my other patch) fixes it for me such
that login succeeds, but it's really faking the unicode support, so I'm
not sure this is really a good solution:

diff --git a/channels/rdpdr/smartcard/scard_operations.c 
b/channels/rdpdr/smartcard/scard_operations.c
index c213e38..d5049bd 100644
--- a/channels/rdpdr/smartcard/scard_operations.c
+++ b/channels/rdpdr/smartcard/scard_operations.c
@@ -27,6 +27,7 @@
 #include <pthread.h>

 #include <PCSC/pcsclite.h>
+#include <PCSC/reader.h>
 #include <PCSC/winscard.h>

 #include <freerdp/utils.h>
@@ -2053,6 +2054,14 @@ handle_GetAttrib(struct io_wrapper *io)
        attrLen = SCARD_AUTOALLOCATE;
    }
    rv = SCardGetAttrib(hCard, dwAttrId, attrLen == 0 ? NULL : (unsigned char 
*)&pbAttr, &attrLen);
+   if( dwAttrId == SCARD_ATTR_DEVICE_FRIENDLY_NAME_A && rv == 
SCARD_E_UNSUPPORTED_FEATURE )
+   {
+       rv = SCardGetAttrib(hCard, SCARD_ATTR_DEVICE_FRIENDLY_NAME_W, attrLen 
== 0 ? NULL : (unsigned char *)&pbAttr, &attrLen);
+   }
+   if( dwAttrId == SCARD_ATTR_DEVICE_FRIENDLY_NAME_W && rv == 
SCARD_E_UNSUPPORTED_FEATURE )
+   {
+       rv = SCardGetAttrib(hCard, SCARD_ATTR_DEVICE_FRIENDLY_NAME_A, attrLen 
== 0 ? NULL : (unsigned char *)&pbAttr, &attrLen);
+   }
    if( attrLen > dwAttrLen && pbAttr != NULL )
    {
        rv = SCARD_E_INSUFFICIENT_BUFFER;
-- 
1.7.4.4


Thanks,
Aaron


* Eduardo Beloni <[email protected]> wrote:

> Thank you for the report Aaron.
> 
> I've pushed a commit that should fix it. Can you test?
> 
> 
> Eduardo Fiss Beloni
> 55 53 8117 8244
> 
> 
> --- On Wed, 4/5/11, Aaron Small <[email protected]> wrote:
> > 
> > I find that with the latest changes, if I run with
> > smartcard redirection
> > enabled on the command line, but no smartcard inserted,
> > then I cancel
> > the login, the program locks up. It does not lock up if I
> > run it without
> > smartcard redirection enabled, but shuts down properly.
> > When it freezes,
> > here are the call stacks for the two active threads:
> > 
> > #0  0xb7fe2424 in __kernel_vsyscall ()
> > #1  0xb7e17420 in sem_wait@GLIBC_2.0 () at
> > ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/sem_wait.S:318
> > #2  0xb7f81c3d in freerdp_sem_wait
> > (sem_struct=0x8052804) at
> > semaphore.c:53
> > #3  0x0804f3ec in main (argc=7, argv=0xbffff3a4) at
> > xfreerdp.c:840
> > 
> > #0  0xb7fe2424 in __kernel_vsyscall ()
> > #1  0xb7d5c516 in nanosleep () at
> > ../sysdeps/unix/syscall-template.S:82
> > #2  0xb7d8aa4c in usleep (useconds=250000) at
> > ../sysdeps/unix/sysv/linux/usleep.c:33
> > #3  0xb7793b09 in InitEventProcessTerminated
> > (pInitHandle=0x8061e60,
> > event=4, pData=0x0, dataLength=0) at rdpdr_main.c:965
> > #4  InitEvent (pInitHandle=0x8061e60, event=4,
> > pData=0x0, dataLength=0)
> > at rdpdr_main.c:998
> > #5  0xb7f7f117 in freerdp_chanman_close
> > (chan_man=0x8061e60,
> > inst=0x8063c48) at libfreerdpchanman.c:1030
> > #6  0x0804f00a in run_xfreerdp (xfi=0x805ffd0) at
> > xfreerdp.c:735
> > #7  0x0804f121 in thread_func (arg=0x805ffd0) at
> > xfreerdp.c:771
> > #8  0xb7e10955 in start_thread (arg=0xb776ab70) at
> > pthread_create.c:300
> > #9  0xb7d90e7e in clone () at
> > ../sysdeps/unix/sysv/linux/i386/clone.S:130
> > 
> > 
> > Thanks,
> > Aaron
> > 
> > * Eduardo Beloni <[email protected]>
> > wrote:
> > 
> > > Hi,
> > > 
> > > There is a new latest version at
> > > 
> > > https://github.com/OSSystems/FreeRDP/tree/wip%2Fsmartcard
> > > 
> > > So, if you can, we ask you to do the same as my
> > previous mail :)
> > > 
> > > Eduardo Fiss Beloni
> > > 55 53 8117 8244
> > > 
> > > 
> > > --- On Tue, 3/5/11, Eduardo Beloni <[email protected]>
> > wrote:
> > > 
> > > > From: Eduardo Beloni <[email protected]>
> > > > Subject: Re: [Freerdp-devel] Smart card
> > redirection
> > > > To: "freerdp" <[email protected]>
> > > > Date: Tuesday, 3 May, 2011, 14:44
> > > > Hello,
> > > > 
> > > > I've pushed two commits to the wip/smartcard:
> > > > 
> > > > https://github.com/OSSystems/FreeRDP/tree/wip/smartcard
> > > > 
> > > > Those intent to remove all service->scard_*
> > functions,
> > > > by using the API's get_event. They are a close
> > approach (I
> > > > think) to what is acceptable to push into
> > FreeRDP/master.
> > > > 
> > > > I need some comments in these commits and of
> > course, more
> > > > tests. If you've got any other clues on how to
> > best fit
> > > > those operations in the API, please let me know.
> > > 
> > >
> > ------------------------------------------------------------------------------
> > > WhatsUp Gold - Download Free Network Management
> > Software
> > > The most intuitive, comprehensive, and cost-effective
> > network 
> > > management toolset available today.  Delivers
> > lowest initial 
> > > acquisition cost and overall TCO of any competing
> > solution.
> > > http://p.sf.net/sfu/whatsupgold-sd
> > > _______________________________________________
> > > Freerdp-devel mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/freerdp-devel
> > 
> > ------------------------------------------------------------------------------
> > WhatsUp Gold - Download Free Network Management Software
> > The most intuitive, comprehensive, and cost-effective
> > network 
> > management toolset available today.  Delivers lowest
> > initial 
> > acquisition cost and overall TCO of any competing
> > solution.
> > http://p.sf.net/sfu/whatsupgold-sd
> > _______________________________________________
> > Freerdp-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/freerdp-devel
> >

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Freerdp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to