wpa_cli: Use tab as only word separator for networks

White space is a valid SSID character so completion routine for
networks should only use tab as word separator.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
Mikael Kanstrup 2015-03-27 11:03:28 +01:00 committed by Jouni Malinen
parent 5a997b2f79
commit 9ccc10f56e

View file

@ -170,13 +170,12 @@ static void cli_txt_list_del_addr(struct dl_list *txt_list, const char *txt)
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
static void cli_txt_list_del_word(struct dl_list *txt_list, const char *txt) static void cli_txt_list_del_word(struct dl_list *txt_list, const char *txt,
int separator)
{ {
const char *end; const char *end;
char *buf; char *buf;
end = os_strchr(txt, ' '); end = os_strchr(txt, separator);
if (end == NULL)
end = os_strchr(txt, '\t');
if (end == NULL) if (end == NULL)
end = txt + os_strlen(txt); end = txt + os_strlen(txt);
buf = dup_binstr(txt, end - txt); buf = dup_binstr(txt, end - txt);
@ -220,14 +219,13 @@ static int cli_txt_list_add_addr(struct dl_list *txt_list, const char *txt)
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
static int cli_txt_list_add_word(struct dl_list *txt_list, const char *txt) static int cli_txt_list_add_word(struct dl_list *txt_list, const char *txt,
int separator)
{ {
const char *end; const char *end;
char *buf; char *buf;
int ret; int ret;
end = os_strchr(txt, ' '); end = os_strchr(txt, separator);
if (end == NULL)
end = os_strchr(txt, '\t');
if (end == NULL) if (end == NULL)
end = txt + os_strlen(txt); end = txt + os_strlen(txt);
buf = dup_binstr(txt, end - txt); buf = dup_binstr(txt, end - txt);
@ -3752,7 +3750,7 @@ static void cli_event(const char *str)
s = os_strchr(start, ' '); s = os_strchr(start, ' ');
if (s == NULL) if (s == NULL)
return; return;
cli_txt_list_add_word(&p2p_groups, s + 1); cli_txt_list_add_word(&p2p_groups, s + 1, ' ');
return; return;
} }
@ -3760,7 +3758,7 @@ static void cli_event(const char *str)
s = os_strchr(start, ' '); s = os_strchr(start, ' ');
if (s == NULL) if (s == NULL)
return; return;
cli_txt_list_del_word(&p2p_groups, s + 1); cli_txt_list_del_word(&p2p_groups, s + 1, ' ');
return; return;
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
@ -4031,7 +4029,7 @@ static void update_networks(struct wpa_ctrl *ctrl)
break; break;
*end = '\0'; *end = '\0';
if (!header) if (!header)
cli_txt_list_add_word(&networks, pos); cli_txt_list_add_word(&networks, pos, '\t');
header = 0; header = 0;
pos = end + 1; pos = end + 1;
} }