Copy -16 from F-8 branch

This commit is contained in:
Daniel Williams 2007-11-13 21:19:45 +00:00
parent 322c7cf838
commit 8653bc4e96
5 changed files with 249 additions and 3 deletions

View File

@ -17,7 +17,7 @@ diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c b/wpa_supplicant/ctrl_ifa
index 5e952ec..3ece2fe 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.c
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c
@@ -1203,3 +1203,128 @@ DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
@@ -1203,3 +1203,129 @@ DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
return reply;
}
@ -84,6 +84,7 @@ index 5e952ec..3ece2fe 100644
+ }
+
+ 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) {
@ -163,3 +164,23 @@ index 0fd1d31..0ae94c4 100644
#endif /* CONFIG_CTRL_IFACE_DBUS */
#endif /* CTRL_IFACE_DBUS_HANDLERS_H */
diff -up wpa_supplicant-0.5.7/config.c.dbus-blobs wpa_supplicant-0.5.7/config.c
--- a/wpa_supplicant-0.5.7/config.c.dbus-blobs 2007-10-24 16:41:37.000000000 -0400
+++ b/wpa_supplicant-0.5.7/config.c 2007-10-24 16:41:49.000000000 -0400
@@ -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;
}
}

View File

@ -0,0 +1,14 @@
Backport from 0.6.x branch; apparently this hasn't even landed on
the stable 0.5.x branch yet.
diff -up wpa_supplicant-0.5.7/driver_wext.c.dynamic-wep-mac80211 wpa_supplicant-0.5.7/driver_wext.c
--- wpa_supplicant-0.5.7/driver_wext.c.dynamic-wep-mac80211 2007-10-28 00:57:11.000000000 -0400
+++ wpa_supplicant-0.5.7/driver_wext.c 2007-10-28 00:57:38.000000000 -0400
@@ -1724,6 +1724,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;

View File

@ -0,0 +1,155 @@
diff -up wpa_supplicant-0.5.7/tls_openssl.c.ignore-dup-ca-cert-addition wpa_supplicant-0.5.7/tls_openssl.c
--- wpa_supplicant-0.5.7/tls_openssl.c.ignore-dup-ca-cert-addition 2006-11-29 23:50:28.000000000 -0500
+++ wpa_supplicant-0.5.7/tls_openssl.c 2007-11-13 11:19:30.000000000 -0500
@@ -1105,11 +1105,21 @@ static int tls_connection_ca_cert(void *
}
if (!X509_STORE_add_cert(ssl_ctx->cert_store, cert)) {
+ unsigned long err = ERR_peek_error();
+
tls_show_errors(MSG_WARNING, __func__,
"Failed to add ca_cert_blob to "
"certificate store");
- X509_free(cert);
- return -1;
+
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: %s - ignoring "
+ "cert already in hash table error",
+ __func__);
+ } else {
+ X509_free(cert);
+ return -1;
+ }
}
X509_free(cert);
wpa_printf(MSG_DEBUG, "OpenSSL: %s - added ca_cert_blob "
@@ -1259,15 +1269,28 @@ static int tls_connection_client_cert(st
if (client_cert == NULL && client_cert_blob == NULL)
return 0;
- if (client_cert_blob &&
- SSL_use_certificate_ASN1(conn->ssl, (u8 *) client_cert_blob,
+ if (client_cert_blob) {
+ if (SSL_use_certificate_ASN1(conn->ssl, (u8 *) client_cert_blob,
client_cert_blob_len) == 1) {
- wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_certificate_ASN1 --> "
- "OK");
- return 0;
- } else if (client_cert_blob) {
- tls_show_errors(MSG_DEBUG, __func__,
- "SSL_use_certificate_ASN1 failed");
+ wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_certificate_ASN1"
+ " --> OK");
+ return 0;
+ } else {
+ unsigned long err = ERR_peek_error();
+
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: %s - ignoring "
+ "cert already in hash table error",
+ __func__);
+ wpa_printf(MSG_DEBUG, "OpenSSL: "
+ "SSL_use_certificate_ASN1 --> OK");
+ return 0;
+ }
+
+ tls_show_errors(MSG_DEBUG, __func__,
+ "SSL_use_certificate_ASN1 failed");
+ }
}
if (client_cert == NULL)
@@ -1515,40 +1538,73 @@ static int tls_connection_private_key(vo
while (private_key_blob) {
if (SSL_use_PrivateKey_ASN1(EVP_PKEY_RSA, conn->ssl,
(u8 *) private_key_blob,
- private_key_blob_len) == 1) {
- wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_PrivateKey_"
- "ASN1(EVP_PKEY_RSA) --> OK");
- ok = 1;
- break;
- } else {
+ private_key_blob_len) != 1) {
+ unsigned long err = ERR_peek_error();
+
tls_show_errors(MSG_DEBUG, __func__,
"SSL_use_PrivateKey_ASN1(EVP_PKEY_RSA)"
" failed");
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: %s - ignoring "
+ "cert already in hash table error",
+ __func__);
+ ok = 1;
+ }
+ } else
+ ok = 1;
+
+ if (ok == 1) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_PrivateKey_"
+ "ASN1(EVP_PKEY_RSA) --> OK");
+ break;
}
if (SSL_use_PrivateKey_ASN1(EVP_PKEY_DSA, conn->ssl,
(u8 *) private_key_blob,
- private_key_blob_len) == 1) {
- wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_PrivateKey_"
- "ASN1(EVP_PKEY_DSA) --> OK");
- ok = 1;
- break;
- } else {
+ private_key_blob_len) != 1) {
+ unsigned long err = ERR_peek_error();
+
tls_show_errors(MSG_DEBUG, __func__,
"SSL_use_PrivateKey_ASN1(EVP_PKEY_DSA)"
" failed");
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: %s - ignoring "
+ "cert already in hash table error",
+ __func__);
+ ok = 1;
+ }
+ } else
+ ok = 1;
+
+ if (ok == 1) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_PrivateKey_"
+ "ASN1(EVP_PKEY_DSA) --> OK");
+ break;
}
if (SSL_use_RSAPrivateKey_ASN1(conn->ssl,
(u8 *) private_key_blob,
- private_key_blob_len) == 1) {
+ private_key_blob_len) != 1) {
+ unsigned long err = ERR_peek_error();
+
+ tls_show_errors(MSG_DEBUG, __func__,
+ "SSL_use_RSAPrivateKey_ASN1 failed");
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+ wpa_printf(MSG_DEBUG, "OpenSSL: %s - ignoring "
+ "cert already in hash table error",
+ __func__);
+ ok = 1;
+ }
+ } else
+ ok = 1;
+
+ if (ok == 1) {
wpa_printf(MSG_DEBUG, "OpenSSL: "
"SSL_use_RSAPrivateKey_ASN1 --> OK");
- ok = 1;
break;
- } else {
- tls_show_errors(MSG_DEBUG, __func__,
- "SSL_use_RSAPrivateKey_ASN1 failed");
}
if (tls_read_pkcs12_blob(ssl_ctx, conn->ssl, private_key_blob,

View File

@ -0,0 +1,28 @@
Index: wpa_supplicant-0.4.8/driver_wext.c
===================================================================
--- wpa_supplicant-0.4.8.orig/driver_wext.c 2006-07-13 11:23:05.000000000 +0200
+++ wpa_supplicant-0.4.8/driver_wext.c 2006-07-13 11:23:57.000000000 +0200
@@ -1280,6 +1280,7 @@ static int wpa_driver_wext_set_key_ext(v
memset(&iwr, 0, sizeof(iwr));
strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.encoding.flags = key_idx + 1;
+ iwr.u.encoding.flags |= IW_ENCODE_TEMP;
if (alg == WPA_ALG_NONE)
iwr.u.encoding.flags |= IW_ENCODE_DISABLED;
iwr.u.encoding.pointer = (caddr_t) ext;
@@ -1401,6 +1402,7 @@ int wpa_driver_wext_set_key(void *priv,
memset(&iwr, 0, sizeof(iwr));
strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.encoding.flags = key_idx + 1;
+ iwr.u.encoding.flags |= IW_ENCODE_TEMP;
if (alg == WPA_ALG_NONE)
iwr.u.encoding.flags |= IW_ENCODE_DISABLED;
iwr.u.encoding.pointer = (caddr_t) key;
@@ -1415,6 +1417,7 @@ int wpa_driver_wext_set_key(void *priv,
memset(&iwr, 0, sizeof(iwr));
strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.encoding.flags = key_idx + 1;
+ iwr.u.encoding.flags |= IW_ENCODE_TEMP;
iwr.u.encoding.pointer = (caddr_t) NULL;
iwr.u.encoding.length = 0;
if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) {

View File

@ -2,8 +2,8 @@ Summary: WPA/WPA2/IEEE 802.1X Supplicant
Name: wpa_supplicant
Epoch: 1
Version: 0.5.7
Release: 11%{?dist}
License: GPLv2
Release: 16%{?dist}
License: BSD
Group: System Environment/Base
Source0: http://hostap.epitest.fi/releases/%{name}-%{version}.tar.gz
Source1: %{name}.config
@ -25,6 +25,9 @@ Patch8: wpa_supplicant-0.5.7-always-scan.patch
Patch9: wpa_supplicant-0.5.7-dbus-iface-segfault-fix.patch
Patch10: wpa_supplicant-0.5.7-dbus-blobs.patch
Patch11: wpa_supplicant-0.5.7-dbus-permissions-fix.patch
Patch12: wpa_supplicant-0.5.7-ignore-dup-ca-cert-addition.patch
Patch13: wpa_supplicant-0.5.7-fix-dynamic-wep-with-mac80211.patch
Patch14: wpa_supplicant-0.5.7-use-IW_ENCODE_TEMP.patch
URL: http://w1.fi/wpa_supplicant/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -63,6 +66,9 @@ Graphical User Interface for wpa_supplicant written using QT3
%patch9 -p1 -b .dbus-iface-segfault-fix
%patch10 -p2 -b .dbus-blobs
%patch11 -p1 -b .dbus-permissions-fix
%patch12 -p1 -b .ignore-dup-ca-cert-addition
%patch13 -p1 -b .fix-dynamic-wep-with-mac80211
%patch14 -p1 -b .use-IW_ENCODE_TEMP
%build
cp %{SOURCE1} ./.config
@ -148,6 +154,28 @@ fi
%{_bindir}/wpa_gui
%changelog
* Tue Nov 13 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-16
- Add IW_ENCODE_TEMP patch for airo driver and Dynamic WEP
- Fix error in wpa_supplicant-0.5.7-ignore-dup-ca-cert-addition.patch that
caused the last error to not be printed
- Fix wpa_supplicant-0.5.7-ignore-dup-ca-cert-addition.patch to ignore
duplicate cert additions for all certs and keys
- Change license to BSD due to linkage against OpenSSL since there is no
OpenSSL exception in the GPLv2 license text that upstream ships
* Sun Oct 28 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-15
- Fix Dynamic WEP associations with mac80211-based drivers
* Sun Oct 28 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-14
- Don't error an association on duplicate CA cert additions
* Wed Oct 24 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-13
- Correctly set the length of blobs added via the D-Bus interface
* Wed Oct 24 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-12
- Fix conversion of byte arrays to strings by ensuring the buffer is NULL
terminated after conversion
* Sat Oct 20 2007 Dan Williams <dcbw@redhat.com> - 0.5.7-11
- Add BLOB support to the D-Bus interface
- Fix D-Bus interface permissions so that only root can use the wpa_supplicant