summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2015-01-20 23:14:00 +0000
committerDamien Miller <djm@mindrot.org>2015-01-26 23:58:53 +1100
commit087266ec33c76fc8d54ac5a19efacf2f4a4ca076 (patch)
tree71f57bb41b61561ebaa13026d8dc5d04d9829b00
parent57e783c8ba2c0797f93977e83b2a8644a03065d8 (diff)
upstream commit
Reduce use of <sys/param.h> and transition to <limits.h> throughout. ok djm markus
-rw-r--r--auth.c8
-rw-r--r--authfile.c6
-rw-r--r--channels.c5
-rw-r--r--clientloop.c13
-rw-r--r--deattack.c3
-rw-r--r--dh.c5
-rw-r--r--groupaccess.c4
-rw-r--r--gss-genr.c3
-rw-r--r--gss-serv.c3
-rw-r--r--kex.c4
-rw-r--r--kexgexs.c4
-rw-r--r--key.c4
-rw-r--r--krl.c4
-rw-r--r--moduli.c9
-rw-r--r--monitor.c4
-rw-r--r--monitor_mm.c4
-rw-r--r--mux.c3
-rw-r--r--packet.c5
-rw-r--r--sandbox-systrace.c4
-rw-r--r--serverloop.c4
-rw-r--r--sftp-client.c4
-rw-r--r--sftp-common.c4
-rw-r--r--sftp-server.c10
-rw-r--r--sftp.c6
-rw-r--r--ssh-keyscan.c3
-rw-r--r--ssh-pkcs11-helper.c3
-rw-r--r--ssh.c8
-rw-r--r--sshbuf.c4
-rw-r--r--sshconnect.c4
-rw-r--r--sshd.c10
-rw-r--r--sshlogin.c6
31 files changed, 82 insertions, 79 deletions
diff --git a/auth.c b/auth.c
index b259c6ef1..facc962b2 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.108 2014/12/21 22:27:56 djm Exp $ */ 1/* $OpenBSD: auth.c,v 1.109 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -27,7 +27,6 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <sys/param.h>
31 30
32#include <netinet/in.h> 31#include <netinet/in.h>
33 32
@@ -50,6 +49,7 @@
50#include <stdio.h> 49#include <stdio.h>
51#include <string.h> 50#include <string.h>
52#include <unistd.h> 51#include <unistd.h>
52#include <limits.h>
53 53
54#include "xmalloc.h" 54#include "xmalloc.h"
55#include "match.h" 55#include "match.h"
@@ -376,7 +376,7 @@ auth_root_allowed(const char *method)
376char * 376char *
377expand_authorized_keys(const char *filename, struct passwd *pw) 377expand_authorized_keys(const char *filename, struct passwd *pw)
378{ 378{
379 char *file, ret[MAXPATHLEN]; 379 char *file, ret[PATH_MAX];
380 int i; 380 int i;
381 381
382 file = percent_expand(filename, "h", pw->pw_dir, 382 file = percent_expand(filename, "h", pw->pw_dir,
@@ -468,7 +468,7 @@ int
468auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 468auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
469 uid_t uid, char *err, size_t errlen) 469 uid_t uid, char *err, size_t errlen)
470{ 470{
471 char buf[MAXPATHLEN], homedir[MAXPATHLEN]; 471 char buf[PATH_MAX], homedir[PATH_MAX];
472 char *cp; 472 char *cp;
473 int comparehome = 0; 473 int comparehome = 0;
474 struct stat st; 474 struct stat st;
diff --git a/authfile.c b/authfile.c
index d47e0058f..7d7f45ead 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.109 2015/01/08 10:14:08 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.110 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
4 * 4 *
@@ -27,7 +27,6 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <sys/param.h>
31#include <sys/uio.h> 30#include <sys/uio.h>
32 31
33#include <errno.h> 32#include <errno.h>
@@ -37,6 +36,7 @@
37#include <stdlib.h> 36#include <stdlib.h>
38#include <string.h> 37#include <string.h>
39#include <unistd.h> 38#include <unistd.h>
39#include <limits.h>
40 40
41#include "cipher.h" 41#include "cipher.h"
42#include "key.h" 42#include "key.h"
@@ -335,7 +335,7 @@ int
335sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp) 335sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
336{ 336{
337 struct sshkey *pub = NULL; 337 struct sshkey *pub = NULL;
338 char file[MAXPATHLEN]; 338 char file[PATH_MAX];
339 int r, fd; 339 int r, fd;
340 340
341 if (keyp != NULL) 341 if (keyp != NULL)
diff --git a/channels.c b/channels.c
index 29a62f70a..2fedaf89d 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.339 2015/01/19 20:07:45 markus Exp $ */ 1/* $OpenBSD: channels.c,v 1.340 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,7 +42,7 @@
42#include "includes.h" 42#include "includes.h"
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/param.h> 45#include <sys/param.h> /* MIN MAX */
46#include <sys/stat.h> 46#include <sys/stat.h>
47#include <sys/ioctl.h> 47#include <sys/ioctl.h>
48#include <sys/un.h> 48#include <sys/un.h>
@@ -62,6 +62,7 @@
62#include <string.h> 62#include <string.h>
63#include <termios.h> 63#include <termios.h>
64#include <unistd.h> 64#include <unistd.h>
65#include <limits.h>
65#include <stdarg.h> 66#include <stdarg.h>
66 67
67#include "openbsd-compat/sys-queue.h" 68#include "openbsd-compat/sys-queue.h"
diff --git a/clientloop.c b/clientloop.c
index 5a018ac79..4522a6332 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.265 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.266 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -61,9 +61,9 @@
61 61
62#include "includes.h" 62#include "includes.h"
63 63
64#include <sys/param.h> /* MIN MAX */
64#include <sys/types.h> 65#include <sys/types.h>
65#include <sys/ioctl.h> 66#include <sys/ioctl.h>
66#include <sys/param.h>
67#ifdef HAVE_SYS_STAT_H 67#ifdef HAVE_SYS_STAT_H
68# include <sys/stat.h> 68# include <sys/stat.h>
69#endif 69#endif
@@ -85,6 +85,7 @@
85#include <termios.h> 85#include <termios.h>
86#include <pwd.h> 86#include <pwd.h>
87#include <unistd.h> 87#include <unistd.h>
88#include <limits.h>
88 89
89#include "openbsd-compat/sys-queue.h" 90#include "openbsd-compat/sys-queue.h"
90#include "xmalloc.h" 91#include "xmalloc.h"
@@ -339,12 +340,12 @@ client_x11_get_proto(const char *display, const char *xauth_path,
339 display = xdisplay; 340 display = xdisplay;
340 } 341 }
341 if (trusted == 0) { 342 if (trusted == 0) {
342 xauthdir = xmalloc(MAXPATHLEN); 343 xauthdir = xmalloc(PATH_MAX);
343 xauthfile = xmalloc(MAXPATHLEN); 344 xauthfile = xmalloc(PATH_MAX);
344 mktemp_proto(xauthdir, MAXPATHLEN); 345 mktemp_proto(xauthdir, PATH_MAX);
345 if (mkdtemp(xauthdir) != NULL) { 346 if (mkdtemp(xauthdir) != NULL) {
346 do_unlink = 1; 347 do_unlink = 1;
347 snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", 348 snprintf(xauthfile, PATH_MAX, "%s/xauthfile",
348 xauthdir); 349 xauthdir);
349 snprintf(cmd, sizeof(cmd), 350 snprintf(cmd, sizeof(cmd),
350 "%s -f %s generate %s " SSH_X11_PROTO 351 "%s -f %s generate %s " SSH_X11_PROTO
diff --git a/deattack.c b/deattack.c
index b102401e7..e76481a6d 100644
--- a/deattack.c
+++ b/deattack.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: deattack.c,v 1.31 2015/01/19 19:52:16 markus Exp $ */ 1/* $OpenBSD: deattack.c,v 1.32 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Cryptographic attack detector for ssh - source code 3 * Cryptographic attack detector for ssh - source code
4 * 4 *
@@ -20,7 +20,6 @@
20 20
21#include "includes.h" 21#include "includes.h"
22 22
23#include <sys/param.h>
24#include <string.h> 23#include <string.h>
25#include <stdio.h> 24#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
diff --git a/dh.c b/dh.c
index 38ad615c5..a260240fd 100644
--- a/dh.c
+++ b/dh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.c,v 1.54 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: dh.c,v 1.55 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * 4 *
@@ -25,7 +25,7 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/param.h> 28#include <sys/param.h> /* MIN */
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -34,6 +34,7 @@
34#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <string.h> 36#include <string.h>
37#include <limits.h>
37 38
38#include "dh.h" 39#include "dh.h"
39#include "pathnames.h" 40#include "pathnames.h"
diff --git a/groupaccess.c b/groupaccess.c
index 1eab10b19..4fca04471 100644
--- a/groupaccess.c
+++ b/groupaccess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: groupaccess.c,v 1.14 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: groupaccess.c,v 1.15 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Kevin Steves. All rights reserved. 3 * Copyright (c) 2001 Kevin Steves. All rights reserved.
4 * 4 *
@@ -26,13 +26,13 @@
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/param.h>
30 29
31#include <grp.h> 30#include <grp.h>
32#include <unistd.h> 31#include <unistd.h>
33#include <stdarg.h> 32#include <stdarg.h>
34#include <stdlib.h> 33#include <stdlib.h>
35#include <string.h> 34#include <string.h>
35#include <limits.h>
36 36
37#include "xmalloc.h" 37#include "xmalloc.h"
38#include "groupaccess.h" 38#include "groupaccess.h"
diff --git a/gss-genr.c b/gss-genr.c
index b39281bc1..60ac65f8d 100644
--- a/gss-genr.c
+++ b/gss-genr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-genr.c,v 1.22 2013/11/08 00:39:15 djm Exp $ */ 1/* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
@@ -31,6 +31,7 @@
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/param.h> 32#include <sys/param.h>
33 33
34#include <limits.h>
34#include <stdarg.h> 35#include <stdarg.h>
35#include <string.h> 36#include <string.h>
36#include <unistd.h> 37#include <unistd.h>
diff --git a/gss-serv.c b/gss-serv.c
index 5c599247b..e7b8c5223 100644
--- a/gss-serv.c
+++ b/gss-serv.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-serv.c,v 1.27 2014/07/03 03:34:09 djm Exp $ */ 1/* $OpenBSD: gss-serv.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -29,7 +29,6 @@
29#ifdef GSSAPI 29#ifdef GSSAPI
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/param.h>
33 32
34#include <stdarg.h> 33#include <stdarg.h>
35#include <string.h> 34#include <string.h>
diff --git a/kex.c b/kex.c
index 9280dd3f4..5b7b1e86a 100644
--- a/kex.c
+++ b/kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.c,v 1.102 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: kex.c,v 1.103 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,7 +25,7 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/param.h> 28#include <sys/param.h> /* MAX roundup */
29 29
30#include <signal.h> 30#include <signal.h>
31#include <stdarg.h> 31#include <stdarg.h>
diff --git a/kexgexs.c b/kexgexs.c
index d45682063..ca5ee13e9 100644
--- a/kexgexs.c
+++ b/kexgexs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgexs.c,v 1.22 2015/01/20 07:55:33 djm Exp $ */ 1/* $OpenBSD: kexgexs.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -28,7 +28,7 @@
28 28
29#ifdef WITH_OPENSSL 29#ifdef WITH_OPENSSL
30 30
31#include <sys/param.h> 31#include <sys/param.h> /* MIN MAX */
32 32
33#include <stdarg.h> 33#include <stdarg.h>
34#include <stdio.h> 34#include <stdio.h>
diff --git a/key.c b/key.c
index 37eb67634..c2b696af9 100644
--- a/key.c
+++ b/key.c
@@ -1,15 +1,15 @@
1/* $OpenBSD: key.c,v 1.125 2015/01/08 10:14:08 djm Exp $ */ 1/* $OpenBSD: key.c,v 1.126 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * placed in the public domain 3 * placed in the public domain
4 */ 4 */
5 5
6#include "includes.h" 6#include "includes.h"
7 7
8#include <sys/param.h>
9#include <sys/types.h> 8#include <sys/types.h>
10#include <errno.h> 9#include <errno.h>
11#include <stdarg.h> 10#include <stdarg.h>
12#include <stdio.h> 11#include <stdio.h>
12#include <limits.h>
13 13
14#define SSH_KEY_NO_DEFINE 14#define SSH_KEY_NO_DEFINE
15#include "key.h" 15#include "key.h"
diff --git a/krl.c b/krl.c
index acfb22732..363bf122f 100644
--- a/krl.c
+++ b/krl.c
@@ -14,12 +14,12 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.c,v 1.28 2015/01/19 17:35:48 djm Exp $ */ 17/* $OpenBSD: krl.c,v 1.29 2015/01/20 23:14:00 deraadt Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
21#include <sys/param.h> /* MIN */
21#include <sys/types.h> 22#include <sys/types.h>
22#include <sys/param.h>
23#include <openbsd-compat/sys-tree.h> 23#include <openbsd-compat/sys-tree.h>
24#include <openbsd-compat/sys-queue.h> 24#include <openbsd-compat/sys-queue.h>
25 25
diff --git a/moduli.c b/moduli.c
index 729d55c10..ed1bdc946 100644
--- a/moduli.c
+++ b/moduli.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: moduli.c,v 1.29 2014/08/21 01:08:52 doug Exp $ */ 1/* $OpenBSD: moduli.c,v 1.30 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright 1994 Phil Karn <karn@qualcomm.com> 3 * Copyright 1994 Phil Karn <karn@qualcomm.com>
4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> 4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
@@ -41,7 +41,7 @@
41 41
42#ifdef WITH_OPENSSL 42#ifdef WITH_OPENSSL
43 43
44#include <sys/param.h> 44#include <sys/param.h> /* MAX */
45#include <sys/types.h> 45#include <sys/types.h>
46 46
47#include <openssl/bn.h> 47#include <openssl/bn.h>
@@ -54,6 +54,7 @@
54#include <stdarg.h> 54#include <stdarg.h>
55#include <time.h> 55#include <time.h>
56#include <unistd.h> 56#include <unistd.h>
57#include <limits.h>
57 58
58#include "xmalloc.h" 59#include "xmalloc.h"
59#include "dh.h" 60#include "dh.h"
@@ -449,11 +450,11 @@ static void
449write_checkpoint(char *cpfile, u_int32_t lineno) 450write_checkpoint(char *cpfile, u_int32_t lineno)
450{ 451{
451 FILE *fp; 452 FILE *fp;
452 char tmp[MAXPATHLEN]; 453 char tmp[PATH_MAX];
453 int r; 454 int r;
454 455
455 r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); 456 r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile);
456 if (r == -1 || r >= MAXPATHLEN) { 457 if (r == -1 || r >= PATH_MAX) {
457 logit("write_checkpoint: temp pathname too long"); 458 logit("write_checkpoint: temp pathname too long");
458 return; 459 return;
459 } 460 }
diff --git a/monitor.c b/monitor.c
index 40fff097d..90db9800b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.140 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: monitor.c,v 1.141 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -28,7 +28,6 @@
28#include "includes.h" 28#include "includes.h"
29 29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/param.h>
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include "openbsd-compat/sys-tree.h" 32#include "openbsd-compat/sys-tree.h"
34#include <sys/wait.h> 33#include <sys/wait.h>
@@ -42,6 +41,7 @@
42#include <signal.h> 41#include <signal.h>
43#include <stdlib.h> 42#include <stdlib.h>
44#include <string.h> 43#include <string.h>
44#include <limits.h>
45#include <stdarg.h> 45#include <stdarg.h>
46#include <stdio.h> 46#include <stdio.h>
47#include <unistd.h> 47#include <unistd.h>
diff --git a/monitor_mm.c b/monitor_mm.c
index 0ba0658a1..f224fb67e 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_mm.c,v 1.19 2014/01/04 17:50:55 tedu Exp $ */ 1/* $OpenBSD: monitor_mm.c,v 1.20 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -30,7 +30,6 @@
30#ifdef HAVE_SYS_MMAN_H 30#ifdef HAVE_SYS_MMAN_H
31#include <sys/mman.h> 31#include <sys/mman.h>
32#endif 32#endif
33#include <sys/param.h>
34#include "openbsd-compat/sys-tree.h" 33#include "openbsd-compat/sys-tree.h"
35 34
36#include <errno.h> 35#include <errno.h>
@@ -38,6 +37,7 @@
38#include <stddef.h> 37#include <stddef.h>
39#include <stdlib.h> 38#include <stdlib.h>
40#include <string.h> 39#include <string.h>
40#include <limits.h>
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "ssh.h" 43#include "ssh.h"
diff --git a/mux.c b/mux.c
index 52d478c2b..f3faaeec9 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.49 2014/12/22 07:24:11 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.50 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -33,7 +33,6 @@
33#include "includes.h" 33#include "includes.h"
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h>
37#include <sys/stat.h> 36#include <sys/stat.h>
38#include <sys/socket.h> 37#include <sys/socket.h>
39#include <sys/un.h> 38#include <sys/un.h>
diff --git a/packet.c b/packet.c
index cf9d3648b..2c8d8aa9b 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.202 2015/01/19 20:30:23 markus Exp $ */ 1/* $OpenBSD: packet.c,v 1.203 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -39,9 +39,9 @@
39 39
40#include "includes.h" 40#include "includes.h"
41 41
42#include <sys/param.h> /* MIN roundup */
42#include <sys/types.h> 43#include <sys/types.h>
43#include "openbsd-compat/sys-queue.h" 44#include "openbsd-compat/sys-queue.h"
44#include <sys/param.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#ifdef HAVE_SYS_TIME_H 46#ifdef HAVE_SYS_TIME_H
47# include <sys/time.h> 47# include <sys/time.h>
@@ -57,6 +57,7 @@
57#include <stdlib.h> 57#include <stdlib.h>
58#include <string.h> 58#include <string.h>
59#include <unistd.h> 59#include <unistd.h>
60#include <limits.h>
60#include <signal.h> 61#include <signal.h>
61#include <time.h> 62#include <time.h>
62 63
diff --git a/sandbox-systrace.c b/sandbox-systrace.c
index aaa3d8f0a..f30e70575 100644
--- a/sandbox-systrace.c
+++ b/sandbox-systrace.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sandbox-systrace.c,v 1.13 2014/07/17 00:10:56 djm Exp $ */ 1/* $OpenBSD: sandbox-systrace.c,v 1.14 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -20,7 +20,6 @@
20#ifdef SANDBOX_SYSTRACE 20#ifdef SANDBOX_SYSTRACE
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <sys/param.h>
24#include <sys/ioctl.h> 23#include <sys/ioctl.h>
25#include <sys/syscall.h> 24#include <sys/syscall.h>
26#include <sys/socket.h> 25#include <sys/socket.h>
@@ -37,6 +36,7 @@
37#include <stdlib.h> 36#include <stdlib.h>
38#include <string.h> 37#include <string.h>
39#include <unistd.h> 38#include <unistd.h>
39#include <limits.h>
40 40
41#include "atomicio.h" 41#include "atomicio.h"
42#include "log.h" 42#include "log.h"
diff --git a/serverloop.c b/serverloop.c
index 83a1e010d..48bb3f631 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.175 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.176 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -37,8 +37,8 @@
37 37
38#include "includes.h" 38#include "includes.h"
39 39
40#include <sys/param.h> /* MIN MAX */
40#include <sys/types.h> 41#include <sys/types.h>
41#include <sys/param.h>
42#include <sys/wait.h> 42#include <sys/wait.h>
43#include <sys/socket.h> 43#include <sys/socket.h>
44#ifdef HAVE_SYS_TIME_H 44#ifdef HAVE_SYS_TIME_H
diff --git a/sftp-client.c b/sftp-client.c
index 574da833a..80f4805cb 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.116 2015/01/14 13:54:13 djm Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.117 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -22,8 +22,8 @@
22 22
23#include "includes.h" 23#include "includes.h"
24 24
25#include <sys/param.h> /* MIN MAX */
25#include <sys/types.h> 26#include <sys/types.h>
26#include <sys/param.h>
27#ifdef HAVE_SYS_STATVFS_H 27#ifdef HAVE_SYS_STATVFS_H
28#include <sys/statvfs.h> 28#include <sys/statvfs.h>
29#endif 29#endif
diff --git a/sftp-common.c b/sftp-common.c
index 9c54d5c6b..9dc1f9831 100644
--- a/sftp-common.c
+++ b/sftp-common.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-common.c,v 1.27 2015/01/14 13:54:13 djm Exp $ */ 1/* $OpenBSD: sftp-common.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2001 Damien Miller. All rights reserved. 4 * Copyright (c) 2001 Damien Miller. All rights reserved.
@@ -26,9 +26,9 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#include <sys/param.h> /* MAX */
29#include <sys/types.h> 30#include <sys/types.h>
30#include <sys/stat.h> 31#include <sys/stat.h>
31#include <sys/param.h>
32 32
33#include <grp.h> 33#include <grp.h>
34#include <pwd.h> 34#include <pwd.h>
diff --git a/sftp-server.c b/sftp-server.c
index 7d09504d9..4f735cd93 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-server.c,v 1.104 2015/01/14 13:54:13 djm Exp $ */ 1/* $OpenBSD: sftp-server.c,v 1.105 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
4 * 4 *
@@ -17,8 +17,8 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#include <sys/param.h> /* MIN */
20#include <sys/types.h> 21#include <sys/types.h>
21#include <sys/param.h>
22#include <sys/stat.h> 22#include <sys/stat.h>
23#ifdef HAVE_SYS_TIME_H 23#ifdef HAVE_SYS_TIME_H
24# include <sys/time.h> 24# include <sys/time.h>
@@ -1055,7 +1055,7 @@ process_readdir(u_int32_t id)
1055 send_status(id, SSH2_FX_FAILURE); 1055 send_status(id, SSH2_FX_FAILURE);
1056 } else { 1056 } else {
1057 struct stat st; 1057 struct stat st;
1058 char pathname[MAXPATHLEN]; 1058 char pathname[PATH_MAX];
1059 Stat *stats; 1059 Stat *stats;
1060 int nstats = 10, count = 0, i; 1060 int nstats = 10, count = 0, i;
1061 1061
@@ -1150,7 +1150,7 @@ process_rmdir(u_int32_t id)
1150static void 1150static void
1151process_realpath(u_int32_t id) 1151process_realpath(u_int32_t id)
1152{ 1152{
1153 char resolvedname[MAXPATHLEN]; 1153 char resolvedname[PATH_MAX];
1154 char *path; 1154 char *path;
1155 int r; 1155 int r;
1156 1156
@@ -1238,7 +1238,7 @@ static void
1238process_readlink(u_int32_t id) 1238process_readlink(u_int32_t id)
1239{ 1239{
1240 int r, len; 1240 int r, len;
1241 char buf[MAXPATHLEN]; 1241 char buf[PATH_MAX];
1242 char *path; 1242 char *path;
1243 1243
1244 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0) 1244 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
diff --git a/sftp.c b/sftp.c
index eee472d08..cb9b967ed 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.169 2015/01/14 13:54:13 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -17,6 +17,7 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#include <sys/param.h> /* MIN MAX */
20#include <sys/types.h> 21#include <sys/types.h>
21#include <sys/ioctl.h> 22#include <sys/ioctl.h>
22#ifdef HAVE_SYS_STAT_H 23#ifdef HAVE_SYS_STAT_H
@@ -46,6 +47,7 @@
46#else 47#else
47typedef void EditLine; 48typedef void EditLine;
48#endif 49#endif
50#include <limits.h>
49#include <signal.h> 51#include <signal.h>
50#include <stdlib.h> 52#include <stdlib.h>
51#include <stdio.h> 53#include <stdio.h>
@@ -1401,7 +1403,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
1401 int cmdnum, i; 1403 int cmdnum, i;
1402 unsigned long n_arg = 0; 1404 unsigned long n_arg = 0;
1403 Attrib a, *aa; 1405 Attrib a, *aa;
1404 char path_buf[MAXPATHLEN]; 1406 char path_buf[PATH_MAX];
1405 int err = 0; 1407 int err = 0;
1406 glob_t g; 1408 glob_t g;
1407 1409
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index e02a3bbb1..62dbd62fa 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.95 2015/01/19 20:32:39 markus Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.96 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -10,7 +10,6 @@
10#include "includes.h" 10#include "includes.h"
11 11
12#include <sys/types.h> 12#include <sys/types.h>
13#include <sys/param.h>
14#include "openbsd-compat/sys-queue.h" 13#include "openbsd-compat/sys-queue.h"
15#include <sys/resource.h> 14#include <sys/resource.h>
16#ifdef HAVE_SYS_TIME_H 15#ifdef HAVE_SYS_TIME_H
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
index d487f023b..ceabc8ba7 100644
--- a/ssh-pkcs11-helper.c
+++ b/ssh-pkcs11-helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.9 2014/12/11 08:20:09 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.10 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -18,7 +18,6 @@
18#include "includes.h" 18#include "includes.h"
19 19
20#include <sys/types.h> 20#include <sys/types.h>
21#include <sys/param.h>
22#ifdef HAVE_SYS_TIME_H 21#ifdef HAVE_SYS_TIME_H
23# include <sys/time.h> 22# include <sys/time.h>
24#endif 23#endif
diff --git a/ssh.c b/ssh.c
index 5190f1f9b..430773c74 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.413 2015/01/16 07:19:48 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.414 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -48,7 +48,6 @@
48#endif 48#endif
49#include <sys/resource.h> 49#include <sys/resource.h>
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#include <sys/param.h>
52#include <sys/socket.h> 51#include <sys/socket.h>
53#include <sys/wait.h> 52#include <sys/wait.h>
54 53
@@ -67,6 +66,7 @@
67#include <stdlib.h> 66#include <stdlib.h>
68#include <string.h> 67#include <string.h>
69#include <unistd.h> 68#include <unistd.h>
69#include <limits.h>
70 70
71#include <netinet/in.h> 71#include <netinet/in.h>
72#include <arpa/inet.h> 72#include <arpa/inet.h>
@@ -454,7 +454,7 @@ resolve_canonicalize(char **hostp, int port)
454static void 454static void
455process_config_files(const char *host_arg, struct passwd *pw, int post_canon) 455process_config_files(const char *host_arg, struct passwd *pw, int post_canon)
456{ 456{
457 char buf[MAXPATHLEN]; 457 char buf[PATH_MAX];
458 int r; 458 int r;
459 459
460 if (config != NULL) { 460 if (config != NULL) {
@@ -505,7 +505,7 @@ int
505main(int ac, char **av) 505main(int ac, char **av)
506{ 506{
507 int i, r, opt, exit_status, use_syslog, config_test = 0; 507 int i, r, opt, exit_status, use_syslog, config_test = 0;
508 char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg, *logfile; 508 char *p, *cp, *line, *argv0, buf[PATH_MAX], *host_arg, *logfile;
509 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; 509 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
510 char cname[NI_MAXHOST]; 510 char cname[NI_MAXHOST];
511 struct stat st; 511 struct stat st;
diff --git a/sshbuf.c b/sshbuf.c
index 78f5340a1..dbe0c9192 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.c,v 1.2 2014/06/25 14:16:09 deraadt Exp $ */ 1/* $OpenBSD: sshbuf.c,v 1.3 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -18,8 +18,8 @@
18#define SSHBUF_INTERNAL 18#define SSHBUF_INTERNAL
19#include "includes.h" 19#include "includes.h"
20 20
21#include <sys/param.h> /* roundup */
21#include <sys/types.h> 22#include <sys/types.h>
22#include <sys/param.h>
23#include <signal.h> 23#include <signal.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <stdio.h> 25#include <stdio.h>
diff --git a/sshconnect.c b/sshconnect.c
index 1a633211a..6fc3fa520 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.255 2015/01/19 20:20:20 markus Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.256 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -15,8 +15,8 @@
15 15
16#include "includes.h" 16#include "includes.h"
17 17
18#include <sys/param.h> /* roundup */
18#include <sys/types.h> 19#include <sys/types.h>
19#include <sys/param.h>
20#include <sys/wait.h> 20#include <sys/wait.h>
21#include <sys/stat.h> 21#include <sys/stat.h>
22#include <sys/socket.h> 22#include <sys/socket.h>
diff --git a/sshd.c b/sshd.c
index 6e40ba42e..ef63bd1e8 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.437 2015/01/20 20:16:21 markus Exp $ */ 1/* $OpenBSD: sshd.c,v 1.438 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -45,7 +45,6 @@
45#include "includes.h" 45#include "includes.h"
46 46
47#include <sys/types.h> 47#include <sys/types.h>
48#include <sys/param.h>
49#include <sys/ioctl.h> 48#include <sys/ioctl.h>
50#include <sys/socket.h> 49#include <sys/socket.h>
51#ifdef HAVE_SYS_STAT_H 50#ifdef HAVE_SYS_STAT_H
@@ -72,6 +71,7 @@
72#include <stdlib.h> 71#include <stdlib.h>
73#include <string.h> 72#include <string.h>
74#include <unistd.h> 73#include <unistd.h>
74#include <limits.h>
75 75
76#ifdef WITH_OPENSSL 76#ifdef WITH_OPENSSL
77#include <openssl/dh.h> 77#include <openssl/dh.h>
@@ -229,7 +229,7 @@ u_char *session_id2 = NULL;
229u_int session_id2_len = 0; 229u_int session_id2_len = 0;
230 230
231/* record remote hostname or ip */ 231/* record remote hostname or ip */
232u_int utmp_len = MAXHOSTNAMELEN; 232u_int utmp_len = HOST_NAME_MAX+1;
233 233
234/* options.max_startup sized array of fd ints */ 234/* options.max_startup sized array of fd ints */
235int *startup_pipes = NULL; 235int *startup_pipes = NULL;
@@ -1544,8 +1544,8 @@ main(int ac, char **av)
1544 exit(1); 1544 exit(1);
1545 break; 1545 break;
1546 case 'u': 1546 case 'u':
1547 utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); 1547 utmp_len = (u_int)strtonum(optarg, 0, HOST_NAME_MAX+1+1, NULL);
1548 if (utmp_len > MAXHOSTNAMELEN) { 1548 if (utmp_len > HOST_NAME_MAX+1) {
1549 fprintf(stderr, "Invalid utmp length.\n"); 1549 fprintf(stderr, "Invalid utmp length.\n");
1550 exit(1); 1550 exit(1);
1551 } 1551 }
diff --git a/sshlogin.c b/sshlogin.c
index 3313ac998..818312ff1 100644
--- a/sshlogin.c
+++ b/sshlogin.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshlogin.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */ 1/* $OpenBSD: sshlogin.c,v 1.31 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,7 +42,6 @@
42#include "includes.h" 42#include "includes.h"
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/param.h> /* MAXHOSTNAMELEN */
46#include <sys/socket.h> 45#include <sys/socket.h>
47 46
48#include <netinet/in.h> 47#include <netinet/in.h>
@@ -54,6 +53,7 @@
54#include <string.h> 53#include <string.h>
55#include <time.h> 54#include <time.h>
56#include <unistd.h> 55#include <unistd.h>
56#include <limits.h>
57 57
58#include "loginrec.h" 58#include "loginrec.h"
59#include "log.h" 59#include "log.h"
@@ -88,7 +88,7 @@ static void
88store_lastlog_message(const char *user, uid_t uid) 88store_lastlog_message(const char *user, uid_t uid)
89{ 89{
90#ifndef NO_SSH_LASTLOG 90#ifndef NO_SSH_LASTLOG
91 char *time_string, hostname[MAXHOSTNAMELEN] = "", buf[512]; 91 char *time_string, hostname[HOST_NAME_MAX+1] = "", buf[512];
92 time_t last_login_time; 92 time_t last_login_time;
93 93
94 if (!options.print_lastlog) 94 if (!options.print_lastlog)