summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-05-06 13:24:00 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-05-06 13:45:09 +0300
commitd66d5e118a2c790422d4e08a79f207b28bfbe355 (patch)
tree7e48a4663f83d056190d132b5268f86420097505 /client
parenta42f136e202914012a1fa03c020063301797a145 (diff)
downloadconnman-d66d5e118a2c790422d4e08a79f207b28bfbe355.tar.gz
connman-d66d5e118a2c790422d4e08a79f207b28bfbe355.tar.bz2
connman-d66d5e118a2c790422d4e08a79f207b28bfbe355.zip
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.
Diffstat (limited to 'client')
-rw-r--r--client/agent.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/agent.c b/client/agent.c
index bc564941..921f2fc8 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)