summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
Diffstat (limited to 'hcid')
-rw-r--r--hcid/adapter.c6
-rw-r--r--hcid/dbus-common.c4
-rw-r--r--hcid/dbus-common.h2
-rw-r--r--hcid/dbus-database.c18
-rw-r--r--hcid/dbus-database.h2
5 files changed, 17 insertions, 15 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 62b17334..fc1608d5 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -3882,9 +3882,11 @@ static DBusHandlerResult unregister_agent(DBusConnection *conn,
static DBusHandlerResult add_service_record(DBusConnection *conn,
DBusMessage *msg, void *data)
{
+ struct adapter *adapter = data;
DBusMessage *reply;
const char *sender, *record;
dbus_uint32_t handle;
+ bdaddr_t src;
int err;
if (dbus_message_get_args(msg, NULL,
@@ -3892,8 +3894,8 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
return error_invalid_arguments(conn, msg, NULL);
sender = dbus_message_get_sender(msg);
-
- err = add_xml_record(conn, sender, record, &handle);
+ str2ba(adapter->address, &src);
+ err = add_xml_record(conn, sender, &src, record, &handle);
if (err < 0)
return error_failed_errno(conn, msg, err);
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c
index 6c1601fb..38e11665 100644
--- a/hcid/dbus-common.c
+++ b/hcid/dbus-common.c
@@ -398,14 +398,14 @@ int register_sdp_binary(uint8_t *data, uint32_t size, uint32_t *handle)
return err;
}
-int register_sdp_record(sdp_record_t *rec)
+int register_sdp_record(bdaddr_t *src, sdp_record_t *rec)
{
int err;
if (!get_sdp_session())
return -1;
- err = sdp_device_record_register(sess, BDADDR_ANY, rec, 0);
+ err = sdp_device_record_register(sess, src, rec, 0);
if (err < 0)
cleanup_sdp_session();
diff --git a/hcid/dbus-common.h b/hcid/dbus-common.h
index 61782dfe..baccfb59 100644
--- a/hcid/dbus-common.h
+++ b/hcid/dbus-common.h
@@ -52,7 +52,7 @@ void hcid_dbus_exit(void);
int hcid_dbus_init(void);
int register_sdp_binary(uint8_t *data, uint32_t size, uint32_t *handle);
-int register_sdp_record(sdp_record_t *rec);
+int register_sdp_record(bdaddr_t *src, sdp_record_t *rec);
int unregister_sdp_record(uint32_t handle);
int update_sdp_record(uint32_t handle, sdp_record_t *rec);
void cleanup_sdp_session(void);
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index a2330940..e6e1de06 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -129,7 +129,7 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
return error_failed_errno(conn, msg, EIO);
}
- if (add_record_to_server(sdp_record) < 0) {
+ if (add_record_to_server(BDADDR_ANY, sdp_record) < 0) {
error("Failed to register service record");
g_free(user_record);
sdp_record_free(sdp_record);
@@ -166,7 +166,7 @@ static DBusHandlerResult add_service_record(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
-int add_xml_record(DBusConnection *conn, const char *sender,
+int add_xml_record(DBusConnection *conn, const char *sender, bdaddr_t *src,
const char *record, dbus_uint32_t *handle)
{
struct record_data *user_record;
@@ -182,7 +182,7 @@ int add_xml_record(DBusConnection *conn, const char *sender,
}
if (sdp_server_enable) {
- if (add_record_to_server(sdp_record) < 0) {
+ if (add_record_to_server(src, sdp_record) < 0) {
error("Failed to register service record");
g_free(user_record);
sdp_record_free(sdp_record);
@@ -191,7 +191,7 @@ int add_xml_record(DBusConnection *conn, const char *sender,
user_record->handle = sdp_record->handle;
} else {
- if (register_sdp_record(sdp_record) < 0) {
+ if (register_sdp_record(src, sdp_record) < 0) {
error("Failed to register service record");
g_free(user_record);
sdp_record_free(sdp_record);
@@ -232,7 +232,7 @@ static DBusHandlerResult add_service_record_from_xml(DBusConnection *conn,
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
- err = add_xml_record(conn, sender, record, &handle);
+ err = add_xml_record(conn, sender, BDADDR_ANY, record, &handle);
if (err < 0)
return error_failed_errno(conn, msg, err);
@@ -243,7 +243,7 @@ static DBusHandlerResult add_service_record_from_xml(DBusConnection *conn,
}
static DBusHandlerResult update_record(DBusConnection *conn, DBusMessage *msg,
- dbus_uint32_t handle, sdp_record_t *sdp_record)
+ bdaddr_t *src, dbus_uint32_t handle, sdp_record_t *sdp_record)
{
int err;
@@ -254,7 +254,7 @@ static DBusHandlerResult update_record(DBusConnection *conn, DBusMessage *msg,
}
sdp_record->handle = handle;
- err = add_record_to_server(sdp_record);
+ err = add_record_to_server(src, sdp_record);
if (err < 0) {
sdp_record_free(sdp_record);
error("Failed to update the service record");
@@ -311,7 +311,7 @@ static DBusHandlerResult update_service_record(DBusConnection *conn,
return error_invalid_arguments(conn, msg, NULL);
}
- return update_record(conn, msg, handle, sdp_record);
+ return update_record(conn, msg, BDADDR_ANY, handle, sdp_record);
}
DBusHandlerResult update_xml_record(DBusConnection *conn,
@@ -344,7 +344,7 @@ DBusHandlerResult update_xml_record(DBusConnection *conn,
return error_failed_errno(conn, msg, EIO);
}
- return update_record(conn, msg, handle, sdp_record);
+ return update_record(conn, msg, src, handle, sdp_record);
}
static DBusHandlerResult update_service_record_from_xml(DBusConnection *conn,
diff --git a/hcid/dbus-database.h b/hcid/dbus-database.h
index 9ca7ce6c..c5450c8c 100644
--- a/hcid/dbus-database.h
+++ b/hcid/dbus-database.h
@@ -29,7 +29,7 @@ dbus_bool_t database_init(DBusConnection *conn, const char *path);
DBusHandlerResult database_message(DBusConnection *conn,
DBusMessage *msg, void *data);
-int add_xml_record(DBusConnection *conn, const char *sender,
+int add_xml_record(DBusConnection *conn, const char *sender, bdaddr_t *src,
const char *record, dbus_uint32_t *handle);
DBusHandlerResult update_xml_record(DBusConnection *conn,
DBusMessage *msg, bdaddr_t *src);