From efb9420f786b6f0ead36a3a16b3aee0c4f372fb6 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 16 Jan 2015 16:04:38 +0000 Subject: [PATCH] change to universe. The only changes in the binary are due to the heavy use of assert. ok millert --- usr.sbin/ldapd/ber.c | 6 +++--- usr.sbin/ldapd/btree.c | 3 +-- usr.sbin/ldapd/control.c | 3 +-- usr.sbin/ldapd/imsgev.c | 1 - usr.sbin/ldapd/ldapd.c | 4 ++-- usr.sbin/ldapd/ldapd.h | 5 ++--- usr.sbin/ldapd/ldape.c | 4 ++-- usr.sbin/ldapd/ssl.c | 7 ++++--- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/usr.sbin/ldapd/ber.c b/usr.sbin/ldapd/ber.c index 91f2596c6a8..95af0fc4992 100644 --- a/usr.sbin/ldapd/ber.c +++ b/usr.sbin/ldapd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.6 2011/01/08 19:42:45 martinh Exp $ */ +/* $OpenBSD: ber.c,v 1.7 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2007 Reyk Floeter @@ -19,7 +19,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include "ber.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) #define BER_TYPE_CONSTRUCTED 0x20 /* otherwise primitive */ #define BER_TYPE_SINGLE_MAX 30 @@ -1170,7 +1170,7 @@ ber_readbuf(struct ber *b, void *buf, size_t nbytes) return -1; sz = b->br_rend - b->br_rptr; - len = MIN(nbytes, sz); + len = MINIMUM(nbytes, sz); if (len == 0) { errno = ECANCELED; return (-1); /* end of buffer and parser wants more data */ diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index deecbcc74d0..cbba2ba5c54 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.31 2013/11/02 13:31:51 deraadt Exp $ */ +/* $OpenBSD: btree.c,v 1.32 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/usr.sbin/ldapd/control.c b/usr.sbin/ldapd/control.c index d13f404a352..e72139441d5 100644 --- a/usr.sbin/ldapd/control.c +++ b/usr.sbin/ldapd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.9 2013/11/02 13:31:51 deraadt Exp $ */ +/* $OpenBSD: control.c,v 1.10 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2010 Martin Hedenfalk @@ -18,7 +18,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/ldapd/imsgev.c b/usr.sbin/ldapd/imsgev.c index 6daa4d1d397..57c26a5e1f7 100644 --- a/usr.sbin/ldapd/imsgev.c +++ b/usr.sbin/ldapd/imsgev.c @@ -14,7 +14,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/ldapd/ldapd.c b/usr.sbin/ldapd/ldapd.c index 4dfd3557fe5..4d379a49f64 100644 --- a/usr.sbin/ldapd/ldapd.c +++ b/usr.sbin/ldapd/ldapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.c,v 1.11 2014/08/25 07:50:26 doug Exp $ */ +/* $OpenBSD: ldapd.c,v 1.12 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -351,7 +351,7 @@ ldapd_open_request(struct imsgev *iev, struct imsg *imsg) fatal("invalid size of open request"); /* make sure path is null-terminated */ - oreq->path[MAXPATHLEN] = '\0'; + oreq->path[PATH_MAX] = '\0'; if (strncmp(oreq->path, DATADIR, strlen(DATADIR)) != 0) { log_warnx("refusing to open file %s", oreq->path); diff --git a/usr.sbin/ldapd/ldapd.h b/usr.sbin/ldapd/ldapd.h index 3fb655ca6b7..144db1b7937 100644 --- a/usr.sbin/ldapd/ldapd.h +++ b/usr.sbin/ldapd/ldapd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.h,v 1.23 2012/06/16 00:08:32 jmatthew Exp $ */ +/* $OpenBSD: ldapd.h,v 1.24 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -285,7 +284,7 @@ struct auth_res }; struct open_req { - char path[MAXPATHLEN+1]; + char path[PATH_MAX+1]; unsigned int rdonly; }; diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c index b13fdb01455..58a698fcf14 100644 --- a/usr.sbin/ldapd/ldape.c +++ b/usr.sbin/ldapd/ldape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldape.c,v 1.18 2013/11/02 13:31:51 deraadt Exp $ */ +/* $OpenBSD: ldape.c,v 1.19 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -530,7 +530,7 @@ ldape_open_result(struct imsg *imsg) fatal("invalid size of open result"); /* make sure path is null-terminated */ - oreq->path[MAXPATHLEN] = '\0'; + oreq->path[PATH_MAX] = '\0'; log_debug("open(%s) returned fd %d", oreq->path, imsg->fd); diff --git a/usr.sbin/ldapd/ssl.c b/usr.sbin/ldapd/ssl.c index 2f2e0404da4..759a18f291a 100644 --- a/usr.sbin/ldapd/ssl.c +++ b/usr.sbin/ldapd/ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.c,v 1.7 2014/07/11 06:06:25 jsg Exp $ */ +/* $OpenBSD: ssl.c,v 1.8 2015/01/16 16:04:38 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,8 @@ #include #include +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + #include "ldapd.h" #define SSL_CIPHERS "HIGH:!aNULL" @@ -78,7 +79,7 @@ ssl_read(int fd, short event, void *p) } 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(s->s_ssl, rbuf, howmuch); if (ret <= 0) { -- 2.20.1