[pkg-wpa-devel] Bug#612842: Please make dependendency on libpcsclite1 optional

Kel Modderman kel at otaku42.de
Mon Mar 7 10:52:35 UTC 2011


Hi Ludovic Rousseau,

On Sunday 13 February 2011 18:25:58 Ludovic Rousseau wrote:
> 2011/2/13 Michael Biebl <biebl at debian.org>:
> > On 11.02.2011 21:43, Ludovic Rousseau wrote:
> >> reassign 612842 wpasupplicant
> >> thank
> >>
> >
> > Hm, I don't see how libpcsclite1 depending on pcscd is a bug in wpasupplicant.
> > Could you elaborate?
> 
> wpasupplicant depends on libpcsclite1 to add support of smart cards.
> libpcsclite1 has dependencies on other packages, in particular
> indirectly on libhal.
> 
> Adding smart card support has a (high) cost for every body, including
> the vast majority of wpasupplicant users with no smart card.
> 
> The best solution is for spasupplicant to use the libpcsclite1 library
> only when needed/requested by the user.
> Use dlopen() instead of a direct link, and change the Depends: to a
> Suggests: instead.
> 
> I proposed a patch [1] in Debian bug #531592

Can you please take a look at attached patch? Tweaked it in preparation for
sending upstream.

> 
> The wpasupplicant Debian packagers decided to completely remove smart
> card support [2]. I don't know if using dlopen() to add smart card
> support back is on the roadmap.

Description: Load libpcsclite dynamically
Origin: http://w1.fi/bugz/attachment.cgi?id=149
Bug: http://w1.fi/bugz/show_bug.cgi?id=315
Bug-Debian: http://bugs.debian.org/531592
Author: Ludovic Rousseau <ludovic.rousseau at gmail.com>

Modified by Kel Modderman <kel at otaku42.de>:
* reduce ifdef's which #define stuff to one block
* make dynamic load optional via configuration option

Please note that neither of the patch "author's" have any means of testing
the end result.
---
--- a/src/utils/pcsc_funcs.c
+++ b/src/utils/pcsc_funcs.c
@@ -97,11 +97,25 @@ struct scard_data {
 	int pin1_required;
 };
 
-#ifdef __MINGW32_VERSION
+#if defined( __MINGW32_VERSION) || defined(PCSC_DYNAMIC)
 /* MinGW does not yet support WinScard, so load the needed functions
  * dynamically from winscard.dll for now. */
 
+#ifdef __MINGW32_VERSION
 static HINSTANCE dll = NULL; /* winscard.dll */
+#else
+#include <dlfcn.h>
+#define WINSCARDAPI
+#define WINAPI
+#define IN
+#define OUT
+#define SCardListReadersA SCardListReaders
+#define SCardConnectA SCardConnect
+#define LoadLibrary(lib) dlopen("libpcsclite.so.1", RTLD_LAZY)
+#define GetProcAddress dlsym
+#define FreeLibrary dlclose
+static void* dll = NULL;
+#endif
 
 static const SCARD_IO_REQUEST *dll_g_rgSCardT0Pci, *dll_g_rgSCardT1Pci;
 #undef SCARD_PCI_T0
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -691,9 +691,13 @@ ifdef CONFIG_NATIVE_WINDOWS
 #dynamic symbol loading that is now used in pcsc_funcs.c
 #LIBS += -lwinscard
 else
+ifeq ($(CONFIG_PCSC), dyn)
+CFLAGS += -DPCSC_DYNAMIC
+else
 LIBS += $(shell pkg-config --libs libpcsclite)
 endif
 endif
+endif
 
 ifdef CONFIG_SIM_SIMULATOR
 CFLAGS += -DCONFIG_SIM_SIMULATOR
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -204,6 +204,7 @@ CONFIG_SMARTCARD=y
 
 # PC/SC interface for smartcards (USIM, GSM SIM)
 # Enable this if EAP-SIM or EAP-AKA is included
+# If CONFIG_PCSC=dyn pcsc library is loaded dynamically
 #CONFIG_PCSC=y
 
 # Development testing
---





More information about the Pkg-wpa-devel mailing list