summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /libexec
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'libexec')
-rw-r--r--libexec/comsat/comsat.c7
-rw-r--r--libexec/fingerd/fingerd.c5
-rw-r--r--libexec/ftpd/ftpcmd.y4
-rw-r--r--libexec/ftpd/ftpd.c36
-rw-r--r--libexec/login_passwd/common.h4
-rw-r--r--libexec/login_passwd/login.c4
-rw-r--r--libexec/login_radius/raddauth.c6
-rw-r--r--libexec/login_skey/login_skey.c4
-rw-r--r--libexec/login_tis/login_tis.c3
-rw-r--r--libexec/login_yubikey/login_yubikey.c6
-rw-r--r--libexec/mail.local/locking.c9
-rw-r--r--libexec/mail.local/mail.local.c7
-rw-r--r--libexec/rpc.rquotad/rquotad.c4
-rw-r--r--libexec/rpc.rstatd/rstat_proc.c4
-rw-r--r--libexec/spamd-setup/spamd-setup.c6
-rw-r--r--libexec/spamd/spamd.c20
-rw-r--r--libexec/spamlogd/spamlogd.c3
-rw-r--r--libexec/talkd/announce.c6
-rw-r--r--libexec/talkd/process.c6
-rw-r--r--libexec/talkd/table.c3
-rw-r--r--libexec/talkd/talkd.c6
21 files changed, 82 insertions, 71 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index 0e4b0a5cc22..b77ef5aa13b 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comsat.c,v 1.37 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: comsat.c,v 1.38 2015/01/16 06:39:49 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -40,6 +40,7 @@
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
+#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -57,7 +58,7 @@ int debug = 0;
#define MAXIDLE 120
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct utmp *utmp = NULL;
time_t lastmsgtime;
int nutmp, uf;
@@ -222,7 +223,7 @@ notify(struct utmp *utp, off_t offset)
FILE *tp;
struct stat stb;
struct termios ttybuf;
- char tty[MAXPATHLEN], name[UT_NAMESIZE + 1];
+ char tty[PATH_MAX], name[UT_NAMESIZE + 1];
(void)snprintf(tty, sizeof(tty), "%s%.*s",
_PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line);
diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c
index 5d44b3f6dae..26d353caa77 100644
--- a/libexec/fingerd/fingerd.c
+++ b/libexec/fingerd/fingerd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fingerd.c,v 1.36 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: fingerd.c,v 1.37 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <limits.h>
#include "pathnames.h"
__dead void logerr(const char *, ...);
@@ -65,7 +66,7 @@ main(int argc, char *argv[])
#define ENTRIES 50
char **comp, *prog;
char **ap, *av[ENTRIES + 1], line[8192], *lp, *hname;
- char hostbuf[MAXHOSTNAMELEN];
+ char hostbuf[HOST_NAME_MAX+1];
prog = _PATH_FINGER;
logging = secure = user_required = short_list = 0;
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index e67e24ecdd4..a1de80ed99c 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpcmd.y,v 1.56 2014/02/08 13:31:51 millert Exp $ */
+/* $OpenBSD: ftpcmd.y,v 1.57 2015/01/16 06:39:50 deraadt Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
@@ -39,7 +39,7 @@
%{
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index b5f09f18277..9c2560303ff 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.205 2014/10/25 03:19:22 lteo Exp $ */
+/* $OpenBSD: ftpd.c,v 1.206 2015/01/16 06:39:50 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -151,9 +151,9 @@ off_t byte_count;
mode_t defumask = CMASK; /* default umask value */
int umaskchange = 1; /* allow user to change umask value. */
char tmpline[7];
-char hostname[MAXHOSTNAMELEN];
-char remotehost[MAXHOSTNAMELEN];
-char dhostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
+char remotehost[HOST_NAME_MAX+1];
+char dhostname[HOST_NAME_MAX+1];
char *guestpw;
char ttyline[20];
#if 0
@@ -227,7 +227,7 @@ void set_slave_signals(void);
static char *
curdir(void)
{
- static char path[MAXPATHLEN+1]; /* path + '/' */
+ static char path[PATH_MAX+1]; /* path + '/' */
if (getcwd(path, sizeof(path)-1) == NULL)
return ("");
@@ -702,7 +702,7 @@ sgetpwnam(char *name, struct passwd *pw)
static int login_attempts; /* number of failed login attempts */
static int askpasswd; /* had user command, ask for passwd */
-static char curname[MAXLOGNAME]; /* current USER name */
+static char curname[LOGIN_NAME_MAX]; /* current USER name */
/*
* USER command.
@@ -906,8 +906,8 @@ pass(char *passwd)
int authok;
unsigned int flags;
FILE *fp;
- static char homedir[MAXPATHLEN];
- char *motd, *dir, rootdir[MAXPATHLEN];
+ static char homedir[PATH_MAX];
+ char *motd, *dir, rootdir[PATH_MAX];
size_t sz_pw_dir;
if (logged_in || askpasswd == 0) {
@@ -1101,7 +1101,7 @@ pass(char *passwd)
/*
* Set home directory so that use of ~ (tilde) works correctly.
*/
- if (getcwd(homedir, MAXPATHLEN) != NULL) {
+ if (getcwd(homedir, PATH_MAX) != NULL) {
if (setenv("HOME", homedir, 1) == -1) {
reply(550, "Can't setup environment.");
goto bad;
@@ -1469,7 +1469,7 @@ dataconn(char *name, off_t size, char *mode)
(void) fclose(file);
file = getdatasock(mode);
if (file == NULL) {
- char hbuf[MAXHOSTNAMELEN], pbuf[10];
+ char hbuf[HOST_NAME_MAX+1], pbuf[10];
error = getnameinfo((struct sockaddr *)&data_source,
data_source.su_len, hbuf, sizeof(hbuf), pbuf,
@@ -1814,7 +1814,7 @@ statcmd(void)
{
union sockunion *su;
u_char *a, *p;
- char hbuf[MAXHOSTNAMELEN];
+ char hbuf[HOST_NAME_MAX+1];
int ispassive;
int error;
@@ -2092,7 +2092,7 @@ void
replydirname(const char *name, const char *message)
{
char *p, *ep;
- char npath[MAXPATHLEN * 2];
+ char npath[PATH_MAX * 2];
p = npath;
ep = &npath[sizeof(npath) - 1];
@@ -2137,7 +2137,7 @@ removedir(char *name)
void
pwd(void)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
if (getcwd(path, sizeof(path)) == NULL)
perror_reply(550, "Can't get current directory");
@@ -2596,7 +2596,7 @@ epsv_protounsupp(const char *message)
static int
guniquefd(char *local, char **nam)
{
- static char new[MAXPATHLEN];
+ static char new[PATH_MAX];
struct stat st;
int count, len, fd;
char *cp;
@@ -2715,7 +2715,7 @@ send_file_list(char *whichf)
continue;
while ((dir = readdir(dirp)) != NULL) {
- char nbuf[MAXPATHLEN];
+ char nbuf[PATH_MAX];
if (recvurg) {
myoob();
@@ -2797,9 +2797,9 @@ reapchild(int signo)
void
logxfer(char *name, off_t size, time_t start)
{
- char buf[400 + MAXHOSTNAMELEN*4 + MAXPATHLEN*4];
- char dir[MAXPATHLEN], path[MAXPATHLEN], rpath[MAXPATHLEN];
- char vremotehost[MAXHOSTNAMELEN*4], vpath[MAXPATHLEN*4];
+ char buf[400 + (HOST_NAME_MAX+1)*4 + PATH_MAX*4];
+ char dir[PATH_MAX], path[PATH_MAX], rpath[PATH_MAX];
+ char vremotehost[(HOST_NAME_MAX+1)*4], vpath[PATH_MAX*4];
char *vpw;
time_t now;
int len;
diff --git a/libexec/login_passwd/common.h b/libexec/login_passwd/common.h
index 18eca80aad7..aeaee7b41e4 100644
--- a/libexec/login_passwd/common.h
+++ b/libexec/login_passwd/common.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.h,v 1.4 2012/06/01 01:43:19 dlg Exp $ */
+/* $OpenBSD: common.h,v 1.5 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 2001 Hans Insulander <hin@openbsd.org>.
* All rights reserved.
@@ -30,7 +30,6 @@
#include <sys/types.h>
#include <sys/resource.h>
-#include <sys/param.h>
#include <signal.h>
#include <syslog.h>
@@ -43,6 +42,7 @@
#include <pwd.h>
#include <err.h>
#include <util.h>
+#include <limits.h>
#define MODE_LOGIN 0
diff --git a/libexec/login_passwd/login.c b/libexec/login_passwd/login.c
index 4f73489e463..6548178e001 100644
--- a/libexec/login_passwd/login.c
+++ b/libexec/login_passwd/login.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login.c,v 1.10 2012/06/01 01:43:19 dlg Exp $ */
+/* $OpenBSD: login.c,v 1.11 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1995 Berkeley Software Design, Inc. All rights reserved.
@@ -45,7 +45,7 @@ main(int argc, char **argv)
char *username, *password = NULL;
char response[1024];
int arg_login = 0, arg_notickets = 0;
- char invokinguser[MAXLOGNAME];
+ char invokinguser[LOGIN_NAME_MAX];
char *wheel = NULL, *class = NULL;
invokinguser[0] = '\0';
diff --git a/libexec/login_radius/raddauth.c b/libexec/login_radius/raddauth.c
index b0fb6933451..71089908058 100644
--- a/libexec/login_radius/raddauth.c
+++ b/libexec/login_radius/raddauth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raddauth.c,v 1.26 2014/08/10 05:06:38 guenther Exp $ */
+/* $OpenBSD: raddauth.c,v 1.27 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -483,7 +483,7 @@ rad_recv(char *state, char *challenge, u_char *req_vector)
in_addr_t
gethost(void)
{
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
if (gethostname(hostname, sizeof(hostname)))
err(1, "gethost");
@@ -511,7 +511,7 @@ void
getsecret(void)
{
FILE *servfd;
- char *host, *secret, buffer[MAXPATHLEN];
+ char *host, *secret, buffer[PATH_MAX];
size_t len;
snprintf(buffer, sizeof(buffer), "%s/%s",
diff --git a/libexec/login_skey/login_skey.c b/libexec/login_skey/login_skey.c
index b67e78ad287..63838238e17 100644
--- a/libexec/login_skey/login_skey.c
+++ b/libexec/login_skey/login_skey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_skey.c,v 1.23 2009/06/02 20:42:48 jmeltzer Exp $ */
+/* $OpenBSD: login_skey.c,v 1.24 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2000, 2001, 2004 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -16,7 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -34,6 +33,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <login_cap.h>
#include <bsd_auth.h>
diff --git a/libexec/login_tis/login_tis.c b/libexec/login_tis/login_tis.c
index 7bd493cde60..3ac22aaa3f1 100644
--- a/libexec/login_tis/login_tis.c
+++ b/libexec/login_tis/login_tis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_tis.c,v 1.11 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: login_tis.c,v 1.12 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <syslog.h>
#include <unistd.h>
diff --git a/libexec/login_yubikey/login_yubikey.c b/libexec/login_yubikey/login_yubikey.c
index 57170d4c79f..8580a836a8b 100644
--- a/libexec/login_yubikey/login_yubikey.c
+++ b/libexec/login_yubikey/login_yubikey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_yubikey.c,v 1.9 2014/05/28 12:59:03 otto Exp $ */
+/* $OpenBSD: login_yubikey.c,v 1.10 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2010 Daniel Hartmeier <daniel@benzedrine.cx>
@@ -30,7 +30,6 @@
*
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -43,6 +42,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include "yubikey.h"
@@ -178,7 +178,7 @@ clean_string(const char *s)
static int
yubikey_login(const char *username, const char *password)
{
- char fn[MAXPATHLEN];
+ char fn[PATH_MAX];
char hexkey[33], key[YUBIKEY_KEY_SIZE];
char hexuid[13], uid[YUBIKEY_UID_SIZE];
FILE *f;
diff --git a/libexec/mail.local/locking.c b/libexec/mail.local/locking.c
index a9a2a8d1881..191b2dfeed7 100644
--- a/libexec/mail.local/locking.c
+++ b/libexec/mail.local/locking.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: locking.c,v 1.11 2014/01/17 21:42:47 tobias Exp $ */
+/* $OpenBSD: locking.c,v 1.12 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
@@ -28,13 +28,14 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,7 +44,7 @@
#include "pathnames.h"
#include "mail.local.h"
-static char lpath[MAXPATHLEN];
+static char lpath[PATH_MAX];
void
rellock(void)
@@ -141,7 +142,7 @@ again:
void
baditem(char *path)
{
- char npath[MAXPATHLEN];
+ char npath[PATH_MAX];
int fd;
if (unlink(path) == 0)
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c
index 5c776327558..5231b44661d 100644
--- a/libexec/mail.local/mail.local.c
+++ b/libexec/mail.local/mail.local.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.local.c,v 1.32 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: mail.local.c,v 1.33 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -41,6 +41,7 @@
#include <pwd.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -171,7 +172,7 @@ deliver(int fd, char *name, int lockfile)
struct stat sb, fsb;
struct passwd *pw;
int mbfd=-1, rval=1, lfd=-1;
- char biffmsg[100], buf[8*1024], path[MAXPATHLEN];
+ char biffmsg[100], buf[8*1024], path[PATH_MAX];
off_t curoff;
size_t off;
ssize_t nr, nw;
diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c
index f357b26c7af..12b854eded1 100644
--- a/libexec/rpc.rquotad/rquotad.c
+++ b/libexec/rpc.rquotad/rquotad.c
@@ -1,10 +1,10 @@
-/* $OpenBSD: rquotad.c,v 1.21 2014/10/08 04:29:16 deraadt Exp $ */
+/* $OpenBSD: rquotad.c,v 1.22 2015/01/16 06:39:50 deraadt Exp $ */
/*
* by Manuel Bouyer (bouyer@ensta.fr). Public domain.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/socket.h>
diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c
index 793ca385924..1b73cba4128 100644
--- a/libexec/rpc.rstatd/rstat_proc.c
+++ b/libexec/rpc.rstatd/rstat_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rstat_proc.c,v 1.32 2014/09/15 19:08:19 miod Exp $ */
+/* $OpenBSD: rstat_proc.c,v 1.33 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -35,7 +35,7 @@
* rstat service: built with rstat.x and derived from rpc.rstatd.c
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sched.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c
index d88b31181db..9f37ee1c182 100644
--- a/libexec/spamd-setup/spamd-setup.c
+++ b/libexec/spamd-setup/spamd-setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd-setup.c,v 1.42 2015/01/14 11:59:10 millert Exp $ */
+/* $OpenBSD: spamd-setup.c,v 1.43 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
@@ -89,6 +89,8 @@ int greyonly = 1;
extern char *__progname;
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+
u_int32_t
imask(u_int8_t b)
{
@@ -140,7 +142,7 @@ range2cidrlist(struct cidr *list, u_int *cli, u_int *cls, u_int32_t start,
maxsize = maxblock(start, 32);
diff = maxdiff(start, end);
- maxsize = MAX(maxsize, diff);
+ maxsize = MAXIMUM(maxsize, diff);
if (*cls <= *cli + 1) { /* one extra for terminator */
tmp = reallocarray(list, *cls + 32,
sizeof(struct cidr));
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index 87d5eeffe9f..ea6a06f15d4 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.121 2015/01/13 23:22:33 millert Exp $ */
+/* $OpenBSD: spamd.c,v 1.122 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2002-2007 Bob Beck. All rights reserved.
@@ -17,10 +17,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
+#include <sys/signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -35,6 +36,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <netdb.h>
@@ -101,7 +103,7 @@ void getcaddr(struct con *);
void gethelo(char *, size_t, char *);
int read_configline(FILE *);
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct syslog_data sdata = SYSLOG_DATA_INIT;
char *nreply = "450";
char *spamd = "spamd IP-based SPAM blocker";
@@ -147,6 +149,8 @@ int syncrecv;
int syncsend;
#define MAXTIME 400
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+
void
usage(void)
{
@@ -1382,16 +1386,16 @@ jail:
int max, n;
int writers;
- max = MAX(s, conflisten);
+ max = MAXIMUM(s, conflisten);
if (syncrecv)
- max = MAX(max, syncfd);
- max = MAX(max, conffd);
- max = MAX(max, trapfd);
+ max = MAXIMUM(max, syncfd);
+ max = MAXIMUM(max, conffd);
+ max = MAXIMUM(max, trapfd);
time(&t);
for (i = 0; i < maxcon; i++)
if (con[i].fd != -1)
- max = MAX(max, con[i].fd);
+ max = MAXIMUM(max, con[i].fd);
if (max > omax) {
free(fdsr);
diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c
index 8c4ae14f5dc..18ce44a1e94 100644
--- a/libexec/spamlogd/spamlogd.c
+++ b/libexec/spamlogd/spamlogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamlogd.c,v 1.23 2014/10/25 03:19:22 lteo Exp $ */
+/* $OpenBSD: spamlogd.c,v 1.24 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/signal.h>
#include <net/if.h>
#include <net/if_pflog.h>
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index 1ba6286d536..421b9663fa9 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: announce.c,v 1.22 2013/04/17 17:40:53 deraadt Exp $ */
+/* $OpenBSD: announce.c,v 1.23 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -29,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -39,6 +38,7 @@
#include <errno.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -55,7 +55,7 @@ static void print_mesg(FILE *,CTL_MSG *,char *);
int
announce(CTL_MSG *request, char *remote_machine)
{
- char full_tty[MAXPATHLEN];
+ char full_tty[PATH_MAX];
FILE *tf;
struct stat stbuf;
diff --git a/libexec/talkd/process.c b/libexec/talkd/process.c
index 49c627e0f28..91b10ee4818 100644
--- a/libexec/talkd/process.c
+++ b/libexec/talkd/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.20 2013/11/27 21:25:24 deraadt Exp $ */
+/* $OpenBSD: process.c,v 1.21 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -37,7 +37,6 @@
* in the table for the local user
* DELETE - delete invitation
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -49,6 +48,7 @@
#include <string.h>
#include <ctype.h>
#include <paths.h>
+#include <limits.h>
#include "talkd.h"
#define satosin(sa) ((struct sockaddr_in *)(sa))
@@ -192,7 +192,7 @@ find_user(char *name, char *tty, size_t ttyl)
int status;
FILE *fp;
char line[UT_LINESIZE+1];
- char ftty[MAXPATHLEN];
+ char ftty[PATH_MAX];
time_t idle, now;
time(&now);
diff --git a/libexec/talkd/table.c b/libexec/talkd/table.c
index c75b1f76783..556ddfd4d66 100644
--- a/libexec/talkd/table.c
+++ b/libexec/talkd/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.15 2014/10/08 02:10:05 deraadt Exp $ */
+/* $OpenBSD: table.c,v 1.16 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -37,7 +37,6 @@
*
* Consider this a mis-guided attempt at modularity
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/queue.h>
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index ee2e7be2bad..f28d7acf071 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.c,v 1.22 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: talkd.c,v 1.23 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,6 @@
* disconnect all descriptors and ttys, and then endless
* loop on waiting for and processing requests
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <protocols/talkd.h>
@@ -44,6 +43,7 @@
#include <time.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -54,7 +54,7 @@ int debug = 0;
void timeout(int);
long lastmsgtime;
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
#define TIMEOUT 30
#define MAXIDLE 120