client: Fix passphrase handling
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 12 Jun 2013 13:54:32 +0000 (16:54 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 13 Jun 2013 07:40:17 +0000 (10:40 +0300)
An empty passphrase means that WPS is to be tried next. If WPS is not
supported by the service, passphrase can not be left empty.

client/agent.c

index 780104b..12b0a98 100644 (file)
@@ -418,11 +418,19 @@ static void request_input_ssid_return(char *input,
 static void request_input_passphrase_return(char *input, void *user_data)
 {
        struct agent_data *request = user_data;
+       int len = 0;
 
        /* TBD passphrase length checking */
 
-       if (input != NULL && strlen(input) > 0) {
-               request->input[PASSPHRASE].requested = false;
+       if (input != NULL)
+               len = strlen(input);
+
+       if (len == 0 && request->input[WPS].requested == false)
+               return;
+
+       request->input[PASSPHRASE].requested = false;
+
+       if (len > 0) {
                request_input_append(request,
                                request->input[PASSPHRASE].attribute, input);