From 1566d8ae23d8ebf20f153676764bcfe947c111968bf61856e196142ff079f1f7 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 14 Nov 2007 13:55:48 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/wpa_supplicant?expand=0&rev=6 --- config | 6 +- fi.epitest.hostap.WPASupplicant.service | 5 + wpa_supplicant-0.5.8-gcc43.patch | 34 ---- wpa_supplicant-always-scan.patch | 13 ++ wpa_supplicant-assoc-timeout.patch | 16 ++ wpa_supplicant-dbus-blobs.patch | 186 +++++++++++++++++ wpa_supplicant-dbus-iface-segfault-fix.patch | 14 ++ wpa_supplicant-dbus-permissions-fix.patch | 15 ++ wpa_supplicant-debug-file.patch | 81 ++++++++ wpa_supplicant-driver-wext-debug.patch | 115 +++++++++++ ...plicant-fix-deprecated-dbus-function.patch | 189 ++++++++++++++++++ ...licant-fix-dynamic-wep-with-mac80211.patch | 12 ++ wpa_supplicant-flush-debug-output.patch | 51 +++++ ...upplicant-sigusr1-changes-debuglevel.patch | 38 ++++ wpa_supplicant-wep-key-fix.patch | 13 ++ wpa_supplicant.changes | 8 + wpa_supplicant.conf | 3 + wpa_supplicant.spec | 66 +++++- 18 files changed, 819 insertions(+), 46 deletions(-) create mode 100644 fi.epitest.hostap.WPASupplicant.service delete mode 100644 wpa_supplicant-0.5.8-gcc43.patch create mode 100644 wpa_supplicant-always-scan.patch create mode 100644 wpa_supplicant-assoc-timeout.patch create mode 100644 wpa_supplicant-dbus-blobs.patch create mode 100644 wpa_supplicant-dbus-iface-segfault-fix.patch create mode 100644 wpa_supplicant-dbus-permissions-fix.patch create mode 100644 wpa_supplicant-debug-file.patch create mode 100644 wpa_supplicant-driver-wext-debug.patch create mode 100644 wpa_supplicant-fix-deprecated-dbus-function.patch create mode 100644 wpa_supplicant-fix-dynamic-wep-with-mac80211.patch create mode 100644 wpa_supplicant-flush-debug-output.patch create mode 100644 wpa_supplicant-sigusr1-changes-debuglevel.patch create mode 100644 wpa_supplicant-wep-key-fix.patch create mode 100644 wpa_supplicant.conf diff --git a/config b/config index 41d81c1..a0c3e15 100644 --- a/config +++ b/config @@ -4,8 +4,8 @@ CONFIG_DRIVER_PRISM54=y # CONFIG_DRIVER_MADWIFI gets dynamically added when needed CONFIG_DRIVER_ATMEL=y CONFIG_DRIVER_WEXT=y -CONFIG_DRIVER_NDISWRAPPER=y -CONFIG_DRIVER_IPW=y +#CONFIG_DRIVER_NDISWRAPPER=y +#CONFIG_DRIVER_IPW=y CONFIG_DRIVER_WIRED=y CONFIG_WIRELESS_EXTENSION=y CONFIG_IEEE8021X_EAPOL=y @@ -22,7 +22,9 @@ CONFIG_EAP_LEAP=y CONFIG_PKCS12=y CONFIG_SMARTCARD=y CONFIG_CTRL_IFACE=y +CONFIG_CTRL_IFACE_DBUS=y CONFIG_READLINE=y #CONFIG_PCSC #CONFIG_EAP_SIM #CONFIG_EAP_AKA +CONFIG_DEBUG_FILE=y \ No newline at end of file diff --git a/fi.epitest.hostap.WPASupplicant.service b/fi.epitest.hostap.WPASupplicant.service new file mode 100644 index 0000000..8444169 --- /dev/null +++ b/fi.epitest.hostap.WPASupplicant.service @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=fi.epitest.hostap.WPASupplicant +Exec=/usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -f +User=root + diff --git a/wpa_supplicant-0.5.8-gcc43.patch b/wpa_supplicant-0.5.8-gcc43.patch deleted file mode 100644 index 4490d15..0000000 --- a/wpa_supplicant-0.5.8-gcc43.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -Naur wpa_supplicant-0.5.8.org/wpa_gui/networkconfig.ui.h wpa_supplicant-0.5.8/wpa_gui/networkconfig.ui.h ---- wpa_supplicant-0.5.8.org/wpa_gui/networkconfig.ui.h 2007-11-12 14:09:15.880153000 +0100 -+++ wpa_supplicant-0.5.8/wpa_gui/networkconfig.ui.h 2007-11-12 14:16:58.865706000 +0100 -@@ -10,6 +10,7 @@ - ** destructor. - *****************************************************************************/ - -+#include - - enum { - AUTH_NONE = 0, -diff -Naur wpa_supplicant-0.5.8.org/wpa_gui/userdatarequest.ui.h wpa_supplicant-0.5.8/wpa_gui/userdatarequest.ui.h ---- wpa_supplicant-0.5.8.org/wpa_gui/userdatarequest.ui.h 2007-11-12 14:09:15.910119000 +0100 -+++ wpa_supplicant-0.5.8/wpa_gui/userdatarequest.ui.h 2007-11-12 14:14:20.493231000 +0100 -@@ -10,6 +10,8 @@ - ** destructor. - *****************************************************************************/ - -+#include -+ - int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg) - { - char *tmp, *pos, *pos2; -diff -Naur wpa_supplicant-0.5.8.org/wpa_gui/wpagui.ui.h wpa_supplicant-0.5.8/wpa_gui/wpagui.ui.h ---- wpa_supplicant-0.5.8.org/wpa_gui/wpagui.ui.h 2007-11-12 14:09:15.923117000 +0100 -+++ wpa_supplicant-0.5.8/wpa_gui/wpagui.ui.h 2007-11-12 14:17:46.359161000 +0100 -@@ -16,6 +16,7 @@ - #include - #endif - -+#include - - void WpaGui::init() - { diff --git a/wpa_supplicant-always-scan.patch b/wpa_supplicant-always-scan.patch new file mode 100644 index 0000000..d537306 --- /dev/null +++ b/wpa_supplicant-always-scan.patch @@ -0,0 +1,13 @@ +Index: wpa_supplicant-0.5.8/wpa_supplicant.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/wpa_supplicant.c ++++ wpa_supplicant-0.5.8/wpa_supplicant.c +@@ -974,7 +974,7 @@ static void wpa_supplicant_scan(void *el + struct wpa_ssid *ssid; + int enabled, scan_req = 0, ret; + +- if (wpa_s->disconnected) ++ if (wpa_s->disconnected && !wpa_s->scan_req) + return; + + enabled = 0; diff --git a/wpa_supplicant-assoc-timeout.patch b/wpa_supplicant-assoc-timeout.patch new file mode 100644 index 0000000..fc709eb --- /dev/null +++ b/wpa_supplicant-assoc-timeout.patch @@ -0,0 +1,16 @@ +Index: wpa_supplicant-0.5.8/wpa_supplicant.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/wpa_supplicant.c ++++ wpa_supplicant-0.5.8/wpa_supplicant.c +@@ -1513,9 +1513,9 @@ void wpa_supplicant_associate(struct wpa + /* Timeout for IEEE 802.11 authentication and association */ + int timeout; + if (assoc_failed) +- timeout = 5; ++ timeout = 15; + else if (wpa_s->conf->ap_scan == 1) +- timeout = 10; ++ timeout = 15; + else + timeout = 60; + wpa_supplicant_req_auth_timeout(wpa_s, timeout, 0); diff --git a/wpa_supplicant-dbus-blobs.patch b/wpa_supplicant-dbus-blobs.patch new file mode 100644 index 0000000..1d7ef12 --- /dev/null +++ b/wpa_supplicant-dbus-blobs.patch @@ -0,0 +1,186 @@ +Index: wpa_supplicant-0.5.8/config.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/config.c ++++ wpa_supplicant-0.5.8/config.c +@@ -70,13 +70,14 @@ static char * wpa_config_parse_string(co + if (hlen & 1) + return NULL; + *len = hlen / 2; +- str = os_malloc(*len); ++ str = os_malloc(*len + 1); + if (str == NULL) + return NULL; + if (hexstr2bin(value, str, *len)) { + os_free(str); + return NULL; + } ++ str[*len] = '\0'; + return (char *) str; + } + } +Index: wpa_supplicant-0.5.8/ctrl_iface_dbus.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/ctrl_iface_dbus.c ++++ wpa_supplicant-0.5.8/ctrl_iface_dbus.c +@@ -536,6 +536,10 @@ static DBusHandlerResult wpas_iface_mess + reply = wpas_dbus_iface_set_ap_scan(message, wpa_s); + else if (!strcmp(method, "state")) + reply = wpas_dbus_iface_get_state(message, wpa_s); ++ else if (!strcmp(method, "setBlobs")) ++ reply = wpas_dbus_iface_set_blobs(message, wpa_s); ++ else if (!strcmp(method, "removeBlobs")) ++ reply = wpas_dbus_iface_remove_blobs(message, wpa_s); + } + + /* If the message was handled, send back the reply */ +Index: wpa_supplicant-0.5.8/ctrl_iface_dbus_handlers.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/ctrl_iface_dbus_handlers.c ++++ wpa_supplicant-0.5.8/ctrl_iface_dbus_handlers.c +@@ -1203,3 +1203,129 @@ DBusMessage * wpas_dbus_iface_get_state( + + return reply; + } ++ ++ ++/** ++ * wpas_dbus_iface_set_blobs - Store named binary blobs (ie, for certificates) ++ * @message: Pointer to incoming dbus message ++ * @global: %wpa_supplicant global data structure ++ * Returns: A dbus message containing a UINT32 indicating success (1) or ++ * failure (0) ++ * ++ * Asks wpa_supplicant to internally store a one or more binary blobs. ++ */ ++DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message, ++ struct wpa_supplicant *wpa_s) ++{ ++ DBusMessage *reply = NULL; ++ struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; ++ DBusMessageIter iter, iter_dict; ++ ++ dbus_message_iter_init(message, &iter); ++ ++ if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) ++ return wpas_dbus_new_invalid_opts_error(message, NULL); ++ ++ while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { ++ struct wpa_config_blob *blob; ++ ++ if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) { ++ reply = wpas_dbus_new_invalid_opts_error(message, NULL); ++ break; ++ } ++ ++ if (entry.type != DBUS_TYPE_ARRAY || ++ entry.array_type != DBUS_TYPE_BYTE) { ++ reply = wpas_dbus_new_invalid_opts_error(message, ++ "Byte array expected."); ++ break; ++ } ++ ++ if ( (entry.array_len <= 0) ++ || (entry.array_len > 65536) ++ || !strlen(entry.key)) { ++ reply = wpas_dbus_new_invalid_opts_error(message, ++ "Invalid array size."); ++ break; ++ } ++ ++ blob = os_zalloc(sizeof(*blob)); ++ if (blob == NULL) { ++ reply = dbus_message_new_error(message, ++ WPAS_ERROR_ADD_ERROR, ++ "Not enough memory to add blob."); ++ break; ++ } ++ blob->data = os_zalloc(entry.array_len); ++ if (blob->data == NULL) { ++ reply = dbus_message_new_error(message, ++ WPAS_ERROR_ADD_ERROR, ++ "Not enough memory to add blob data."); ++ os_free(blob); ++ break; ++ } ++ ++ blob->name = os_strdup(entry.key); ++ blob->len = entry.array_len; ++ os_memcpy(blob->data, (u8 *) entry.bytearray_value, ++ entry.array_len); ++ if (blob->name == NULL || blob->data == NULL) { ++ wpa_config_free_blob(blob); ++ reply = dbus_message_new_error(message, ++ WPAS_ERROR_ADD_ERROR, ++ "Error adding blob."); ++ break; ++ } ++ ++ /* Success */ ++ wpa_config_remove_blob(wpa_s->conf, blob->name); ++ wpa_config_set_blob(wpa_s->conf, blob); ++ wpa_dbus_dict_entry_clear(&entry); ++ } ++ wpa_dbus_dict_entry_clear(&entry); ++ ++ return reply ? reply : wpas_dbus_new_success_reply(message);; ++} ++ ++/** ++ * wpas_dbus_iface_remove_blob - Remove named binary blobs ++ * @message: Pointer to incoming dbus message ++ * @global: %wpa_supplicant global data structure ++ * Returns: A dbus message containing a UINT32 indicating success (1) or ++ * failure (0) ++ * ++ * Asks wpa_supplicant to remove one or more previously stored binary blobs. ++ */ ++DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message, ++ struct wpa_supplicant *wpa_s) ++{ ++ DBusMessageIter iter, array; ++ char *err_msg = NULL; ++ ++ dbus_message_iter_init(message, &iter); ++ ++ if ((dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) ++ || (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_STRING)) ++ return wpas_dbus_new_invalid_opts_error(message, NULL); ++ ++ dbus_message_iter_recurse(&iter, &array); ++ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) { ++ const char *name; ++ ++ dbus_message_iter_get_basic(&array, &name); ++ if (!strlen(name)) ++ err_msg = "Invalid blob name."; ++ ++ if (wpa_config_remove_blob(wpa_s->conf, name) != 0) ++ err_msg = "Error removing blob."; ++ dbus_message_iter_next(&array); ++ } ++ ++ if (err_msg) { ++ return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR, ++ err_msg); ++ } ++ ++ return wpas_dbus_new_success_reply(message); ++} ++ +Index: wpa_supplicant-0.5.8/ctrl_iface_dbus_handlers.h +=================================================================== +--- wpa_supplicant-0.5.8.orig/ctrl_iface_dbus_handlers.h ++++ wpa_supplicant-0.5.8/ctrl_iface_dbus_handlers.h +@@ -71,6 +71,12 @@ DBusMessage * wpas_dbus_iface_set_ap_sca + DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message, + struct wpa_supplicant *wpa_s); + ++DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message, ++ struct wpa_supplicant *wpa_s); ++ ++DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message, ++ struct wpa_supplicant *wpa_s); ++ + #endif /* CONFIG_CTRL_IFACE_DBUS */ + + #endif /* CTRL_IFACE_DBUS_HANDLERS_H */ diff --git a/wpa_supplicant-dbus-iface-segfault-fix.patch b/wpa_supplicant-dbus-iface-segfault-fix.patch new file mode 100644 index 0000000..637d694 --- /dev/null +++ b/wpa_supplicant-dbus-iface-segfault-fix.patch @@ -0,0 +1,14 @@ +Index: wpa_supplicant-0.5.8/wpa_supplicant.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/wpa_supplicant.c ++++ wpa_supplicant-0.5.8/wpa_supplicant.c +@@ -2363,7 +2363,8 @@ static void wpa_supplicant_deinit_iface( + wpa_clear_keys(wpa_s, NULL); + } + +- wpas_dbus_unregister_iface(wpa_s); ++ if (wpa_s->global) ++ wpas_dbus_unregister_iface(wpa_s); + + wpa_supplicant_cleanup(wpa_s); + diff --git a/wpa_supplicant-dbus-permissions-fix.patch b/wpa_supplicant-dbus-permissions-fix.patch new file mode 100644 index 0000000..0237c0e --- /dev/null +++ b/wpa_supplicant-dbus-permissions-fix.patch @@ -0,0 +1,15 @@ +Index: wpa_supplicant-0.5.8/dbus-wpa_supplicant.conf +=================================================================== +--- wpa_supplicant-0.5.8.orig/dbus-wpa_supplicant.conf ++++ wpa_supplicant-0.5.8/dbus-wpa_supplicant.conf +@@ -8,10 +8,6 @@ + + + +- +- +- +- + + + diff --git a/wpa_supplicant-debug-file.patch b/wpa_supplicant-debug-file.patch new file mode 100644 index 0000000..53d285f --- /dev/null +++ b/wpa_supplicant-debug-file.patch @@ -0,0 +1,81 @@ +Index: wpa_supplicant-0.5.8/Makefile +=================================================================== +--- wpa_supplicant-0.5.8.orig/Makefile ++++ wpa_supplicant-0.5.8/Makefile +@@ -744,6 +744,10 @@ ifndef LDO + LDO=$(CC) + endif + ++ifdef CONFIG_DEBUG_FILE ++CFLAGS += -DCONFIG_DEBUG_FILE ++endif ++ + dynamic_eap_methods: $(EAPDYN) + + wpa_supplicant: .config $(OBJS) +Index: wpa_supplicant-0.5.8/common.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/common.c ++++ wpa_supplicant-0.5.8/common.c +@@ -354,11 +354,8 @@ int wpa_debug_open_file(void) + #ifdef _WIN32 + os_snprintf(fname, sizeof(fname), "\\Temp\\wpa_supplicant-log-%d.txt", + count++); +-#else /* _WIN32 */ +- os_snprintf(fname, sizeof(fname), "/tmp/wpa_supplicant-log-%d.txt", +- count++); + #endif /* _WIN32 */ +- out_file = fopen(fname, "w"); ++ out_file = fopen("/var/log/wpa_supplicant.log", "a"); + return out_file == NULL ? -1 : 0; + #else /* CONFIG_DEBUG_FILE */ + return 0; +Index: wpa_supplicant-0.5.8/main.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/main.c ++++ wpa_supplicant-0.5.8/main.c +@@ -45,7 +45,12 @@ static void usage(void) + "[-p] \\\n" + " [-b [-N -i -c [-C] " + "[-D] \\\n" +- " [-p] [-b] ...]\n" ++ " [-p] [-b] ...] " ++#ifdef CONFIG_DEBUG_FILE ++ "[-f] \\\n" ++#else ++ "\n" ++#endif + "\n" + "drivers:\n", + wpa_supplicant_version, wpa_supplicant_license); +@@ -65,6 +70,9 @@ static void usage(void) + " -i = interface name\n" + " -d = increase debugging verbosity (-dd even more)\n" + " -D = driver name\n" ++#ifdef CONFIG_DEBUG_FILE ++ " -f = Log output to /var/log/wpa_supplicant.log\n" ++#endif + " -g = global ctrl_interface\n" + " -K = include keys (passwords, etc.) in debug output\n" + " -t = include timestamp in debug messages\n" +@@ -143,7 +151,7 @@ int main(int argc, char *argv[]) + wpa_supplicant_fd_workaround(); + + for (;;) { +- c = getopt(argc, argv, "b:Bc:C:D:dg:hi:KLNp:P:qtuvwW"); ++ c = getopt(argc, argv, "b:Bc:C:D:dfg:hi:KLNp:P:qtuvwW"); + if (c < 0) + break; + switch (c) { +@@ -172,6 +180,11 @@ int main(int argc, char *argv[]) + params.wpa_debug_level--; + break; + #endif /* CONFIG_NO_STDOUT_DEBUG */ ++#ifdef CONFIG_DEBUG_FILE ++ case 'f': ++ params.wpa_debug_use_file = 1; ++ break; ++#endif + case 'g': + params.ctrl_interface = optarg; + break; diff --git a/wpa_supplicant-driver-wext-debug.patch b/wpa_supplicant-driver-wext-debug.patch new file mode 100644 index 0000000..82eb736 --- /dev/null +++ b/wpa_supplicant-driver-wext-debug.patch @@ -0,0 +1,115 @@ +Index: wpa_supplicant-0.5.8/driver_wext.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/driver_wext.c ++++ wpa_supplicant-0.5.8/driver_wext.c +@@ -1803,20 +1803,32 @@ wpa_driver_wext_associate(void *priv, + */ + if (drv->auth_alg_fallback && + wpa_driver_wext_auth_alg_fallback(drv, params) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because auth_alg_fallback failed", __FUNCTION__); + ret = -1; ++} + + if (!params->bssid && + wpa_driver_wext_set_bssid(drv, NULL) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_bssid failed", __FUNCTION__); + ret = -1; ++} + + if (wpa_driver_wext_set_mode(drv, params->mode) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_mode failed", __FUNCTION__); + ret = -1; ++} + /* TODO: should consider getting wpa version and cipher/key_mgmt suites + * from configuration, not from here, where only the selected suite is + * available */ + if (wpa_driver_wext_set_gen_ie(drv, params->wpa_ie, params->wpa_ie_len) + < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_gen_ie failed", __FUNCTION__); + ret = -1; ++} + if (params->wpa_ie == NULL || params->wpa_ie_len == 0) + value = IW_AUTH_WPA_VERSION_DISABLED; + else if (params->wpa_ie[0] == RSN_INFO_ELEM) +@@ -1825,26 +1837,41 @@ wpa_driver_wext_associate(void *priv, + value = IW_AUTH_WPA_VERSION_WPA; + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_WPA_VERSION, value) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(WPA_VERSION) failed", __FUNCTION__); + ret = -1; ++} + value = wpa_driver_wext_cipher2wext(params->pairwise_suite); + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_CIPHER_PAIRWISE, value) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(CIPHER_PAIRWISE) failed", __FUNCTION__); + ret = -1; ++} + value = wpa_driver_wext_cipher2wext(params->group_suite); + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_CIPHER_GROUP, value) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(CIPHER_GROUP) failed", __FUNCTION__); + ret = -1; ++} + value = wpa_driver_wext_keymgmt2wext(params->key_mgmt_suite); + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_KEY_MGMT, value) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(KEY_MGMT) failed", __FUNCTION__); + ret = -1; ++} + value = params->key_mgmt_suite != KEY_MGMT_NONE || + params->pairwise_suite != CIPHER_NONE || + params->group_suite != CIPHER_NONE || + params->wpa_ie_len; + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_PRIVACY_INVOKED, value) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(PRIVACY_INVOKED) failed", __FUNCTION__); + ret = -1; ++} + + /* Allow unencrypted EAPOL messages even if pairwise keys are set when + * not using WPA. IEEE 802.1X specifies that these frames are not +@@ -1858,14 +1885,26 @@ wpa_driver_wext_associate(void *priv, + if (wpa_driver_wext_set_auth_param(drv, + IW_AUTH_RX_UNENCRYPTED_EAPOL, + allow_unencrypted_eapol) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(RX_UNENCRYPTED_EAPOL) failed", __FUNCTION__); + ret = -1; ++} + if (params->freq && wpa_driver_wext_set_freq(drv, params->freq) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_freq failed", __FUNCTION__); + ret = -1; ++} + if (wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_ssid failed", __FUNCTION__); + ret = -1; ++} + if (params->bssid && + wpa_driver_wext_set_bssid(drv, params->bssid) < 0) ++{ ++wpa_printf(MSG_DEBUG, "%s: assoc failed because set_bssid2 failed", __FUNCTION__); + ret = -1; ++} + + return ret; + } +@@ -1890,6 +1929,8 @@ static int wpa_driver_wext_set_auth_alg( + res = wpa_driver_wext_set_auth_param(drv, IW_AUTH_80211_AUTH_ALG, + algs); + drv->auth_alg_fallback = res == -2; ++if (res == -2) ++wpa_printf(MSG_DEBUG, "%s: falling back to ENCODE for AUTH", __FUNCTION__); + return res; + } + diff --git a/wpa_supplicant-fix-deprecated-dbus-function.patch b/wpa_supplicant-fix-deprecated-dbus-function.patch new file mode 100644 index 0000000..97cb543 --- /dev/null +++ b/wpa_supplicant-fix-deprecated-dbus-function.patch @@ -0,0 +1,189 @@ +Index: wpa_supplicant-0.5.8/dbus_dict_helpers.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/dbus_dict_helpers.c ++++ wpa_supplicant-0.5.8/dbus_dict_helpers.c +@@ -629,36 +629,55 @@ dbus_bool_t wpa_dbus_dict_open_read(DBus + } + + ++#define BYTE_ARRAY_CHUNK_SIZE 34 ++#define BYTE_ARRAY_ITEM_SIZE (sizeof (char)) ++ + static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array( +- DBusMessageIter *iter, int array_len, int array_type, ++ DBusMessageIter *iter, int array_type, + struct wpa_dbus_dict_entry *entry) + { +- dbus_uint32_t i = 0; ++ dbus_uint32_t count = 0; + dbus_bool_t success = FALSE; +- char byte; ++ char * buffer; + +- /* Zero-length arrays are valid. */ +- if (array_len == 0) { +- entry->bytearray_value = NULL; +- entry->array_type = DBUS_TYPE_BYTE; +- success = TRUE; +- goto done; +- } ++ entry->bytearray_value = NULL; ++ entry->array_type = DBUS_TYPE_BYTE; + +- entry->bytearray_value = wpa_zalloc(array_len * sizeof(char)); +- if (!entry->bytearray_value) { ++ buffer = wpa_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE); ++ if (!buffer) { + perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of " + "memory"); + goto done; + } + +- entry->array_type = DBUS_TYPE_BYTE; +- entry->array_len = array_len; ++ entry->bytearray_value = buffer; ++ entry->array_len = 0; + while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) { ++ char byte; ++ ++ if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) { ++ buffer = realloc(buffer, BYTE_ARRAY_ITEM_SIZE * (count + BYTE_ARRAY_CHUNK_SIZE)); ++ if (buffer == NULL) { ++ perror("_wpa_dbus_dict_entry_get_byte_array[" ++ "dbus] out of memory trying to " ++ "retrieve the string array"); ++ goto done; ++ } ++ } ++ entry->bytearray_value = buffer; ++ + dbus_message_iter_get_basic(iter, &byte); +- entry->bytearray_value[i++] = byte; ++ entry->bytearray_value[count] = byte; ++ entry->array_len = ++count; + dbus_message_iter_next(iter); + } ++ ++ /* Zero-length arrays are valid. */ ++ if (entry->array_len == 0) { ++ free(entry->bytearray_value); ++ entry->strarray_value = NULL; ++ } ++ + success = TRUE; + + done: +@@ -666,8 +685,11 @@ done: + } + + ++#define STR_ARRAY_CHUNK_SIZE 8 ++#define STR_ARRAY_ITEM_SIZE (sizeof (char *)) ++ + static dbus_bool_t _wpa_dbus_dict_entry_get_string_array( +- DBusMessageIter *iter, int array_len, int array_type, ++ DBusMessageIter *iter, int array_type, + struct wpa_dbus_dict_entry *entry) + { + dbus_uint32_t count = 0; +@@ -677,13 +699,7 @@ static dbus_bool_t _wpa_dbus_dict_entry_ + entry->strarray_value = NULL; + entry->array_type = DBUS_TYPE_STRING; + +- /* Zero-length arrays are valid. */ +- if (array_len == 0) { +- success = TRUE; +- goto done; +- } +- +- buffer = wpa_zalloc(sizeof (char *) * 8); ++ buffer = wpa_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE); + if (buffer == NULL) { + perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of " + "memory trying to retrieve a string array"); +@@ -696,18 +712,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_ + const char *value; + char *str; + +- if ((count % 8) == 0 && count != 0) { +- char **tmp; +- tmp = realloc(buffer, sizeof(char *) * (count + 8)); +- if (tmp == NULL) { ++ if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) { ++ buffer = realloc(buffer, STR_ARRAY_ITEM_SIZE * (count + STR_ARRAY_CHUNK_SIZE)); ++ if (buffer == NULL) { + perror("_wpa_dbus_dict_entry_get_string_array[" + "dbus] out of memory trying to " + "retrieve the string array"); +- free(buffer); +- buffer = NULL; + goto done; + } +- buffer = tmp; + } + entry->strarray_value = buffer; + +@@ -723,6 +735,13 @@ static dbus_bool_t _wpa_dbus_dict_entry_ + entry->array_len = ++count; + dbus_message_iter_next(iter); + } ++ ++ /* Zero-length arrays are valid. */ ++ if (entry->array_len == 0) { ++ free(entry->strarray_value); ++ entry->strarray_value = NULL; ++ } ++ + success = TRUE; + + done: +@@ -734,7 +753,6 @@ static dbus_bool_t _wpa_dbus_dict_entry_ + DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry) + { + int array_type = dbus_message_iter_get_element_type(iter_dict_val); +- int array_len; + dbus_bool_t success = FALSE; + DBusMessageIter iter_array; + +@@ -743,20 +761,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_ + + dbus_message_iter_recurse(iter_dict_val, &iter_array); + +- array_len = dbus_message_iter_get_array_len(&iter_array); +- if (array_len < 0) +- return FALSE; +- + switch (array_type) { + case DBUS_TYPE_BYTE: + success = _wpa_dbus_dict_entry_get_byte_array(&iter_array, +- array_len, + array_type, + entry); + break; + case DBUS_TYPE_STRING: + success = _wpa_dbus_dict_entry_get_string_array(&iter_array, +- array_len, + array_type, + entry); + break; +@@ -946,9 +958,17 @@ void wpa_dbus_dict_entry_clear(struct wp + break; + case DBUS_TYPE_ARRAY: + switch (entry->array_type) { +- case DBUS_TYPE_BYTE: +- free(entry->bytearray_value); +- break; ++ case DBUS_TYPE_BYTE: { ++ free(entry->bytearray_value); ++ break; ++ } ++ case DBUS_TYPE_STRING: { ++ int i; ++ for (i = 0; i < entry->array_len; i++) ++ free (entry->strarray_value[i]); ++ free (entry->strarray_value); ++ break; ++ } + } + break; + } diff --git a/wpa_supplicant-fix-dynamic-wep-with-mac80211.patch b/wpa_supplicant-fix-dynamic-wep-with-mac80211.patch new file mode 100644 index 0000000..d1161d5 --- /dev/null +++ b/wpa_supplicant-fix-dynamic-wep-with-mac80211.patch @@ -0,0 +1,12 @@ +Index: wpa_supplicant-0.5.8/driver_wext.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/driver_wext.c ++++ wpa_supplicant-0.5.8/driver_wext.c +@@ -1733,6 +1733,7 @@ static int wpa_driver_wext_keymgmt2wext( + { + switch (keymgmt) { + case KEY_MGMT_802_1X: ++ case KEY_MGMT_802_1X_NO_WPA: + return IW_AUTH_KEY_MGMT_802_1X; + case KEY_MGMT_PSK: + return IW_AUTH_KEY_MGMT_PSK; diff --git a/wpa_supplicant-flush-debug-output.patch b/wpa_supplicant-flush-debug-output.patch new file mode 100644 index 0000000..c296063 --- /dev/null +++ b/wpa_supplicant-flush-debug-output.patch @@ -0,0 +1,51 @@ +Index: wpa_supplicant-0.5.8/common.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/common.c ++++ wpa_supplicant-0.5.8/common.c +@@ -157,6 +157,7 @@ void wpa_debug_print_timestamp(void) + if (out_file) { + fprintf(out_file, "%ld.%06u: ", (long) tv.sec, + (unsigned int) tv.usec); ++ fflush(out_file); + } else + #endif /* CONFIG_DEBUG_FILE */ + printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec); +@@ -185,6 +186,7 @@ void wpa_printf(int level, char *fmt, .. + if (out_file) { + vfprintf(out_file, fmt, ap); + fprintf(out_file, "\n"); ++ fflush(out_file); + } else { + #endif /* CONFIG_DEBUG_FILE */ + vprintf(fmt, ap); +@@ -217,6 +219,7 @@ static void _wpa_hexdump(int level, cons + fprintf(out_file, " [REMOVED]"); + } + fprintf(out_file, "\n"); ++ fflush(out_file); + } else { + #endif /* CONFIG_DEBUG_FILE */ + printf("%s - hexdump(len=%lu):", title, (unsigned long) len); +@@ -262,12 +265,14 @@ static void _wpa_hexdump_ascii(int level + fprintf(out_file, + "%s - hexdump_ascii(len=%lu): [REMOVED]\n", + title, (unsigned long) len); ++ fflush(out_file); + return; + } + if (buf == NULL) { + fprintf(out_file, + "%s - hexdump_ascii(len=%lu): [NULL]\n", + title, (unsigned long) len); ++ fflush(out_file); + return; + } + fprintf(out_file, "%s - hexdump_ascii(len=%lu):\n", +@@ -292,6 +297,7 @@ static void _wpa_hexdump_ascii(int level + pos += llen; + len -= llen; + } ++ fflush(out_file); + } else { + #endif /* CONFIG_DEBUG_FILE */ + if (!show) { diff --git a/wpa_supplicant-sigusr1-changes-debuglevel.patch b/wpa_supplicant-sigusr1-changes-debuglevel.patch new file mode 100644 index 0000000..65e6e87 --- /dev/null +++ b/wpa_supplicant-sigusr1-changes-debuglevel.patch @@ -0,0 +1,38 @@ +Index: wpa_supplicant-0.5.8/wpa_supplicant.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/wpa_supplicant.c ++++ wpa_supplicant-0.5.8/wpa_supplicant.c +@@ -931,6 +931,24 @@ static void wpa_supplicant_reconfig(int + } + + ++static void wpa_supplicant_handle_sigusr1(int sig, void *eloop_ctx, ++ void *signal_ctx) ++{ ++ /* Increase verbosity (by decreasing the debug level) and wrap back ++ * to MSG_INFO when needed. ++ */ ++ if (wpa_debug_level) ++ wpa_debug_level--; ++ else ++ wpa_debug_level = MSG_INFO; ++ ++ wpa_printf(MSG_INFO, "Signal %d received - changing debug level to %s", sig, ++ (wpa_debug_level == MSG_INFO) ? "INFO" : ++ ((wpa_debug_level == MSG_DEBUG) ? "DEBUG" : ++ ((wpa_debug_level == MSG_MSGDUMP) ? "MSGDUMP" : "UNKNOWN"))); ++} ++ ++ + static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s) + { + struct wpa_ssid *ssid; +@@ -2570,6 +2588,8 @@ int wpa_supplicant_run(struct wpa_global + eloop_register_signal_terminate(wpa_supplicant_terminate, NULL); + eloop_register_signal_reconfig(wpa_supplicant_reconfig, NULL); + ++ eloop_register_signal(SIGUSR1, wpa_supplicant_handle_sigusr1, NULL); ++ + eloop_run(); + + return 0; diff --git a/wpa_supplicant-wep-key-fix.patch b/wpa_supplicant-wep-key-fix.patch new file mode 100644 index 0000000..638f129 --- /dev/null +++ b/wpa_supplicant-wep-key-fix.patch @@ -0,0 +1,13 @@ +Index: wpa_supplicant-0.5.8/driver_wext.c +=================================================================== +--- wpa_supplicant-0.5.8.orig/driver_wext.c ++++ wpa_supplicant-0.5.8/driver_wext.c +@@ -1610,7 +1610,7 @@ int wpa_driver_wext_set_key(void *priv, + os_memset(&iwr, 0, sizeof(iwr)); + os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); + iwr.u.encoding.flags = key_idx + 1; +- iwr.u.encoding.pointer = (caddr_t) key; ++ iwr.u.encoding.pointer = (caddr_t) NULL; + iwr.u.encoding.length = 0; + if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) { + perror("ioctl[SIOCSIWENCODE] (set_tx)"); diff --git a/wpa_supplicant.changes b/wpa_supplicant.changes index 6cbadaf..081cb9b 100644 --- a/wpa_supplicant.changes +++ b/wpa_supplicant.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Nov 14 13:36:33 CET 2007 - jg@suse.de + +- enable dbus interface +- apply fixes from Dan Williams +- build Qt4 version of wpa_gui +- dropped gcc 4.3 patch for Qt3 wpa_gui + ------------------------------------------------------------------- Mon Nov 12 14:24:33 CET 2007 - ssommer@suse.de diff --git a/wpa_supplicant.conf b/wpa_supplicant.conf new file mode 100644 index 0000000..17eb227 --- /dev/null +++ b/wpa_supplicant.conf @@ -0,0 +1,3 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=wheel + diff --git a/wpa_supplicant.spec b/wpa_supplicant.spec index 9a6a8b0..81ab60b 100644 --- a/wpa_supplicant.spec +++ b/wpa_supplicant.spec @@ -11,19 +11,32 @@ # norootforbuild Name: wpa_supplicant -BuildRequires: libdrm-devel libjpeg-devel openssl-devel qt3-devel readline-devel update-desktop-files +BuildRequires: dbus-1-devel libqt4 libqt4-devel openssl-devel pkg-config readline-devel %ifarch %ix86 x86_64 BuildRequires: madwifi-devel %endif Url: http://hostap.epitest.fi/wpa_supplicant/ Version: 0.5.8 -Release: 51 +Release: 53 License: BSD 3-Clause; GPL v2 or later Group: Productivity/Networking/Other Summary: WPA supplicant implementation Source: http://hostap.epitest.fi/releases/wpa_supplicant-%{version}.tar.bz2 Source1: config -Patch0: wpa_supplicant-0.5.8-gcc43.patch +Source2: %{name}.conf +Source3: fi.epitest.hostap.WPASupplicant.service +Patch0: wpa_supplicant-assoc-timeout.patch +Patch1: wpa_supplicant-driver-wext-debug.patch +Patch2: wpa_supplicant-wep-key-fix.patch +Patch3: wpa_supplicant-fix-deprecated-dbus-function.patch +Patch4: wpa_supplicant-debug-file.patch +Patch5: wpa_supplicant-flush-debug-output.patch +Patch6: wpa_supplicant-sigusr1-changes-debuglevel.patch +Patch7: wpa_supplicant-always-scan.patch +Patch8: wpa_supplicant-dbus-iface-segfault-fix.patch +Patch9: wpa_supplicant-dbus-blobs.patch +Patch10: wpa_supplicant-dbus-permissions-fix.patch +Patch11: wpa_supplicant-fix-dynamic-wep-with-mac80211.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -57,6 +70,17 @@ Authors: %setup -n wpa_supplicant-%{version} cp %{SOURCE1} .config %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 %build %ifarch %ix86 x86_64 @@ -64,16 +88,26 @@ echo CONFIG_DRIVER_MADWIFI=y >>.config echo "CFLAGS += -I/usr/include/madwifi" >> .config %endif CFLAGS="$RPM_OPT_FLAGS" make %{?jobs:-j%jobs} -cd wpa_gui -/usr/lib/qt3/bin/qmake +cd wpa_gui-qt4 +qmake QMAKE_CXXFLAGS="$RPM_OPT_FLAGS" make %{?jobs:-j%jobs} %install -mkdir -p %{buildroot}%{_sbindir} -install -m 755 wpa_cli %{buildroot}%{_sbindir} -install -m 755 wpa_passphrase %{buildroot}%{_sbindir} -install -m 755 wpa_supplicant %{buildroot}%{_sbindir} -install -m 755 wpa_gui/wpa_gui %{buildroot}%{_sbindir} +install -d %{buildroot}/%{_sbindir} +install -m 0755 wpa_cli %{buildroot}%{_sbindir} +install -m 0755 wpa_passphrase %{buildroot}%{_sbindir} +install -m 0755 wpa_supplicant %{buildroot}%{_sbindir} +install -d %{buildroot}%{_sysconfdir}/dbus-1/system.d +install -m 0644 dbus-wpa_supplicant.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/wpa_supplicant.conf +install -d %{buildroot}/%{_sysconfdir}/%{name} +install -m 0600 %{SOURCE2} %{buildroot}/%{_sysconfdir}/%{name} +install -d %{buildroot}/%{_datadir}/dbus-1/system-services +install -m 0644 %{SOURCE3} %{buildroot}/%{_datadir}/dbus-1/system-services +install -d %{buildroot}/%{_localstatedir}/run/%{name} +install -d %{buildroot}%{_mandir}/man{5,8} +install -m 0644 doc/docbook/*.8 %{buildroot}%{_mandir}/man8 +install -m 0644 doc/docbook/*.5 %{buildroot}%{_mandir}/man5 +install -m 755 wpa_gui-qt4/wpa_gui %{buildroot}%{_sbindir} %files %defattr(-,root,root) @@ -81,11 +115,23 @@ install -m 755 wpa_gui/wpa_gui %{buildroot}%{_sbindir} %{_sbindir}/wpa_cli %{_sbindir}/wpa_passphrase %{_sbindir}/wpa_supplicant +%config %{_sysconfdir}/dbus-1/system.d/%{name}.conf +%{_datadir}/dbus-1/system-services +%config %{_sysconfdir}/%{name}/%{name}.conf +%dir %{_localstatedir}/run/%{name} +%dir %{_sysconfdir}/%{name} +%{_mandir}/man8/* +%{_mandir}/man5/* %files gui %defattr(-,root,root) /usr/sbin/wpa_gui %changelog +* Wed Nov 14 2007 - jg@suse.de +- enable dbus interface +- apply fixes from Dan Williams +- build Qt4 version of wpa_gui +- dropped gcc 4.3 patch for Qt3 wpa_gui * Mon Nov 12 2007 - ssommer@suse.de - fix build with gcc 4.3 * Tue Jul 24 2007 - jg@suse.de