From e2318a52076f48eb62c6c09598b857d518388494 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 16 Jan 2015 15:06:40 +0000 Subject: [PATCH] Adapt to universe. ok millert --- usr.sbin/relayd/ca.c | 3 +-- usr.sbin/relayd/carp.c | 3 +-- usr.sbin/relayd/check_icmp.c | 3 +-- usr.sbin/relayd/check_script.c | 3 +-- usr.sbin/relayd/check_tcp.c | 3 +-- usr.sbin/relayd/control.c | 3 +-- usr.sbin/relayd/hce.c | 3 +-- usr.sbin/relayd/parse.y | 4 ++-- usr.sbin/relayd/pfe.c | 3 +-- usr.sbin/relayd/pfe_filter.c | 6 ++++-- usr.sbin/relayd/pfe_route.c | 4 ++-- usr.sbin/relayd/relay.c | 10 ++++++---- usr.sbin/relayd/relay_http.c | 4 ++-- usr.sbin/relayd/relay_udp.c | 3 ++- usr.sbin/relayd/relayd.c | 7 +++++-- usr.sbin/relayd/relayd.h | 21 ++++++++++----------- usr.sbin/relayd/ssl.c | 3 +-- 17 files changed, 42 insertions(+), 44 deletions(-) diff --git a/usr.sbin/relayd/ca.c b/usr.sbin/relayd/ca.c index 137d503fc31..6964a0b70e3 100644 --- a/usr.sbin/relayd/ca.c +++ b/usr.sbin/relayd/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.10 2014/12/12 10:05:09 reyk Exp $ */ +/* $OpenBSD: ca.c,v 1.11 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c index 536fed2d709..ba5836b67c5 100644 --- a/usr.sbin/relayd/carp.c +++ b/usr.sbin/relayd/carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: carp.c,v 1.9 2012/11/27 05:00:28 guenther Exp $ */ +/* $OpenBSD: carp.c,v 1.10 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Henning Brauer @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include diff --git a/usr.sbin/relayd/check_icmp.c b/usr.sbin/relayd/check_icmp.c index a32d9306a7a..3fefb8ad469 100644 --- a/usr.sbin/relayd/check_icmp.c +++ b/usr.sbin/relayd/check_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check_icmp.c,v 1.38 2014/12/21 00:54:49 guenther Exp $ */ +/* $OpenBSD: check_icmp.c,v 1.39 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c index adf9340fe0c..0e22176f64b 100644 --- a/usr.sbin/relayd/check_script.c +++ b/usr.sbin/relayd/check_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check_script.c,v 1.16 2014/06/25 11:05:15 reyk Exp $ */ +/* $OpenBSD: check_script.c,v 1.17 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c index 4e2553ee7e4..d439471f8d5 100644 --- a/usr.sbin/relayd/check_tcp.c +++ b/usr.sbin/relayd/check_tcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check_tcp.c,v 1.44 2014/12/12 10:05:09 reyk Exp $ */ +/* $OpenBSD: check_tcp.c,v 1.45 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c index e9c7fb29da8..2272e341e83 100644 --- a/usr.sbin/relayd/control.c +++ b/usr.sbin/relayd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.46 2014/07/11 16:39:10 krw Exp $ */ +/* $OpenBSD: control.c,v 1.47 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c index 5459e834617..70748dd8a17 100644 --- a/usr.sbin/relayd/hce.c +++ b/usr.sbin/relayd/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.67 2014/12/12 10:05:09 reyk Exp $ */ +/* $OpenBSD: hce.c,v 1.68 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 7b46db8c344..1c692c2f78b 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.199 2014/12/23 13:18:23 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.200 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -150,7 +150,7 @@ typedef struct { enum direction dir; struct { struct sockaddr_storage ss; - char name[MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; } addr; struct { enum digest_type type; diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c index 150642a9a78..c7ddde93902 100644 --- a/usr.sbin/relayd/pfe.c +++ b/usr.sbin/relayd/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.76 2014/11/19 10:24:40 blambert Exp $ */ +/* $OpenBSD: pfe.c,v 1.77 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c index d828f8e2c12..19cb4d85bc4 100644 --- a/usr.sbin/relayd/pfe_filter.c +++ b/usr.sbin/relayd/pfe_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe_filter.c,v 1.54 2014/12/23 13:18:23 reyk Exp $ */ +/* $OpenBSD: pfe_filter.c,v 1.55 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -38,6 +38,8 @@ #include +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + #include "relayd.h" struct pfdata { @@ -443,7 +445,7 @@ sync_ruleset(struct relayd *env, struct rdr *rdr, int enable) if (rio.rule.proto == IPPROTO_TCP) rio.rule.timeout[PFTM_TCP_ESTABLISHED] = - (u_int32_t)MIN(rdr->conf.timeout.tv_sec, INT_MAX); + (u_int32_t)MINIMUM(rdr->conf.timeout.tv_sec, INT_MAX); if (strlen(rdr->conf.tag)) (void)strlcpy(rio.rule.tagname, rdr->conf.tag, diff --git a/usr.sbin/relayd/pfe_route.c b/usr.sbin/relayd/pfe_route.c index 715bad81f30..135b9359862 100644 --- a/usr.sbin/relayd/pfe_route.c +++ b/usr.sbin/relayd/pfe_route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe_route.c,v 1.7 2014/12/21 00:54:49 guenther Exp $ */ +/* $OpenBSD: pfe_route.c,v 1.8 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2009 - 2011 Reyk Floeter @@ -75,7 +75,7 @@ sync_routes(struct relayd *env, struct router *rt) { struct netroute *nr; struct host *host; - char buf[MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX+1]; struct ctl_netroute crt; if (!(env->sc_flags & F_NEEDRT)) diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 894c26dc06a..eff2ee2db13 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.185 2015/01/16 14:34:51 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.186 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter @@ -45,6 +45,8 @@ #include "relayd.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + void relay_statistics(int, short, void *); int relay_dispatch_parent(int, struct privsep_proc *, struct imsg *); @@ -1964,7 +1966,7 @@ relay_tls_callback_dh(SSL *ssl, int export, int keylen) } /* get built-in params based on the shorter key length */ - dh = relay_tls_get_dhparams(MIN(keylen, maxlen)); + dh = relay_tls_get_dhparams(MINIMUM(keylen, maxlen)); return (dh); } @@ -1994,7 +1996,7 @@ relay_tls_ctx_create(struct relay *rlay) /* Modify session timeout and cache size*/ SSL_CTX_set_timeout(ctx, - (long)MIN(rlay->rl_conf.timeout.tv_sec, LONG_MAX)); + (long)MINIMUM(rlay->rl_conf.timeout.tv_sec, LONG_MAX)); if (proto->cache < -1) { SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); } else if (proto->cache >= -1) { @@ -2338,7 +2340,7 @@ relay_tls_readcb(int fd, short event, void *arg) } if (bufev->wm_read.high != 0) - howmuch = MIN(sizeof(rbuf), bufev->wm_read.high); + howmuch = MINIMUM(sizeof(rbuf), bufev->wm_read.high); ret = SSL_read(cre->ssl, rbuf, howmuch); if (ret <= 0) { diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c index b3038deebf0..99b804d06f5 100644 --- a/usr.sbin/relayd/relay_http.c +++ b/usr.sbin/relayd/relay_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_http.c,v 1.40 2015/01/13 09:24:20 reyk Exp $ */ +/* $OpenBSD: relay_http.c,v 1.41 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -693,7 +693,7 @@ relay_lookup_url(struct ctl_relay_event *cre, const char *host, struct kv *kv) struct http_descriptor *desc = (struct http_descriptor *)cre->desc; int i, j, dots; char *hi[RELAY_MAXLOOKUPLEVELS], *p, *pp, *c, ch; - char ph[MAXHOSTNAMELEN]; + char ph[HOST_NAME_MAX+1]; int ret; if (desc->http_path == NULL) diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c index df1912218a5..ccd85670275 100644 --- a/usr.sbin/relayd/relay_udp.c +++ b/usr.sbin/relayd/relay_udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_udp.c,v 1.37 2014/12/21 00:54:49 guenther Exp $ */ +/* $OpenBSD: relay_udp.c,v 1.38 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2007 - 2013 Reyk Floeter @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index eceeb2e3893..b5fdf917ecf 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.135 2014/12/18 20:55:01 reyk Exp $ */ +/* $OpenBSD: relayd.c,v 1.136 2015/01/16 15:06:40 deraadt Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,8 @@ #include "relayd.h" +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) + __dead void usage(void); int parent_configure(struct relayd *); @@ -1483,7 +1486,7 @@ socket_rlimit(int maxfd) if (maxfd == -1) rl.rlim_cur = rl.rlim_max; else - rl.rlim_cur = MAX(rl.rlim_max, (rlim_t)maxfd); + rl.rlim_cur = MAXIMUM(rl.rlim_max, (rlim_t)maxfd); if (setrlimit(RLIMIT_NOFILE, &rl) == -1) fatal("socket_rlimit: failed to set resource limit"); } diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 1da7e9dce94..1a450d2e1cf 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.203 2015/01/13 09:24:21 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.204 2015/01/16 15:06:41 deraadt Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -23,7 +23,6 @@ #include -#include /* MAXHOSTNAMELEN */ #include #include #include @@ -126,8 +125,8 @@ struct ctl_script { objid_t host; int retval; struct timeval timeout; - char name[MAXHOSTNAMELEN]; - char path[MAXPATHLEN]; + char name[HOST_NAME_MAX+1]; + char path[PATH_MAX]; }; struct ctl_demote { @@ -387,7 +386,7 @@ struct host_config { objid_t parentid; objid_t tableid; int retry; - char name[MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; struct sockaddr_storage ss; int ttl; int priority; @@ -469,7 +468,7 @@ struct table_config { int skip_cnt; char name[TABLE_NAME_SIZE]; size_t name_len; - char path[MAXPATHLEN]; + char path[PATH_MAX]; char exbuf[64]; char digest[41]; /* length of sha1 digest * 2 */ u_int8_t digest_type; @@ -683,9 +682,9 @@ struct protocol { char tlsciphers[768]; int tlsdhparams; int tlsecdhcurve; - char tlsca[MAXPATHLEN]; - char tlscacert[MAXPATHLEN]; - char tlscakey[MAXPATHLEN]; + char tlsca[PATH_MAX]; + char tlscacert[PATH_MAX]; + char tlscakey[PATH_MAX]; char *tlscapass; char name[MAX_NAME_SIZE]; int cache; @@ -728,7 +727,7 @@ struct relay_config { objid_t id; u_int32_t flags; objid_t proto; - char name[MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; in_port_t port; in_port_t dstport; int dstretry; @@ -813,7 +812,7 @@ TAILQ_HEAD(netroutelist, netroute); struct router_config { objid_t id; u_int32_t flags; - char name[MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; char label[RT_LABEL_SIZE]; int nroutes; objid_t gwtable; diff --git a/usr.sbin/relayd/ssl.c b/usr.sbin/relayd/ssl.c index 93f7b1e40ea..b8133296eaa 100644 --- a/usr.sbin/relayd/ssl.c +++ b/usr.sbin/relayd/ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.c,v 1.26 2014/12/12 10:05:09 reyk Exp $ */ +/* $OpenBSD: ssl.c,v 1.27 2015/01/16 15:06:41 deraadt Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -17,7 +17,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include -- 2.20.1