summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/clparse.c19
-rw-r--r--sbin/dhclient/parse.c9
2 files changed, 10 insertions, 18 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index ea122a66c50..9660b10be87 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.106 2017/04/03 14:16:34 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.107 2017/04/03 15:34:46 krw Exp $ */
/* Parser for dhclient config and lease files. */
@@ -281,11 +281,13 @@ parse_client_statement(FILE *cfile, struct interface_info *ifi)
string = parse_string(cfile);
free(config->filename);
config->filename = string;
+ parse_semi(cfile);
break;
case TOK_SERVER_NAME:
string = parse_string(cfile);
free(config->server_name);
config->server_name = string;
+ parse_semi(cfile);
break;
case TOK_FIXED_ADDR:
if (parse_ip_addr(cfile, &config->address))
@@ -585,16 +587,16 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease,
return;
case TOK_FILENAME:
lease->filename = parse_string(cfile);
- return;
+ break;
case TOK_SERVER_NAME:
lease->server_name = parse_string(cfile);
- return;
+ break;
case TOK_SSID:
val = parse_string(cfile);
if (val)
strlcpy(lease->ssid, val, sizeof(lease->ssid));
free(val);
- return;
+ break;
case TOK_RENEW:
lease->renewal = parse_date(cfile);
return;
@@ -666,13 +668,9 @@ parse_option_decl(FILE *cfile, struct option_data *options)
hunkix += len;
break;
case 't': /* Text string. */
- token = next_token(&val, cfile);
- if (token != TOK_STRING) {
- parse_warn("expecting string.");
- if (token != ';')
- skip_to_semi(cfile);
+ val = parse_string(cfile);
+ if (val == NULL)
return (-1);
- }
len = strlen(val);
if (hunkix + len + 1 > sizeof(hunkbuf)) {
parse_warn("option data buffer "
@@ -683,6 +681,7 @@ parse_option_decl(FILE *cfile, struct option_data *options)
memcpy(&hunkbuf[hunkix], val, len + 1);
nul_term = 1;
hunkix += len;
+ free(val);
break;
case 'I': /* IP address. */
if (!parse_ip_addr(cfile, &ip_addr))
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index c3e7643783f..d0e39fa332f 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.45 2017/04/03 14:16:34 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.46 2017/04/03 15:34:46 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -127,9 +127,6 @@ parse_semi(FILE *cfile)
return (1);
}
-/*
- * string-parameter :== STRING SEMI
- */
char *
parse_string(FILE *cfile)
{
@@ -147,10 +144,6 @@ parse_string(FILE *cfile)
if (!s)
fatalx("no memory for string %s.", val);
- if (!parse_semi(cfile)) {
- free(s);
- return (NULL);
- }
return (s);
}