aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-05-05 08:53:20 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-05 08:53:20 (GMT)
commitf1fb042cec8e57bb41d9e55911c6be52f10c8e53 (patch)
treef2dd45a645e77dd14a3efcd4c8951dd3a3725f17 /wpa_supplicant/wpa_cli.c
parentf5ffc348dcc205ebd3391cc4ab060105a3f1d64d (diff)
downloadhostap-f1fb042cec8e57bb41d9e55911c6be52f10c8e53.zip
hostap-f1fb042cec8e57bb41d9e55911c6be52f10c8e53.tar.gz
hostap-f1fb042cec8e57bb41d9e55911c6be52f10c8e53.tar.bz2
wpa_cli: Allow space in the set command value
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>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index bd84a19..ee7106a 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -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);
}