summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-10 01:16:28 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-07-10 01:16:28 +0000
commit81ef88706fcf1a8d1671506d6734bdab0dbd7c6f (patch)
tree846e9a777ad740d3c57a09da4d63364b0190e76d /test
parentee0b35445ba76b7b73badbcdefbeca4ac9d5dc77 (diff)
Quick hack to allow reject of PIN code requests
Diffstat (limited to 'test')
-rw-r--r--test/passkey-agent.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/passkey-agent.c b/test/passkey-agent.c
index 4a612662..8ac91d27 100644
--- a/test/passkey-agent.c
+++ b/test/passkey-agent.c
@@ -40,6 +40,8 @@
static char *passkey = NULL;
static char *address = NULL;
+static int do_reject = 0;
+
static volatile sig_atomic_t __io_canceled = 0;
static volatile sig_atomic_t __io_terminated = 0;
@@ -88,6 +90,12 @@ static DBusHandlerResult request_message(DBusConnection *conn,
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
+ if (do_reject) {
+ reply = dbus_message_new_error(msg,
+ "org.bluez.Error.Rejected", "");
+ goto send;
+ }
+
reply = dbus_message_new_method_return(msg);
if (!reply) {
fprintf(stderr, "Can't create reply message\n");
@@ -99,6 +107,7 @@ static DBusHandlerResult request_message(DBusConnection *conn,
dbus_message_append_args(reply, DBUS_TYPE_STRING, &passkey,
DBUS_TYPE_INVALID);
+send:
dbus_connection_send(conn, reply, NULL);
dbus_connection_flush(conn);
@@ -307,6 +316,7 @@ static void usage(void)
static struct option main_options[] = {
{ "default", 0, 0, 'd' },
+ { "reject", 0, 0, 'r' },
{ "path", 1, 0, 'p' },
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0 }
@@ -327,6 +337,9 @@ int main(int argc, char *argv[])
case 'd':
use_default = 1;
break;
+ case 'r':
+ do_reject = 1;
+ break;
case 'p':
if (optarg[0] != '/') {
fprintf(stderr, "Invalid path\n");