From: Patrik Flykt Date: Mon, 6 May 2013 10:24:00 +0000 (+0300) Subject: client: Fixes for handling Agent messages X-Git-Tag: 1.14~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d66d5e118a2c790422d4e08a79f207b28bfbe355;p=platform%2Fupstream%2Fconnman.git client: Fixes for handling Agent messages Properly handle agent confirmation input, unset the prompt when RequestInput processing ends and set the passphrase only if it contains some text. --- diff --git a/client/agent.c b/client/agent.c index bc56494..921f2fc 100644 --- a/client/agent.c +++ b/client/agent.c @@ -57,11 +57,11 @@ static int confirm_input(char *input) int i; if (input == NULL) - return false; + return -1; for (i = 0; input[i] != '\0'; i++) - if (isspace(input[i]) != 0) - continue; + if (isspace(input[i]) == 0) + break; if (strcasecmp(&input[i], "yes") == 0 || strcasecmp(&input[i], "y") == 0) @@ -69,7 +69,7 @@ static int confirm_input(char *input) if (strcasecmp(&input[i], "no") == 0 || strcasecmp(&input[i], "n") == 0) - return 1; + return 0; return -1; } @@ -284,6 +284,9 @@ static void request_input_next(void) g_dbus_send_message(agent_connection, agent_reply.reply); agent_reply.reply = NULL; + + pending_message_remove(); + pending_command_complete(""); } static void request_input_append(const char *attribute, char *value) @@ -311,13 +314,14 @@ static void request_input_passphrase_return(char *input) { /* TBD passphrase length checking */ - agent_input[PASSPHRASE].requested = false; - request_input_append(agent_input[PASSPHRASE].attribute, input); + if (input != NULL && strlen(input) > 0) { + agent_input[PASSPHRASE].requested = false; + request_input_append(agent_input[PASSPHRASE].attribute, input); - if (input != NULL && strlen(input) > 0) agent_input[WPS].requested = false; - request_input_next(); + request_input_next(); + } } static void request_input_string_return(char *input)