aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_old_handlers.c
Commit message (Collapse)AuthorAgeFilesLines
* Move network add/remove operations to a common functionRoshan Pius2016-08-181-15/+5
| | | | | | | | | All the 3 control interfaces: socket based, dbus & binder needs to perform the same sequence of steps for network add/remove. So, move these to a common utility method in |wpa_supplicant.c| instead of duplicating the code everywhere. Signed-off-by: Roshan Pius <rpius@google.com>
* Move disconnect command handling to a common placeRoshan Pius2016-08-131-2/+1
| | | | | | | | Move out the disconnect command handling from |ctrl_iface.c| to |wpa_supplicant.c| so that it can be reused across the different control interfaces (socket, dbus & binder). Signed-off-by: Roshan Pius <rpius@google.com>
* dbus: Do not quote scan_freq and freq_list in dbus_old_handlers.cJiří Klimeš2015-08-271-1/+1
| | | | | | | | | | | | scan_freq and freq_list are not parsed correctly by wpa_config_parse_int_array() if quoted. Patch for dbus_old_handlers.c, the same change as done by Robert Shade <robert.shade@gmail.com> for dbus_new_handlers.c in commit 99276998fa26d4299825eeafb6386fe1c51f6287 ('dbus: Do not quote scan_freq and freq_list'). Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
* D-Bus: Fix dont_quote const declarationJouni Malinen2015-07-071-1/+1
| | | | | | | | | Commit 38279bdb35c1b0c248289752197ebddd2fdd52ef ('D-Bus: Coding style cleanup') handled the dbus_new_handlers.c change properly, but misplaced the second 'const' in dbus_old_handlers.c in a way that resulted in duplicated const rather than marking the actual value const. Signed-off-by: Jouni Malinen <j@w1.fi>
* dbus: Do not initialize variable twiceJouni Malinen2015-06-231-1/+1
| | | | | | | There is no point in initializing 'success' to FALSE when the actual value is set just below this. Signed-off-by: Jouni Malinen <j@w1.fi>
* Do not check unsigned size is less than zeroJouni Malinen2015-06-231-1/+1
| | | | | | | The variables here are unsigned and as such, cannot have a negative value. Use == 0 instead of <= 0 to make this cleaner. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus: Fix operations when P2P management interface is usedJouni Malinen2015-04-291-6/+12
| | | | | | | | | | | | | | | | | | | Commit 21efc940f6e7f07b84b7e5c5867f3d81594c4fb0 ('wpa_supplicant: Do not register a P2P management interface on DBus') hides the special P2P management interface from D-Bus. However, it did not take into account the possibility of wpa_s->dbus_path and wpa_s->dbus_new_path being NULL in such cases on number of code paths within the D-Bus handlers. This could result in invalid arguments (NULL path) being provided to D-Bus functions (mainly, dbus_message_iter_append_basic) and NULL pointer dereference when iterating over all interfaces. Either of these could make wpa_supplicant process terminate. Fix this by explicitly checking that the interface-specific D-Bus path has been registered before using it anywhere with D-Bus handlers. In addition, find the correct wpa_s instance to fix P2P operations through D-Bus when the P2P Device interface is used. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* P2P: Fix interface deinit for failed group interface initializationJouni Malinen2015-03-011-1/+1
| | | | | | | | | | | wpa_supplicant_deinit_iface() ends up removing all P2P groups if the removed interface is the parent interface. This is correct behavior in general, but this resulted in issues in the new group interface initialization error path since wpa_s->parent was not assigned before hitting this check. Fix this by assigning wpa_s->parent as part of wpa_supplicant_add_iface(). Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus (old): Fix memory leak on error pathJouni Malinen2015-01-071-1/+3
| | | | | | | If setSmartcardModules() fails to allocate memory with os_strdup(), the allocated items in the dict entry were not freed. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus: Coding style cleanupJouni Malinen2015-01-021-52/+54
| | | | Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus: Simplify message building error pathsJouni Malinen2015-01-021-188/+103
| | | | | | | | | There is no need to have multiple separate return statements for error cases in a sequence of operations. In addition, there is not much point in "converting" boolean return values with "if (!res) return FALSE; return TRUE;" style constructions. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus (old): Fix removeNetwork method to not use freed memoryJouni Malinen2015-01-021-3/+4
| | | | | | | | wpa_supplicant_deauthenticate() call needs to happen before wpa_config_remove_network(). Freed memory could be dereferenced if removeNetwork method was issued on the currently connected network. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus(old): Remove duplicated blob->data checkJouni Malinen2014-12-291-1/+1
| | | | | | | This was already verified to be non-NULL above and there is no point in having an extra check after the pointer has already been dereferenced. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus(old): Fix removeNetwork and selectNetwork error handlingJouni Malinen2014-12-291-2/+3
| | | | | | | | | | wpas_dbus_decompose_object_path() may leave the network part NULL on unexpected path. This resulted in NULL pointer dereference when processing an invalid removeNetwork or selectNetwork call. Fix this by explicitly verifying that the network part was included in the object path. Signed-off-by: Jouni Malinen <j@w1.fi>
* D-Bus(old): Fix interface to show correct err_msg for blob removalJouni Malinen2014-12-291-2/+1
| | | | | | | The "Invalid blob name" string was not shown since the zero-length name was used regardless of first verifying that it should not be allowed. Signed-off-by: Jouni Malinen <j@w1.fi>
* Check os_snprintf() result more consistently - manualJouni Malinen2014-12-081-1/+1
| | | | | | | | This converts os_snprintf() result validation cases to use os_snprintf_error() for cases that were note covered by spatch and semantic patches. Signed-off-by: Jouni Malinen <j@w1.fi>
* Check os_snprintf() result more consistently - maximum lengthJouni Malinen2014-12-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | This adds verification of os_snprintf() result against the maximum buffer length. These changes were done automatically with spatch using the following semantic patch: @@ expression E1,E2,E3; statement S1; @@ E1 = os_snprintf(E2, E3, ...); - if (\( E1 < 0 \| E1 <= 0 \)) + if (os_snprintf_error(E3, E1)) ( S1 | { ... } ) Signed-off-by: Jouni Malinen <j@w1.fi>
* dbus: Fix indentation level to match code logicJouni Malinen2014-07-021-1/+1
| | | | Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* dbus: Check return value more consistently (CID 62841)Jouni Malinen2014-06-141-7/+16
| | | | | | | | Most of these calls are checked to return success and there is no reason why these wouldn't, so be more consistent. This addresses CID 62841, CID 62840, CID 62839, CID 62838, CID 62837, CID 62836. Signed-off-by: Jouni Malinen <j@w1.fi>
* dbus: Avoid theoretical memory leaks with duplicated dict entriesJouni Malinen2014-06-121-0/+7
| | | | | | | | | If a dict would include duplicated items, the parsing code here would have leaked memory by overwriting old os_strdup() result with the new one. Fix this by explicitly freeing the previous entry. This addresses CID 62852, CID 62851, CID 62850, CID 62849, CID 62847, CID 62846. Signed-off-by: Jouni Malinen <j@w1.fi>
* Declare wpa_debug_* variables in src/utils/wpa_debug.hJouni Malinen2013-12-311-4/+0
| | | | | | | | | These were somewhat more hidden to avoid direct use, but there are now numerous places where these are needed and more justification to make the extern int declarations available from wpa_debug.h. In addition, this avoids some warnings from sparse. Signed-hostap: Jouni Malinen <j@w1.fi>
* Use ARRAY_SIZE() macroJouni Malinen2013-10-261-5/+5
| | | | | | | Replace the common sizeof(a)/sizeof(a[0]) constructions with a more readable version. Signed-hostap: Jouni Malinen <j@w1.fi>
* Fix build with CONFIG_NO_CONFIG_BLOBSJouni Malinen2013-03-161-0/+4
| | | | Signed-hostap: Jouni Malinen <j@w1.fi>
* Document wpa_s->scan_reqJouni Malinen2012-11-251-1/+1
| | | | | | | Use an enum with documented values to make it easier to understand how wpa_s->scan_req is used. Signed-hostap: Jouni Malinen <j@w1.fi>
* Update license notification in D-Bus interface filesJouni Malinen2012-07-021-8/+2
| | | | | | | | This updates these files to use the license notification that uses only the BSD license. The changes were acknowledged by email (Dan Williams <dcbw@redhat.com>, Sun, 01 Jul 2012 15:53:36 -0500). Signed-hostap: Jouni Malinen <j@w1.fi>
* Let wpa_supplicant_deinit_iface() know that process is terminatingDmitry Shmidt2012-01-291-1/+1
| | | | | | | This will be needed to be able to move ctrl_iface TERMINATING event to the end of interface removal. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* dbus: clean up new D-Bus interface getters and settersDan Williams2011-07-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of fixes/improvements here: 1) Remove casting of getter/setter function types which allows us to change the prototypes in the future and not have hard-to-find runtime segfaults 2) Instead of having the getters create a fake reply message which then gets its arguments copied into the real reply message, and is then disposed, just pass message iters around and have them add their arguments to the message itself 3) For setters, just pass in the message iter positioned at the start of the argument list, instead of each setter having to skip over the standard interface+property name 4) Convert error handling to use DBusError and return the error back down through the call stacks to the function that will actually send the error back to the caller, instead of having a fake DBusMessage of type DBUS_MESSAGE_TYPE_ERROR that then needs to have the error extracted from it. But most of all, this fixes various segfaults (like rh #725517 and #678625) which were caused by some functions deep down in the getter callpaths wanting a source DBusMessage* when the getters were used for two things: signals (which don't have a source DBusMessage) and methods (which will have a source DBusMessage that's being replied to). This duality made the code fragile when handling errors like invalid IEs over the air. Signed-off-by: Dan Williams <dcbw@redhat.com>
* dbus: Add D-Bus methods to flush the BSS cacheSam Leffler2011-03-201-0/+32
| | | | | | | | | | | Add an "Interface.FlushBSS" method to the new D-Bus API and a "flush" method to the old API. Both take an age parameter that is a threshold (in seconds) for selecting entries to evict. Setting this parameter to zero flushes all entries from the cache. This mechanism is useful for a connection manager to clear state at startup and on resume (where the age parameter may be used to hold onto recent/valid data).
* dbus: Deauthenticate instead of disassociate on disconnect commandJouni Malinen2010-08-181-2/+3
| | | | | | | | This clears up authentication state in the driver and in case of cfg80211, unlocks the BSS entry for the previously used AP. The previous commit cf4783e35fb4861181c275a3dbd607b58c7d4067 changed only the ctrl_iface DISCONNECT command behavior; this new commit does the same for D-Bus commands.
* Update priority list after priority changeDmitry Shmidt2010-03-061-0/+2
| | | | | | | | Despite comments in the wpa_config_update_prio_list(struct wpa_config *config) telling that it is called "if priority for a network is changed", it is apparently not. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
* Move wpa_supplicant specific scan code away from src/driversJouni Malinen2010-01-031-0/+1
| | | | | | This fits better in wpa_supplicant/scan.c. Couple of remaining scan_helpers.c functions are currently used in driver wrappers, but they can likely be removed in the future.
* dbus: Use stack for temporary object pathJouni Malinen2010-01-021-9/+1
| | | | | This is small enough buffer to not require more complex dynamic allocation for temporary use.
* dbus: Use BSS table instead of raw scan results in older APIJouni Malinen2010-01-021-38/+24
| | | | | Change the old D-Bus API to use the new BSS table instead of raw scan results.
* Only expire scanned BSSes based on new scan resultsJouni Malinen2010-01-021-1/+1
| | | | | | Get more information about scans when updating BSS table information. This allows the missing-from-scans expiration rule to work properly when only partial set of channels or SSIDs are being scanned.
* dbus: Remove perror() callsJouni Malinen2010-01-011-18/+8
| | | | | | | | The perror() calls do not make much sense with libdbus functions and wpa_printf() would really be used for all error printing anyway. In addition, many of the error messages on out-of-memory cases are not really of much use, so they were removed. This is also cleaning up some of the error path handling to avoid duplicated code.
* dbus: Clean up dbus_path/dbus_new_path useJouni Malinen2010-01-011-18/+6
| | | | | | These cannot be NULL, so there is no point in checking for that. In addition, the accessor function for this is just making the code harder to understand.
* dbus: Do not include libdbus dbus/dbus.h into dbus_{old,new}.hJouni Malinen2010-01-011-0/+1
| | | | | | These header files are included outside the dbus subdirectory and there is not really any need to force the libdbus dbus/dbus.h header file to be included into these files.
* dbus: Rename old D-Bus API files to include "_old"Jouni Malinen2009-12-311-0/+1475
This makes it easier to figure out which file is used by which D-Bus interface.