In packet-ieee802.11.c, fix a serious preference bug introduced in the
authorGerald Combs <gerald@wireshark.org>
Thu, 21 Jun 2007 20:22:56 +0000 (20:22 -0000)
committerGerald Combs <gerald@wireshark.org>
Thu, 21 Jun 2007 20:22:56 +0000 (20:22 -0000)
last checkin.  In airpcap.c, appease the toolbar code by returning a
lower-case, non-separated WEP key.

svn path=/trunk/; revision=22152

epan/crypt/airpdcap.c
epan/dissectors/packet-ieee80211.c

index 43fe4c458f6bb3c7168fab1905e9aacb88e7ec00..2e24e121256db5ea31551b88943cdf5042ab2e19 100644 (file)
@@ -1353,13 +1353,16 @@ parse_key_string(gchar* input_string)
     key_ba = g_byte_array_new();
     res = hex_str_to_bytes(first_nibble, key_ba, FALSE);
 
-    if (res) {
+    if (res && key_ba->len > 0) {
         /* Key is correct! It was probably an 'old style' WEP key */
         /* Create the decryption_key_t structure, fill it and return it*/
         dk = g_malloc(sizeof(decryption_key_t));
 
         dk->type = AIRPDCAP_KEY_TYPE_WEP;
-        dk->key  = g_string_new(input_string);
+        /* XXX - The current key handling code in the GUI requires
+         * no separators and lower case */
+        dk->key  = g_string_new(bytes_to_str(key_ba->data, key_ba->len));
+        g_string_down(dk->key);
         dk->bits = key_ba->len * 8;
         dk->ssid = NULL;
 
index a4bd66952e6d8dc11c47203e9a4f38d8d7428f0f..73c79491fb280bc95d84d5018e217285eb02aa5f 100644 (file)
@@ -10092,17 +10092,17 @@ proto_register_ieee80211 (void)
   g_string_sprintf(key_title, "Key #%d", i + 1);
   /* Davide Schiera (2006-11-26): modified keys input tooltip          */
   g_string_sprintf(key_desc,
-      "Key #%d string can be:\n"
-      "   <wep hexadecimal key>;\n"
-      "   wep:<wep hexadecimal key>;\n"
-      "   wpa-pwd:<passphrase>[:<ssid>];\n"
+      "Key #%d string can be:"
+      "   <wep hexadecimal key>;"
+      "   wep:<wep hexadecimal key>;"
+      "   wpa-pwd:<passphrase>[:<ssid>];"
       "   wpa-psk:<wpa hexadecimal key>", i + 1);
 #else
     g_string_sprintf(key_name, "wep_key%d", i + 1);
     g_string_sprintf(key_title, "WEP key #%d", i + 1);
-    g_string_sprintf(key_desc, "WEP key #%d can be:\n"
-      "   <wep hexadecimal key>;\n"
-      "   wep:<wep hexadecimal key>\n", i + 1);
+    g_string_sprintf(key_desc, "WEP key #%d can be:"
+      "   <wep hexadecimal key>;"
+      "   wep:<wep hexadecimal key>", i + 1);
 #endif
 
     prefs_register_string_preference(wlan_module, key_name->str,