FW: problem with rdesktop PC/SC handle conversion
"Jennings, Jared L CTR USAF AFMC 46 SK/CCI" <[email protected]>
| Newsgroups | gmane.network.rdesktop.devel |
|---|---|
| Message-ID | <09B8D4A01E10D14CA028A4D0CD5779D90294F638@VFEGMLEG03.Enterprise.afmc.ds.af.mil> |
(Sorry for the extra copy, Ludovic: I meant to send this to the mailing list.) 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. > 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. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® 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-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ rdesktop-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdesktop-devel
rdesktop-1.5.001cvs20080324-pcsc-lite-1.4.100.patch
(application/octet-stream, 4 KB)
diff -ru -x autom4te.cache -x configure rdesktop-1.5.001cvs20080324/configure.ac rdesktop-1.5.001cvs20080324-mod/configure.ac
--- rdesktop-1.5.001cvs20080324/configure.ac 2008-03-24 13:20:48.000000000 -0500
+++ rdesktop-1.5.001cvs20080324-mod/configure.ac 2008-03-25 13:08:39.000000000 -0500
@@ -105,6 +105,23 @@
rpath="$rpath:$ssldir/lib"
])
+
+# [email protected] 25 Mar 2008
+m4_define([_PKG_CONFIG_IFELSE],
+[if test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$2],
+ [if AC_RUN_LOG([$PKG_CONFIG --[]$1 "$2"]); then
+ [$3]
+ else
+ [$4]
+ fi],
+ [pkg_failed=yes])
+else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG_IFELSE
+
+
AC_ARG_ENABLE(smartcard,
[ --enable-smartcard Enables smart-card support.
],
@@ -143,6 +160,14 @@
[AC_MSG_RESULT(yes) AC_DEFINE(WITH_PCSC120, 1, [old version of PCSC])],
[AC_MSG_RESULT(no)]
)
+ AC_MSG_CHECKING([for new (>=1.4.100) version of PCSC])
+ _PKG_CONFIG_IFELSE([atleast-version=1.4.100],
+ [libpcsclite],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PCSCLITE_1_4_100_OR_LATER, 1,
+ [version of PCSC with IDENTITY_SHIFT]),
+ AC_MSG_RESULT(no))
+
])
AC_SUBST(SCARDOBJ)
diff -ru -x autom4te.cache -x configure rdesktop-1.5.001cvs20080324/scard.c rdesktop-1.5.001cvs20080324-mod/scard.c
--- rdesktop-1.5.001cvs20080324/scard.c 2008-03-25 14:36:20.000000000 -0500
+++ rdesktop-1.5.001cvs20080324-mod/scard.c 2008-03-25 14:31:36.000000000 -0500
@@ -238,7 +238,15 @@
#ifndef MAKE_PROTO
/* ---------------------------------- */
-/* These two functions depend heavily on the actual implementation of the smart
+/* Changeset 2635 in the PC/SC Lite Subversion repository
+ * <http://svn.debian.org/wsvn/pcsclite/> amends readerfactory.c to shift the
+ * reader context identity by a constant IDENTITY_SHIFT bits (defined at 16
+ * right now), instead of (sizeof(DWORD)/2)*8 bits as cited below, which varies
+ * with the sizeof(DWORD). The first release with this change in it is 1.4.100;
+ * the lengthy comment below still applies to pcsc-lite 1.4.4 and earlier.
+ * - <[email protected]>, 25 March 2008
+ *
+ * These two functions depend heavily on the actual implementation of the smart
* card handle in PC/SC Lite 1.3.1. Here are the salient bits:
*
* From winscard.c:331, in SCardConnect: *phCard =
@@ -279,22 +287,30 @@
* sizeof(MYPCSC_DWORD) == sizeof(SERVER_DWORD), we're essentially doing
* nothing, which will not break anything.)
*
- * - [email protected], 2 Aug 2006
+ * - [email protected], 2 Aug 2006
*/
static MYPCSC_SCARDHANDLE
scHandleToMyPCSC(SERVER_SCARDHANDLE server)
{
+#ifdef PCSCLITE_1_4_100_OR_LATER
+ return (MYPCSC_SCARDHANDLE) server;
+#else
return (((MYPCSC_SCARDHANDLE) server >> (sizeof(SERVER_DWORD) * 8 / 2) & 0xffff)
<< (sizeof(MYPCSC_DWORD) * 8 / 2)) + (server & 0xffff);
+#endif
}
static SERVER_SCARDHANDLE
scHandleToServer(MYPCSC_SCARDHANDLE mypcsc)
{
+#ifdef PCSCLITE_1_4_100_OR_LATER
+ return (SERVER_SCARDHANDLE) mypcsc;
+#else
return ((mypcsc >> (sizeof(MYPCSC_DWORD) * 8 / 2) & 0xffff)
<< (sizeof(SERVER_DWORD) * 8 / 2)) + (mypcsc & 0xffff);
+#endif
}
/* ---------------------------------- */
diff -ru -x autom4te.cache -x configure rdesktop-1.5.001cvs20080324/scard.h rdesktop-1.5.001cvs20080324-mod/scard.h
--- rdesktop-1.5.001cvs20080324/scard.h 2008-03-24 13:20:56.000000000 -0500
+++ rdesktop-1.5.001cvs20080324-mod/scard.h 2008-03-25 14:34:41.000000000 -0500
@@ -31,7 +31,7 @@
* spreads without limit. The alternative is to patch the heck out of rdesktop,
* which is already being done anyway.
*
- * - [email protected], 2 Aug 2006
+ * - [email protected], 2 Aug 2006
*/
#ifdef HAVE_STDINT_H