summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
Diffstat (limited to 'hcid')
-rw-r--r--hcid/adapter.c113
-rw-r--r--hcid/adapter.h3
-rw-r--r--hcid/agent.c11
-rw-r--r--hcid/dbus-database.c7
-rw-r--r--hcid/dbus-hci.c114
-rw-r--r--hcid/dbus-hci.h3
-rw-r--r--hcid/dbus-security.c32
-rw-r--r--hcid/dbus-test.c30
8 files changed, 159 insertions, 154 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 1383ed50..9c70b0e9 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -59,6 +59,8 @@
#include "dbus-hci.h"
#include "dbus-sdp.h"
#include "dbus-database.h"
+#include "dbus-service.h"
+#include "dbus-security.h"
#include "dbus-error.h"
#include "error.h"
#include "glib-helper.h"
@@ -2574,9 +2576,7 @@ failed:
remove_pending_device(adapter);
cleanup:
- name_listener_remove(adapter->bonding->conn,
- dbus_message_get_sender(adapter->bonding->msg),
- (name_cb_t) create_bond_req_exit, adapter);
+ name_listener_id_remove(adapter->bonding->listener_id);
bonding_request_free(adapter->bonding);
adapter->bonding = NULL;
@@ -2584,6 +2584,51 @@ cleanup:
return FALSE;
}
+static void create_bond_req_exit(const char *name, void *user_data)
+{
+ struct adapter *adapter = user_data;
+ char path[MAX_PATH_LENGTH];
+ GSList *l;
+
+ snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, adapter->dev_id);
+
+ debug("CreateConnection requestor (%s) exited before bonding was completed",
+ name);
+
+ cancel_passkey_agent_requests(adapter->passkey_agents, path,
+ &adapter->bonding->bdaddr);
+ release_passkey_agents(adapter, &adapter->bonding->bdaddr);
+
+ l = g_slist_find_custom(adapter->pin_reqs, &adapter->bonding->bdaddr,
+ pin_req_cmp);
+ if (l) {
+ struct pending_pin_info *p = l->data;
+
+ if (!p->replied) {
+ int dd;
+
+ dd = hci_open_dev(adapter->dev_id);
+ if (dd >= 0) {
+ hci_send_cmd(dd, OGF_LINK_CTL,
+ OCF_PIN_CODE_NEG_REPLY,
+ 6, &adapter->bonding->bdaddr);
+ hci_close_dev(dd);
+ }
+ }
+
+ adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, p);
+ g_free(p);
+ }
+
+ remove_pending_device(adapter);
+
+ g_io_channel_close(adapter->bonding->io);
+ if (adapter->bonding->io_id)
+ g_source_remove(adapter->bonding->io_id);
+ bonding_request_free(adapter->bonding);
+ adapter->bonding = NULL;
+}
+
static DBusHandlerResult create_bonding(DBusConnection *conn, DBusMessage *msg,
const char *address, const char *agent_path,
void *data)
@@ -2591,6 +2636,7 @@ static DBusHandlerResult create_bonding(DBusConnection *conn, DBusMessage *msg,
char filename[PATH_MAX + 1];
char *str;
struct adapter *adapter = data;
+ struct bonding_request_info *bonding;
bdaddr_t bdaddr;
int sk;
@@ -2622,21 +2668,23 @@ static DBusHandlerResult create_bonding(DBusConnection *conn, DBusMessage *msg,
if (sk < 0)
return error_connection_attempt_failed(conn, msg, 0);
- adapter->bonding = bonding_request_new(conn, msg, adapter, address,
- agent_path);
- if (!adapter->bonding) {
+ bonding = bonding_request_new(conn, msg, adapter, address, agent_path);
+ if (!bonding) {
close(sk);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
- adapter->bonding->io = g_io_channel_unix_new(sk);
- adapter->bonding->io_id = g_io_add_watch(adapter->bonding->io,
- G_IO_OUT | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
- (GIOFunc) create_bonding_conn_complete,
- adapter);
+ bonding->io = g_io_channel_unix_new(sk);
+ bonding->io_id = g_io_add_watch(bonding->io,
+ G_IO_OUT | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
+ (GIOFunc) create_bonding_conn_complete,
+ adapter);
+
+ bonding->listener_id = name_listener_add(conn,
+ dbus_message_get_sender(msg),
+ create_bond_req_exit, adapter);
- name_listener_add(conn, dbus_message_get_sender(msg),
- (name_cb_t) create_bond_req_exit, adapter);
+ adapter->bonding = bonding;
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -2892,6 +2940,19 @@ static DBusHandlerResult adapter_get_encryption_key_size(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static void periodic_discover_req_exit(const char *name, void *user_data)
+{
+ struct adapter *adapter = user_data;
+
+ debug("PeriodicDiscovery requestor (%s) exited", name);
+
+ /* Cleanup the discovered devices list and send the cmd to exit from
+ * periodic inquiry or cancel remote name request. The return value can
+ * be ignored. */
+
+ cancel_periodic_discovery(adapter);
+}
+
static DBusHandlerResult adapter_start_periodic(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -2966,9 +3027,10 @@ static DBusHandlerResult adapter_start_periodic(DBusConnection *conn,
/* track the request owner to cancel it automatically if the owner
* exits */
- name_listener_add(conn, dbus_message_get_sender(msg),
- (name_cb_t) periodic_discover_req_exit,
- adapter);
+ adapter->pdiscov_listener = name_listener_add(conn,
+ dbus_message_get_sender(msg),
+ periodic_discover_req_exit,
+ adapter);
return send_message_and_unref(conn, reply);
}
@@ -3079,6 +3141,17 @@ static DBusHandlerResult adapter_get_pdiscov_resolve(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static void discover_devices_req_exit(const char *name, void *user_data)
+{
+ struct adapter *adapter = user_data;
+
+ debug("DiscoverDevices requestor (%s) exited", name);
+
+ /* Cleanup the discovered devices list and send the command to cancel
+ * inquiry or cancel remote name request. The return can be ignored. */
+ cancel_discovery(adapter);
+}
+
static DBusHandlerResult adapter_discover_devices(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -3152,8 +3225,10 @@ static DBusHandlerResult adapter_discover_devices(DBusConnection *conn,
/* track the request owner to cancel it automatically if the owner
* exits */
- name_listener_add(conn, dbus_message_get_sender(msg),
- (name_cb_t) discover_devices_req_exit, adapter);
+ adapter->discov_listener = name_listener_add(conn,
+ dbus_message_get_sender(msg),
+ discover_devices_req_exit,
+ adapter);
return send_message_and_unref(conn, reply);
}
@@ -3692,7 +3767,7 @@ static DBusHandlerResult request_mode(DBusConnection *conn,
req->msg = dbus_message_ref(msg);
req->mode = new_mode;
req->id = name_listener_add(conn, dbus_message_get_sender(msg),
- (name_cb_t) session_exit, req);
+ session_exit, req);
if (!adapter->sessions)
adapter->global_mode = adapter->mode;
diff --git a/hcid/adapter.h b/hcid/adapter.h
index 421684f8..e9631ee0 100644
--- a/hcid/adapter.h
+++ b/hcid/adapter.h
@@ -58,6 +58,7 @@ struct bonding_request_info {
bdaddr_t bdaddr;
GIOChannel *io;
guint io_id;
+ guint listener_id;
int hci_status;
int cancel;
int auth_active;
@@ -98,7 +99,9 @@ struct adapter {
GSList *found_devices;
GSList *oor_devices; /* out of range device list */
char *pdiscov_requestor; /* periodic discovery requestor unique name */
+ guint pdiscov_listener;
char *discov_requestor; /* discovery requestor unique name */
+ guint discov_listener;
DBusMessage *discovery_cancel; /* discovery cancel message request */
GSList *passkey_agents;
struct agent *agent; /* For the new API */
diff --git a/hcid/agent.c b/hcid/agent.c
index 330d00e4..831f68b2 100644
--- a/hcid/agent.c
+++ b/hcid/agent.c
@@ -70,6 +70,7 @@ struct agent {
guint timeout;
agent_remove_cb remove_cb;
void *remove_cb_data;
+ guint listener_id;
};
struct agent_request {
@@ -125,8 +126,10 @@ static void agent_request_free(struct agent_request *req)
g_free(req);
}
-static void agent_exited(const char *name, struct agent *agent)
+static void agent_exited(const char *name, void *user_data)
{
+ struct agent *agent = user_data;
+
debug("Agent %s exited without calling Unregister", name);
agent_destroy(agent, TRUE);
@@ -169,8 +172,7 @@ static void agent_free(struct agent *agent)
g_source_remove(agent->timeout);
if (!agent->exited) {
- name_listener_remove(connection, agent->name,
- (name_cb_t) agent_exited, agent);
+ name_listener_id_remove(agent->listener_id);
agent_release(agent);
}
@@ -215,7 +217,8 @@ struct agent *agent_create(struct adapter *adapter, const char *name,
(GSourceFunc) agent_timeout, agent);
}
- name_listener_add(connection, name, (name_cb_t) agent_exited, agent);
+ agent->listener_id = name_listener_add(connection, name, agent_exited,
+ agent);
return agent;
}
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index acf5301c..cf2369b1 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -58,6 +58,7 @@ static GSList *records = NULL;
struct record_data {
uint32_t handle;
char *sender;
+ guint listener_id;
};
static struct record_data *find_record(uint32_t handle, const char *sender)
@@ -133,7 +134,9 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
records = g_slist_append(records, user_record);
- name_listener_add(conn, sender, exit_callback, user_record);
+ user_record->listener_id = name_listener_add(conn, sender,
+ exit_callback,
+ user_record);
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -314,7 +317,7 @@ int remove_record(DBusConnection *conn, const char *sender,
if (!user_record)
return -1;
- name_listener_remove(conn, sender, exit_callback, user_record);
+ name_listener_id_remove(user_record->listener_id);
records = g_slist_remove(records, user_record);
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 319d7cbd..c8d01f7f 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -334,10 +334,8 @@ static void reply_pending_requests(const char *path, struct adapter *adapter)
remove_pending_device(adapter);
- name_listener_remove(connection,
- dbus_message_get_sender(adapter->bonding->msg),
- (name_cb_t) create_bond_req_exit,
- adapter);
+ name_listener_id_remove(adapter->bonding->listener_id);
+
if (adapter->bonding->io_id)
g_source_remove(adapter->bonding->io_id);
g_io_channel_close(adapter->bonding->io);
@@ -418,18 +416,15 @@ int unregister_adapter_path(const char *path)
}
if (adapter->discov_requestor) {
- name_listener_remove(connection,
- adapter->discov_requestor,
- (name_cb_t) discover_devices_req_exit, adapter);
+ name_listener_id_remove(adapter->discov_listener);
+ adapter->discov_listener = 0;
g_free(adapter->discov_requestor);
adapter->discov_requestor = NULL;
}
if (adapter->pdiscov_requestor) {
- name_listener_remove(connection,
- adapter->pdiscov_requestor,
- (name_cb_t) periodic_discover_req_exit,
- adapter);
+ name_listener_id_remove(adapter->pdiscov_listener);
+ adapter->pdiscov_listener = 0;
g_free(adapter->pdiscov_requestor);
adapter->pdiscov_requestor = NULL;
}
@@ -835,17 +830,15 @@ int hcid_dbus_stop_device(uint16_t id)
release_passkey_agents(adapter, NULL);
if (adapter->discov_requestor) {
- name_listener_remove(connection, adapter->discov_requestor,
- (name_cb_t) discover_devices_req_exit,
- adapter);
+ name_listener_id_remove(adapter->discov_listener);
+ adapter->discov_listener = 0;
g_free(adapter->discov_requestor);
adapter->discov_requestor = NULL;
}
if (adapter->pdiscov_requestor) {
- name_listener_remove(connection, adapter->pdiscov_requestor,
- (name_cb_t) periodic_discover_req_exit,
- adapter);
+ name_listener_id_remove(adapter->pdiscov_listener);
+ adapter->pdiscov_listener = 0;
g_free(adapter->pdiscov_requestor);
adapter->pdiscov_requestor = NULL;
}
@@ -1143,9 +1136,7 @@ proceed:
}
cleanup:
- name_listener_remove(connection,
- dbus_message_get_sender(adapter->bonding->msg),
- (name_cb_t) create_bond_req_exit, adapter);
+ name_listener_id_remove(adapter->bonding->listener_id);
if (adapter->bonding->io_id)
g_source_remove(adapter->bonding->io_id);
@@ -1417,8 +1408,8 @@ void hcid_dbus_inquiry_complete(bdaddr_t *local)
adapter->found_devices = NULL;
if (adapter->discov_requestor) {
- name_listener_remove(connection, adapter->discov_requestor,
- (name_cb_t) discover_devices_req_exit, adapter);
+ name_listener_id_remove(adapter->discov_listener);
+ adapter->discov_listener = 0;
g_free(adapter->discov_requestor);
adapter->discov_requestor = NULL;
@@ -1525,9 +1516,8 @@ void hcid_dbus_periodic_inquiry_exit(bdaddr_t *local, uint8_t status)
adapter->oor_devices = NULL;
if (adapter->pdiscov_requestor) {
- name_listener_remove(connection, adapter->pdiscov_requestor,
- (name_cb_t) periodic_discover_req_exit,
- adapter);
+ name_listener_id_remove(adapter->pdiscov_listener);
+ adapter->pdiscov_listener = 0;
g_free(adapter->pdiscov_requestor);
adapter->pdiscov_requestor = NULL;
}
@@ -1858,8 +1848,8 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
/* The discovery completed signal must be sent only for discover
* devices request WITH name resolving */
if (adapter->discov_requestor) {
- name_listener_remove(connection, adapter->discov_requestor,
- (name_cb_t) discover_devices_req_exit, adapter);
+ name_listener_id_remove(adapter->discov_listener);
+ adapter->discov_listener = 0;
g_free(adapter->discov_requestor);
adapter->discov_requestor = NULL;
@@ -2032,10 +2022,8 @@ void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status,
send_message_and_unref(connection, reply);
}
- name_listener_remove(connection,
- dbus_message_get_sender(adapter->bonding->msg),
- (name_cb_t) create_bond_req_exit,
- adapter);
+ name_listener_id_remove(adapter->bonding->listener_id);
+
if (adapter->bonding->io_id)
g_source_remove(adapter->bonding->io_id);
g_io_channel_close(adapter->bonding->io);
@@ -2404,59 +2392,6 @@ void hcid_dbus_pin_code_reply(bdaddr_t *local, void *ptr)
}
}
-void create_bond_req_exit(const char *name, struct adapter *adapter)
-{
- char path[MAX_PATH_LENGTH];
- GSList *l;
-
- snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, adapter->dev_id);
-
- debug("CreateConnection requestor (%s) exited before bonding was completed",
- name);
-
- cancel_passkey_agent_requests(adapter->passkey_agents, path,
- &adapter->bonding->bdaddr);
- release_passkey_agents(adapter, &adapter->bonding->bdaddr);
-
- l = g_slist_find_custom(adapter->pin_reqs, &adapter->bonding->bdaddr,
- pin_req_cmp);
- if (l) {
- struct pending_pin_info *p = l->data;
-
- if (!p->replied) {
- int dd;
-
- dd = hci_open_dev(adapter->dev_id);
- if (dd >= 0) {
- hci_send_cmd(dd, OGF_LINK_CTL,
- OCF_PIN_CODE_NEG_REPLY,
- 6, &adapter->bonding->bdaddr);
- hci_close_dev(dd);
- }
- }
-
- adapter->pin_reqs = g_slist_remove(adapter->pin_reqs, p);
- g_free(p);
- }
-
- remove_pending_device(adapter);
-
- g_io_channel_close(adapter->bonding->io);
- if (adapter->bonding->io_id)
- g_source_remove(adapter->bonding->io_id);
- bonding_request_free(adapter->bonding);
- adapter->bonding = NULL;
-}
-
-void discover_devices_req_exit(const char *name, struct adapter *adapter)
-{
- debug("DiscoverDevices requestor (%s) exited", name);
-
- /* Cleanup the discovered devices list and send the command to cancel
- * inquiry or cancel remote name request. The return can be ignored. */
- cancel_discovery(adapter);
-}
-
static int inquiry_cancel(int dd, int to)
{
struct hci_request rq;
@@ -2568,17 +2503,6 @@ cleanup:
return err;
}
-void periodic_discover_req_exit(const char *name, struct adapter *adapter)
-{
- debug("PeriodicDiscovery requestor (%s) exited", name);
-
- /* Cleanup the discovered devices list and send the cmd to exit from
- * periodic inquiry or cancel remote name request. The return value can
- * be ignored. */
-
- cancel_periodic_discovery(adapter);
-}
-
static int periodic_inquiry_exit(int dd, int to)
{
struct hci_request rq;
diff --git a/hcid/dbus-hci.h b/hcid/dbus-hci.h
index da3dd5e9..5b8c89e3 100644
--- a/hcid/dbus-hci.h
+++ b/hcid/dbus-hci.h
@@ -54,10 +54,7 @@ DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status);
int get_default_dev_id(void);
-void create_bond_req_exit(const char *name, struct adapter *adapter);
-void discover_devices_req_exit(const char *name, struct adapter *adapter);
int cancel_discovery(struct adapter *adapter);
-void periodic_discover_req_exit(const char *name, struct adapter *adapter);
int cancel_periodic_discovery(struct adapter *adapter);
int active_conn_find_by_bdaddr(const void *data, const void *user_data);
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index f0b4f924..11de85c6 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -64,6 +64,7 @@ struct passkey_agent {
GSList *pending_requests;
int exited;
guint timeout;
+ guint listener_id;
};
struct pending_agent_request {
@@ -82,6 +83,7 @@ struct authorization_agent {
char *name;
char *path;
GSList *pending_requests;
+ guint listener_id;
};
struct auth_agent_req {
@@ -134,8 +136,9 @@ static void passkey_agent_free(struct passkey_agent *agent)
g_free(agent);
}
-static void agent_exited(const char *name, struct adapter *adapter)
+static void agent_exited(const char *name, void *user_data)
{
+ struct adapter *adapter = user_data;
GSList *cur, *next;
debug("Passkey agent %s exited without calling Unregister", name);
@@ -287,7 +290,8 @@ static DBusHandlerResult register_passkey_agent(DBusConnection *conn,
ref.addr = NULL;
ref.path = NULL;
if (!g_slist_find_custom(adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp))
- name_listener_add(conn, ref.name, (name_cb_t) agent_exited, adapter);
+ agent->listener_id = name_listener_add(conn, ref.name,
+ agent_exited, adapter);
agent->timeout = g_timeout_add(AGENT_TIMEOUT, (GSourceFunc)agent_timeout, agent);
@@ -330,8 +334,7 @@ static DBusHandlerResult unregister_passkey_agent(DBusConnection *conn,
agent = match->data;
- name_listener_remove(agent->conn, agent->name,
- (name_cb_t) agent_exited, adapter);
+ name_listener_id_remove(agent->listener_id);
adapter->passkey_agents = g_slist_remove(adapter->passkey_agents, agent);
agent->exited = 1;
@@ -408,8 +411,7 @@ static DBusHandlerResult unregister_default_passkey_agent(DBusConnection *conn,
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- name_listener_remove(conn, default_agent->name,
- (name_cb_t) default_agent_exited, NULL);
+ name_listener_id_remove(default_agent->listener_id);
info("Default passkey agent (%s, %s) unregistered",
default_agent->name, default_agent->path);
@@ -555,8 +557,7 @@ static void auth_agent_release(struct authorization_agent *agent)
send_message_and_unref(agent->conn, message);
if (agent == default_auth_agent)
- name_listener_remove(agent->conn, agent->name,
- (name_cb_t) default_auth_agent_exited, NULL);
+ name_listener_id_remove(agent->listener_id);
}
static DBusHandlerResult register_default_auth_agent(DBusConnection *conn,
@@ -625,8 +626,7 @@ static DBusHandlerResult unregister_default_auth_agent(DBusConnection *conn,
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- name_listener_remove(conn, default_auth_agent->name,
- (name_cb_t) default_auth_agent_exited, NULL);
+ name_listener_id_remove(default_auth_agent->listener_id);
info("Default authorization agent (%s, %s) unregistered",
default_auth_agent->name, default_auth_agent->path);
@@ -1280,17 +1280,17 @@ static void release_agent(struct passkey_agent *agent)
send_message_and_unref(agent->conn, message);
if (agent == default_agent)
- name_listener_remove(agent->conn, agent->name,
- (name_cb_t) default_agent_exited, NULL);
+ name_listener_id_remove(agent->listener_id);
else {
struct passkey_agent ref;
- /* Only remove the name listener if there are no more agents for this name */
+ /* Only remove the name listener if there are no more agents
+ * for this name */
memset(&ref, 0, sizeof(ref));
ref.name = agent->name;
- if (!g_slist_find_custom(agent->adapter->passkey_agents, &ref, (GCompareFunc) agent_cmp))
- name_listener_remove(agent->conn, ref.name,
- (name_cb_t) agent_exited, agent->adapter);
+ if (!g_slist_find_custom(agent->adapter->passkey_agents, &ref,
+ (GCompareFunc) agent_cmp))
+ name_listener_id_remove(agent->listener_id);
}
}
diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c
index 2ace4252..23876c07 100644
--- a/hcid/dbus-test.c
+++ b/hcid/dbus-test.c
@@ -79,6 +79,8 @@ struct audit {
uint16_t mask_result;
uint32_t mask;
+
+ guint listener_id;
};
static GSList *audits = NULL;
@@ -127,9 +129,12 @@ static void send_audit_status(struct audit *audit, const char *name)
DBUS_TYPE_INVALID);
}
-static void audit_requestor_exited(const char *name, struct audit *audit)
+static void audit_requestor_exited(const char *name, void *user_data)
{
+ struct audit *audit = user_data;
+
debug("AuditRemoteDevice requestor %s exited", name);
+
audits = g_slist_remove(audits, audit);
if (audit->io) {
struct adapter *adapter = NULL;
@@ -178,8 +183,7 @@ static gboolean l2raw_input_timer(struct audit *audit)
g_io_channel_close(audit->io);
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
audit_free(audit);
return FALSE;
@@ -323,8 +327,7 @@ failed:
g_io_channel_close(io);
g_io_channel_unref(io);
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
process_audits_list(audit->adapter_path);
@@ -399,8 +402,7 @@ failed:
g_io_channel_close(io);
g_io_channel_unref(io);
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
audit_free(audit);
return FALSE;
@@ -481,8 +483,9 @@ static DBusHandlerResult audit_remote_device(DBusConnection *conn,
(GIOFunc) l2raw_connect_complete, audit);
}
- name_listener_add(conn, dbus_message_get_sender(msg),
- (name_cb_t) audit_requestor_exited, audit);
+ audit->listener_id = name_listener_add(conn,
+ dbus_message_get_sender(msg),
+ audit_requestor_exited, audit);
audits = g_slist_append(audits, audit);
@@ -538,8 +541,7 @@ static DBusHandlerResult cancel_audit_remote_device(DBusConnection *conn,
g_source_remove(audit->timeout);
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
audit_free(audit);
reply = dbus_message_new_method_return(msg);
@@ -682,8 +684,7 @@ void process_audits_list(const char *adapter_path)
if (!adapter) {
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
audit_free(audit);
continue;
}
@@ -696,8 +697,7 @@ void process_audits_list(const char *adapter_path)
if (sk < 0) {
send_audit_status(audit, "AuditRemoteDeviceFailed");
audits = g_slist_remove(audits, audit);
- name_listener_remove(audit->conn, audit->requestor,
- (name_cb_t) audit_requestor_exited, audit);
+ name_listener_id_remove(audit->listener_id);
audit_free(audit);
continue;
}