From ff1d6653e1bf2bd4d119a17e57bd529863a341ea Mon Sep 17 00:00:00 2001 From: tedu <> Date: Sat, 10 Jan 2015 13:47:05 +0000 Subject: [PATCH] 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 --- src/usr.sbin/ntpd/config.c | 8 +++----- src/usr.sbin/ntpd/ntpd.h | 4 ++-- src/usr.sbin/ntpd/parse.y | 10 ++-------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c index 21a5cba1..e0efb24e 100644 --- a/src/usr.sbin/ntpd/config.c +++ b/src/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/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index 2b0ba465..2cdaf8bf 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/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/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index 2d2a5095..1d459580 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/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; } ;