]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_cli: Allow space in the set command value
authorJouni Malinen <j@w1.fi>
Sun, 5 May 2013 08:53:20 +0000 (11:53 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 5 May 2013 08:53:20 +0000 (11:53 +0300)
Previously, interactive mode could not be used to enter space-separated
lists with the set command. This removes that restriction and allows
such commands to be encoded properly.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/wpa_cli.c

index bd84a19c97d511ec2bd6533e2a7983e27a75193a..ee7106adc89adc8e44a1b31555f10dc5136f3fab 100644 (file)
@@ -590,22 +590,16 @@ static int wpa_cli_cmd_set(struct wpa_ctrl *ctrl, int argc, char *argv[])
                return 0;
        }
 
-       if (argc != 1 && argc != 2) {
-               printf("Invalid SET command: needs two arguments (variable "
-                      "name and value)\n");
-               return -1;
-       }
-
-       if (argc == 1)
+       if (argc == 1) {
                res = os_snprintf(cmd, sizeof(cmd), "SET %s ", argv[0]);
-       else
-               res = os_snprintf(cmd, sizeof(cmd), "SET %s %s",
-                                 argv[0], argv[1]);
-       if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
-               printf("Too long SET command.\n");
-               return -1;
+               if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+                       printf("Too long SET command.\n");
+                       return -1;
+               }
+               return wpa_ctrl_command(ctrl, cmd);
        }
-       return wpa_ctrl_command(ctrl, cmd);
+
+       return wpa_cli_cmd(ctrl, "SET", 2, argc, argv);
 }