aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2010-01-29 00:22:32 +0800
committerChia-chi Yeh <chiachi@android.com>2010-01-29 00:22:32 +0800
commitf4fc3fbe982b67b82b143384bd5e7330d4202eca (patch)
tree97f3fe83221e54924d9d59f6c76edcafbe59bd0b
parenteb26c9627ca1cf7315f2eff0454114c81874fc92 (diff)
downloadwpa_supplicant-f4fc3fbe982b67b82b143384bd5e7330d4202eca.tar.gz
wpa_supplicant: extend set_network to allow string variables to be unset.
To unset a variable, use NULL without quotation as the value in set_network. Back ported from wpa_supplicant 0.6.x b56c0546b7e46f221d751ef7390fbfec607254e2.
-rw-r--r--config.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/config.c b/config.c
index e5aeac2..a1112b7 100644
--- a/config.c
+++ b/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);