Hi Eduardo,
I have a patch to support SCARD_IOCTL_GETATTRIB. With this, I'm able to
get all the way to a working system using smartcard login. Could you
include this?
diff --git a/channels/rdpdr/smartcard/scard_operations.c
b/channels/rdpdr/smartcard/scard_operations.c
index fdec51a..715b70a 100644
--- a/channels/rdpdr/smartcard/scard_operations.c
+++ b/channels/rdpdr/smartcard/scard_operations.c
@@ -267,6 +267,9 @@ handle_Status(struct io_wrapper *io, RD_BOOL wide);
static LONG
handle_State(struct io_wrapper *io);
+static LONG
+handle_GetAttrib(struct io_wrapper *io);
+
uint32
sc_create()
@@ -615,6 +618,9 @@ sc_device_control(IRP * irp)
case SCARD_IOCTL_STATE:
result = handle_State(&io);
break;
+ case SCARD_IOCTL_GETATTRIB:
+ result = handle_GetAttrib(&io);
+ break;
default:
LLOGLN(0, ("%s: NOT FOUND IoControlCode SCARD IOCTL
0x%x", __PRETTY_FUNCTION__, irp->ioControlCode));
@@ -2028,3 +2034,72 @@ handle_State(struct io_wrapper *io)
return rv;
}
+
+static LONG
+handle_GetAttrib(struct io_wrapper *io)
+{
+ LONG rv;
+ SCARDHANDLE hCard;
+ DWORD dwAttrId, dwAttrLen;
+ DWORD attrLen;
+ unsigned char *pbAttr;
+
+ io->iffset += 0x20;
+ dwAttrId = GET_UINT32(io->inbuf, io->iffset);
+ io->iffset += 0x04 + 4;
+ dwAttrLen = GET_UINT32(io->inbuf, io->iffset);
+ io->iffset += 0x0C + 4;
+ hCard = GET_UINT32(io->inbuf, io->iffset);
+ io->iffset += 4;
+
+ DEBUG_SCARD("SCardGetAttrib(hcard: 0x%08x, attrib: 0x%08x (%d
bytes))\n",
+ (unsigned) hCard, (unsigned) dwAttrId, (int) dwAttrLen);
+
+ if( dwAttrLen == 0 ) {
+ attrLen = 0;
+ } else {
+ attrLen = SCARD_AUTOALLOCATE;
+ }
+ rv = SCardGetAttrib(hCard, dwAttrId, attrLen == 0 ? NULL : (unsigned
char *)&pbAttr, &attrLen);
+ if( attrLen > dwAttrLen && pbAttr != NULL )
+ {
+ rv = SCARD_E_INSUFFICIENT_BUFFER;
+ }
+ dwAttrLen = attrLen;
+
+ if (rv != SCARD_S_SUCCESS)
+ {
+ DEBUG_SCARD("Failure: %s (0x%08x)\n",
+ pcsc_stringify_error(rv), (unsigned int) rv);
+ free(pbAttr);
+ return sc_output_return(rv, io);
+ }
+ else
+ {
+ DEBUG_SCARD("Success (%d bytes)\n", (int) dwAttrLen);
+
+ SET_UINT32(io->outbuf, io->offset, dwAttrLen);
+ SET_UINT32(io->outbuf, io->offset+4, 0x00000200);
+ SET_UINT32(io->outbuf, io->offset+8, dwAttrLen);
+ io->offset += 12;
+
+ if (!pbAttr)
+ {
+ SET_UINT8V(io->outbuf, io->offset, 0, dwAttrLen);
+ }
+ else
+ {
+ SET_UINT8A(io->outbuf, io->offset, pbAttr, dwAttrLen);
+ }
+ io->offset += dwAttrLen;
+ sc_output_repos(io, dwAttrLen);
+ // Align to multiple of 4
+ SET_UINT32(io->outbuf, io->offset, 0x00000000);
+ io->offset += 4;
+ }
+ sc_output_alignment(io, 8);
+
+ free(pbAttr);
+
+ return rv;
+}
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