diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-06-01 20:08:50 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-06-01 20:08:50 +0000 |
commit | 57722c34c18e4067ebb397120156a673dfe89256 (patch) | |
tree | 6a32d1f0414937bc3f4bd618f8399d00baa6b891 /hcid/dbus-manager.c | |
parent | 5c59f168117c1f3d48bafda1f868ae3784f28e23 (diff) |
Added wrong signature verification
Diffstat (limited to 'hcid/dbus-manager.c')
-rw-r--r-- | hcid/dbus-manager.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c index 7db28949..2a5b8d82 100644 --- a/hcid/dbus-manager.c +++ b/hcid/dbus-manager.c @@ -45,6 +45,9 @@ static DBusHandlerResult interface_version(DBusConnection *conn, DBusMessage *reply; dbus_uint32_t version = 0; + if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) + return error_invalid_arguments(conn, msg); + reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; @@ -62,6 +65,9 @@ static DBusHandlerResult default_adapter(DBusConnection *conn, char path[MAX_PATH_LENGTH], *path_ptr = path; int default_dev = get_default_dev_id(); + if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) + return error_invalid_arguments(conn, msg); + if (default_dev < 0) return error_no_such_adapter(conn, msg); @@ -81,12 +87,21 @@ static DBusHandlerResult find_adapter(DBusConnection *conn, DBusMessage *msg, void *data) { DBusMessage *reply; + DBusError err; char path[MAX_PATH_LENGTH], *path_ptr = path; const char *pattern; int dev_id; - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &pattern, - DBUS_TYPE_INVALID); + dbus_error_init(&err); + dbus_message_get_args(msg, &err, + DBUS_TYPE_STRING, &pattern, + DBUS_TYPE_INVALID); + + if (dbus_error_is_set(&err)) { + error("Can't extract message arguments:%s", err.message); + dbus_error_free(&err); + return error_invalid_arguments(conn, msg); + } dev_id = hci_devid(pattern); if (dev_id < 0) @@ -114,6 +129,9 @@ static DBusHandlerResult list_adapters(DBusConnection *conn, struct hci_dev_req *dr; int i, sk; + if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) + return error_invalid_arguments(conn, msg); + sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (sk < 0) return error_failed(conn, msg, errno); @@ -177,6 +195,9 @@ static DBusHandlerResult list_services(DBusConnection *conn, { DBusMessage *reply; + if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) + return error_invalid_arguments(conn, msg); + reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; |