dbus_old_handlers.c (214501) | dbus_old_handlers.c (252190) |
---|---|
1/* 2 * WPA Supplicant / dbus-based control interface 3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 4 * | 1/* 2 * WPA Supplicant / dbus-based control interface 3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 4 * |
5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation. 8 * 9 * Alternatively, this software may be distributed under the terms of BSD 10 * license. 11 * 12 * See README and COPYING for more details. | 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. |
13 */ 14 15#include "includes.h" 16#include <dbus/dbus.h> 17 18#include "common.h" 19#include "eap_peer/eap_methods.h" 20#include "common/ieee802_11_defs.h" --- 90 unchanged lines hidden (view full) --- 111 if (!os_strlen(ifname)) 112 goto error; 113 114 /* Second argument: dict of options */ 115 if (dbus_message_iter_next(&iter)) { 116 DBusMessageIter iter_dict; 117 struct wpa_dbus_dict_entry entry; 118 | 7 */ 8 9#include "includes.h" 10#include <dbus/dbus.h> 11 12#include "common.h" 13#include "eap_peer/eap_methods.h" 14#include "common/ieee802_11_defs.h" --- 90 unchanged lines hidden (view full) --- 105 if (!os_strlen(ifname)) 106 goto error; 107 108 /* Second argument: dict of options */ 109 if (dbus_message_iter_next(&iter)) { 110 DBusMessageIter iter_dict; 111 struct wpa_dbus_dict_entry entry; 112 |
119 if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) | 113 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
120 goto error; 121 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 122 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 123 goto error; 124 if (!strcmp(entry.key, "driver") && 125 (entry.type == DBUS_TYPE_STRING)) { 126 driver = os_strdup(entry.str_value); 127 wpa_dbus_dict_entry_clear(&entry); --- 96 unchanged lines hidden (view full) --- 224 } 225 226 wpa_s = wpa_supplicant_get_iface_by_dbus_path(global, path); 227 if (wpa_s == NULL) { 228 reply = wpas_dbus_new_invalid_iface_error(message); 229 goto out; 230 } 231 | 114 goto error; 115 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 116 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 117 goto error; 118 if (!strcmp(entry.key, "driver") && 119 (entry.type == DBUS_TYPE_STRING)) { 120 driver = os_strdup(entry.str_value); 121 wpa_dbus_dict_entry_clear(&entry); --- 96 unchanged lines hidden (view full) --- 218 } 219 220 wpa_s = wpa_supplicant_get_iface_by_dbus_path(global, path); 221 if (wpa_s == NULL) { 222 reply = wpas_dbus_new_invalid_iface_error(message); 223 goto out; 224 } 225 |
232 if (!wpa_supplicant_remove_iface(global, wpa_s)) { | 226 if (!wpa_supplicant_remove_iface(global, wpa_s, 0)) { |
233 reply = wpas_dbus_new_success_reply(message); 234 } else { 235 reply = dbus_message_new_error(message, 236 WPAS_ERROR_REMOVE_ERROR, 237 "wpa_supplicant couldn't " 238 "remove this interface."); 239 } 240 --- 91 unchanged lines hidden (view full) --- 332 * 333 * Handler function for "scan" method call of a network device. Requests 334 * that wpa_supplicant perform a wireless scan as soon as possible 335 * on a particular wireless interface. 336 */ 337DBusMessage * wpas_dbus_iface_scan(DBusMessage *message, 338 struct wpa_supplicant *wpa_s) 339{ | 227 reply = wpas_dbus_new_success_reply(message); 228 } else { 229 reply = dbus_message_new_error(message, 230 WPAS_ERROR_REMOVE_ERROR, 231 "wpa_supplicant couldn't " 232 "remove this interface."); 233 } 234 --- 91 unchanged lines hidden (view full) --- 326 * 327 * Handler function for "scan" method call of a network device. Requests 328 * that wpa_supplicant perform a wireless scan as soon as possible 329 * on a particular wireless interface. 330 */ 331DBusMessage * wpas_dbus_iface_scan(DBusMessage *message, 332 struct wpa_supplicant *wpa_s) 333{ |
340 wpa_s->scan_req = 2; | 334 wpa_s->scan_req = MANUAL_SCAN_REQ; |
341 wpa_supplicant_req_scan(wpa_s, 0, 0); 342 return wpas_dbus_new_success_reply(message); 343} 344 345 346/** 347 * wpas_dbus_iface_scan_results - Get the results of a recent scan request 348 * @message: Pointer to incoming dbus message --- 568 unchanged lines hidden (view full) --- 917 struct wpa_ssid *ssid) 918{ 919 DBusMessage *reply = NULL; 920 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 921 DBusMessageIter iter, iter_dict; 922 923 dbus_message_iter_init(message, &iter); 924 | 335 wpa_supplicant_req_scan(wpa_s, 0, 0); 336 return wpas_dbus_new_success_reply(message); 337} 338 339 340/** 341 * wpas_dbus_iface_scan_results - Get the results of a recent scan request 342 * @message: Pointer to incoming dbus message --- 568 unchanged lines hidden (view full) --- 911 struct wpa_ssid *ssid) 912{ 913 DBusMessage *reply = NULL; 914 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 915 DBusMessageIter iter, iter_dict; 916 917 dbus_message_iter_init(message, &iter); 918 |
925 if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) { | 919 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) { |
926 reply = wpas_dbus_new_invalid_opts_error(message, NULL); 927 goto out; 928 } 929 930 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 931 char *value = NULL; 932 size_t size = 50; 933 int ret; --- 263 unchanged lines hidden (view full) --- 1197 char *opensc_engine_path = NULL; 1198 char *pkcs11_engine_path = NULL; 1199 char *pkcs11_module_path = NULL; 1200 struct wpa_dbus_dict_entry entry; 1201 1202 if (!dbus_message_iter_init(message, &iter)) 1203 goto error; 1204 | 920 reply = wpas_dbus_new_invalid_opts_error(message, NULL); 921 goto out; 922 } 923 924 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 925 char *value = NULL; 926 size_t size = 50; 927 int ret; --- 263 unchanged lines hidden (view full) --- 1191 char *opensc_engine_path = NULL; 1192 char *pkcs11_engine_path = NULL; 1193 char *pkcs11_module_path = NULL; 1194 struct wpa_dbus_dict_entry entry; 1195 1196 if (!dbus_message_iter_init(message, &iter)) 1197 goto error; 1198 |
1205 if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) | 1199 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
1206 goto error; 1207 1208 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1209 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 1210 goto error; 1211 if (!strcmp(entry.key, "opensc_engine_path") && 1212 (entry.type == DBUS_TYPE_STRING)) { 1213 opensc_engine_path = os_strdup(entry.str_value); --- 105 unchanged lines hidden (view full) --- 1319 struct wpa_supplicant *wpa_s) 1320{ 1321 DBusMessage *reply = NULL; 1322 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 1323 DBusMessageIter iter, iter_dict; 1324 1325 dbus_message_iter_init(message, &iter); 1326 | 1200 goto error; 1201 1202 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1203 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 1204 goto error; 1205 if (!strcmp(entry.key, "opensc_engine_path") && 1206 (entry.type == DBUS_TYPE_STRING)) { 1207 opensc_engine_path = os_strdup(entry.str_value); --- 105 unchanged lines hidden (view full) --- 1313 struct wpa_supplicant *wpa_s) 1314{ 1315 DBusMessage *reply = NULL; 1316 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 1317 DBusMessageIter iter, iter_dict; 1318 1319 dbus_message_iter_init(message, &iter); 1320 |
1327 if (!wpa_dbus_dict_open_read(&iter, &iter_dict)) | 1321 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
1328 return wpas_dbus_new_invalid_opts_error(message, NULL); 1329 1330 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1331 struct wpa_config_blob *blob; 1332 1333 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) { 1334 reply = wpas_dbus_new_invalid_opts_error(message, 1335 NULL); --- 93 unchanged lines hidden (view full) --- 1429 } 1430 1431 if (err_msg) 1432 return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR, 1433 err_msg); 1434 1435 return wpas_dbus_new_success_reply(message); 1436} | 1322 return wpas_dbus_new_invalid_opts_error(message, NULL); 1323 1324 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1325 struct wpa_config_blob *blob; 1326 1327 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) { 1328 reply = wpas_dbus_new_invalid_opts_error(message, 1329 NULL); --- 93 unchanged lines hidden (view full) --- 1423 } 1424 1425 if (err_msg) 1426 return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR, 1427 err_msg); 1428 1429 return wpas_dbus_new_success_reply(message); 1430} |
1431 1432 1433/** 1434 * wpas_dbus_iface_flush - Clear BSS of old or all inactive entries 1435 * @message: Pointer to incoming dbus message 1436 * @wpa_s: %wpa_supplicant data structure 1437 * Returns: a dbus message containing a UINT32 indicating success (1) or 1438 * failure (0), or returns a dbus error message with more information 1439 * 1440 * Handler function for "flush" method call. Handles requests for an 1441 * interface with an optional "age" parameter that specifies the minimum 1442 * age of a BSS to be flushed. 1443 */ 1444DBusMessage * wpas_dbus_iface_flush(DBusMessage *message, 1445 struct wpa_supplicant *wpa_s) 1446{ 1447 int flush_age = 0; 1448 1449 if (os_strlen(dbus_message_get_signature(message)) != 0 && 1450 !dbus_message_get_args(message, NULL, 1451 DBUS_TYPE_INT32, &flush_age, 1452 DBUS_TYPE_INVALID)) { 1453 return wpas_dbus_new_invalid_opts_error(message, NULL); 1454 } 1455 1456 if (flush_age == 0) 1457 wpa_bss_flush(wpa_s); 1458 else 1459 wpa_bss_flush_by_age(wpa_s, flush_age); 1460 1461 return wpas_dbus_new_success_reply(message); 1462} |
|