dbus: Clean up dbus_path/dbus_new_path use
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.
This commit is contained in:
parent
1912049828
commit
c49cf2d68f
7 changed files with 58 additions and 222 deletions
|
@ -51,13 +51,6 @@ static void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
|
||||||
if (path == NULL) {
|
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_interface[dbus]: "
|
|
||||||
"Interface doesn't have a dbus path. "
|
|
||||||
"Can't send signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
|
_signal = dbus_message_new_signal(WPAS_DBUS_NEW_PATH,
|
||||||
WPAS_DBUS_NEW_INTERFACE, sig_name);
|
WPAS_DBUS_NEW_INTERFACE, sig_name);
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
|
@ -68,7 +61,8 @@ static void wpas_dbus_signal_interface(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
dbus_message_iter_init_append(_signal, &iter);
|
dbus_message_iter_init_append(_signal, &iter);
|
||||||
|
|
||||||
if(!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
path = wpa_s->dbus_new_path;
|
||||||
|
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
||||||
&path))
|
&path))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -132,7 +126,6 @@ void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
const char *path;
|
|
||||||
dbus_bool_t succ;
|
dbus_bool_t succ;
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
@ -141,14 +134,8 @@ void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success)
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_scan_done[dbus]: "
|
|
||||||
"Interface doesn't have a dbus path. "
|
|
||||||
"Can't send signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
||||||
"ScanDone");
|
"ScanDone");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_scan_done[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_scan_done[dbus]: "
|
||||||
|
@ -184,7 +171,6 @@ static void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s,
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
DBusMessageIter iter, iter_dict;
|
DBusMessageIter iter, iter_dict;
|
||||||
const char *path;
|
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
|
||||||
|
@ -192,14 +178,8 @@ static void wpas_dbus_signal_bss(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_bss[dbus]: "
|
|
||||||
"Interface doesn't have a dbus path. "
|
|
||||||
"Can't send signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
||||||
sig_name);
|
sig_name);
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_bss[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_bss[dbus]: "
|
||||||
|
@ -278,7 +258,6 @@ static void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
const char *path;
|
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
|
||||||
|
@ -286,14 +265,8 @@ static void wpas_dbus_signal_blob(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_blob[dbus]: "
|
|
||||||
"Interface doesn't have a dbus path. "
|
|
||||||
"Can't send signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
||||||
sig_name);
|
sig_name);
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_blob[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_blob[dbus]: "
|
||||||
|
@ -356,7 +329,6 @@ static void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s,
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
DBusMessageIter iter, iter_dict;
|
DBusMessageIter iter, iter_dict;
|
||||||
const char *path;
|
|
||||||
char *net_obj_path;
|
char *net_obj_path;
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
@ -365,21 +337,15 @@ static void wpas_dbus_signal_network(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
|
||||||
if (path == NULL) {
|
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_network[dbus]: "
|
|
||||||
"Interface doesn't have a dbus path. "
|
|
||||||
"Can't send signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
net_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
net_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (net_obj_path == NULL)
|
if (net_obj_path == NULL)
|
||||||
return;
|
return;
|
||||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", path, id);
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
||||||
|
wpa_s->dbus_new_path, id);
|
||||||
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_INTERFACE,
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
sig_name);
|
sig_name);
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_network[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_network[dbus]: "
|
||||||
|
@ -475,7 +441,6 @@ void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
const char *path;
|
|
||||||
char *new_state_str, *old_state_str;
|
char *new_state_str, *old_state_str;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
@ -490,17 +455,8 @@ void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
||||||
if (new_state == old_state)
|
if (new_state == old_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
perror("wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"interface didn't have a dbus path");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"interface didn't have a dbus path; can't send "
|
|
||||||
"signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_INTERFACE,
|
|
||||||
"StateChanged");
|
"StateChanged");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpas_dbus_signal_state_changed[dbus]: "
|
perror("wpas_dbus_signal_state_changed[dbus]: "
|
||||||
|
@ -574,7 +530,7 @@ void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||||
char path[WPAS_DBUS_OBJECT_PATH_MAX];
|
char path[WPAS_DBUS_OBJECT_PATH_MAX];
|
||||||
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
||||||
wpas_dbus_get_path(wpa_s), ssid->id);
|
wpa_s->dbus_new_path, ssid->id);
|
||||||
|
|
||||||
wpa_dbus_signal_property_changed(wpa_s->global->dbus,
|
wpa_dbus_signal_property_changed(wpa_s->global->dbus,
|
||||||
(WPADBusPropertyAccessor)
|
(WPADBusPropertyAccessor)
|
||||||
|
@ -599,7 +555,6 @@ void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
DBusMessageIter iter, dict_iter;
|
DBusMessageIter iter, dict_iter;
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
char *key = "success";
|
char *key = "success";
|
||||||
const char *path;
|
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
|
||||||
|
@ -607,15 +562,8 @@ void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s)
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (!path) {
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_success"
|
|
||||||
"[dbus]: interface has no dbus path set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_WPS,
|
|
||||||
"Event");
|
|
||||||
if (!_signal) {
|
if (!_signal) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_success"
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_success"
|
||||||
"[dbus]: out of memory when creating a signal");
|
"[dbus]: out of memory when creating a signal");
|
||||||
|
@ -653,7 +601,6 @@ void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
DBusMessageIter iter, dict_iter;
|
DBusMessageIter iter, dict_iter;
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
char *key = "fail";
|
char *key = "fail";
|
||||||
const char *path;
|
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
|
||||||
|
@ -661,15 +608,8 @@ void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (!path) {
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_fail[dbus]: "
|
|
||||||
"interface has no dbus path set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_WPS,
|
|
||||||
"Event");
|
|
||||||
if (!_signal) {
|
if (!_signal) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_fail[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_fail[dbus]: "
|
||||||
"out of memory when creating a signal");
|
"out of memory when creating a signal");
|
||||||
|
@ -708,7 +648,6 @@ void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
DBusMessageIter iter, dict_iter;
|
DBusMessageIter iter, dict_iter;
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
char *key = "m2d";
|
char *key = "m2d";
|
||||||
const char *path;
|
|
||||||
|
|
||||||
iface = wpa_s->global->dbus;
|
iface = wpa_s->global->dbus;
|
||||||
|
|
||||||
|
@ -716,15 +655,8 @@ void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (!path) {
|
WPAS_DBUS_NEW_IFACE_WPS, "Event");
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_m2d[dbus]: "
|
|
||||||
"interface has no dbus path set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_WPS,
|
|
||||||
"Event");
|
|
||||||
if (!_signal) {
|
if (!_signal) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_m2d[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_event_m2d[dbus]: "
|
||||||
"out of memory when creating a signal");
|
"out of memory when creating a signal");
|
||||||
|
@ -784,7 +716,6 @@ void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
DBusMessageIter iter, dict_iter;
|
DBusMessageIter iter, dict_iter;
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
const char *path;
|
|
||||||
char *auth_type[6]; /* we have six possible authorization types */
|
char *auth_type[6]; /* we have six possible authorization types */
|
||||||
int at_num = 0;
|
int at_num = 0;
|
||||||
char *encr_type[4]; /* we have four possible encryption types */
|
char *encr_type[4]; /* we have four possible encryption types */
|
||||||
|
@ -796,14 +727,8 @@ void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
if (!path) {
|
WPAS_DBUS_NEW_IFACE_WPS,
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_cred[dbus]: "
|
|
||||||
"interface has no dbus path set");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_NEW_IFACE_WPS,
|
|
||||||
"Credentials");
|
"Credentials");
|
||||||
if (!_signal) {
|
if (!_signal) {
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_cred[dbus]: "
|
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_cred[dbus]: "
|
||||||
|
@ -937,9 +862,8 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_dbus_signal_property_changed(wpa_s->global->dbus,
|
wpa_dbus_signal_property_changed(wpa_s->global->dbus,
|
||||||
getter, arg,
|
getter, arg, wpa_s->dbus_new_path,
|
||||||
wpas_dbus_get_path(wpa_s), iface,
|
iface, prop);
|
||||||
prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1251,7 +1175,7 @@ int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
|
||||||
return -1;
|
return -1;
|
||||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
||||||
wpas_dbus_get_path(wpa_s), ssid->id);
|
wpa_s->dbus_new_path, ssid->id);
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'",
|
wpa_printf(MSG_DEBUG, "dbus: Register network object '%s'",
|
||||||
net_obj_path);
|
net_obj_path);
|
||||||
|
@ -1320,7 +1244,7 @@ int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid)
|
||||||
return -1;
|
return -1;
|
||||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
||||||
wpas_dbus_get_path(wpa_s), nid);
|
wpa_s->dbus_new_path, nid);
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'",
|
wpa_printf(MSG_DEBUG, "dbus: Unregister network object '%s'",
|
||||||
net_obj_path);
|
net_obj_path);
|
||||||
|
@ -1428,7 +1352,7 @@ int wpas_dbus_unregister_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
||||||
wpas_dbus_get_path(wpa_s), id);
|
wpa_s->dbus_new_path, id);
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'",
|
wpa_printf(MSG_DEBUG, "dbus: Unregister BSS object '%s'",
|
||||||
bss_obj_path);
|
bss_obj_path);
|
||||||
|
@ -1478,7 +1402,7 @@ int wpas_dbus_register_bss(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
||||||
wpas_dbus_get_path(wpa_s), id);
|
wpa_s->dbus_new_path, id);
|
||||||
|
|
||||||
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc));
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
|
@ -1806,9 +1730,9 @@ int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'",
|
wpa_printf(MSG_DEBUG, "dbus: Unregister interface object '%s'",
|
||||||
wpas_dbus_get_path(wpa_s));
|
wpa_s->dbus_new_path);
|
||||||
if (wpa_dbus_unregister_object_per_iface(ctrl_iface,
|
if (wpa_dbus_unregister_object_per_iface(ctrl_iface,
|
||||||
wpas_dbus_get_path(wpa_s)))
|
wpa_s->dbus_new_path))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
wpas_dbus_signal_interface_removed(wpa_s);
|
wpas_dbus_signal_interface_removed(wpa_s);
|
||||||
|
@ -1818,14 +1742,3 @@ int wpas_dbus_unregister_interface(struct wpa_supplicant *wpa_s)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wpas_dbus_get_path - Get an interface's dbus path
|
|
||||||
* @wpa_s: %wpa_supplicant interface structure
|
|
||||||
* Returns: Interface's dbus object path, or %NULL on error
|
|
||||||
*/
|
|
||||||
const char * wpas_dbus_get_path(struct wpa_supplicant *wpa_s)
|
|
||||||
{
|
|
||||||
return wpa_s->dbus_new_path;
|
|
||||||
}
|
|
||||||
|
|
|
@ -72,8 +72,6 @@ enum wpas_dbus_prop {
|
||||||
|
|
||||||
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
|
||||||
|
|
||||||
const char * wpas_dbus_get_path(struct wpa_supplicant *wpa_s);
|
|
||||||
|
|
||||||
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
|
int wpas_dbus_ctrl_iface_init(struct wpas_dbus_priv *priv);
|
||||||
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
|
void wpas_dbus_ctrl_iface_deinit(struct wpas_dbus_priv *iface);
|
||||||
|
|
||||||
|
|
|
@ -626,7 +626,7 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
|
||||||
iface.bridge_ifname = bridge_ifname;
|
iface.bridge_ifname = bridge_ifname;
|
||||||
/* Otherwise, have wpa_supplicant attach to it. */
|
/* Otherwise, have wpa_supplicant attach to it. */
|
||||||
if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
|
if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
|
||||||
const char *path = wpas_dbus_get_path(wpa_s);
|
const char *path = wpa_s->dbus_new_path;
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
||||||
&path, DBUS_TYPE_INVALID);
|
&path, DBUS_TYPE_INVALID);
|
||||||
|
@ -707,13 +707,7 @@ DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
|
||||||
if (wpa_s == NULL)
|
if (wpa_s == NULL)
|
||||||
return wpas_dbus_error_iface_unknown(message);
|
return wpas_dbus_error_iface_unknown(message);
|
||||||
|
|
||||||
path = wpas_dbus_get_path(wpa_s);
|
path = wpa_s->dbus_new_path;
|
||||||
if (path == NULL) {
|
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_handler_get_interface[dbus]: "
|
|
||||||
"interface has no dbus object path set");
|
|
||||||
return wpas_dbus_error_unknown_error(message, "path not set");
|
|
||||||
}
|
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
perror("wpas_dbus_handler_get_interface[dbus]: out of memory "
|
perror("wpas_dbus_handler_get_interface[dbus]: out of memory "
|
||||||
|
@ -896,7 +890,7 @@ DBusMessage * wpas_dbus_getter_interfaces(DBusMessage *message,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
|
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
|
||||||
paths[i] = wpas_dbus_get_path(wpa_s);
|
paths[i] = wpa_s->dbus_new_path;
|
||||||
|
|
||||||
reply = wpas_dbus_simple_array_property_getter(message,
|
reply = wpas_dbus_simple_array_property_getter(message,
|
||||||
DBUS_TYPE_OBJECT_PATH,
|
DBUS_TYPE_OBJECT_PATH,
|
||||||
|
@ -1378,8 +1372,7 @@ DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
|
||||||
/* Construct the object path for this network. */
|
/* Construct the object path for this network. */
|
||||||
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
||||||
wpas_dbus_get_path(wpa_s),
|
wpa_s->dbus_new_path, ssid->id);
|
||||||
ssid->id);
|
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
|
@ -1435,7 +1428,7 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
||||||
/* Extract the network ID and ensure the network */
|
/* Extract the network ID and ensure the network */
|
||||||
/* is actually a child of this interface */
|
/* is actually a child of this interface */
|
||||||
iface = wpas_dbus_new_decompose_object_path(op, &net_id, NULL);
|
iface = wpas_dbus_new_decompose_object_path(op, &net_id, NULL);
|
||||||
if (iface == NULL || strcmp(iface, wpas_dbus_get_path(wpa_s)) != 0) {
|
if (iface == NULL || os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
|
||||||
reply = wpas_dbus_error_invald_args(message, op);
|
reply = wpas_dbus_error_invald_args(message, op);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1497,7 +1490,7 @@ DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
|
||||||
/* Extract the network ID and ensure the network */
|
/* Extract the network ID and ensure the network */
|
||||||
/* is actually a child of this interface */
|
/* is actually a child of this interface */
|
||||||
iface = wpas_dbus_new_decompose_object_path(op, &net_id, NULL);
|
iface = wpas_dbus_new_decompose_object_path(op, &net_id, NULL);
|
||||||
if (iface == NULL || strcmp(iface, wpas_dbus_get_path(wpa_s)) != 0) {
|
if (iface == NULL || os_strcmp(iface, wpa_s->dbus_new_path) != 0) {
|
||||||
reply = wpas_dbus_error_invald_args(message, op);
|
reply = wpas_dbus_error_invald_args(message, op);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -2146,7 +2139,6 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s)
|
struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
DBusMessage *reply = NULL;
|
DBusMessage *reply = NULL;
|
||||||
const char *path = wpas_dbus_get_path(wpa_s);
|
|
||||||
char *bss_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
char *bss_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
struct wpa_bss *bss = NULL;
|
struct wpa_bss *bss = NULL;
|
||||||
|
|
||||||
|
@ -2164,7 +2156,7 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
|
||||||
if (bss)
|
if (bss)
|
||||||
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
||||||
path, bss->id);
|
wpa_s->dbus_new_path, bss->id);
|
||||||
else
|
else
|
||||||
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
|
os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
|
||||||
|
|
||||||
|
@ -2190,7 +2182,6 @@ DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s)
|
struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
DBusMessage *reply = NULL;
|
DBusMessage *reply = NULL;
|
||||||
const char *path = wpas_dbus_get_path(wpa_s);
|
|
||||||
char *net_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
char *net_obj_path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
|
|
||||||
if (net_obj_path == NULL) {
|
if (net_obj_path == NULL) {
|
||||||
|
@ -2202,8 +2193,8 @@ DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
||||||
|
|
||||||
if (wpa_s->current_ssid)
|
if (wpa_s->current_ssid)
|
||||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u", path,
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
||||||
wpa_s->current_ssid->id);
|
wpa_s->dbus_new_path, wpa_s->current_ssid->id);
|
||||||
else
|
else
|
||||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
|
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
|
||||||
|
|
||||||
|
@ -2279,7 +2270,7 @@ DBusMessage * wpas_dbus_getter_bsss(DBusMessage *message,
|
||||||
/* Construct the object path for this BSS. */
|
/* Construct the object path for this BSS. */
|
||||||
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
"%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u",
|
||||||
wpas_dbus_get_path(wpa_s), bss->id);
|
wpa_s->dbus_new_path, bss->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = wpas_dbus_simple_array_property_getter(message,
|
reply = wpas_dbus_simple_array_property_getter(message,
|
||||||
|
@ -2342,7 +2333,7 @@ DBusMessage * wpas_dbus_getter_networks(DBusMessage *message,
|
||||||
/* Construct the object path for this network. */
|
/* Construct the object path for this network. */
|
||||||
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(paths[i++], WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%d",
|
||||||
wpas_dbus_get_path(wpa_s), ssid->id);
|
wpa_s->dbus_new_path, ssid->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = wpas_dbus_simple_array_property_getter(message,
|
reply = wpas_dbus_simple_array_property_getter(message,
|
||||||
|
|
|
@ -288,7 +288,7 @@ DBusMessage * wpas_dbus_setter_process_credentials(
|
||||||
wpa_s->global->dbus,
|
wpa_s->global->dbus,
|
||||||
(WPADBusPropertyAccessor)
|
(WPADBusPropertyAccessor)
|
||||||
wpas_dbus_getter_process_credentials,
|
wpas_dbus_getter_process_credentials,
|
||||||
wpa_s, wpas_dbus_get_path(wpa_s),
|
wpa_s, wpa_s->dbus_new_path,
|
||||||
WPAS_DBUS_NEW_IFACE_WPS,
|
WPAS_DBUS_NEW_IFACE_WPS,
|
||||||
"ProcessCredentials");
|
"ProcessCredentials");
|
||||||
|
|
||||||
|
|
|
@ -397,23 +397,13 @@ void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
const char *path;
|
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* Do nothing if the control interface is not turned on */
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
perror("wpa_supplicant_dbus_notify_scan_results[dbus]: "
|
|
||||||
"interface didn't have a dbus path");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpa_supplicant_dbus_notify_scan_results[dbus]: "
|
|
||||||
"interface didn't have a dbus path; can't send "
|
|
||||||
"scan result signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_IFACE_INTERFACE,
|
|
||||||
"ScanResultsAvailable");
|
"ScanResultsAvailable");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_scan_results[dbus]: "
|
perror("wpa_supplicant_dbus_notify_scan_results[dbus]: "
|
||||||
|
@ -442,7 +432,6 @@ void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
const char *path;
|
|
||||||
const char *new_state_str, *old_state_str;
|
const char *new_state_str, *old_state_str;
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* Do nothing if the control interface is not turned on */
|
||||||
|
@ -456,17 +445,8 @@ void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
||||||
if (new_state == old_state)
|
if (new_state == old_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
|
||||||
"interface didn't have a dbus path");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpa_supplicant_dbus_notify_state_change[dbus]: "
|
|
||||||
"interface didn't have a dbus path; can't send "
|
|
||||||
"signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_IFACE_INTERFACE,
|
|
||||||
"StateChange");
|
"StateChange");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
||||||
|
@ -520,23 +500,14 @@ void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
struct wpas_dbus_priv *iface = wpa_s->global->dbus;
|
||||||
DBusMessage *_signal;
|
DBusMessage *_signal;
|
||||||
const char *path;
|
|
||||||
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
|
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* Do nothing if the control interface is not turned on */
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
perror("wpa_supplicant_dbus_notify_scanning[dbus]: interface "
|
|
||||||
"didn't have a dbus path");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"%s[dbus]: interface didn't have a dbus path; "
|
|
||||||
"can't send scanning signal.", __FUNCTION__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_IFACE_INTERFACE,
|
|
||||||
"Scanning");
|
"Scanning");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_scanning[dbus]: couldn't "
|
perror("wpa_supplicant_dbus_notify_scanning[dbus]: couldn't "
|
||||||
|
@ -567,7 +538,6 @@ void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *iface;
|
struct wpas_dbus_priv *iface;
|
||||||
DBusMessage *_signal = NULL;
|
DBusMessage *_signal = NULL;
|
||||||
const char *path;
|
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* Do nothing if the control interface is not turned on */
|
||||||
if (wpa_s->global == NULL)
|
if (wpa_s->global == NULL)
|
||||||
|
@ -576,17 +546,8 @@ void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
||||||
if (iface == NULL)
|
if (iface == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
_signal = dbus_message_new_signal(wpa_s->dbus_path,
|
||||||
if (path == NULL) {
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
perror("wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
|
||||||
"interface didn't have a dbus path");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
|
||||||
"interface didn't have a dbus path; can't send "
|
|
||||||
"signal.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_signal = dbus_message_new_signal(path, WPAS_DBUS_IFACE_INTERFACE,
|
|
||||||
"WpsCred");
|
"WpsCred");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
perror("wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
||||||
|
@ -739,7 +700,6 @@ int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpas_dbus_priv *ctrl_iface;
|
struct wpas_dbus_priv *ctrl_iface;
|
||||||
DBusConnection *con;
|
DBusConnection *con;
|
||||||
const char *path;
|
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* 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)
|
||||||
|
@ -749,9 +709,7 @@ int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
con = ctrl_iface->con;
|
con = ctrl_iface->con;
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
if (!dbus_connection_unregister_object_path(con, wpa_s->dbus_path))
|
||||||
|
|
||||||
if (!dbus_connection_unregister_object_path(con, path))
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
os_free(wpa_s->dbus_path);
|
os_free(wpa_s->dbus_path);
|
||||||
|
@ -778,14 +736,3 @@ struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wpa_supplicant_get_dbus_path - Get an interface's dbus path
|
|
||||||
* @wpa_s: %wpa_supplicant interface structure
|
|
||||||
* Returns: Interface's dbus object path, or %NULL on error
|
|
||||||
*/
|
|
||||||
const char * wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s)
|
|
||||||
{
|
|
||||||
return wpa_s->dbus_path;
|
|
||||||
}
|
|
||||||
|
|
|
@ -91,7 +91,6 @@ int wpas_dbus_unregister_iface(struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
|
||||||
/* Methods internal to the dbus control interface */
|
/* Methods internal to the dbus control interface */
|
||||||
const char *wpa_supplicant_get_dbus_path(struct wpa_supplicant *wpa_s);
|
|
||||||
struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
|
struct wpa_supplicant * wpa_supplicant_get_iface_by_dbus_path(
|
||||||
struct wpa_global *global, const char *path);
|
struct wpa_global *global, const char *path);
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ DBusMessage * wpas_dbus_global_add_interface(DBusMessage *message,
|
||||||
iface.bridge_ifname = bridge_ifname;
|
iface.bridge_ifname = bridge_ifname;
|
||||||
/* Otherwise, have wpa_supplicant attach to it. */
|
/* Otherwise, have wpa_supplicant attach to it. */
|
||||||
if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
|
if ((wpa_s = wpa_supplicant_add_iface(global, &iface))) {
|
||||||
const char *path = wpa_supplicant_get_dbus_path(wpa_s);
|
const char *path = wpa_s->dbus_path;
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
||||||
&path, DBUS_TYPE_INVALID);
|
&path, DBUS_TYPE_INVALID);
|
||||||
|
@ -272,15 +272,7 @@ DBusMessage * wpas_dbus_global_get_interface(DBusMessage *message,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = wpa_supplicant_get_dbus_path(wpa_s);
|
path = wpa_s->dbus_path;
|
||||||
if (path == NULL) {
|
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
WPAS_ERROR_INTERNAL_ERROR,
|
|
||||||
"an internal error occurred "
|
|
||||||
"getting the interface.");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
dbus_message_append_args(reply,
|
dbus_message_append_args(reply,
|
||||||
DBUS_TYPE_OBJECT_PATH, &path,
|
DBUS_TYPE_OBJECT_PATH, &path,
|
||||||
|
@ -403,8 +395,7 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
||||||
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_BSSIDS_PART "/"
|
"%s/" WPAS_DBUS_BSSIDS_PART "/"
|
||||||
WPAS_DBUS_BSSID_FORMAT,
|
WPAS_DBUS_BSSID_FORMAT,
|
||||||
wpa_supplicant_get_dbus_path(wpa_s),
|
wpa_s->dbus_path, MAC2STR(res->bssid));
|
||||||
MAC2STR(res->bssid));
|
|
||||||
dbus_message_iter_append_basic(&sub_iter,
|
dbus_message_iter_append_basic(&sub_iter,
|
||||||
DBUS_TYPE_OBJECT_PATH, &path);
|
DBUS_TYPE_OBJECT_PATH, &path);
|
||||||
os_free(path);
|
os_free(path);
|
||||||
|
@ -842,8 +833,7 @@ DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
|
||||||
/* Construct the object path for this network. */
|
/* Construct the object path for this network. */
|
||||||
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||||
"%s/" WPAS_DBUS_NETWORKS_PART "/%d",
|
"%s/" WPAS_DBUS_NETWORKS_PART "/%d",
|
||||||
wpa_supplicant_get_dbus_path(wpa_s),
|
wpa_s->dbus_path, ssid->id);
|
||||||
ssid->id);
|
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
|
||||||
|
@ -888,7 +878,7 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the network is actually a child of this interface */
|
/* Ensure the network is actually a child of this interface */
|
||||||
if (strcmp(iface, wpa_supplicant_get_dbus_path(wpa_s)) != 0) {
|
if (os_strcmp(iface, wpa_s->dbus_path) != 0) {
|
||||||
reply = wpas_dbus_new_invalid_network_error(message);
|
reply = wpas_dbus_new_invalid_network_error(message);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1106,6 @@ DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||||
/* Any network */
|
/* Any network */
|
||||||
ssid = NULL;
|
ssid = NULL;
|
||||||
} else {
|
} else {
|
||||||
const char *obj_path;
|
|
||||||
int nid;
|
int nid;
|
||||||
|
|
||||||
if (!dbus_message_get_args(message, NULL,
|
if (!dbus_message_get_args(message, NULL,
|
||||||
|
@ -1136,8 +1125,7 @@ DBusMessage * wpas_dbus_iface_select_network(DBusMessage *message,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* Ensure the object path really points to this interface */
|
/* Ensure the object path really points to this interface */
|
||||||
obj_path = wpa_supplicant_get_dbus_path(wpa_s);
|
if (os_strcmp(iface_obj_path, wpa_s->dbus_path) != 0) {
|
||||||
if (os_strcmp(iface_obj_path, obj_path) != 0) {
|
|
||||||
reply = wpas_dbus_new_invalid_network_error(message);
|
reply = wpas_dbus_new_invalid_network_error(message);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue