From: deraadt
Date: Mon, 19 Jan 2015 01:48:57 +0000 (+0000)
Subject: move to universe
X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dbad4650ad35235393a341c80d161513d6691849;p=openbsd
move to universe
ok yasuoka
---
diff --git a/usr.sbin/npppctl/npppctl.c b/usr.sbin/npppctl/npppctl.c
index 6f75d825c19..3ee8af9c8c1 100644
--- a/usr.sbin/npppctl/npppctl.c
+++ b/usr.sbin/npppctl/npppctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppctl.c,v 1.4 2014/07/22 02:02:59 yasuoka Exp $ */
+/* $OpenBSD: npppctl.c,v 1.5 2015/01/19 01:48:57 deraadt Exp $ */
/*
* Copyright (c) 2012 Internet Initiative Japan Inc.
@@ -15,7 +15,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include
#include
#include
#include
@@ -40,6 +39,8 @@
#include "parser.h"
#include "npppd_ctl.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#ifndef nitems
#define nitems(_x) (sizeof(_x) / sizeof(_x[0]))
#endif
@@ -196,7 +197,7 @@ show_clear_session(struct parse_result *result, FILE *out)
"but cannot disconnect only %d sessions because of "
"the implementation limit.",
ppp_id_idx, (int)nitems(ppp_id));
- clear_session(ppp_id, MIN(ppp_id_idx, nitems(ppp_id)),
+ clear_session(ppp_id, MINIMUM(ppp_id_idx, nitems(ppp_id)),
ppp_id_idx, out);
}
}
@@ -343,7 +344,7 @@ clear_session(u_int ppp_id[], int ppp_id_count, int total, FILE *out)
offsetof(struct npppd_disconnect_request, ppp_id[0])) /
sizeof(u_int);
for (i = 0; i < ppp_id_count; i += n) {
- n = MIN(nmax, ppp_id_count - i);
+ n = MINIMUM(nmax, ppp_id_count - i);
req.count = n;
iov[0].iov_base = &req;
iov[0].iov_len = offsetof(
diff --git a/usr.sbin/npppctl/parser.c b/usr.sbin/npppctl/parser.c
index 69e268af5c3..bc0a3d409d3 100644
--- a/usr.sbin/npppctl/parser.c
+++ b/usr.sbin/npppctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.2 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: parser.c,v 1.3 2015/01/19 01:48:57 deraadt Exp $ */
/* This file is derived from OpenBSD:src/usr.sbin/ikectl/parser.c 1.9 */
/*
@@ -19,7 +19,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/common/bytebuf.c b/usr.sbin/npppd/common/bytebuf.c
index a4fe5c17a81..39f3e2f5156 100644
--- a/usr.sbin/npppd/common/bytebuf.c
+++ b/usr.sbin/npppd/common/bytebuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bytebuf.c,v 1.6 2014/05/30 05:06:00 yasuoka Exp $ */
+/* $OpenBSD: bytebuf.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
@@ -41,7 +41,7 @@
* }
*
* @author Yasuoka Masahiko
- * $Id: bytebuf.c,v 1.6 2014/05/30 05:06:00 yasuoka Exp $
+ * $Id: bytebuf.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $
*/
#include
#include
@@ -80,10 +80,6 @@ struct _bytebuffer {
void *data;
};
-#ifndef MIN
-#define MIN(m,n) ((m) < (n)? (m) : (n))
-#endif
-
/**
* Create a bytebuffer and allocate memory area.
*
diff --git a/usr.sbin/npppd/common/debugutil.c b/usr.sbin/npppd/common/debugutil.c
index 7e687b732c6..6970ad47fad 100644
--- a/usr.sbin/npppd/common/debugutil.c
+++ b/usr.sbin/npppd/common/debugutil.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
#include
-#include
#include
#include
#include
@@ -35,6 +34,9 @@
#include "debugutil.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
int debuglevel = 0;
FILE *debugfp = NULL;
static int prio_idx_inititialized = 0;
@@ -137,8 +139,8 @@ vlog_printf(uint32_t prio, const char *format, va_list ap)
if (use_syslog && DL(prio) == 0) {
level = LOG_PRI(prio) + syslog_level_adjust;
if (!no_debuglog || level < LOG_DEBUG) {
- level = MIN(LOG_DEBUG, level);
- level = MAX(LOG_EMERG, level);
+ level = MINIMUM(LOG_DEBUG, level);
+ level = MAXIMUM(LOG_EMERG, level);
level |= (prio & LOG_FACMASK);
vsyslog(level, format, ap);
}
diff --git a/usr.sbin/npppd/common/ipsec_util.c b/usr.sbin/npppd/common/ipsec_util.c
index 23e43420e01..fc6aed3081b 100644
--- a/usr.sbin/npppd/common/ipsec_util.c
+++ b/usr.sbin/npppd/common/ipsec_util.c
@@ -23,13 +23,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ipsec_util.c,v 1.6 2014/11/18 20:54:28 krw Exp $ */
+/* $Id: ipsec_util.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $ */
/*@file IPsec related utility functions */
/*
* RFC 2367 PF_KEY Key Management API, Version 2
*/
-#include
#include
#include
#include
@@ -353,9 +352,9 @@ sadb_del_args_init(struct sadb_del_args *args, uint32_t spi,
args->dst.sadb_address_prefixlen = 0;
#define SADB2SA(_base) ((struct sockaddr *)((_base) + 1))
memcpy(&args->src_sa, SADB2SA(src),
- MIN(sizeof(args->src_sa), SADB2SA(src)->sa_len));
+ MINIMUM(sizeof(args->src_sa), SADB2SA(src)->sa_len));
memcpy(&args->dst_sa, SADB2SA(dst),
- MIN(sizeof(args->src_sa), SADB2SA(dst)->sa_len));
+ MINIMUM(sizeof(args->src_sa), SADB2SA(dst)->sa_len));
#undef SADB2SA
if (proto != 0) {
args->src.sadb_address_proto = proto;
diff --git a/usr.sbin/npppd/l2tp/l2tp_call.c b/usr.sbin/npppd/l2tp/l2tp_call.c
index 51b470d8ece..4d18d226d34 100644
--- a/usr.sbin/npppd/l2tp/l2tp_call.c
+++ b/usr.sbin/npppd/l2tp/l2tp_call.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_call.c,v 1.15 2013/09/20 07:26:23 yasuoka Exp $ */
+/* $OpenBSD: l2tp_call.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,10 +25,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: l2tp_call.c,v 1.15 2013/09/20 07:26:23 yasuoka Exp $ */
+/* $Id: l2tp_call.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/**@file L2TP LNS call */
#include
-#include
#include
#include
#include
@@ -331,7 +330,7 @@ l2tp_call_recv_ICRQ(l2tp_call *_this, u_char *pkt, int pktlen)
*/
break;
case L2TP_AVP_TYPE_CALLING_NUMBER:
- slen = MIN(sizeof(_this->calling_number) - 1,
+ slen = MINIMUM(sizeof(_this->calling_number) - 1,
avp_attr_length(avp));
memcpy(_this->calling_number, avp->attr_value, slen);
_this->calling_number[slen] = '\0';
@@ -671,7 +670,7 @@ l2tp_recv_CDN(l2tp_call *_this, u_char *pkt, int pktlen)
avp->attr_value[3];
len = avp->length - 12;
if (len > 0) {
- len = MIN(len, sizeof(pmes) - 1);
+ len = MINIMUM(len, sizeof(pmes) - 1);
memcpy(pmes, &avp->attr_value[4], len);
pmes[len] = '\0';
}
@@ -777,7 +776,7 @@ l2tp_call_send_CDN(l2tp_call *_this, int result_code, int error_code, const
#endif
if (errmes != NULL) {
- len = MIN(strlen(errmes), L2TP_AVP_MAXSIZ - 128);
+ len = MINIMUM(strlen(errmes), L2TP_AVP_MAXSIZ - 128);
memcpy(&avp->attr_value[avplen], errmes, len);
avplen += len;
}
@@ -1011,7 +1010,7 @@ l2tp_call_bind_ppp(l2tp_call *_this, dialin_proxy_info *dpi)
sizeof(ppp->phy_label));
L2TP_CALL_ASSERT(sizeof(ppp->phy_info) >= _this->ctrl->peer.ss_len);
memcpy(&ppp->phy_info, &_this->ctrl->peer,
- MIN(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
+ MINIMUM(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
strlcpy(ppp->calling_number, _this->calling_number,
sizeof(ppp->calling_number));
if (ppp_init(npppd_get_npppd(), ppp) != 0) {
diff --git a/usr.sbin/npppd/l2tp/l2tp_ctrl.c b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
index 802da768c1b..5b652eaaab4 100644
--- a/usr.sbin/npppd/l2tp/l2tp_ctrl.c
+++ b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_ctrl.c,v 1.18 2014/07/21 01:51:11 guenther Exp $ */
+/* $OpenBSD: l2tp_ctrl.c,v 1.19 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,9 +26,8 @@
* SUCH DAMAGE.
*/
/**@file Control connection processing functions for L2TP LNS */
-/* $Id: l2tp_ctrl.c,v 1.18 2014/07/21 01:51:11 guenther Exp $ */
+/* $Id: l2tp_ctrl.c,v 1.19 2015/01/19 01:48:59 deraadt Exp $ */
#include
-#include
#include
#include
#include
@@ -47,6 +46,7 @@
#include
#include
#include
+#include
#ifdef USE_LIBSOCKUTIL
#include
@@ -65,6 +65,8 @@
#include "version.h"
#include "recvfromto.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int l2tp_ctrl_init (l2tp_ctrl *, l2tpd *, struct sockaddr *, struct sockaddr *, void *);
static void l2tp_ctrl_reload (l2tp_ctrl *);
static int l2tp_ctrl_send_disconnect_notify (l2tp_ctrl *);
@@ -1256,13 +1258,13 @@ l2tp_ctrl_recv_SCCRQ(l2tp_ctrl *_this, u_char *pkt, int pktlen, l2tpd *_l2tpd,
continue;
case L2TP_AVP_TYPE_HOST_NAME:
AVP_SIZE_CHECK(avp, >, 4);
- len = MIN(sizeof(hostname) - 1, avp->length - 6);
+ len = MINIMUM(sizeof(hostname) - 1, avp->length - 6);
memcpy(hostname, avp->attr_value, len);
hostname[len] = '\0';
continue;
case L2TP_AVP_TYPE_VENDOR_NAME:
AVP_SIZE_CHECK(avp, >, 4);
- len = MIN(sizeof(vendorname) - 1, avp->length - 6);
+ len = MINIMUM(sizeof(vendorname) - 1, avp->length - 6);
memcpy(vendorname, avp->attr_value, len);
vendorname[len] = '\0';
continue;
@@ -1410,7 +1412,7 @@ l2tp_ctrl_recv_StopCCN(l2tp_ctrl *_this, u_char *pkt, int pktlen)
avp->attr_value[3];
len = avp->length - 12;
if (len > 0) {
- len = MIN(len, sizeof(pmes) - 1);
+ len = MINIMUM(len, sizeof(pmes) - 1);
memcpy(pmes, &avp->attr_value[4], len);
pmes[len] = '\0';
}
@@ -1473,7 +1475,7 @@ l2tp_ctrl_send_SCCRP(l2tp_ctrl *_this)
{
int len;
struct l2tp_avp *avp;
- char buf[L2TP_AVP_MAXSIZ], hbuf[MAXHOSTNAMELEN];
+ char buf[L2TP_AVP_MAXSIZ], hbuf[HOST_NAME_MAX+1];
const char *val;
bytebuffer *bytebuf;
diff --git a/usr.sbin/npppd/npppd/chap.c b/usr.sbin/npppd/npppd/chap.c
index 82d291cd927..656d2f79f79 100644
--- a/usr.sbin/npppd/npppd/chap.c
+++ b/usr.sbin/npppd/npppd/chap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chap.c,v 1.11 2014/05/28 16:14:19 yasuoka Exp $ */
+/* $OpenBSD: chap.c,v 1.12 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -36,9 +36,8 @@
*
*/
/* RFC 1994, 2433 */
-/* $Id: chap.c,v 1.11 2014/05/28 16:14:19 yasuoka Exp $ */
+/* $Id: chap.c,v 1.12 2015/01/19 01:48:59 deraadt Exp $ */
#include
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/npppd/control.c b/usr.sbin/npppd/npppd/control.c
index d7ce1b525d9..54fb8081c71 100644
--- a/usr.sbin/npppd/npppd/control.c
+++ b/usr.sbin/npppd/npppd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.2 2014/07/22 02:03:00 yasuoka Exp $ */
+/* $OpenBSD: control.c,v 1.3 2015/01/19 01:48:59 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer
@@ -16,7 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/npppd/lcp.c b/usr.sbin/npppd/npppd/lcp.c
index e52f481bc67..8bc298acd79 100644
--- a/usr.sbin/npppd/npppd/lcp.c
+++ b/usr.sbin/npppd/npppd/lcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcp.c,v 1.9 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $OpenBSD: lcp.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: lcp.c,v 1.9 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $Id: lcp.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides LCP related functions.
*
@@ -34,7 +34,6 @@
*
*/
#include
-#include
#include
#include
#include
@@ -981,7 +980,7 @@ lcp_rechoreq(fsm *f, int id, u_char *inp, int inlen)
inp0 = inp;
PUTLONG(_this->magic_number, inp)
- len = MIN(inlen, f->ppp->peer_mru - 8);
+ len = MINIMUM(inlen, f->ppp->peer_mru - 8);
fsm_sdata(f, ECHOREP, id, inp0, len);
return 1;
@@ -1004,7 +1003,7 @@ lcp_ext(fsm *f, int code, int id, u_char *inp, int inlen)
GETLONG(magic, inp);
inlen -= 4;
memset(buf, 0, sizeof(buf));
- len = MIN(inlen, sizeof(buf) - 1);
+ len = MINIMUM(inlen, sizeof(buf) - 1);
memcpy(buf, inp, len);
buf[len] = '\0';
for (i = 0; i < len; i++) {
diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c
index 7cd60c66909..584288625ec 100644
--- a/usr.sbin/npppd/npppd/npppd.c
+++ b/usr.sbin/npppd/npppd/npppd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd.c,v 1.39 2015/01/08 07:34:05 yasuoka Exp $ */
+/* $OpenBSD: npppd.c,v 1.40 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2005-2008,2009 Internet Initiative Japan Inc.
@@ -29,12 +29,12 @@
* Next pppd(nppd). This file provides a npppd daemon process and operations
* for npppd instance.
* @author Yasuoka Masahiko
- * $Id: npppd.c,v 1.39 2015/01/08 07:34:05 yasuoka Exp $
+ * $Id: npppd.c,v 1.40 2015/01/19 01:48:59 deraadt Exp $
*/
#include "version.h"
+#include /* ALIGNED_POINTER */
#include
#include
-#include
#include
#include
#include
@@ -839,7 +839,7 @@ npppd_network_output(npppd *_this, npppd_ppp *ppp, int proto, u_char *pktp,
ppp_log(ppp, LOG_DEBUG, "Received IP packet is too small");
return;
}
- lbuf = MIN(lpktp, sizeof(buf));
+ lbuf = MINIMUM(lpktp, sizeof(buf));
if (!ALIGNED_POINTER(pktp, struct ip)) {
memcpy(buf, pktp, lbuf);
pip = (struct ip *)buf;
diff --git a/usr.sbin/npppd/npppd/npppd.h b/usr.sbin/npppd/npppd/npppd.h
index 0d2e6954a9e..2806d5c3c7a 100644
--- a/usr.sbin/npppd/npppd/npppd.h
+++ b/usr.sbin/npppd/npppd/npppd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd.h,v 1.15 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: npppd.h,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -29,7 +29,6 @@
#define NPPPD_H 1
-#include
#include
#include
#include
@@ -37,6 +36,7 @@
#include
#include
#include
+#include
#include "addr_range.h"
@@ -44,6 +44,9 @@
#include "pptp_conf.h"
#include "pppoe_conf.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define NPPPD_USER "_ppp"
#define NPPPD_GENERIC_NAME_LEN 32
@@ -152,7 +155,7 @@ struct authconf {
bool eap_capable;
bool strip_nt_domain;
bool strip_atmark_realm;
- char users_file_path[MAXPATHLEN];
+ char users_file_path[PATH_MAX];
union {
struct {
struct radconf auth;
diff --git a/usr.sbin/npppd/npppd/npppd_auth.c b/usr.sbin/npppd/npppd/npppd_auth.c
index 01a83e2d2be..c263ccd7e37 100644
--- a/usr.sbin/npppd/npppd/npppd_auth.c
+++ b/usr.sbin/npppd/npppd/npppd_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_auth.c,v 1.15 2014/08/22 04:36:16 jsg Exp $ */
+/* $OpenBSD: npppd_auth.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file authentication realm */
-/* $Id: npppd_auth.c,v 1.15 2014/08/22 04:36:16 jsg Exp $ */
+/* $Id: npppd_auth.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
#include
#include
#include
@@ -456,7 +456,7 @@ npppd_auth_username_for_auth(npppd_auth_base *base, const char *username,
u0 = username;
u1 = username_buffer;
if (username_buffer != u0)
- memmove(username_buffer, u0, MIN(strlen(u0) + 1,
+ memmove(username_buffer, u0, MINIMUM(strlen(u0) + 1,
MAX_USERNAME_LENGTH));
if (base->strip_atmark_realm != 0) {
if ((atmark = strrchr(u1, '@')) != NULL)
diff --git a/usr.sbin/npppd/npppd/npppd_config.c b/usr.sbin/npppd/npppd/npppd_config.c
index 22ab364accb..d5a93fbcc2e 100644
--- a/usr.sbin/npppd/npppd/npppd_config.c
+++ b/usr.sbin/npppd/npppd/npppd_config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_config.c,v 1.13 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: npppd_config.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,11 +25,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: npppd_config.c,v 1.13 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: npppd_config.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*@file
* This file provides functions which operates configuration and so on.
*/
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/npppd/npppd_ctl.c b/usr.sbin/npppd/npppd/npppd_ctl.c
index c57f0c8bd8c..8b66baefc1b 100644
--- a/usr.sbin/npppd/npppd/npppd_ctl.c
+++ b/usr.sbin/npppd/npppd/npppd_ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_ctl.c,v 1.13 2014/10/18 04:12:57 deraadt Exp $ */
+/* $OpenBSD: npppd_ctl.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include
#include
#include
#include
@@ -280,7 +279,7 @@ npppd_who_init(struct npppd_who *_this, npppd_ppp *ppp)
_this->tunnel_peer.peer_in4.sin_family = AF_UNSPEC;
if (((struct sockaddr *)&ppp->phy_info)->sa_len > 0) {
memcpy(&_this->tunnel_peer, &ppp->phy_info,
- MIN(sizeof(_this->tunnel_peer),
+ MINIMUM(sizeof(_this->tunnel_peer),
((struct sockaddr *)&ppp->phy_info)->sa_len));
}
diff --git a/usr.sbin/npppd/npppd/npppd_iface.c b/usr.sbin/npppd/npppd/npppd_iface.c
index 06026f1ac4d..2f80c7cbddc 100644
--- a/usr.sbin/npppd/npppd/npppd_iface.c
+++ b/usr.sbin/npppd/npppd/npppd_iface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_iface.c,v 1.9 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: npppd_iface.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,13 +25,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: npppd_iface.c,v 1.9 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: npppd_iface.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* The interface of npppd and kernel.
* This is an implementation to use tun(4) or pppx(4).
*/
#include
-#include
#include
#include
#include
@@ -272,7 +271,7 @@ int
npppd_iface_start(npppd_iface *_this)
{
int x;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
NPPPD_IFACE_ASSERT(_this != NULL);
diff --git a/usr.sbin/npppd/npppd/npppd_local.h b/usr.sbin/npppd/npppd/npppd_local.h
index b63cc506827..d60b1839a18 100644
--- a/usr.sbin/npppd/npppd/npppd_local.h
+++ b/usr.sbin/npppd/npppd/npppd_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_local.h,v 1.13 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: npppd_local.h,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -33,7 +33,6 @@
#define NPPPD_BUFSZ BUFSZ
#endif
-#include
#include
#include "npppd_defs.h"
@@ -131,10 +130,10 @@ struct _npppd {
int auth_finalizer_itvl;
/** name of configuration file */
- char config_file[MAXPATHLEN];
+ char config_file[PATH_MAX];
/** name of pid file */
- char pidpath[MAXPATHLEN];
+ char pidpath[PATH_MAX];
/** process id */
pid_t pid;
diff --git a/usr.sbin/npppd/npppd/npppd_subr.c b/usr.sbin/npppd/npppd/npppd_subr.c
index 3f4aded41e8..c391419e868 100644
--- a/usr.sbin/npppd/npppd/npppd_subr.c
+++ b/usr.sbin/npppd/npppd/npppd_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_subr.c,v 1.15 2014/11/13 04:18:27 yasuoka Exp $ */
+/* $OpenBSD: npppd_subr.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,7 +28,6 @@
/**@file
* This file provides helper functions for npppd.
*/
-#include
#include
#include
@@ -58,6 +57,8 @@
#include "npppd_subr.h"
#include "privsep.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static u_int16_t route_seq = 0;
static int in_route0(int, struct in_addr *, struct in_addr *, struct in_addr *, int, const char *, uint32_t);
#define ROUNDUP(a) \
@@ -507,7 +508,7 @@ adjust_tcp_mss(u_char *pktp, int lpktp, int mtu)
if ((th->th_flags & TH_SYN) == 0)
return 0;
- lpktp = MIN(th->th_off << 4, lpktp);
+ lpktp = MINIMUM(th->th_off << 4, lpktp);
pktp += sizeof(struct tcphdr);
lpktp -= sizeof(struct tcphdr);
diff --git a/usr.sbin/npppd/npppd/npppd_tun.c b/usr.sbin/npppd/npppd/npppd_tun.c
index 28631bb4be4..9eddf7df632 100644
--- a/usr.sbin/npppd/npppd/npppd_tun.c
+++ b/usr.sbin/npppd/npppd/npppd_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_tun.c,v 1.4 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: npppd_tun.c,v 1.5 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -30,7 +30,6 @@
*/
#include
#include
-#include
#include
#include
#include
@@ -81,7 +80,7 @@ int
npppd_tundev_start(npppd *_this)
{
int x, sock;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
struct ifaliasreq ifra;
struct sockaddr_in *sin0;
diff --git a/usr.sbin/npppd/npppd/pap.c b/usr.sbin/npppd/npppd/pap.c
index 73eb31da384..2e199099b02 100644
--- a/usr.sbin/npppd/npppd/pap.c
+++ b/usr.sbin/npppd/npppd/pap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pap.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: pap.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,13 +25,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pap.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $Id: pap.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides Password Authentication Protocol (PAP) handlers.
* @author Yasuoka Masahiko
*/
#include
-#include
#include
#include
#include
@@ -292,7 +291,7 @@ pap_response(pap *_this, int authok, const char *mes)
lmes = 0;
else
lmes = strlen(mes);
- lmes = MIN(lmes, lpktp - 1);
+ lmes = MINIMUM(lmes, lpktp - 1);
PUTCHAR(lmes, pktp1);
if (lmes > 0)
@@ -426,7 +425,7 @@ pap_radius_authenticate(pap *_this, const char *username, const char *password)
s_len = strlen(s);
memset(pass, 0, sizeof(pass)); /* null padding */
- passlen = MIN(strlen(password), sizeof(pass));
+ passlen = MINIMUM(strlen(password), sizeof(pass));
memcpy(pass, password, passlen);
if ((passlen % 16) != 0)
passlen += 16 - (passlen % 16);
diff --git a/usr.sbin/npppd/npppd/ppp.c b/usr.sbin/npppd/npppd/ppp.c
index 8f8d48b8ae4..bea6386fda6 100644
--- a/usr.sbin/npppd/npppd/ppp.c
+++ b/usr.sbin/npppd/npppd/ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp.c,v 1.23 2014/11/20 14:51:42 krw Exp $ */
+/* $OpenBSD: ppp.c,v 1.24 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,14 +25,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ppp.c,v 1.23 2014/11/20 14:51:42 krw Exp $ */
+/* $Id: ppp.c,v 1.24 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides PPP(Point-to-Point Protocol, RFC 1661) and
* {@link :: _npppd_ppp PPP instance} related functions.
*/
#include
#include
-#include
#include
#include
#include
@@ -953,7 +952,7 @@ ppp_recv_packet(npppd_ppp *_this, unsigned char *pkt, int lpkt, int flags)
* comply with the peer's established MRU.
*/
lcp_send_protrej(&_this->lcp, inp_proto,
- MIN(lpkt - (inp_proto - pkt), NPPPD_MIN_MRU - 32));
+ MINIMUM(lpkt - (inp_proto - pkt), NPPPD_MIN_MRU - 32));
}
return 1;
diff --git a/usr.sbin/npppd/npppd/privsep.c b/usr.sbin/npppd/npppd/privsep.c
index a1e05616e50..8ad7c514bfe 100644
--- a/usr.sbin/npppd/npppd/privsep.c
+++ b/usr.sbin/npppd/npppd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.15 2014/08/23 15:29:55 doug Exp $ */
+/* $OpenBSD: privsep.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*
* Copyright (c) 2010 Yasuoka Masahiko
@@ -15,7 +15,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/npppd/radius+.c b/usr.sbin/npppd/npppd/radius+.c
index 87272d70d99..ebd42e06b16 100644
--- a/usr.sbin/npppd/npppd/radius+.c
+++ b/usr.sbin/npppd/npppd/radius+.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radius+.c,v 1.7 2013/08/26 14:15:08 naddy Exp $ */
+/* $OpenBSD: radius+.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -33,7 +33,6 @@
#include
#endif
-#include
#include
#include
#include
@@ -43,6 +42,8 @@
#include "radius+_local.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
u_int8_t radius_id_counter = 0;
static int radius_check_packet_data(const RADIUS_PACKET_DATA* pdata,
@@ -351,7 +352,7 @@ int radius_put_raw_attr_all(RADIUS_PACKET* packet, u_int8_t type,
off = 0;
while (off < length) {
- len0 = MIN(length - off, 255-2);
+ len0 = MINIMUM(length - off, 255-2);
if(radius_ensure_add_capacity(packet, len0+2) != 0)
return 1;
@@ -514,7 +515,7 @@ int radius_put_vs_raw_attr_all(RADIUS_PACKET* packet, u_int32_t vendor,
off = 0;
while (off < length) {
- len0 = MIN(length - off, 255-8);
+ len0 = MINIMUM(length - off, 255-8);
if(radius_ensure_add_capacity(packet, len0+8) != 0)
return 1;
diff --git a/usr.sbin/npppd/npppd/radius_req.c b/usr.sbin/npppd/npppd/radius_req.c
index 5477e060100..748cb7f9756 100644
--- a/usr.sbin/npppd/npppd/radius_req.c
+++ b/usr.sbin/npppd/npppd/radius_req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radius_req.c,v 1.8 2014/05/30 05:06:00 yasuoka Exp $ */
+/* $OpenBSD: radius_req.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,10 +28,9 @@
/**@file
* This file provides functions for RADIUS request using radius+.c and event(3).
* @author Yasuoka Masahiko
- * $Id: radius_req.c,v 1.8 2014/05/30 05:06:00 yasuoka Exp $
+ * $Id: radius_req.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $
*/
#include
-#include
#include
#include
#include
diff --git a/usr.sbin/npppd/pppoe/pppoe_session.c b/usr.sbin/npppd/pppoe/pppoe_session.c
index e81348878a3..676b60cc990 100644
--- a/usr.sbin/npppd/pppoe/pppoe_session.c
+++ b/usr.sbin/npppd/pppoe/pppoe_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pppoe_session.c,v 1.8 2014/11/18 20:54:28 krw Exp $ */
+/* $OpenBSD: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,12 +28,11 @@
/**@file
* Session management of PPPoE protocol
- * $Id: pppoe_session.c,v 1.8 2014/11/18 20:54:28 krw Exp $
+ * $Id: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $
*/
#include
#include
-#include
#include
#include
#include
@@ -323,7 +322,7 @@ pppoe_session_send_PADS(pppoe_session *_this, struct pppoe_tlv *hostuniq,
if (len > 0) {
bytebuffer_put(buf, service_name->value, len);
strlcpy(msgbuf, service_name->value,
- MIN(len + 1, sizeof(msgbuf)));
+ MINIMUM(len + 1, sizeof(msgbuf)));
}
}
diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c
index 8315ac31b8d..8ee027209c6 100644
--- a/usr.sbin/npppd/pppoe/pppoed.c
+++ b/usr.sbin/npppd/pppoe/pppoed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pppoed.c,v 1.16 2014/11/27 10:22:38 tobias Exp $ */
+/* $OpenBSD: pppoed.c,v 1.17 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,10 +28,10 @@
/**@file
* This file provides the PPPoE(RFC2516) server(access concentrator)
* implementaion.
- * $Id: pppoed.c,v 1.16 2014/11/27 10:22:38 tobias Exp $
+ * $Id: pppoed.c,v 1.17 2015/01/19 01:48:59 deraadt Exp $
*/
+#include /* ALIGN */
#include
-#include
#include
#include
#include
@@ -69,6 +69,8 @@
#include "pppoe.h"
#include "pppoe_local.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int pppoed_seqno = 0;
#ifdef PPPOED_DEBUG
diff --git a/usr.sbin/npppd/pptp/pptp_call.c b/usr.sbin/npppd/pptp/pptp_call.c
index a9ff1276cbb..cbf04fb0573 100644
--- a/usr.sbin/npppd/pptp/pptp_call.c
+++ b/usr.sbin/npppd/pptp/pptp_call.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptp_call.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: pptp_call.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,11 +25,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptp_call.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $Id: pptp_call.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/**@file PPTP Call */
/* currently it supports PAC mode only */
#include
-#include
#include
#include
#include
@@ -753,7 +752,7 @@ pptp_call_bind_ppp(pptp_call *_this)
PPTP_CALL_ASSERT(sizeof(ppp->phy_info) >= _this->ctrl->peer.ss_len);
memcpy(&ppp->phy_info, &_this->ctrl->peer,
- MIN(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
+ MINIMUM(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
if (ppp_init(npppd_get_npppd(), ppp) != 0)
goto fail;
diff --git a/usr.sbin/npppd/pptp/pptp_ctrl.c b/usr.sbin/npppd/pptp/pptp_ctrl.c
index a42e8635166..80de9c12ea2 100644
--- a/usr.sbin/npppd/pptp/pptp_ctrl.c
+++ b/usr.sbin/npppd/pptp/pptp_ctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptp_ctrl.c,v 1.8 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $OpenBSD: pptp_ctrl.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -29,9 +29,8 @@
* PPTP(RFC 2637) control connection implementation.
* currently it only support PAC part
*/
-/* $Id: pptp_ctrl.c,v 1.8 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $Id: pptp_ctrl.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
#include
-#include
#include
#include
#include
@@ -58,6 +57,9 @@
#include "pptp_local.h"
#include "pptp_subr.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/* periods of pptp_ctrl_timeout */
#define PPTP_CTRL_TIMEOUT_IVAL_SEC 2
@@ -236,7 +238,7 @@ pptp_ctrl_timeout(int fd, short event, void *ctx)
}
break;
case PPTP_CTRL_STATE_ESTABLISHED:
- last = MAX(_this->last_rcv_ctrl, _this->last_snd_ctrl);
+ last = MAXIMUM(_this->last_rcv_ctrl, _this->last_snd_ctrl);
if (curr_time - _this->last_rcv_ctrl
>= _this->echo_interval + _this->echo_timeout) {
diff --git a/usr.sbin/npppd/pptp/pptpd.c b/usr.sbin/npppd/pptp/pptpd.c
index 93649f35893..489ba324d09 100644
--- a/usr.sbin/npppd/pptp/pptpd.c
+++ b/usr.sbin/npppd/pptp/pptpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,15 +25,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides a implementation of PPTP daemon. Currently it
* provides functions for PAC (PPTP Access Concentrator) only.
- * $Id: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $
+ * $Id: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $
*/
#include
-#include
#include
#include
#include
@@ -70,6 +69,8 @@
#include "privsep.h"
#include "accept.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int pptpd_seqno = 0;
#ifdef PPTPD_DEBUG
@@ -127,7 +128,7 @@ pptpd_init(pptpd *_this)
call[i - 1] = call0;
}
- for (i = 0; i < MIN(PPTP_MAX_CALL, countof(call)); i++)
+ for (i = 0; i < MINIMUM(PPTP_MAX_CALL, countof(call)); i++)
slist_add(&_this->call_free_list, (void *)(uintptr_t)call[i]);
slist_add(&_this->call_free_list, (void *)PPTPD_SHUFFLE_MARK);