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>
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
return;
msg = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
return;
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt);
return;
field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt);
char path[WPAS_DBUS_OBJECT_PATH_MAX];
char path[WPAS_DBUS_OBJECT_PATH_MAX];
+ if (!wpa_s->dbus_new_path)
+ return;
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
wpa_s->dbus_new_path, ssid->id);
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
wpa_s->dbus_new_path, ssid->id);
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
if (parent->p2p_mgmt)
parent = parent->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
- if (!wpa_s->dbus_groupobj_path)
+ if (!wpa_s->dbus_groupobj_path || !wpa_s->dbus_new_path ||
+ !parent->dbus_new_path)
return;
msg = dbus_message_new_signal(parent->dbus_new_path,
return;
msg = dbus_message_new_signal(parent->dbus_new_path,
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
if (request || !status) {
if (config_methods & WPS_CONFIG_DISPLAY)
if (request || !status) {
if (config_methods & WPS_CONFIG_DISPLAY)
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
- if (os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN))
+ if (!wpa_s->dbus_new_path ||
+ os_memcmp(ssid->ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN))
return -1;
os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2);
return -1;
os_memcpy(group_name, ssid->ssid + P2P_WILDCARD_SSID_LEN, 2);
iface = parent->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = parent->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !parent->dbus_new_path || !wpa_s->dbus_new_path)
return;
if (wpa_s->dbus_groupobj_path == NULL)
return;
if (wpa_s->dbus_groupobj_path == NULL)
os_memset(freqs, 0, sizeof(freqs));
/* Do nothing if the control interface is not turned on */
os_memset(freqs, 0, sizeof(freqs));
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
+ if (!parent->dbus_new_path)
+ return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
+ if (!parent->dbus_new_path)
+ return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
/* Check if this is a known peer */
if (!p2p_peer_known(wpa_s->global->p2p, sa))
/* Check if this is a known peer */
if (!p2p_peer_known(wpa_s->global->p2p, sa))
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
/* Check if this is a known peer */
if (!p2p_peer_known(wpa_s->global->p2p, sa))
/* Check if this is a known peer */
if (!p2p_peer_known(wpa_s->global->p2p, sa))
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"WpsFailed");
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"WpsFailed");
char path[WPAS_DBUS_OBJECT_PATH_MAX];
char *prop;
char path[WPAS_DBUS_OBJECT_PATH_MAX];
char *prop;
+ if (!wpa_s->dbus_new_path)
+ return;
+
switch (property) {
case WPAS_DBUS_BSS_PROP_SIGNAL:
prop = "Signal";
switch (property) {
case WPAS_DBUS_BSS_PROP_SIGNAL:
prop = "Signal";
#endif /* CONFIG_P2P */
/* Do nothing if the control interface is not turned on */
#endif /* CONFIG_P2P */
/* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
+ if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
/* Do nothing if the control interface is not turned on */
char bss_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
/* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
+ if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
struct bss_handler_args *arg;
/* Do nothing if the control interface is not turned on */
struct bss_handler_args *arg;
/* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL)
+ if (wpa_s == NULL || wpa_s->global == NULL || !wpa_s->dbus_new_path)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_new_path)
return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
if (ctrl_iface == NULL)
return 0;
if (ctrl_iface == NULL)
return 0;
- if (wpa_s->p2p_mgmt)
- wpa_s = wpa_s->parent;
+ wpa_s = wpa_s->parent->parent;
+ if (!wpa_s->dbus_new_path)
+ return 0;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
int ret;
/* Do nothing if the control interface is not turned on */
int ret;
/* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL ||
- wpa_s->dbus_new_path == NULL)
+ if (wpa_s == NULL || wpa_s->global == NULL)
- if (wpa_s->p2p_mgmt)
- wpa_s = wpa_s->parent;
+ wpa_s = wpa_s->parent->parent;
+ if (!wpa_s->dbus_new_path)
+ return 0;
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL)
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
+ if (!wpa_s->dbus_new_path)
+ return;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
wpa_s->dbus_new_path, MAC2STR(dev_addr));
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
wpa_s->dbus_new_path, MAC2STR(dev_addr));
/* Do nothing if the control interface is not turned on */
if (wpa_s == NULL || wpa_s->global == NULL)
return 0;
/* Do nothing if the control interface is not turned on */
if (wpa_s == NULL || wpa_s->global == NULL)
return 0;
+ wpa_s = wpa_s->parent->parent;
+ if (!wpa_s->dbus_new_path)
+ return 0;
/* Make sure ssid is a persistent group */
if (ssid->disabled != 2 && !ssid->p2p_persistent_group)
/* Make sure ssid is a persistent group */
if (ssid->disabled != 2 && !ssid->p2p_persistent_group)
int ret;
/* Do nothing if the control interface is not turned on */
int ret;
/* Do nothing if the control interface is not turned on */
- if (wpa_s == NULL || wpa_s->global == NULL ||
- wpa_s->dbus_new_path == NULL)
+ if (wpa_s == NULL || wpa_s->global == NULL)
- if (wpa_s->p2p_mgmt)
- wpa_s = wpa_s->parent;
+ wpa_s = wpa_s->parent->parent;
ctrl_iface = wpa_s->global->dbus;
ctrl_iface = wpa_s->global->dbus;
- if (ctrl_iface == NULL)
+ if (ctrl_iface == NULL || !wpa_s->dbus_new_path)
return 0;
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
return 0;
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
struct wpa_supplicant *wpa_s;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
struct wpa_supplicant *wpa_s;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
- if (os_strcmp(wpa_s->dbus_new_path, path) == 0)
+ if (wpa_s->dbus_new_path &&
+ os_strcmp(wpa_s->dbus_new_path, path) == 0)
return wpa_s;
}
return NULL;
return wpa_s;
}
return NULL;
iface.bridge_ifname = bridge_ifname;
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(global, &iface, NULL);
iface.bridge_ifname = bridge_ifname;
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(global, &iface, NULL);
+ if (wpa_s && wpa_s->dbus_new_path) {
const char *path = wpa_s->dbus_new_path;
reply = dbus_message_new_method_return(message);
const char *path = wpa_s->dbus_new_path;
reply = dbus_message_new_method_return(message);
DBUS_TYPE_INVALID);
wpa_s = wpa_supplicant_get_iface(global, ifname);
DBUS_TYPE_INVALID);
wpa_s = wpa_supplicant_get_iface(global, ifname);
+ if (wpa_s == NULL || wpa_s->dbus_new_path == NULL)
return wpas_dbus_error_iface_unknown(message);
path = wpa_s->dbus_new_path;
return wpas_dbus_error_iface_unknown(message);
path = wpa_s->dbus_new_path;
unsigned int i = 0, num = 0;
dbus_bool_t success;
unsigned int i = 0, num = 0;
dbus_bool_t success;
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
- num++;
+ for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+ if (wpa_s->dbus_new_path)
+ num++;
+ }
paths = os_calloc(num, sizeof(char *));
if (!paths) {
paths = os_calloc(num, sizeof(char *));
if (!paths) {
- for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
- paths[i++] = wpa_s->dbus_new_path;
+ for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+ if (wpa_s->dbus_new_path)
+ paths[i++] = wpa_s->dbus_new_path;
+ }
success = wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_OBJECT_PATH,
success = wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_OBJECT_PATH,
dbus_message_iter_init(message, &iter);
dbus_message_iter_init(message, &iter);
- ssid = wpa_config_add_network(wpa_s->conf);
+ if (wpa_s->dbus_new_path)
+ ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL) {
wpa_printf(MSG_ERROR, "%s[dbus]: can't add new interface.",
__func__);
if (ssid == NULL) {
wpa_printf(MSG_ERROR, "%s[dbus]: can't add new interface.",
__func__);
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
- if (iface == NULL || net_id == NULL ||
+ if (iface == NULL || net_id == NULL || !wpa_s->dbus_new_path ||
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
- if (iface == NULL || net_id == NULL ||
+ if (iface == NULL || net_id == NULL || !wpa_s->dbus_new_path ||
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
iface = wpas_dbus_new_decompose_object_path(op,
WPAS_DBUS_NEW_NETWORKS_PART,
&net_id);
- if (iface == NULL || net_id == NULL ||
+ if (iface == NULL || net_id == NULL || !wpa_s->dbus_new_path ||
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
message, DBUS_ERROR_FAILED,
"Reinit of the EAPOL state machine with the new PKCS #11 engine and module path failed.");
message, DBUS_ERROR_FAILED,
"Reinit of the EAPOL state machine with the new PKCS #11 engine and module path failed.");
- wpa_dbus_mark_property_changed(
- wpa_s->global->dbus, wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE, "PKCS11EnginePath");
- wpa_dbus_mark_property_changed(
- wpa_s->global->dbus, wpa_s->dbus_new_path,
- WPAS_DBUS_NEW_IFACE_INTERFACE, "PKCS11ModulePath");
+ if (wpa_s->dbus_new_path) {
+ wpa_dbus_mark_property_changed(
+ wpa_s->global->dbus, wpa_s->dbus_new_path,
+ WPAS_DBUS_NEW_IFACE_INTERFACE, "PKCS11EnginePath");
+ wpa_dbus_mark_property_changed(
+ wpa_s->global->dbus, wpa_s->dbus_new_path,
+ WPAS_DBUS_NEW_IFACE_INTERFACE, "PKCS11ModulePath");
+ }
struct wpa_supplicant *wpa_s = user_data;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *bss_obj_path = path_buf;
struct wpa_supplicant *wpa_s = user_data;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *bss_obj_path = path_buf;
- if (wpa_s->current_bss)
+ if (wpa_s->current_bss && wpa_s->dbus_new_path)
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
wpa_s->dbus_new_path, wpa_s->current_bss->id);
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
wpa_s->dbus_new_path, wpa_s->current_bss->id);
struct wpa_supplicant *wpa_s = user_data;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *net_obj_path = path_buf;
struct wpa_supplicant *wpa_s = user_data;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *net_obj_path = path_buf;
- if (wpa_s->current_ssid)
+ if (wpa_s->current_ssid && wpa_s->dbus_new_path)
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
wpa_s->dbus_new_path, wpa_s->current_ssid->id);
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
wpa_s->dbus_new_path, wpa_s->current_ssid->id);
unsigned int i = 0;
dbus_bool_t success = FALSE;
unsigned int i = 0;
dbus_bool_t success = FALSE;
+ if (!wpa_s->dbus_new_path) {
+ dbus_set_error(error, DBUS_ERROR_FAILED,
+ "%s: no D-Bus interface", __func__);
+ return FALSE;
+ }
+
paths = os_calloc(wpa_s->num_bss, sizeof(char *));
if (!paths) {
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
paths = os_calloc(wpa_s->num_bss, sizeof(char *));
if (!paths) {
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
unsigned int i = 0, num = 0;
dbus_bool_t success = FALSE;
unsigned int i = 0, num = 0;
dbus_bool_t success = FALSE;
+ if (!wpa_s->dbus_new_path) {
+ dbus_set_error(error, DBUS_ERROR_FAILED,
+ "%s: no D-Bus interface", __func__);
+ return FALSE;
+ }
+
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
if (!network_is_persistent_group(ssid))
num++;
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
if (!network_is_persistent_group(ssid))
num++;
struct wpas_dbus_priv *priv = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
struct wpas_dbus_priv *priv = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
+ if (priv == NULL || !wpa_s->dbus_new_path)
return;
if (wpa_s->preq_notify_peer == NULL)
return;
if (wpa_s->preq_notify_peer == NULL)
pg_object_path, WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&net_id_str);
if (iface == NULL || net_id_str == NULL ||
pg_object_path, WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&net_id_str);
if (iface == NULL || net_id_str == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
+ !wpa_s->parent->dbus_new_path ||
+ os_strcmp(iface, wpa_s->parent->dbus_new_path) != 0) {
reply =
wpas_dbus_error_invalid_args(message,
pg_object_path);
reply =
wpas_dbus_error_invalid_args(message,
pg_object_path);
WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&net_id_str);
if (iface == NULL || net_id_str == NULL ||
WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&net_id_str);
if (iface == NULL || net_id_str == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
+ !wpa_s->parent->dbus_new_path ||
+ os_strcmp(iface, wpa_s->parent->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message,
pg_object_path);
goto out;
reply = wpas_dbus_error_invalid_args(message,
pg_object_path);
goto out;
char **peer_obj_paths = NULL;
char **peer_obj_paths = NULL;
- if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
+ if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error) ||
+ !wpa_s->parent->parent->dbus_new_path)
return FALSE;
dl_list_init(&peer_objpath_list);
return FALSE;
dl_list_init(&peer_objpath_list);
os_snprintf(node->path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART
"/" COMPACT_MACSTR,
os_snprintf(node->path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART
"/" COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(addr));
+ wpa_s->parent->parent->dbus_new_path,
+ MAC2STR(addr));
dl_list_add_tail(&peer_objpath_list, &node->list);
num++;
dl_list_add_tail(&peer_objpath_list, &node->list);
num++;
struct wpa_supplicant *wpa_s = user_data;
char go_peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
struct wpa_supplicant *wpa_s = user_data;
char go_peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
+ if (!wpa_s->parent->parent->dbus_new_path)
+ return FALSE;
+
if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_CLIENT)
os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
else
os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
COMPACT_MACSTR,
if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_CLIENT)
os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
else
os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
COMPACT_MACSTR,
- wpa_s->dbus_new_path, MAC2STR(wpa_s->go_dev_addr));
+ wpa_s->parent->parent->dbus_new_path,
+ MAC2STR(wpa_s->go_dev_addr));
path = go_peer_obj_path;
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
path = go_peer_obj_path;
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
unsigned int i = 0, num = 0;
dbus_bool_t success = FALSE;
unsigned int i = 0, num = 0;
dbus_bool_t success = FALSE;
+ if (wpa_s->p2p_dev)
+ wpa_s = wpa_s->p2p_dev;
+ if (!wpa_s->parent->dbus_new_path)
+ return FALSE;
+
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
if (network_is_persistent_group(ssid))
num++;
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
if (network_is_persistent_group(ssid))
num++;
/* Construct the object path for this network. */
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
/* Construct the object path for this network. */
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
+ wpa_s->parent->dbus_new_path, ssid->id);
}
success = wpas_dbus_simple_array_property_getter(iter,
}
success = wpas_dbus_simple_array_property_getter(iter,
dbus_message_iter_init(message, &iter);
dbus_message_iter_init(message, &iter);
- ssid = wpa_config_add_network(wpa_s->conf);
+ if (wpa_s->p2p_dev)
+ wpa_s = wpa_s->p2p_dev;
+ if (wpa_s->parent->dbus_new_path)
+ ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL) {
wpa_printf(MSG_ERROR,
"dbus: %s: Cannot add new persistent group",
if (ssid == NULL) {
wpa_printf(MSG_ERROR,
"dbus: %s: Cannot add new persistent group",
/* Construct the object path for this network. */
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
/* Construct the object path for this network. */
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%d",
- wpa_s->dbus_new_path, ssid->id);
+ wpa_s->parent->dbus_new_path, ssid->id);
reply = dbus_message_new_method_return(message);
if (reply == NULL) {
reply = dbus_message_new_method_return(message);
if (reply == NULL) {
dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
DBUS_TYPE_INVALID);
dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
DBUS_TYPE_INVALID);
+ if (wpa_s->p2p_dev)
+ wpa_s = wpa_s->p2p_dev;
+
/*
* Extract the network ID and ensure the network is actually a child of
* this interface.
/*
* Extract the network ID and ensure the network is actually a child of
* this interface.
op, WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&persistent_group_id);
if (iface == NULL || persistent_group_id == NULL ||
op, WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART,
&persistent_group_id);
if (iface == NULL || persistent_group_id == NULL ||
- os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
+ !wpa_s->parent->dbus_new_path ||
+ os_strcmp(iface, wpa_s->parent->dbus_new_path) != 0) {
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
}
reply = wpas_dbus_error_invalid_args(message, op);
goto out;
}
struct wpa_ssid *ssid, *next;
struct wpa_config *config;
struct wpa_ssid *ssid, *next;
struct wpa_config *config;
+ if (wpa_s->p2p_dev)
+ wpa_s = wpa_s->p2p_dev;
config = wpa_s->conf;
ssid = config->ssid;
while (ssid) {
config = wpa_s->conf;
ssid = config->ssid;
while (ssid) {
const u8 *addr;
dbus_bool_t success = FALSE;
const u8 *addr;
dbus_bool_t success = FALSE;
+ if (!wpa_s->parent->parent->dbus_new_path)
+ return FALSE;
+
/* Verify correct role for this property */
if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_GO) {
return wpas_dbus_simple_array_property_getter(
/* Verify correct role for this property */
if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_GO) {
return wpas_dbus_simple_array_property_getter(
os_snprintf(paths[i], WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART
"/" COMPACT_MACSTR,
os_snprintf(paths[i], WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART
"/" COMPACT_MACSTR,
- wpa_s->parent->dbus_new_path, MAC2STR(addr));
+ wpa_s->parent->parent->dbus_new_path,
+ MAC2STR(addr));
struct wpa_supplicant *wpa_s = user_data;
dbus_bool_t process_credentials, old_pc;
struct wpa_supplicant *wpa_s = user_data;
dbus_bool_t process_credentials, old_pc;
+ if (!wpa_s->dbus_new_path)
+ return FALSE;
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
&process_credentials))
return FALSE;
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
&process_credentials))
return FALSE;
DBusMessage *_signal;
/* Do nothing if the control interface is not turned on */
DBusMessage *_signal;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_path)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
/* Do nothing if the control interface is not turned on */
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
/* Do nothing if the control interface is not turned on */
+ if (iface == NULL || !wpa_s->dbus_path)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
+ if (iface == NULL || !wpa_s->dbus_path)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
+ if (iface == NULL || !wpa_s->dbus_path)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
struct wpa_supplicant *wpa_s;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
struct wpa_supplicant *wpa_s;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
- if (strcmp(wpa_s->dbus_path, path) == 0)
+ if (wpa_s->dbus_path && strcmp(wpa_s->dbus_path, path) == 0)
return wpa_s;
}
return NULL;
return wpa_s;
}
return NULL;
iface.bridge_ifname = bridge_ifname;
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(global, &iface, NULL);
iface.bridge_ifname = bridge_ifname;
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(global, &iface, NULL);
+ if (wpa_s && wpa_s->dbus_path) {
const char *path = wpa_s->dbus_path;
reply = dbus_message_new_method_return(message);
const char *path = wpa_s->dbus_path;
reply = dbus_message_new_method_return(message);
}
wpa_s = wpa_supplicant_get_iface(global, ifname);
}
wpa_s = wpa_supplicant_get_iface(global, ifname);
+ if (wpa_s == NULL || !wpa_s->dbus_path) {
reply = wpas_dbus_new_invalid_iface_error(message);
goto out;
}
reply = wpas_dbus_new_invalid_iface_error(message);
goto out;
}
DBusMessageIter sub_iter;
struct wpa_bss *bss;
DBusMessageIter sub_iter;
struct wpa_bss *bss;
+ if (!wpa_s->dbus_path)
+ return dbus_message_new_error(message,
+ WPAS_ERROR_INTERNAL_ERROR,
+ "no D-Bus interface available");
+
/* Create and initialize the return message */
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
/* Create and initialize the return message */
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
struct wpa_supplicant *wpa_s)
{
DBusMessage *reply = NULL;
+ struct wpa_ssid *ssid = NULL;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *path = path_buf;
char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *path = path_buf;
- ssid = wpa_config_add_network(wpa_s->conf);
+ if (wpa_s->dbus_path)
+ ssid = wpa_config_add_network(wpa_s->conf);
if (ssid == NULL) {
reply = dbus_message_new_error(
message, WPAS_ERROR_ADD_NETWORK_ERROR,
if (ssid == NULL) {
reply = dbus_message_new_error(
message, WPAS_ERROR_ADD_NETWORK_ERROR,
}
/* Ensure the network is actually a child of this interface */
}
/* Ensure the network is actually a child of this interface */
- if (os_strcmp(iface, wpa_s->dbus_path) != 0) {
+ if (!wpa_s->dbus_path || os_strcmp(iface, wpa_s->dbus_path) != 0) {
reply = wpas_dbus_new_invalid_network_error(message);
goto out;
}
reply = wpas_dbus_new_invalid_network_error(message);
goto out;
}
goto out;
}
/* Ensure the object path really points to this interface */
goto out;
}
/* Ensure the object path really points to this interface */
+ if (network == NULL || !wpa_s->dbus_path ||
os_strcmp(iface_obj_path, wpa_s->dbus_path) != 0) {
reply = wpas_dbus_new_invalid_network_error(message);
goto out;
os_strcmp(iface_obj_path, wpa_s->dbus_path) != 0) {
reply = wpas_dbus_new_invalid_network_error(message);
goto out;