From 5accdb359001a8d12b54856405a982b65193fa2b Mon Sep 17 00:00:00 2001 From: krw Date: Thu, 4 Jan 2018 02:27:55 +0000 Subject: [PATCH] We only parse decimal numbers, so parse_decimal() -> parse_number() to match grammar comments and improve euphony. --- sbin/dhclient/clparse.c | 12 ++++++------ sbin/dhclient/dhcpd.h | 4 ++-- sbin/dhclient/parse.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 1773b5c6145..ee8d2a26ead 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.161 2018/01/02 00:13:27 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.162 2018/01/04 02:27:55 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -595,7 +595,7 @@ parse_lease_declaration(FILE *cfile, struct client_lease *lease, /* 'bootp' is just a comment. See BOOTP_LEASE(). */ break; case TOK_EPOCH: - if (parse_decimal(cfile, (unsigned char *)&lease->epoch, 't') + if (parse_number(cfile, (unsigned char *)&lease->epoch, 't') == 0) return; lease->epoch = betoh64(lease->epoch); @@ -714,25 +714,25 @@ parse_option_decl(FILE *cfile, int *code, struct option_data *options) dp = (uint8_t *)&ip_addr; break; case 'l': /* Signed 32-bit integer. */ - if (parse_decimal(cfile, buf, 'l') == 0) + if (parse_number(cfile, buf, 'l') == 0) return 0; len = 4; dp = buf; break; case 'L': /* Unsigned 32-bit integer. */ - if (parse_decimal(cfile, buf, 'L') == 0) + if (parse_number(cfile, buf, 'L') == 0) return 0; len = 4; dp = buf; break; case 'S': /* Unsigned 16-bit integer. */ - if (parse_decimal(cfile, buf, 'S') == 0) + if (parse_number(cfile, buf, 'S') == 0) return 0; len = 2; dp = buf; break; case 'B': /* Unsigned 8-bit integer. */ - if (parse_decimal(cfile, buf, 'B') == 0) + if (parse_number(cfile, buf, 'B') == 0) return 0; len = 1; dp = buf; diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 19782e52554..6dec72fe4ac 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.243 2017/12/18 14:17:58 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.244 2018/01/04 02:27:55 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -181,7 +181,7 @@ int parse_string(FILE *, unsigned int *, char **); int parse_ip_addr(FILE *, struct in_addr *); int parse_cidr(FILE *, unsigned char *); int parse_lease_time(FILE *, time_t *); -int parse_decimal(FILE *, unsigned char *, char); +int parse_number(FILE *, unsigned char *, char); int parse_boolean(FILE *, unsigned char *); void parse_warn(char *); diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c index 6d597f3709d..1f161e8f816 100644 --- a/sbin/dhclient/parse.c +++ b/sbin/dhclient/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.77 2017/11/09 12:34:25 krw Exp $ */ +/* $OpenBSD: parse.c,v 1.78 2018/01/04 02:27:55 krw Exp $ */ /* Common parser code for dhcpd and dhclient. */ @@ -278,7 +278,7 @@ parse_boolean(FILE *cfile, unsigned char *buf) } int -parse_decimal(FILE *cfile, unsigned char *buf, char fmt) +parse_number(FILE *cfile, unsigned char *buf, char fmt) { const char *errstr; char *val, *msg; -- 2.20.1