/[gentoo-x86]/net-wireless/wpa_supplicant/wpa_supplicant-2.4-r2.ebuild
Gentoo

Contents of /net-wireless/wpa_supplicant/wpa_supplicant-2.4-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon May 11 14:53:41 2015 UTC (5 years, 2 months ago) by gurligebis
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Adding more security patches from bug #548742 and fixing patch from bug #544036

(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 15AE484C)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/wpa_supplicant-2.4-r2.ebuild,v 1.1 2015/05/08 17:58:51 gurligebis Exp $
4
5 EAPI=5
6
7 inherit eutils toolchain-funcs qt4-r2 systemd multilib
8
9 DESCRIPTION="IEEE 802.1X/WPA supplicant for secure wireless transfers"
10 HOMEPAGE="http://hostap.epitest.fi/wpa_supplicant/"
11 SRC_URI="http://hostap.epitest.fi/releases/${P}.tar.gz"
12 LICENSE="|| ( GPL-2 BSD )"
13
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
16 IUSE="ap dbus gnutls eap-sim fasteap +hs2-0 p2p ps3 qt4 readline selinux smartcard ssl tdls uncommon-eap-types wimax wps kernel_linux kernel_FreeBSD"
17 REQUIRED_USE="fasteap? ( !gnutls !ssl ) smartcard? ( ssl )"
18
19 CDEPEND="dbus? ( sys-apps/dbus )
20 kernel_linux? (
21 eap-sim? ( sys-apps/pcsc-lite )
22 dev-libs/libnl:3
23 net-wireless/crda
24 )
25 !kernel_linux? ( net-libs/libpcap )
26 qt4? (
27 dev-qt/qtcore:4
28 dev-qt/qtgui:4
29 dev-qt/qtsvg:4
30 )
31 readline? (
32 sys-libs/ncurses
33 sys-libs/readline:0
34 )
35 ssl? ( dev-libs/openssl:0 )
36 !ssl? ( gnutls? ( net-libs/gnutls ) )
37 !ssl? ( !gnutls? ( dev-libs/libtommath ) )
38 "
39 DEPEND="${CDEPEND}
40 virtual/pkgconfig
41 "
42 RDEPEND="${CDEPEND}
43 selinux? ( sec-policy/selinux-networkmanager )
44 "
45
46 S="${WORKDIR}/${P}/${PN}"
47
48 Kconfig_style_config() {
49 #param 1 is CONFIG_* item
50 #param 2 is what to set it = to, defaulting in y
51 CONFIG_PARAM="${CONFIG_HEADER:-CONFIG_}$1"
52 setting="${2:-y}"
53
54 if [ ! $setting = n ]; then
55 #first remove any leading "# " if $2 is not n
56 sed -i "/^# *$CONFIG_PARAM=/s/^# *//" .config || echo "Kconfig_style_config error uncommenting $CONFIG_PARAM"
57 #set item = $setting (defaulting to y)
58 sed -i "/^$CONFIG_PARAM/s/=.*/=$setting/" .config || echo "Kconfig_style_config error setting $CONFIG_PARAM=$setting"
59 else
60 #ensure item commented out
61 sed -i "/^$CONFIG_PARAM/s/$CONFIG_PARAM/# $CONFIG_PARAM/" .config || echo "Kconfig_style_config error commenting $CONFIG_PARAM"
62 fi
63 }
64
65 pkg_setup() {
66 if use gnutls && use ssl ; then
67 elog "You have both 'gnutls' and 'ssl' USE flags enabled: defaulting to USE=\"ssl\""
68 fi
69 }
70
71 src_prepare() {
72 # net/bpf.h needed for net-libs/libpcap on Gentoo/FreeBSD
73 sed -i \
74 -e "s:\(#include <pcap\.h>\):#include <net/bpf.h>\n\1:" \
75 ../src/l2_packet/l2_packet_freebsd.c || die
76
77 # People seem to take the example configuration file too literally (bug #102361)
78 sed -i \
79 -e "s:^\(opensc_engine_path\):#\1:" \
80 -e "s:^\(pkcs11_engine_path\):#\1:" \
81 -e "s:^\(pkcs11_module_path\):#\1:" \
82 wpa_supplicant.conf || die
83
84 # Change configuration to match Gentoo locations (bug #143750)
85 sed -i \
86 -e "s:/usr/lib/opensc:/usr/$(get_libdir):" \
87 -e "s:/usr/lib/pkcs11:/usr/$(get_libdir):" \
88 wpa_supplicant.conf || die
89
90 if use dbus; then
91 epatch "${FILESDIR}/${P}-dbus-path-fix.patch"
92 fi
93
94 # systemd entries to D-Bus service files (bug #372877)
95 echo 'SystemdService=wpa_supplicant.service' \
96 | tee -a dbus/*.service >/dev/null || die
97
98 cd "${WORKDIR}/${P}"
99
100 if use wimax; then
101 # generate-libeap-peer.patch comes before
102 # fix-undefined-reference-to-random_get_bytes.patch
103 epatch "${FILESDIR}/${P}-generate-libeap-peer.patch"
104
105 # multilib-strict fix (bug #373685)
106 sed -e "s/\/usr\/lib/\/usr\/$(get_libdir)/" -i src/eap_peer/Makefile
107 fi
108
109 # bug (548742)
110 epatch "${FILESDIR}/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch"
111 epatch "${FILESDIR}/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch"
112 epatch "${FILESDIR}/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch"
113 epatch "${FILESDIR}/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch"
114 epatch "${FILESDIR}/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch"
115
116 # bug (320097)
117 epatch "${FILESDIR}/${P}-do-not-call-dbus-functions-with-NULL-path.patch"
118
119 # TODO - NEED TESTING TO SEE IF STILL NEEDED, NOT COMPATIBLE WITH 1.0 OUT OF THE BOX,
120 # SO WOULD BE NICE TO JUST DROP IT, IF IT IS NOT NEEDED.
121 # bug (374089)
122 #epatch "${FILESDIR}/${P}-dbus-WPAIE-fix.patch"
123
124 epatch "${FILESDIR}"/wpa_supplicant-2.4-cve-2015-1863.patch
125 }
126
127 src_configure() {
128 # Toolchain setup
129 tc-export CC
130
131 cp defconfig .config
132
133 # Basic setup
134 Kconfig_style_config CTRL_IFACE
135 Kconfig_style_config BACKEND file
136 Kconfig_style_config IBSS_RSN
137 Kconfig_style_config IEEE80211W
138 Kconfig_style_config IEEE80211R
139
140 # Basic authentication methods
141 # NOTE: we don't set GPSK or SAKE as they conflict
142 # with the below options
143 Kconfig_style_config EAP_GTC
144 Kconfig_style_config EAP_MD5
145 Kconfig_style_config EAP_OTP
146 Kconfig_style_config EAP_PAX
147 Kconfig_style_config EAP_PSK
148 Kconfig_style_config EAP_TLV
149 Kconfig_style_config EAP_EXE
150 Kconfig_style_config IEEE8021X_EAPOL
151 Kconfig_style_config PKCS12
152 Kconfig_style_config PEERKEY
153 Kconfig_style_config EAP_LEAP
154 Kconfig_style_config EAP_MSCHAPV2
155 Kconfig_style_config EAP_PEAP
156 Kconfig_style_config EAP_TLS
157 Kconfig_style_config EAP_TTLS
158
159 # Enabling background scanning.
160 Kconfig_style_config BGSCAN_SIMPLE
161 Kconfig_style_config BGSCAN_LEARN
162
163 if use dbus ; then
164 Kconfig_style_config CTRL_IFACE_DBUS
165 Kconfig_style_config CTRL_IFACE_DBUS_NEW
166 Kconfig_style_config CTRL_IFACE_DBUS_INTRO
167 fi
168
169 # Enable support for writing debug info to a log file and syslog.
170 Kconfig_style_config DEBUG_FILE
171 Kconfig_style_config DEBUG_SYSLOG
172
173 if use hs2-0 ; then
174 Kconfig_style_config INTERWORKING
175 Kconfig_style_config HS20
176 fi
177
178 if use uncommon-eap-types; then
179 Kconfig_style_config EAP_GPSK
180 Kconfig_style_config EAP_SAKE
181 Kconfig_style_config EAP_GPSK_SHA256
182 Kconfig_style_config EAP_IKEV2
183 Kconfig_style_config EAP_EKE
184 fi
185
186 if use eap-sim ; then
187 # Smart card authentication
188 Kconfig_style_config EAP_SIM
189 Kconfig_style_config EAP_AKA
190 Kconfig_style_config EAP_AKA_PRIME
191 Kconfig_style_config PCSC
192 fi
193
194 if use fasteap ; then
195 Kconfig_style_config EAP_FAST
196 fi
197
198 if use readline ; then
199 # readline/history support for wpa_cli
200 Kconfig_style_config READLINE
201 else
202 #internal line edit mode for wpa_cli
203 Kconfig_style_config WPA_CLI_EDIT
204 fi
205
206 # SSL authentication methods
207 if use ssl ; then
208 Kconfig_style_config TLS openssl
209 elif use gnutls ; then
210 Kconfig_style_config TLS gnutls
211 Kconfig_style_config GNUTLS_EXTRA
212 else
213 Kconfig_style_config TLS internal
214 fi
215
216 if use smartcard ; then
217 Kconfig_style_config SMARTCARD
218 fi
219
220 if use tdls ; then
221 Kconfig_style_config TDLS
222 fi
223
224 if use kernel_linux ; then
225 # Linux specific drivers
226 Kconfig_style_config DRIVER_ATMEL
227 Kconfig_style_config DRIVER_HOSTAP
228 Kconfig_style_config DRIVER_IPW
229 Kconfig_style_config DRIVER_NL80211
230 Kconfig_style_config DRIVER_RALINK
231 Kconfig_style_config DRIVER_WEXT
232 Kconfig_style_config DRIVER_WIRED
233
234 if use ps3 ; then
235 Kconfig_style_config DRIVER_PS3
236 fi
237
238 elif use kernel_FreeBSD ; then
239 # FreeBSD specific driver
240 Kconfig_style_config DRIVER_BSD
241 fi
242
243 # Wi-Fi Protected Setup (WPS)
244 if use wps ; then
245 Kconfig_style_config WPS
246 Kconfig_style_config WPS2
247 # USB Flash Drive
248 Kconfig_style_config WPS_UFD
249 # External Registrar
250 Kconfig_style_config WPS_ER
251 # Universal Plug'n'Play
252 Kconfig_style_config WPS_UPNP
253 # Near Field Communication
254 Kconfig_style_config WPS_NFC
255 fi
256
257 # Wi-Fi Direct (WiDi)
258 if use p2p ; then
259 Kconfig_style_config P2P
260 Kconfig_style_config WIFI_DISPLAY
261 fi
262
263 # Access Point Mode
264 if use ap ; then
265 Kconfig_style_config AP
266 fi
267
268 # Enable mitigation against certain attacks against TKIP
269 Kconfig_style_config DELAYED_MIC_ERROR_REPORT
270
271 # If we are using libnl 2.0 and above, enable support for it
272 # Bug 382159
273 # Removed for now, since the 3.2 version is broken, and we don't
274 # support it.
275 if has_version ">=dev-libs/libnl-3.2"; then
276 Kconfig_style_config LIBNL32
277 fi
278
279 if use qt4 ; then
280 pushd "${S}"/wpa_gui-qt4 > /dev/null
281 eqmake4 wpa_gui.pro
282 popd > /dev/null
283 fi
284 }
285
286 src_compile() {
287 einfo "Building wpa_supplicant"
288 emake V=1 BINDIR=/usr/sbin
289
290 if use wimax; then
291 emake -C ../src/eap_peer clean
292 emake -C ../src/eap_peer
293 fi
294
295 if use qt4 ; then
296 pushd "${S}"/wpa_gui-qt4 > /dev/null
297 einfo "Building wpa_gui"
298 emake
299 popd > /dev/null
300 fi
301 }
302
303 src_install() {
304 dosbin wpa_supplicant
305 dobin wpa_cli wpa_passphrase
306
307 # baselayout-1 compat
308 if has_version "<sys-apps/baselayout-2.0.0"; then
309 dodir /sbin
310 dosym /usr/sbin/wpa_supplicant /sbin/wpa_supplicant
311 dodir /bin
312 dosym /usr/bin/wpa_cli /bin/wpa_cli
313 fi
314
315 if has_version ">=sys-apps/openrc-0.5.0"; then
316 newinitd "${FILESDIR}/${PN}-init.d" wpa_supplicant
317 newconfd "${FILESDIR}/${PN}-conf.d" wpa_supplicant
318 fi
319
320 exeinto /etc/wpa_supplicant/
321 newexe "${FILESDIR}/wpa_cli.sh" wpa_cli.sh
322
323 dodoc ChangeLog {eap_testing,todo}.txt README{,-WPS} \
324 wpa_supplicant.conf
325
326 newdoc .config build-config
327
328 doman doc/docbook/*.{5,8}
329
330 if use qt4 ; then
331 into /usr
332 dobin wpa_gui-qt4/wpa_gui
333 doicon wpa_gui-qt4/icons/wpa_gui.svg
334 make_desktop_entry wpa_gui "WPA Supplicant Administration GUI" "wpa_gui" "Qt;Network;"
335 fi
336
337 use wimax && emake DESTDIR="${D}" -C ../src/eap_peer install
338
339 if use dbus ; then
340 pushd "${S}"/dbus > /dev/null
341 insinto /etc/dbus-1/system.d
342 newins dbus-wpa_supplicant.conf wpa_supplicant.conf
343 insinto /usr/share/dbus-1/system-services
344 doins fi.epitest.hostap.WPASupplicant.service fi.w1.wpa_supplicant1.service
345 popd > /dev/null
346
347 # This unit relies on dbus support, bug 538600.
348 systemd_dounit systemd/wpa_supplicant.service
349 fi
350
351 systemd_dounit "systemd/wpa_supplicant@.service"
352 systemd_dounit "systemd/wpa_supplicant-nl80211@.service"
353 systemd_dounit "systemd/wpa_supplicant-wired@.service"
354 }
355
356 pkg_postinst() {
357 elog "If this is a clean installation of wpa_supplicant, you"
358 elog "have to create a configuration file named"
359 elog "/etc/wpa_supplicant/wpa_supplicant.conf"
360 elog
361 elog "An example configuration file is available for reference in"
362 elog "/usr/share/doc/${PF}/"
363
364 if [[ -e ${ROOT}etc/wpa_supplicant.conf ]] ; then
365 echo
366 ewarn "WARNING: your old configuration file ${ROOT}etc/wpa_supplicant.conf"
367 ewarn "needs to be moved to ${ROOT}etc/wpa_supplicant/wpa_supplicant.conf"
368 fi
369
370 # Mea culpa, feel free to remove that after some time --mgorny.
371 local fn
372 for fn in wpa_supplicant{,@wlan0}.service; do
373 if [[ -e "${ROOT}"/etc/systemd/system/network.target.wants/${fn} ]]
374 then
375 ebegin "Moving ${fn} to multi-user.target"
376 mv "${ROOT}"/etc/systemd/system/network.target.wants/${fn} \
377 "${ROOT}"/etc/systemd/system/multi-user.target.wants/
378 eend ${?} \
379 "Please try to re-enable ${fn}"
380 fi
381 done
382 }

  ViewVC Help
Powered by ViewVC 1.1.20