On Fri, Jan 09, 2015 at 22:02, Theo de Raadt wrote: >> There is something funny though. parse.y is checking host() for -1, >> but the function never returns that. I think the return (0) is wrong, >> and that's what should be changed. Or change parse.y to check for 0. > > Nope -- you guys aren't testing your work.
OK. Like this then. No functional change. Index: config.c =================================================================== RCS file: /cvs/src/usr.sbin/ntpd/config.c,v retrieving revision 1.19 diff -u -p -r1.19 config.c --- config.c 27 May 2006 17:01:07 -0000 1.19 +++ config.c 10 Jan 2015 05:10:58 -0000 @@ -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 * Index: ntpd.h =================================================================== RCS file: /cvs/src/usr.sbin/ntpd/ntpd.h,v retrieving revision 1.114 diff -u -p -r1.114 ntpd.h --- ntpd.h 8 Jan 2015 00:30:08 -0000 1.114 +++ ntpd.h 10 Jan 2015 05:11:01 -0000 @@ -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 *); Index: parse.y =================================================================== RCS file: /cvs/src/usr.sbin/ntpd/parse.y,v retrieving revision 1.56 diff -u -p -r1.56 parse.y --- parse.y 8 Jan 2015 00:30:08 -0000 1.56 +++ parse.y 10 Jan 2015 05:11:01 -0000 @@ -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; } ;