Permalink
Browse files

wpa_supplicant: extend set_network to allow string variables to be un…

…set.

To unset a variable, use NULL without quotation as the value in set_network.

Back ported from wpa_supplicant 0.6.x b56c0546b7e46f221d751ef7390fbfec607254e2.
  • Loading branch information...
1 parent eb26c96 commit f4fc3fbe982b67b82b143384bd5e7330d4202eca Chia-chi Yeh committed Jan 28, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 config.c
View
9 config.c
@@ -91,6 +91,14 @@ static int wpa_config_parse_str(const struct parse_data *data,
size_t res_len, *dst_len;
char **dst, *tmp;
+ if (os_strcmp(value, "NULL") == 0) {
+ wpa_printf(MSG_DEBUG, "Unset configuration string '%s'",
+ data->name);
+ tmp = NULL;
+ res_len = 0;
+ goto set;
+ }
+
tmp = wpa_config_parse_string(value, &res_len);
if (tmp == NULL) {
wpa_printf(MSG_ERROR, "Line %d: failed to parse %s '%s'.",
@@ -123,6 +131,7 @@ static int wpa_config_parse_str(const struct parse_data *data,
return -1;
}
+set:
dst = (char **) (((u8 *) ssid) + (long) data->param1);
dst_len = (size_t *) (((u8 *) ssid) + (long) data->param2);
os_free(*dst);

0 comments on commit f4fc3fb

Please sign in to comment.