diff options
-rw-r--r-- | hcid/dbus-manager.c | 33 | ||||
-rw-r--r-- | hcid/dbus-security.c | 14 | ||||
-rw-r--r-- | hcid/dbus-service.c | 6 |
3 files changed, 45 insertions, 8 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c index f7eda064..8af432a9 100644 --- a/hcid/dbus-manager.c +++ b/hcid/dbus-manager.c @@ -48,6 +48,7 @@ #include "dbus-security.h" #include "dbus-service.h" #include "dbus-manager.h" +#include "dbus-hci.h" #include "sdp-xml.h" static int default_adapter_id = -1; @@ -203,6 +204,9 @@ static DBusHandlerResult list_services(DBusConnection *conn, DBusMessageIter iter; DBusMessageIter array_iter; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) return error_invalid_arguments(conn, msg); @@ -265,6 +269,9 @@ static DBusHandlerResult register_service(DBusConnection *conn, DBusMessage *message; int err; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_STRING, &name, @@ -333,6 +340,9 @@ static DBusHandlerResult unregister_service(DBusConnection *conn, const char *path; int err; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID)) @@ -391,6 +401,9 @@ static DBusHandlerResult add_service_record(DBusConnection *conn, const char *path; int err; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + /* Check if it is an array of bytes */ if (strcmp(dbus_message_get_signature(msg), "say")) return error_invalid_arguments(conn, msg); @@ -467,6 +480,9 @@ static DBusHandlerResult add_service_record_xml(DBusConnection *conn, const char *record; int err; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_STRING, &record, @@ -564,6 +580,9 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn, const char *path; uint32_t handle; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_UINT32, &handle, @@ -605,13 +624,13 @@ static DBusHandlerResult remove_service_record(DBusConnection *conn, } static struct service_data methods[] = { - { "InterfaceVersion", interface_version }, - { "DefaultAdapter", default_adapter }, - { "FindAdapter", find_adapter }, - { "ListAdapters", list_adapters }, - { "ListServices", list_services }, - { "RegisterService", register_service }, - { "UnregisterService", unregister_service }, + { "InterfaceVersion", interface_version }, + { "DefaultAdapter", default_adapter }, + { "FindAdapter", find_adapter }, + { "ListAdapters", list_adapters }, + { "ListServices", list_services }, + { "RegisterService", register_service }, + { "UnregisterService", unregister_service }, { "AddServiceRecord", add_service_record }, { "AddServiceRecordFromXML", add_service_record_xml }, { "RemoveServiceRecord", remove_service_record }, diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c index cd70616b..5a13fe5b 100644 --- a/hcid/dbus-security.c +++ b/hcid/dbus-security.c @@ -577,6 +577,9 @@ static DBusHandlerResult register_default_auth_agent(DBusConnection *conn, DBusMessage *reply; const char *path; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (default_auth_agent) return error_auth_agent_already_exists(conn, msg); @@ -618,6 +621,9 @@ static DBusHandlerResult unregister_default_auth_agent(DBusConnection *conn, const char *path, *name; DBusMessage *reply; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!default_auth_agent) return error_auth_agent_does_not_exist(conn, msg); @@ -657,7 +663,7 @@ static void auth_agent_req_reply(DBusPendingCall *call, void *data) DBusMessage *message; DBusError err; - dbus_error_init(&err); + dbus_error_init(&err); if (dbus_set_error_from_message(&err, reply)) { if (strcmp(err.name, DBUS_ERROR_NO_REPLY) == 0) auth_agent_call_cancel(req); @@ -763,6 +769,9 @@ static DBusHandlerResult authorize_service(DBusConnection *conn, struct service_agent *sagent; struct slist *l; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &service_path, DBUS_TYPE_STRING, &address, @@ -838,6 +847,9 @@ static DBusHandlerResult cancel_authorization_process(DBusConnection *conn, const char *service_path, *adapter_path, *address, *action; struct service_agent *sagent; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &service_path, DBUS_TYPE_STRING, &address, diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 69136f8f..103c8a4b 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -39,6 +39,7 @@ #include "dbus-error.h" #include "dbus-manager.h" #include "dbus-service.h" +#include "dbus-hci.h" static struct slist *services = NULL; @@ -107,6 +108,7 @@ void service_call_free(void *data) free(call); } +#if 0 static int service_agent_cmp(const struct service_agent *a, const struct service_agent *b) { int ret; @@ -137,6 +139,7 @@ static int service_agent_cmp(const struct service_agent *a, const struct service return 0; } +#endif static void service_agent_free(struct service_agent *agent) { @@ -664,6 +667,9 @@ static DBusHandlerResult msg_func_services(DBusConnection *conn, struct service_call *call_data; const char *iface; + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + iface = dbus_message_get_interface(msg); if (!strcmp(DBUS_INTERFACE_INTROSPECTABLE, iface) && |