aboutsummaryrefslogtreecommitdiffstats
path: root/airpcap_loader.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-07-04 14:07:20 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-07-04 14:07:20 +0000
commit639e59a9f90f1f0dc4f673f8b1f37c9d64b84834 (patch)
treeb72a5b7d6be3d8e4e5edc594582ce11cd2bcd512 /airpcap_loader.c
parent509c6a7fc070c271ce520739464e22e18e320bb1 (diff)
From Michael Mann:
Removed "key prefix" need within GUI so it's a little more intuitive (because that's what this bug is complaining about). Slight backwards compatibility issue with UAT (because key prefix was in previous keys), but all development (including fix for BUG 1123 that created UAT) has just been on SVN and not released. Also adjusted AirPCap (airpcap_loader.c) to account for the lack of "key prefix". Addressed some memory leaks/excess string creation. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5985 svn path=/trunk/; revision=37888
Diffstat (limited to 'airpcap_loader.c')
-rw-r--r--airpcap_loader.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/airpcap_loader.c b/airpcap_loader.c
index a6ef77364d..1887dd80e6 100644
--- a/airpcap_loader.c
+++ b/airpcap_loader.c
@@ -149,7 +149,8 @@ static guint num_legacy_channels = 14;
static guint
get_wep_key(pref_t *pref, gpointer ud)
{
- gchar *my_string = NULL;
+ gchar *key_string = NULL;
+ guint8 key_type = AIRPDCAP_KEY_TYPE_WEP;
keys_cb_data_t* user_data;
decryption_key_t* new_key;
@@ -159,18 +160,33 @@ get_wep_key(pref_t *pref, gpointer ud)
if (g_ascii_strncasecmp(pref->name, "wep_key", 7) == 0 && pref->type == PREF_STRING)
{
- my_string = g_strdup(*pref->varp.string);
+ /* strip out key type */
+ if (g_ascii_strncasecmp(*pref->varp.string, STRING_KEY_TYPE_WEP ":", 4) == 0) {
+ key_string = (gchar*)(*pref->varp.string)+4;
+ }
+ else if (g_ascii_strncasecmp(*pref->varp.string, STRING_KEY_TYPE_WPA_PWD ":", 8) == 0) {
+ key_string = (gchar*)(*pref->varp.string)+8;
+ key_type = AIRPDCAP_KEY_TYPE_WPA_PWD;
+ }
+ else if (g_ascii_strncasecmp(*pref->varp.string, STRING_KEY_TYPE_WPA_PSK ":", 8) == 0) {
+ key_string = (gchar*)(*pref->varp.string)+8;
+ key_type = AIRPDCAP_KEY_TYPE_WPA_PSK;
+ }
+ else {
+ key_type = AIRPDCAP_KEY_TYPE_WEP;
+ key_string = (gchar*)*pref->varp.string;
+ }
/* Here we have the string describing the key... */
- new_key = parse_key_string(my_string);
+ new_key = parse_key_string(key_string, key_type);
- if( new_key != NULL)
- {
- /* Key is added only if not null ... */
- user_data->list = g_list_append(user_data->list,new_key);
- user_data->number_of_keys++;
- user_data->current_index++;
- }
+ if( new_key != NULL)
+ {
+ /* Key is added only if not null ... */
+ user_data->list = g_list_append(user_data->list,new_key);
+ user_data->number_of_keys++;
+ user_data->current_index++;
+ }
}
return 0;
}