From ae5f2c59ae9946da78f7b83f5b53f538bc8e964e Mon Sep 17 00:00:00 2001 From: John Marino Date: Mon, 13 Oct 2014 09:33:07 +0000 Subject: security/wpa_supplicant: Fix NDIS driver, privsep no longer default The NDIS driver didn't build when privsep option was turned off. Moveover, it didn't display the driver name correctly, so I figured out a patch based on base's ndis driver code. Thirdly, when privsep option is turned off, wpa_priv is not built, so let's handle that condition. Finally, remove privsep from default options because it removes the standard list of drivers and replaces it with privsep driver. --- security/wpa_supplicant/Makefile | 13 +++++++--- .../files/patch-src_drivers_driver__ndis.c | 28 ++++++++++++++++++++++ .../files/patch-wpa__supplicant_Makefile | 7 ++++-- 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 security/wpa_supplicant/files/patch-src_drivers_driver__ndis.c (limited to 'security/wpa_supplicant') diff --git a/security/wpa_supplicant/Makefile b/security/wpa_supplicant/Makefile index 52468a0052c2..f193e7f71f4b 100644 --- a/security/wpa_supplicant/Makefile +++ b/security/wpa_supplicant/Makefile @@ -2,6 +2,7 @@ PORTNAME= wpa_supplicant PORTVERSION= 2.3 +PORTREVISION= 1 CATEGORIES= security net MASTER_SITES= http://w1.fi/releases/ @@ -18,7 +19,6 @@ SUB_FILES= pkg-message PLIST_FILES= sbin/wpa_supplicant \ sbin/wpa_passphrase \ sbin/wpa_cli \ - sbin/wpa_priv \ "@sample etc/wpa_supplicant.conf.sample" PORTDOCS= README ChangeLog @@ -35,7 +35,7 @@ OPTIONS_DEFINE= WPS WPS_ER WPS_NOREG WPS_NFC PKCS12 SMARTCARD \ HS20 NO_ROAMING P2P TDLS OPTIONS_DEFAULT= BSD WIRED NDIS \ TLS PEAP TTLS MD5 MSCHAPv2 GTC LEAP OTP PSK \ - WPS PKCS12 SMARTCARD IEEE80211R DEBUG_SYSLOG PRIVSEP \ + WPS PKCS12 SMARTCARD IEEE80211R DEBUG_SYSLOG \ INTERWORKING HS20 WPS_DESC= Wi-Fi Protected Setup @@ -99,6 +99,10 @@ CFLAGS+= -I${LOCALBASE}/include/PCSC LDFLAGS+= -L${LOCALBASE}/lib .endif +.if ${PORT_OPTIONS:MPRIVSEP} +PLIST_FILES+= sbin/wpa_priv +.endif + post-patch: ${CP} ${FILESDIR}/Packet32.[ch] ${FILESDIR}/ntddndis.h \ ${WRKSRC}/src/utils @@ -150,7 +154,10 @@ post-patch: do-install: @${MKDIR} ${STAGEDIR}${DOCSDIR} (cd ${BUILD_WRKSRC} && ${INSTALL_PROGRAM} wpa_supplicant wpa_cli \ - wpa_passphrase wpa_priv ${STAGEDIR}${PREFIX}/sbin) + wpa_passphrase ${STAGEDIR}${PREFIX}/sbin) +.if ${PORT_OPTIONS:MPRIVSEP} + ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/wpa_priv ${STAGEDIR}${PREFIX}/sbin +.endif ${INSTALL_DATA} ${BUILD_WRKSRC}/wpa_supplicant.conf \ ${STAGEDIR}${PREFIX}/etc/wpa_supplicant.conf.sample (cd ${BUILD_WRKSRC} && \ diff --git a/security/wpa_supplicant/files/patch-src_drivers_driver__ndis.c b/security/wpa_supplicant/files/patch-src_drivers_driver__ndis.c new file mode 100644 index 000000000000..5c9ffe9e60d4 --- /dev/null +++ b/security/wpa_supplicant/files/patch-src_drivers_driver__ndis.c @@ -0,0 +1,28 @@ +--- src/drivers/driver_ndis.c.orig 2014-10-09 14:41:31 UTC ++++ src/drivers/driver_ndis.c +@@ -2110,7 +2110,11 @@ static int wpa_driver_ndis_get_names(str + dlen = dpos - desc; + else + dlen = os_strlen(desc); +- drv->adapter_desc = dup_binstr(desc, dlen); ++ drv->adapter_desc = os_malloc(dlen + 1); ++ if (drv->adapter_desc) { ++ os_memcpy(drv->adapter_desc, desc, dlen); ++ drv->adapter_desc[dlen] = '\0'; ++ } + os_free(b); + if (drv->adapter_desc == NULL) + return -1; +@@ -2278,7 +2282,11 @@ static int wpa_driver_ndis_get_names(str + } else { + dlen = os_strlen(desc[i]); + } +- drv->adapter_desc = dup_binstr(desc[i], dlen); ++ drv->adapter_desc = os_malloc(dlen + 1); ++ if (drv->adapter_desc) { ++ os_memcpy(drv->adapter_desc, desc[i], dlen); ++ drv->adapter_desc[dlen] = '\0'; ++ } + os_free(names); + if (drv->adapter_desc == NULL) + return -1; diff --git a/security/wpa_supplicant/files/patch-wpa__supplicant_Makefile b/security/wpa_supplicant/files/patch-wpa__supplicant_Makefile index ecadd5ea713f..cff0ed1d16fe 100644 --- a/security/wpa_supplicant/files/patch-wpa__supplicant_Makefile +++ b/security/wpa_supplicant/files/patch-wpa__supplicant_Makefile @@ -1,11 +1,14 @@ --- wpa_supplicant/Makefile.orig 2014-10-09 14:41:31 UTC +++ wpa_supplicant/Makefile -@@ -97,6 +97,11 @@ OBJS += ../src/utils/os_$(CONFIG_OS).o +@@ -97,6 +97,14 @@ OBJS += ../src/utils/os_$(CONFIG_OS).o OBJS_p += ../src/utils/os_$(CONFIG_OS).o OBJS_c += ../src/utils/os_$(CONFIG_OS).o +ifdef CONFIG_DRIVER_NDIS -+OBJS += ../src/utils/Packet32.o ../src/drivers/driver_ndis.o ++OBJS += ../src/utils/Packet32.o ++ifdef CONFIG_PRIVSEP ++OBJS += ../src/drivers/driver_ndis.o ++endif +OBJS_priv += ../src/utils/Packet32.o +endif + -- cgit v1.2.3