Re: FW: problem with rdesktop PC/SC handle conversion

Ludovic Rousseau <[email protected]>
Newsgroups gmane.network.rdesktop.devel
Message-ID <[email protected]>
2009/9/21 Jennings, Jared L CTR USAF AFMC 46 SK/CCI
<[email protected]>:
> Ludovic Rousseau:
>> Pierre Ossman:
>> > (and the different versions of pcsclite would have to
>> > count as several implementations as they keep changing how the
> handle
>> > is generated).
>
> Quite. After I wrote that translation function, pcsc-lite changed
> (revision 2635, release 1.4.100) and I had to add a check in the
> autoconf script for the version of pcsc-lite, acting accordingly. I
> wrote that patch on March 25, 2008, and I thought I sent it to this
> mailing list. I'll attach it again, and it might apply: I haven't seen
> many changes to scard.c. I'll get the latest svn and send another patch
> if needed.

OK. I see now.

>> The way the handle are generated is not important as long as they can
>> be stored in a 32-bit integer. And I think that is the case for
>> pcsc-lite since a long time now.
>
>> Can you point me a version of pcsc-lite that does not store a handle
>> in a 32-bit integer?
>
> I think Red Hat is still shipping pcsc-lite 1.4.4 in Red Hat Enterprise
> Linux 5, and I have no idea what Apple's up to.

Apple version of pcsc-lite is available at [1]. From the
readerfactory.c file [2] we have:
	ctxSlot->dwIdentity = (slotNumber + 1) << (sizeof(DWORD) / 2) * 8;
Is it similar to pcsc-lite < 1.4.100 but we also have:
	typedef uint32_t DWORD;
So DWORD has the same size on 32 and 64-bits Mac OS X (unlike what we on Linux).

Maybe you should change your patch to check for definition of
PCSCLITE_1_4_4_OR_BEFORE. The idea is that if PCSCLITE_1_4_4_OR_BEFORE
is not defined (by default) then the rdesktop code does not do any
conversion.

Something like:
#ifdef PCSCLITE_1_4_4_OR_BEFORE
 	return (((MYPCSC_SCARDHANDLE) server >> (sizeof(SERVER_DWORD) * 8 /
2) & 0xffff)
 		<< (sizeof(MYPCSC_DWORD) * 8 / 2)) + (server & 0xffff);
#else
	return (MYPCSC_SCARDHANDLE) server;
#endif

Regards,

[1] http://www.opensource.apple.com/source/SmartCardServices/SmartCardServices-36160/
[2] http://www.opensource.apple.com/source/SmartCardServices/SmartCardServices-36160/src/PCSC/readerfactory.c

-- 
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.