Colin Watson a écrit :
Package: libpcsclite1
Version: 1.5.3-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch karmic
We currently ship wpa_supplicant in /sbin so that it can be used early
in the boot process. However, it links against libpcsclite.so.1 which is
in /usr/lib. This breaks things for people with a separate /usr.
Would you consent to moving this library to /lib? The attached patch
implements this change.
I don't think that is the correct solution to the problem.
Moving the library to /lib will allow moving wpa_supplicant in /sbin but
wpa_supplicant will not be able to work with smart card support.
libpcsclite needs to communicate with the pcscd daemon. This daemon is
in /usr/sbin/ and is linked with libhal (and other libs). I don't think
you plan to move libhal (and its dependencies) in /lib.
The correct way to solve this problem is to use dlopen() in
wpa_supplicant and use libpcsclite.so.1 only when needed/requested.
I looked at the wpa_supplicant code and the needed code is already
present. It is in the file wpasupplicant-0.6.9/src/utils/pcsc_funcs.c
Dynamic loading is used in case of __MINGW32_VERSION. I include a simple
patch to use loading at runtime even on Linux.
I have not tested the patch. I have just tested that the compilation
works and that the resulting binary is no more linked with libpcsclite.so.1.
I think this bug should be reassigned to wpasupplicant, and my patch
sent to wpasupplicant upstream for review.
Bye
--
Dr. Ludovic Rousseau
diff -ru wpasupplicant-0.6.9/wpa_supplicant/Makefile
wpasupplicant-0.6.9.new/wpa_supplicant/Makefile
--- wpasupplicant-0.6.9/wpa_supplicant/Makefile 2009-03-23 15:06:28.000000000
+0100
+++ wpasupplicant-0.6.9.new/wpa_supplicant/Makefile 2009-06-05
22:02:06.000000000 +0200
@@ -631,7 +631,7 @@
#dynamic symbol loading that is now used in pcsc_funcs.c
#LIBS += -lwinscard
else
-LIBS += -lpcsclite -lpthread
+#LIBS += $(shell pkg-config --libs libpcsclite)
endif
endif
--- wpasupplicant-0.6.9/src/utils/pcsc_funcs.c 2009-03-23 15:06:28.000000000
+0100
+++ wpasupplicant-0.6.9.new/src/utils/pcsc_funcs.c 2009-06-05
22:13:57.000000000 +0200
@@ -97,11 +97,25 @@
int pin1_required;
};
-#ifdef __MINGW32_VERSION
+#define DYNAMIC_LOADING
+
+#define DYNAMIC_LOADING
+#if defined( __MINGW32_VERSION) || defined(DYNAMIC_LOADING)
/* 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
+static void* dll = NULL;
+#define WINSCARDAPI
+#define WINAPI
+#define IN
+#define OUT
+#include <dlfcn.h>
+#define SCardListReadersA SCardListReaders
+#define SCardConnectA SCardConnect
+#endif
static const SCARD_IO_REQUEST *dll_g_rgSCardT0Pci, *dll_g_rgSCardT1Pci;
#undef SCARD_PCI_T0
@@ -169,6 +183,12 @@
if (dll)
return 0;
+#ifndef __MINGW32_VERSION
+#define LoadLibrary(lib) dlopen("libpcsclite.so.1", RTLD_LAZY)
+#define GetProcAddress dlsym
+#define FreeLibrary dlclose
+#endif
+
dll = LoadLibrary("winscard");
if (dll == NULL) {
wpa_printf(MSG_DEBUG, "WinSCard: Could not load winscard.dll "