From 791897c6c33eb80bf8091f78e2e80f83c175cef5 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 10 Jan 2015 13:47:06 +0000 Subject: don't check for a return value that host() doesn't return, so future generations don't try to change any of the values and break the code. ok deraadt --- usr.sbin/ntpd/config.c | 8 +++----- usr.sbin/ntpd/ntpd.h | 4 ++-- usr.sbin/ntpd/parse.y | 10 ++-------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/usr.sbin/ntpd/config.c b/usr.sbin/ntpd/config.c index 21a5cba1f92..e0efb24ec78 100644 --- a/usr.sbin/ntpd/config.c +++ b/usr.sbin/ntpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.21 2015/01/10 01:56:52 bcook Exp $ */ +/* $OpenBSD: config.c,v 1.22 2015/01/10 13:47:05 tedu Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -36,7 +36,7 @@ struct ntp_addr *host_v6(const char *); static u_int32_t maxid = 0; -int +void host(const char *s, struct ntp_addr **hn) { struct ntp_addr *h = NULL; @@ -54,11 +54,9 @@ host(const char *s, struct ntp_addr **hn) h = host_v6(s); if (h == NULL) - return (0); + return; *hn = h; - - return (1); } struct ntp_addr * diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 2b0ba4654e0..2cdaf8bff53 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.115 2015/01/09 07:35:37 deraadt Exp $ */ +/* $OpenBSD: ntpd.h,v 1.116 2015/01/10 13:47:05 tedu Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -279,7 +279,7 @@ extern struct ctl_conns ctl_conns; int parse_config(const char *, struct ntpd_conf *); /* config.c */ -int host(const char *, struct ntp_addr **); +void host(const char *, struct ntp_addr **); int host_dns(const char *, struct ntp_addr **); struct ntp_peer *new_peer(void); struct ntp_conf_sensor *new_sensor(char *); diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y index 2d2a5095512..1d4595800df 100644 --- a/usr.sbin/ntpd/parse.y +++ b/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.56 2015/01/08 00:30:08 bcook Exp $ */ +/* $OpenBSD: parse.y,v 1.57 2015/01/10 13:47:05 tedu Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -225,13 +225,7 @@ address : STRING { if (($$ = calloc(1, sizeof(struct ntp_addr_wrap))) == NULL) fatal(NULL); - if (host($1, &$$->a) == -1) { - yyerror("could not parse address spec \"%s\"", - $1); - free($1); - free($$); - YYERROR; - } + host($1, &$$->a); $$->name = $1; } ; -- cgit v1.2.3