OLD | NEW |
1 /* | 1 /* |
2 * WPA Supplicant / dbus-based control interface | 2 * WPA Supplicant / dbus-based control interface |
3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. | 3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. |
4 * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com> | 4 * Copyright (c) 2009-2010, Witold Sowa <witold.sowa@gmail.com> |
5 * Copyright (c) 2009, Jouni Malinen <j@w1.fi> | 5 * Copyright (c) 2009, Jouni Malinen <j@w1.fi> |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License version 2 as | 8 * it under the terms of the GNU General Public License version 2 as |
9 * published by the Free Software Foundation. | 9 * published by the Free Software Foundation. |
10 * | 10 * |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 "call"); | 988 "call"); |
989 *reply = wpas_dbus_error_invalid_args( | 989 *reply = wpas_dbus_error_invalid_args( |
990 message, "Too many ssids specified. Specify " | 990 message, "Too many ssids specified. Specify " |
991 "at most four"); | 991 "at most four"); |
992 return -1; | 992 return -1; |
993 } | 993 } |
994 | 994 |
995 dbus_message_iter_recurse(&array_iter, &sub_array_iter); | 995 dbus_message_iter_recurse(&array_iter, &sub_array_iter); |
996 | 996 |
997 dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len); | 997 dbus_message_iter_get_fixed_array(&sub_array_iter, &val, &len); |
998 » » if (len == 0) { | 998 |
999 » » » dbus_message_iter_next(&array_iter); | 999 » » if (len != 0) { |
1000 » » » continue; | 1000 » » » ssid = os_malloc(len); |
| 1001 » » » if (ssid == NULL) { |
| 1002 » » » » wpa_printf(MSG_DEBUG, |
| 1003 » » » » » "wpas_dbus_handler_scan[dbus]: " |
| 1004 » » » » » "out of memory. Cannot allocate " |
| 1005 » » » » » "memory for SSID"); |
| 1006 » » » » *reply = dbus_message_new_error( |
| 1007 » » » » » » message, DBUS_ERROR_NO_MEMORY, |
| 1008 » » » » » » NULL); |
| 1009 » » » » return -1; |
| 1010 » » » } |
| 1011 » » » os_memcpy(ssid, val, len); |
| 1012 » » } else { |
| 1013 » » » /* Allow zero-length SSIDs */ |
| 1014 » » » ssid = NULL; |
1001 } | 1015 } |
1002 | 1016 |
1003 ssid = os_malloc(len); | |
1004 if (ssid == NULL) { | |
1005 wpa_printf(MSG_DEBUG, "wpas_dbus_handler_scan[dbus]: " | |
1006 "out of memory. Cannot allocate memory for " | |
1007 "SSID"); | |
1008 *reply = dbus_message_new_error( | |
1009 message, DBUS_ERROR_NO_MEMORY, NULL); | |
1010 return -1; | |
1011 } | |
1012 os_memcpy(ssid, val, len); | |
1013 ssids[ssids_num].ssid = ssid; | 1017 ssids[ssids_num].ssid = ssid; |
1014 ssids[ssids_num].ssid_len = len; | 1018 ssids[ssids_num].ssid_len = len; |
1015 | 1019 |
1016 dbus_message_iter_next(&array_iter); | 1020 dbus_message_iter_next(&array_iter); |
1017 ssids_num++; | 1021 ssids_num++; |
1018 } | 1022 } |
1019 | 1023 |
1020 params->num_ssids = ssids_num; | 1024 params->num_ssids = ssids_num; |
1021 return 0; | 1025 return 0; |
1022 } | 1026 } |
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3010 dbus_message_iter_recurse(&iter, &variant_iter); | 3014 dbus_message_iter_recurse(&iter, &variant_iter); |
3011 | 3015 |
3012 reply = set_network_properties(message, net->wpa_s, ssid, | 3016 reply = set_network_properties(message, net->wpa_s, ssid, |
3013 &variant_iter); | 3017 &variant_iter); |
3014 if (reply) | 3018 if (reply) |
3015 wpa_printf(MSG_DEBUG, "dbus control interface couldn't set " | 3019 wpa_printf(MSG_DEBUG, "dbus control interface couldn't set " |
3016 "network properties"); | 3020 "network properties"); |
3017 | 3021 |
3018 return reply; | 3022 return reply; |
3019 } | 3023 } |
OLD | NEW |