mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-18 10:54:03 -05:00
dbus: Remove perror() calls
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.
This commit is contained in:
parent
c49cf2d68f
commit
c2b8c674cb
@ -291,8 +291,7 @@ static int integrate_with_eloop(struct wpas_dbus_priv *priv)
|
|||||||
if (!dbus_connection_set_watch_functions(priv->con, add_watch,
|
if (!dbus_connection_set_watch_functions(priv->con, add_watch,
|
||||||
remove_watch, watch_toggled,
|
remove_watch, watch_toggled,
|
||||||
priv, NULL)) {
|
priv, NULL)) {
|
||||||
perror("dbus_connection_set_watch_functions[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to set up");
|
||||||
wpa_printf(MSG_ERROR, "Not enough memory to set up dbus.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,14 +299,13 @@ static int integrate_with_eloop(struct wpas_dbus_priv *priv)
|
|||||||
remove_timeout,
|
remove_timeout,
|
||||||
timeout_toggled, priv,
|
timeout_toggled, priv,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
perror("dbus_connection_set_timeout_functions[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to set up");
|
||||||
wpa_printf(MSG_ERROR, "Not enough memory to set up dbus.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection_setup_wakeup_main(priv) < 0) {
|
if (connection_setup_wakeup_main(priv) < 0) {
|
||||||
perror("connection_setup_wakeup_main[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not setup main wakeup "
|
||||||
wpa_printf(MSG_ERROR, "Could not setup main wakeup function.");
|
"function");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,17 +636,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
|
|||||||
{
|
{
|
||||||
dbus_uint32_t count = 0;
|
dbus_uint32_t count = 0;
|
||||||
dbus_bool_t success = FALSE;
|
dbus_bool_t success = FALSE;
|
||||||
char *buffer;
|
char *buffer, *nbuffer;;
|
||||||
|
|
||||||
entry->bytearray_value = NULL;
|
entry->bytearray_value = NULL;
|
||||||
entry->array_type = DBUS_TYPE_BYTE;
|
entry->array_type = DBUS_TYPE_BYTE;
|
||||||
|
|
||||||
buffer = os_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
|
buffer = os_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
|
||||||
if (!buffer) {
|
if (!buffer)
|
||||||
perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of "
|
return FALSE;
|
||||||
"memory");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
entry->bytearray_value = buffer;
|
entry->bytearray_value = buffer;
|
||||||
entry->array_len = 0;
|
entry->array_len = 0;
|
||||||
@ -654,14 +651,17 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
|
|||||||
char byte;
|
char byte;
|
||||||
|
|
||||||
if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
|
if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
|
||||||
buffer = os_realloc(buffer, BYTE_ARRAY_ITEM_SIZE *
|
nbuffer = os_realloc(buffer, BYTE_ARRAY_ITEM_SIZE *
|
||||||
(count + BYTE_ARRAY_CHUNK_SIZE));
|
(count + BYTE_ARRAY_CHUNK_SIZE));
|
||||||
if (buffer == NULL) {
|
if (nbuffer == NULL) {
|
||||||
perror("_wpa_dbus_dict_entry_get_byte_array["
|
os_free(buffer);
|
||||||
"dbus] out of memory trying to "
|
wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
|
||||||
"retrieve the string array");
|
"entry_get_byte_array out of "
|
||||||
|
"memory trying to retrieve the "
|
||||||
|
"string array");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
buffer = nbuffer;
|
||||||
}
|
}
|
||||||
entry->bytearray_value = buffer;
|
entry->bytearray_value = buffer;
|
||||||
|
|
||||||
@ -693,17 +693,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
|
|||||||
{
|
{
|
||||||
dbus_uint32_t count = 0;
|
dbus_uint32_t count = 0;
|
||||||
dbus_bool_t success = FALSE;
|
dbus_bool_t success = FALSE;
|
||||||
char **buffer;
|
char **buffer, **nbuffer;
|
||||||
|
|
||||||
entry->strarray_value = NULL;
|
entry->strarray_value = NULL;
|
||||||
entry->array_type = DBUS_TYPE_STRING;
|
entry->array_type = DBUS_TYPE_STRING;
|
||||||
|
|
||||||
buffer = os_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
|
buffer = os_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL)
|
||||||
perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of "
|
return FALSE;
|
||||||
"memory trying to retrieve a string array");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
entry->strarray_value = buffer;
|
entry->strarray_value = buffer;
|
||||||
entry->array_len = 0;
|
entry->array_len = 0;
|
||||||
@ -712,23 +709,26 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
|
|||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
|
if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
|
||||||
buffer = os_realloc(buffer, STR_ARRAY_ITEM_SIZE *
|
nbuffer = os_realloc(buffer, STR_ARRAY_ITEM_SIZE *
|
||||||
(count + STR_ARRAY_CHUNK_SIZE));
|
(count + STR_ARRAY_CHUNK_SIZE));
|
||||||
if (buffer == NULL) {
|
if (nbuffer == NULL) {
|
||||||
perror("_wpa_dbus_dict_entry_get_string_array["
|
os_free(buffer);
|
||||||
"dbus] out of memory trying to "
|
wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
|
||||||
"retrieve the string array");
|
"entry_get_string_array out of "
|
||||||
|
"memory trying to retrieve the "
|
||||||
|
"string array");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
buffer = nbuffer;
|
||||||
}
|
}
|
||||||
entry->strarray_value = buffer;
|
entry->strarray_value = buffer;
|
||||||
|
|
||||||
dbus_message_iter_get_basic(iter, &value);
|
dbus_message_iter_get_basic(iter, &value);
|
||||||
str = os_strdup(value);
|
str = os_strdup(value);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
perror("_wpa_dbus_dict_entry_get_string_array[dbus] "
|
wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_entry_get_"
|
||||||
"out of memory trying to duplicate the string "
|
"string_array out of memory trying to "
|
||||||
"array");
|
"duplicate the string array");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
entry->strarray_value[count] = str;
|
entry->strarray_value[count] = str;
|
||||||
@ -933,10 +933,8 @@ error:
|
|||||||
*/
|
*/
|
||||||
dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict)
|
dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict)
|
||||||
{
|
{
|
||||||
if (!iter_dict) {
|
if (!iter_dict)
|
||||||
perror("wpa_dbus_dict_has_dict_entry[dbus]: out of memory");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
return dbus_message_iter_get_arg_type(iter_dict) ==
|
return dbus_message_iter_get_arg_type(iter_dict) ==
|
||||||
DBUS_TYPE_DICT_ENTRY;
|
DBUS_TYPE_DICT_ENTRY;
|
||||||
}
|
}
|
||||||
|
@ -458,26 +458,13 @@ void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
|||||||
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
"StateChanged");
|
"StateChanged");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL)
|
||||||
perror("wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"couldn't create dbus signal; likely out of memory");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"couldn't create dbus signal; likely out of "
|
|
||||||
"memory.");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
new_state_str = os_strdup(wpa_supplicant_state_txt(new_state));
|
new_state_str = os_strdup(wpa_supplicant_state_txt(new_state));
|
||||||
old_state_str = os_strdup(wpa_supplicant_state_txt(old_state));
|
old_state_str = os_strdup(wpa_supplicant_state_txt(old_state));
|
||||||
if (new_state_str == NULL || old_state_str == NULL) {
|
if (new_state_str == NULL || old_state_str == NULL)
|
||||||
perror("wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"couldn't convert state strings");
|
|
||||||
wpa_printf(MSG_ERROR,
|
|
||||||
"wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"couldn't convert state strings.");
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
/* make state string lowercase to fit new DBus API convention */
|
/* make state string lowercase to fit new DBus API convention */
|
||||||
tmp = new_state_str;
|
tmp = new_state_str;
|
||||||
@ -495,12 +482,10 @@ void wpas_dbus_signal_state_changed(struct wpa_supplicant *wpa_s,
|
|||||||
DBUS_TYPE_STRING, &new_state_str,
|
DBUS_TYPE_STRING, &new_state_str,
|
||||||
DBUS_TYPE_STRING, &old_state_str,
|
DBUS_TYPE_STRING, &old_state_str,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
perror("wpas_dbus_signal_state_changed[dbus]: "
|
|
||||||
"not enough memory to construct state change signal.");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpas_dbus_signal_state_changed[dbus]: "
|
"dbus: wpas_dbus_signal_state_changed: "
|
||||||
"not enough memory to construct state change "
|
"not enough memory to construct state change "
|
||||||
"signal.");
|
"signal");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,19 +715,13 @@ void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
|||||||
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
_signal = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||||
WPAS_DBUS_NEW_IFACE_WPS,
|
WPAS_DBUS_NEW_IFACE_WPS,
|
||||||
"Credentials");
|
"Credentials");
|
||||||
if (!_signal) {
|
if (!_signal)
|
||||||
wpa_printf(MSG_ERROR, "wpas_dbus_signal_wps_cred[dbus]: "
|
|
||||||
"out of memory when creating a signal");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
dbus_message_iter_init_append(_signal, &iter);
|
dbus_message_iter_init_append(_signal, &iter);
|
||||||
|
|
||||||
if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter))
|
||||||
perror("wpas_dbus_signal_wps_cred[dbus]: out of memory "
|
|
||||||
"when opening a dictionary");
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
|
||||||
|
|
||||||
if (cred->auth_type & WPS_AUTH_OPEN)
|
if (cred->auth_type & WPS_AUTH_OPEN)
|
||||||
auth_type[at_num++] = "open";
|
auth_type[at_num++] = "open";
|
||||||
@ -771,11 +750,8 @@ void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
|||||||
if (!wpa_dbus_dict_append_byte_array(
|
if (!wpa_dbus_dict_append_byte_array(
|
||||||
&dict_iter, "BSSID",
|
&dict_iter, "BSSID",
|
||||||
(const char *) wpa_s->current_ssid->bssid,
|
(const char *) wpa_s->current_ssid->bssid,
|
||||||
ETH_ALEN)) {
|
ETH_ALEN))
|
||||||
perror("wpas_dbus_signal_wps_cred[dbus]: out of "
|
|
||||||
"memory when appending bssid to dictionary");
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
|
if (!(wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
|
||||||
@ -791,17 +767,11 @@ void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
|||||||
(const char *) cred->key,
|
(const char *) cred->key,
|
||||||
cred->key_len) &&
|
cred->key_len) &&
|
||||||
wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex",
|
wpa_dbus_dict_append_uint32(&dict_iter, "KeyIndex",
|
||||||
cred->key_idx))) {
|
cred->key_idx)))
|
||||||
perror("wpas_dbus_signal_wps_cred[dbus]: out of memory "
|
|
||||||
"when appending to dictionary");
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
|
||||||
|
|
||||||
if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
if (!wpa_dbus_dict_close_write(&iter, &dict_iter))
|
||||||
perror("wpas_dbus_signal_wps_cred[dbus]: out of memory "
|
|
||||||
"when closing a dictionary");
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
|
||||||
|
|
||||||
dbus_connection_send(iface->con, _signal, NULL);
|
dbus_connection_send(iface->con, _signal, NULL);
|
||||||
|
|
||||||
|
@ -709,16 +709,11 @@ DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
|
|||||||
|
|
||||||
path = wpa_s->dbus_new_path;
|
path = wpa_s->dbus_new_path;
|
||||||
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 "
|
|
||||||
"when creating reply");
|
|
||||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
|
||||||
if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
|
if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
perror("wpas_dbus_handler_get_interface[dbus]: out of memory "
|
|
||||||
"when appending argument to reply");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1338,8 +1333,6 @@ DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
|
|||||||
|
|
||||||
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
perror("wpas_dbus_handler_add_network[dbus]: out of "
|
|
||||||
"memory.");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto err;
|
goto err;
|
||||||
@ -1376,16 +1369,12 @@ DBusMessage * wpas_dbus_handler_add_network(DBusMessage *message,
|
|||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
perror("wpas_dbus_handler_add_network[dbus]: out of memory "
|
|
||||||
"when creating reply");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
|
if (!dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
perror("wpas_dbus_handler_add_network[dbus]: out of memory "
|
|
||||||
"when appending argument to reply");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1552,8 +1541,6 @@ DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
|||||||
|
|
||||||
blob = os_zalloc(sizeof(*blob));
|
blob = os_zalloc(sizeof(*blob));
|
||||||
if (!blob) {
|
if (!blob) {
|
||||||
perror("wpas_dbus_handler_add_blob[dbus] out of memory when "
|
|
||||||
"trying to allocate blob struct");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto err;
|
goto err;
|
||||||
@ -1561,8 +1548,6 @@ DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
|||||||
|
|
||||||
blob->data = os_malloc(blob_len);
|
blob->data = os_malloc(blob_len);
|
||||||
if (!blob->data) {
|
if (!blob->data) {
|
||||||
perror("wpas_dbus_handler_add_blob[dbus] out of memory when "
|
|
||||||
"trying to allocate blob data");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto err;
|
goto err;
|
||||||
@ -1572,8 +1557,6 @@ DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
|||||||
blob->len = blob_len;
|
blob->len = blob_len;
|
||||||
blob->name = os_strdup(blob_name);
|
blob->name = os_strdup(blob_name);
|
||||||
if (!blob->name) {
|
if (!blob->name) {
|
||||||
perror("wpas_dbus_handler_add_blob[dbus] out of memory when "
|
|
||||||
"trying to copy blob name");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto err;
|
goto err;
|
||||||
@ -1623,8 +1606,6 @@ DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
|
|||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
perror("wpas_dbus_handler_get_blob[dbus] out of memory when "
|
|
||||||
"trying to allocate return message");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1636,8 +1617,6 @@ DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
|
|||||||
DBUS_TYPE_BYTE_AS_STRING,
|
DBUS_TYPE_BYTE_AS_STRING,
|
||||||
&array_iter)) {
|
&array_iter)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_handler_get_blob[dbus] out of memory when "
|
|
||||||
"trying to open array");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1646,8 +1625,6 @@ DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
|
|||||||
if (!dbus_message_iter_append_fixed_array(&array_iter, DBUS_TYPE_BYTE,
|
if (!dbus_message_iter_append_fixed_array(&array_iter, DBUS_TYPE_BYTE,
|
||||||
&(blob->data), blob->len)) {
|
&(blob->data), blob->len)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_handler_get_blob[dbus] out of memory when "
|
|
||||||
"trying to append data to array");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1655,8 +1632,6 @@ DBusMessage * wpas_dbus_handler_get_blob(DBusMessage *message,
|
|||||||
|
|
||||||
if (!dbus_message_iter_close_container(&iter, &array_iter)) {
|
if (!dbus_message_iter_close_container(&iter, &array_iter)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_handler_get_blob[dbus] out of memory when "
|
|
||||||
"trying to close array");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
goto out;
|
||||||
@ -2142,12 +2117,9 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
|
|||||||
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;
|
||||||
|
|
||||||
if (bss_obj_path == NULL) {
|
if (bss_obj_path == NULL)
|
||||||
perror("wpas_dbus_getter_current_bss[dbus]: out of "
|
|
||||||
"memory to allocate result argument.");
|
|
||||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: store current BSS or BSS id in wpa_s */
|
/* TODO: store current BSS or BSS id in wpa_s */
|
||||||
if (!is_zero_ether_addr(wpa_s->bssid))
|
if (!is_zero_ether_addr(wpa_s->bssid))
|
||||||
@ -2184,12 +2156,9 @@ DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
|||||||
DBusMessage *reply = NULL;
|
DBusMessage *reply = NULL;
|
||||||
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)
|
||||||
perror("wpas_dbus_getter_current_network[dbus]: out of "
|
|
||||||
"memory to allocate result argument.");
|
|
||||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
@ -2260,8 +2229,6 @@ DBusMessage * wpas_dbus_getter_bsss(DBusMessage *message,
|
|||||||
dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
|
dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
|
||||||
paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (paths[i] == NULL) {
|
if (paths[i] == NULL) {
|
||||||
perror("wpas_dbus_getter_bsss[dbus]: out of "
|
|
||||||
"memory.");
|
|
||||||
reply = dbus_message_new_error(message,
|
reply = dbus_message_new_error(message,
|
||||||
DBUS_ERROR_NO_MEMORY,
|
DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
@ -2319,11 +2286,8 @@ DBusMessage * wpas_dbus_getter_networks(DBusMessage *message,
|
|||||||
|
|
||||||
/* Loop through configured networks and append object path of each */
|
/* Loop through configured networks and append object path of each */
|
||||||
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
|
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
|
||||||
|
|
||||||
paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
paths[i] = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (paths[i] == NULL) {
|
if (paths[i] == NULL) {
|
||||||
perror("wpas_dbus_getter_networks[dbus]: out of "
|
|
||||||
"memory.");
|
|
||||||
reply = dbus_message_new_error(message,
|
reply = dbus_message_new_error(message,
|
||||||
DBUS_ERROR_NO_MEMORY,
|
DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
@ -2367,132 +2331,57 @@ DBusMessage * wpas_dbus_getter_blobs(DBusMessage *message,
|
|||||||
reply = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL);
|
reply = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL);
|
||||||
else
|
else
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (!reply) {
|
if (!reply)
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory when "
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
"trying to initialize return message");
|
NULL);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbus_message_iter_init_append(reply, &iter);
|
dbus_message_iter_init_append(reply, &iter);
|
||||||
|
|
||||||
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
|
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
|
||||||
"a{say}", &variant_iter)) {
|
"a{say}", &variant_iter) ||
|
||||||
dbus_message_unref(reply);
|
!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory when "
|
|
||||||
"trying to open variant");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
|
|
||||||
"{say}", &dict_iter)) {
|
"{say}", &dict_iter)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory when "
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
"trying to open dictionary");
|
NULL);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blob = wpa_s->conf->blobs;
|
blob = wpa_s->conf->blobs;
|
||||||
while (blob) {
|
while (blob) {
|
||||||
if (!dbus_message_iter_open_container(&dict_iter,
|
if (!dbus_message_iter_open_container(&dict_iter,
|
||||||
DBUS_TYPE_DICT_ENTRY,
|
DBUS_TYPE_DICT_ENTRY,
|
||||||
NULL, &entry_iter)) {
|
NULL, &entry_iter) ||
|
||||||
dbus_message_unref(reply);
|
!dbus_message_iter_append_basic(&entry_iter,
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
|
||||||
"when trying to open entry");
|
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_append_basic(&entry_iter,
|
|
||||||
DBUS_TYPE_STRING,
|
DBUS_TYPE_STRING,
|
||||||
&(blob->name))) {
|
&(blob->name)) ||
|
||||||
dbus_message_unref(reply);
|
!dbus_message_iter_open_container(&entry_iter,
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
|
||||||
"when trying to append blob name");
|
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_open_container(&entry_iter,
|
|
||||||
DBUS_TYPE_ARRAY,
|
DBUS_TYPE_ARRAY,
|
||||||
DBUS_TYPE_BYTE_AS_STRING,
|
DBUS_TYPE_BYTE_AS_STRING,
|
||||||
&array_iter)) {
|
&array_iter) ||
|
||||||
dbus_message_unref(reply);
|
!dbus_message_iter_append_fixed_array(&array_iter,
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
|
||||||
"when trying to open array");
|
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_append_fixed_array(&array_iter,
|
|
||||||
DBUS_TYPE_BYTE,
|
DBUS_TYPE_BYTE,
|
||||||
&(blob->data),
|
&(blob->data),
|
||||||
blob->len)) {
|
blob->len) ||
|
||||||
dbus_message_unref(reply);
|
!dbus_message_iter_close_container(&entry_iter,
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
&array_iter) ||
|
||||||
"when trying to append blob data");
|
!dbus_message_iter_close_container(&dict_iter,
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_close_container(&entry_iter,
|
|
||||||
&array_iter)) {
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
|
||||||
"when trying to close array");
|
|
||||||
reply = dbus_message_new_error(message,
|
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_close_container(&dict_iter,
|
|
||||||
&entry_iter)) {
|
&entry_iter)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory "
|
return dbus_message_new_error(message,
|
||||||
"when trying to close entry");
|
DBUS_ERROR_NO_MEMORY,
|
||||||
reply = dbus_message_new_error(message,
|
NULL);
|
||||||
DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blob = blob->next;
|
blob = blob->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_message_iter_close_container(&variant_iter, &dict_iter)) {
|
if (!dbus_message_iter_close_container(&variant_iter, &dict_iter) ||
|
||||||
|
!dbus_message_iter_close_container(&iter, &variant_iter)) {
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory when "
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
"trying to close dictionary");
|
NULL);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_message_iter_close_container(&iter, &variant_iter)) {
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
perror("wpas_dbus_getter_blobs[dbus] out of memory when "
|
|
||||||
"trying to close variant");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2835,20 +2724,15 @@ DBusMessage * wpas_dbus_getter_network_properties(
|
|||||||
DBusMessageIter iter, variant_iter, dict_iter;
|
DBusMessageIter iter, variant_iter, dict_iter;
|
||||||
char **iterator;
|
char **iterator;
|
||||||
char **props = wpa_config_get_all(net->ssid, 0);
|
char **props = wpa_config_get_all(net->ssid, 0);
|
||||||
if (!props) {
|
if (!props)
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] couldn't "
|
|
||||||
"read network properties. out of memory.");
|
|
||||||
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
|
||||||
|
|
||||||
if (message == NULL)
|
if (message == NULL)
|
||||||
reply = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL);
|
reply = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL);
|
||||||
else
|
else
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out of "
|
|
||||||
"memory when trying to initialize return message");
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
goto out;
|
||||||
@ -2857,18 +2741,8 @@ DBusMessage * wpas_dbus_getter_network_properties(
|
|||||||
dbus_message_iter_init_append(reply, &iter);
|
dbus_message_iter_init_append(reply, &iter);
|
||||||
|
|
||||||
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
|
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
|
||||||
"a{sv}", &variant_iter)) {
|
"a{sv}", &variant_iter) ||
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out of "
|
!wpa_dbus_dict_open_write(&variant_iter, &dict_iter)) {
|
||||||
"memory when trying to open variant container");
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wpa_dbus_dict_open_write(&variant_iter, &dict_iter)) {
|
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out of "
|
|
||||||
"memory when trying to open dict");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
@ -2879,8 +2753,6 @@ DBusMessage * wpas_dbus_getter_network_properties(
|
|||||||
while (*iterator) {
|
while (*iterator) {
|
||||||
if (!wpa_dbus_dict_append_string(&dict_iter, *iterator,
|
if (!wpa_dbus_dict_append_string(&dict_iter, *iterator,
|
||||||
*(iterator + 1))) {
|
*(iterator + 1))) {
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out "
|
|
||||||
"of memory when trying to add entry");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message,
|
reply = dbus_message_new_error(message,
|
||||||
DBUS_ERROR_NO_MEMORY,
|
DBUS_ERROR_NO_MEMORY,
|
||||||
@ -2891,18 +2763,8 @@ DBusMessage * wpas_dbus_getter_network_properties(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter)) {
|
if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out of "
|
!dbus_message_iter_close_container(&iter, &variant_iter)) {
|
||||||
"memory when trying to close dictionary");
|
|
||||||
dbus_message_unref(reply);
|
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dbus_message_iter_close_container(&iter, &variant_iter)) {
|
|
||||||
perror("wpas_dbus_getter_network_properties[dbus] out of "
|
|
||||||
"memory when trying to close variant container");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -67,9 +67,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
"wpas_dbus_handler_wps_start"
|
"wpas_dbus_handler_wps_start"
|
||||||
"[dbus]: "
|
"[dbus]: "
|
||||||
"wrong Role type. string required");
|
"wrong Role type. string required");
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Role must be a string");
|
message, "Role must be a string");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
dbus_message_iter_get_basic(&variant_iter, &val);
|
dbus_message_iter_get_basic(&variant_iter, &val);
|
||||||
if (os_strcmp(val, "enrollee") == 0)
|
if (os_strcmp(val, "enrollee") == 0)
|
||||||
@ -80,8 +79,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"unknown role %s", val);
|
"unknown role %s", val);
|
||||||
reply = wpas_dbus_error_invald_args(message, val);
|
return wpas_dbus_error_invald_args(message,
|
||||||
goto out;
|
val);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "Type") == 0) {
|
} else if (strcmp(key, "Type") == 0) {
|
||||||
dbus_message_iter_recurse(&entry_iter, &variant_iter);
|
dbus_message_iter_recurse(&entry_iter, &variant_iter);
|
||||||
@ -90,9 +89,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"wrong Type type. string required");
|
"wrong Type type. string required");
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Type must be a string");
|
message, "Type must be a string");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
dbus_message_iter_get_basic(&variant_iter, &val);
|
dbus_message_iter_get_basic(&variant_iter, &val);
|
||||||
if (os_strcmp(val, "pin") == 0)
|
if (os_strcmp(val, "pin") == 0)
|
||||||
@ -103,9 +101,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"unknown type %s", val);
|
"unknown type %s", val);
|
||||||
reply = wpas_dbus_error_invald_args(message,
|
return wpas_dbus_error_invald_args(message,
|
||||||
val);
|
val);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "Bssid") == 0) {
|
} else if (strcmp(key, "Bssid") == 0) {
|
||||||
dbus_message_iter_recurse(&entry_iter, &variant_iter);
|
dbus_message_iter_recurse(&entry_iter, &variant_iter);
|
||||||
@ -116,9 +113,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"wrong Bssid type. byte array required");
|
"wrong Bssid type. byte array required");
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Bssid must be a byte array");
|
message, "Bssid must be a byte array");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
dbus_message_iter_recurse(&variant_iter, &array_iter);
|
dbus_message_iter_recurse(&variant_iter, &array_iter);
|
||||||
dbus_message_iter_get_fixed_array(&array_iter, &bssid,
|
dbus_message_iter_get_fixed_array(&array_iter, &bssid,
|
||||||
@ -127,9 +123,8 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"wrong Bssid length %d", len);
|
"wrong Bssid length %d", len);
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Bssid is wrong length");
|
message, "Bssid is wrong length");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (os_strcmp(key, "Pin") == 0) {
|
else if (os_strcmp(key, "Pin") == 0) {
|
||||||
@ -139,17 +134,15 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"wrong Pin type. string required");
|
"wrong Pin type. string required");
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Pin must be a string");
|
message, "Pin must be a string");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
dbus_message_iter_get_basic(&variant_iter, &pin);
|
dbus_message_iter_get_basic(&variant_iter, &pin);
|
||||||
} else {
|
} else {
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"wpas_dbus_handler_wps_start[dbus]: "
|
"wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"unknown key %s", key);
|
"unknown key %s", key);
|
||||||
reply = wpas_dbus_error_invald_args(message, key);
|
return wpas_dbus_error_invald_args(message, key);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_next(&dict_iter);
|
dbus_message_iter_next(&dict_iter);
|
||||||
@ -158,23 +151,20 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
if (role == 0) {
|
if (role == 0) {
|
||||||
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"Role not specified");
|
"Role not specified");
|
||||||
reply = wpas_dbus_error_invald_args(message,
|
return wpas_dbus_error_invald_args(message,
|
||||||
"Role not specified");
|
"Role not specified");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
else if (role == 1 && type == 0) {
|
else if (role == 1 && type == 0) {
|
||||||
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"Type not specified");
|
"Type not specified");
|
||||||
reply = wpas_dbus_error_invald_args(message,
|
return wpas_dbus_error_invald_args(message,
|
||||||
"Type not specified");
|
"Type not specified");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
else if (role == 2 && pin == NULL) {
|
else if (role == 2 && pin == NULL) {
|
||||||
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
wpa_printf(MSG_DEBUG, "wpas_dbus_handler_wps_start[dbus]: "
|
||||||
"Pin required for registrar role.");
|
"Pin required for registrar role.");
|
||||||
reply = wpas_dbus_error_invald_args(
|
return wpas_dbus_error_invald_args(
|
||||||
message, "Pin required for registrar role.");
|
message, "Pin required for registrar role.");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == 2)
|
if (role == 2)
|
||||||
@ -191,52 +181,38 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||||||
"wpas_wps_failed in role %s and key %s.",
|
"wpas_wps_failed in role %s and key %s.",
|
||||||
(role == 1 ? "enrollee" : "registrar"),
|
(role == 1 ? "enrollee" : "registrar"),
|
||||||
(type == 0 ? "" : (type == 1 ? "pin" : "pbc")));
|
(type == 0 ? "" : (type == 1 ? "pin" : "pbc")));
|
||||||
reply = wpas_dbus_error_unknown_error(message,
|
return wpas_dbus_error_unknown_error(message,
|
||||||
"wps start failed");
|
"wps start failed");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
perror("wpas_dbus_handler_wps_start[dbus]: out of memory "
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
"when creating reply");
|
NULL);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
|
||||||
NULL);
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_message_iter_init_append(reply, &iter);
|
dbus_message_iter_init_append(reply, &iter);
|
||||||
if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
|
if (!wpa_dbus_dict_open_write(&iter, &dict_iter)) {
|
||||||
perror("wpas_dbus_handler_wps_start[dbus]: out of memory "
|
|
||||||
"when opening dictionary");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (os_strlen(npin) > 0) {
|
if (os_strlen(npin) > 0) {
|
||||||
if (!wpa_dbus_dict_append_string(&dict_iter, "Pin", npin)) {
|
if (!wpa_dbus_dict_append_string(&dict_iter, "Pin", npin)) {
|
||||||
perror("wpas_dbus_handler_wps_start[dbus]: "
|
|
||||||
"out of memory when appending pin");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message,
|
return dbus_message_new_error(message,
|
||||||
DBUS_ERROR_NO_MEMORY,
|
DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
if (!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
||||||
perror("wpas_dbus_handler_wps_start[dbus]: out of memory "
|
|
||||||
"when closing dictionary");
|
|
||||||
dbus_message_unref(reply);
|
dbus_message_unref(reply);
|
||||||
reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
|
||||||
NULL);
|
NULL);
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,9 +550,8 @@ int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface,
|
|||||||
if (!dbus_connection_register_object_path(iface->con,
|
if (!dbus_connection_register_object_path(iface->con,
|
||||||
dbus_path, &wpa_vtable,
|
dbus_path, &wpa_vtable,
|
||||||
obj_desc)) {
|
obj_desc)) {
|
||||||
perror("dbus_connection_register_object_path[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||||
wpa_printf(MSG_ERROR, "Could not set up DBus message "
|
"handler");
|
||||||
"handler.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,14 +565,12 @@ int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface,
|
|||||||
case DBUS_REQUEST_NAME_REPLY_EXISTS:
|
case DBUS_REQUEST_NAME_REPLY_EXISTS:
|
||||||
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
||||||
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
|
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
|
||||||
perror("dbus_bus_request_name[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||||
wpa_printf(MSG_ERROR, "Could not request DBus service name: "
|
"already registered");
|
||||||
"already registered.");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
perror("dbus_bus_request_name[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||||
wpa_printf(MSG_ERROR, "Could not request DBus service name: "
|
"%s %s", error.name, error.message);
|
||||||
"%s %s.", error.name, error.message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
@ -619,10 +616,8 @@ int wpa_dbus_register_object_per_iface(
|
|||||||
/* Register the message handler for the interface functions */
|
/* Register the message handler for the interface functions */
|
||||||
if (!dbus_connection_register_object_path(con, path, &vtable,
|
if (!dbus_connection_register_object_path(con, path, &vtable,
|
||||||
obj_desc)) {
|
obj_desc)) {
|
||||||
perror("wpa_dbus_register_iface [dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||||
wpa_printf(MSG_ERROR, "Could not set up DBus message "
|
"handler for interface %s object %s", ifname, path);
|
||||||
"handler for interface %s\n"
|
|
||||||
"and object %s.", ifname, path);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,10 +406,8 @@ void wpa_supplicant_dbus_notify_scan_results(struct wpa_supplicant *wpa_s)
|
|||||||
WPAS_DBUS_IFACE_INTERFACE,
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
"ScanResultsAvailable");
|
"ScanResultsAvailable");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_scan_results[dbus]: "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
|
||||||
"couldn't create dbus signal; likely out of memory");
|
"results signal");
|
||||||
wpa_printf(MSG_ERROR, "dbus control interface: not enough "
|
|
||||||
"memory to send scan results signal.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dbus_connection_send(iface->con, _signal, NULL);
|
dbus_connection_send(iface->con, _signal, NULL);
|
||||||
@ -449,23 +447,19 @@ void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
|||||||
WPAS_DBUS_IFACE_INTERFACE,
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
"StateChange");
|
"StateChange");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
|
||||||
"couldn't create dbus signal; likely out of memory");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpa_supplicant_dbus_notify_state_change[dbus]: "
|
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||||
"couldn't create dbus signal; likely out of "
|
"could not create dbus signal; likely out of "
|
||||||
"memory.");
|
"memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_state_str = wpa_supplicant_state_txt(new_state);
|
new_state_str = wpa_supplicant_state_txt(new_state);
|
||||||
old_state_str = wpa_supplicant_state_txt(old_state);
|
old_state_str = wpa_supplicant_state_txt(old_state);
|
||||||
if (new_state_str == NULL || old_state_str == NULL) {
|
if (new_state_str == NULL || old_state_str == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
|
||||||
"couldn't convert state strings");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpa_supplicant_dbus_notify_state_change[dbus]: "
|
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||||
"couldn't convert state strings.");
|
"Could not convert state strings");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,12 +467,10 @@ void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
|
|||||||
DBUS_TYPE_STRING, &new_state_str,
|
DBUS_TYPE_STRING, &new_state_str,
|
||||||
DBUS_TYPE_STRING, &old_state_str,
|
DBUS_TYPE_STRING, &old_state_str,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
perror("wpa_supplicant_dbus_notify_state_change[dbus]: "
|
|
||||||
"not enough memory to construct state change signal.");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpa_supplicant_dbus_notify_state_change[dbus]: "
|
"dbus: wpa_supplicant_dbus_notify_state_change: "
|
||||||
"not enough memory to construct state change "
|
"Not enough memory to construct state change "
|
||||||
"signal.");
|
"signal");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,11 +502,8 @@ void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
|
|||||||
WPAS_DBUS_IFACE_INTERFACE,
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
"Scanning");
|
"Scanning");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_scanning[dbus]: couldn't "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
|
||||||
"create dbus signal; likely out of memory");
|
"results signal");
|
||||||
wpa_printf(MSG_ERROR, "%s[dbus]: dbus control interface: not "
|
|
||||||
"enough memory to send scan results signal.",
|
|
||||||
__FUNCTION__);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,10 +512,8 @@ void wpa_supplicant_dbus_notify_scanning(struct wpa_supplicant *wpa_s)
|
|||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
dbus_connection_send(iface->con, _signal, NULL);
|
dbus_connection_send(iface->con, _signal, NULL);
|
||||||
} else {
|
} else {
|
||||||
perror("wpa_supplicant_dbus_notify_scanning[dbus]: not enough "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to construct "
|
||||||
"memory to construct signal.");
|
"signal");
|
||||||
wpa_printf(MSG_ERROR, "%s[dbus]: not enough memory to "
|
|
||||||
"construct signal.", __FUNCTION__);
|
|
||||||
}
|
}
|
||||||
dbus_message_unref(_signal);
|
dbus_message_unref(_signal);
|
||||||
}
|
}
|
||||||
@ -550,12 +537,10 @@ void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
|||||||
WPAS_DBUS_IFACE_INTERFACE,
|
WPAS_DBUS_IFACE_INTERFACE,
|
||||||
"WpsCred");
|
"WpsCred");
|
||||||
if (_signal == NULL) {
|
if (_signal == NULL) {
|
||||||
perror("wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
|
||||||
"couldn't create dbus signal; likely out of memory");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
"dbus: wpa_supplicant_dbus_notify_wps_cred: "
|
||||||
"couldn't create dbus signal; likely out of "
|
"Could not create dbus signal; likely out of "
|
||||||
"memory.");
|
"memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,11 +548,9 @@ void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s,
|
|||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
|
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
|
||||||
&cred->cred_attr, cred->cred_attr_len,
|
&cred->cred_attr, cred->cred_attr_len,
|
||||||
DBUS_TYPE_INVALID)) {
|
DBUS_TYPE_INVALID)) {
|
||||||
perror("wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
|
||||||
"not enough memory to construct signal.");
|
|
||||||
wpa_printf(MSG_ERROR,
|
wpa_printf(MSG_ERROR,
|
||||||
"wpa_supplicant_dbus_notify_wps_cred[dbus]: "
|
"dbus: wpa_supplicant_dbus_notify_wps_cred: "
|
||||||
"not enough memory to construct signal.");
|
"Not enough memory to construct signal");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,9 +587,8 @@ int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface)
|
|||||||
if (!dbus_connection_register_object_path(iface->con,
|
if (!dbus_connection_register_object_path(iface->con,
|
||||||
WPAS_DBUS_PATH, &wpas_vtable,
|
WPAS_DBUS_PATH, &wpas_vtable,
|
||||||
iface)) {
|
iface)) {
|
||||||
perror("dbus_connection_register_object_path[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||||
wpa_printf(MSG_ERROR, "Could not set up DBus message "
|
"handler");
|
||||||
"handler.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,14 +602,12 @@ int wpa_supplicant_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface)
|
|||||||
case DBUS_REQUEST_NAME_REPLY_EXISTS:
|
case DBUS_REQUEST_NAME_REPLY_EXISTS:
|
||||||
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
|
||||||
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
|
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
|
||||||
perror("dbus_bus_request_name[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||||
wpa_printf(MSG_ERROR, "Could not request DBus service name: "
|
"already registered");
|
||||||
"already registered.");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
perror("dbus_bus_request_name[dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not request service name: "
|
||||||
wpa_printf(MSG_ERROR, "Could not request DBus service name: "
|
"%s %s", error.name, error.message);
|
||||||
"%s %s.", error.name, error.message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
@ -657,7 +637,6 @@ int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
|
|||||||
DBusObjectPathVTable vtable = {
|
DBusObjectPathVTable vtable = {
|
||||||
NULL, &wpas_iface_message_handler, NULL, NULL, NULL, NULL
|
NULL, &wpas_iface_message_handler, NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
/* Do nothing if the control interface is not turned on */
|
/* Do nothing if the control interface is not turned on */
|
||||||
if (ctrl_iface == NULL)
|
if (ctrl_iface == NULL)
|
||||||
@ -677,15 +656,12 @@ int wpas_dbus_register_iface(struct wpa_supplicant *wpa_s)
|
|||||||
/* Register the message handler for the interface functions */
|
/* Register the message handler for the interface functions */
|
||||||
if (!dbus_connection_register_fallback(con, wpa_s->dbus_path, &vtable,
|
if (!dbus_connection_register_fallback(con, wpa_s->dbus_path, &vtable,
|
||||||
wpa_s)) {
|
wpa_s)) {
|
||||||
perror("wpas_dbus_register_iface [dbus]");
|
wpa_printf(MSG_ERROR, "dbus: Could not set up message "
|
||||||
wpa_printf(MSG_ERROR, "Could not set up DBus message "
|
"handler for interface %s", wpa_s->ifname);
|
||||||
"handler for interface %s.", wpa_s->ifname);
|
return -1;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,10 +362,9 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
|||||||
/* Ensure we've actually got scan results to return */
|
/* Ensure we've actually got scan results to return */
|
||||||
if (wpa_s->scan_res == NULL &&
|
if (wpa_s->scan_res == NULL &&
|
||||||
wpa_supplicant_get_scan_results(wpa_s) < 0) {
|
wpa_supplicant_get_scan_results(wpa_s) < 0) {
|
||||||
reply = dbus_message_new_error(message, WPAS_ERROR_SCAN_ERROR,
|
return dbus_message_new_error(message, WPAS_ERROR_SCAN_ERROR,
|
||||||
"An error ocurred getting scan "
|
"An error ocurred getting scan "
|
||||||
"results.");
|
"results.");
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize the return message */
|
/* Create and initialize the return message */
|
||||||
@ -382,11 +381,8 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
|||||||
|
|
||||||
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
perror("wpas_dbus_iface_scan_results[dbus]: out of "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to "
|
||||||
"memory.");
|
"send scan results signal");
|
||||||
wpa_printf(MSG_ERROR, "dbus control interface: not "
|
|
||||||
"enough memory to send scan results "
|
|
||||||
"signal.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Construct the object path for this network. Note that ':'
|
/* Construct the object path for this network. Note that ':'
|
||||||
@ -403,7 +399,6 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
|
|||||||
|
|
||||||
dbus_message_iter_close_container(&iter, &sub_iter);
|
dbus_message_iter_close_container(&iter, &sub_iter);
|
||||||
|
|
||||||
out:
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,11 +805,8 @@ DBusMessage * wpas_dbus_iface_add_network(DBusMessage *message,
|
|||||||
|
|
||||||
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
perror("wpas_dbus_iface_scan_results[dbus]: out of "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to send scan "
|
||||||
"memory.");
|
"results signal");
|
||||||
wpa_printf(MSG_ERROR, "dbus control interface: not "
|
|
||||||
"enough memory to send scan results "
|
|
||||||
"signal.");
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,10 +1316,8 @@ DBusMessage * wpas_dbus_iface_get_scanning(DBusMessage *message,
|
|||||||
dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &scanning,
|
dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &scanning,
|
||||||
DBUS_TYPE_INVALID);
|
DBUS_TYPE_INVALID);
|
||||||
} else {
|
} else {
|
||||||
perror("wpas_dbus_iface_get_scanning[dbus]: out of "
|
wpa_printf(MSG_ERROR, "dbus: Not enough memory to return "
|
||||||
"memory.");
|
"scanning state");
|
||||||
wpa_printf(MSG_ERROR, "dbus control interface: not enough "
|
|
||||||
"memory to return scanning state.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
|
Loading…
Reference in New Issue
Block a user