upstream commit

Reduce use of <sys/param.h> and transition to <limits.h>
 throughout. ok djm markus
This commit is contained in:
deraadt@openbsd.org 2015-01-20 23:14:00 +00:00 committed by Damien Miller
parent 57e783c8ba
commit 087266ec33
31 changed files with 82 additions and 79 deletions

8
auth.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth.c,v 1.108 2014/12/21 22:27:56 djm Exp $ */ /* $OpenBSD: auth.c,v 1.109 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2000 Markus Friedl. All rights reserved.
* *
@ -27,7 +27,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -50,6 +49,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "xmalloc.h" #include "xmalloc.h"
#include "match.h" #include "match.h"
@ -376,7 +376,7 @@ auth_root_allowed(const char *method)
char * char *
expand_authorized_keys(const char *filename, struct passwd *pw) expand_authorized_keys(const char *filename, struct passwd *pw)
{ {
char *file, ret[MAXPATHLEN]; char *file, ret[PATH_MAX];
int i; int i;
file = percent_expand(filename, "h", pw->pw_dir, file = percent_expand(filename, "h", pw->pw_dir,
@ -468,7 +468,7 @@ int
auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
uid_t uid, char *err, size_t errlen) uid_t uid, char *err, size_t errlen)
{ {
char buf[MAXPATHLEN], homedir[MAXPATHLEN]; char buf[PATH_MAX], homedir[PATH_MAX];
char *cp; char *cp;
int comparehome = 0; int comparehome = 0;
struct stat st; struct stat st;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: authfile.c,v 1.109 2015/01/08 10:14:08 djm Exp $ */ /* $OpenBSD: authfile.c,v 1.110 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
* *
@ -27,7 +27,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <errno.h> #include <errno.h>
@ -37,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "cipher.h" #include "cipher.h"
#include "key.h" #include "key.h"
@ -335,7 +335,7 @@ int
sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp) sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
{ {
struct sshkey *pub = NULL; struct sshkey *pub = NULL;
char file[MAXPATHLEN]; char file[PATH_MAX];
int r, fd; int r, fd;
if (keyp != NULL) if (keyp != NULL)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.339 2015/01/19 20:07:45 markus Exp $ */ /* $OpenBSD: channels.c,v 1.340 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -42,7 +42,7 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h> /* MIN MAX */
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/un.h> #include <sys/un.h>
@ -62,6 +62,7 @@
#include <string.h> #include <string.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.c,v 1.265 2015/01/19 20:16:15 markus Exp $ */ /* $OpenBSD: clientloop.c,v 1.266 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -61,9 +61,9 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN MAX */
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> # include <sys/stat.h>
#endif #endif
@ -85,6 +85,7 @@
#include <termios.h> #include <termios.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -339,12 +340,12 @@ client_x11_get_proto(const char *display, const char *xauth_path,
display = xdisplay; display = xdisplay;
} }
if (trusted == 0) { if (trusted == 0) {
xauthdir = xmalloc(MAXPATHLEN); xauthdir = xmalloc(PATH_MAX);
xauthfile = xmalloc(MAXPATHLEN); xauthfile = xmalloc(PATH_MAX);
mktemp_proto(xauthdir, MAXPATHLEN); mktemp_proto(xauthdir, PATH_MAX);
if (mkdtemp(xauthdir) != NULL) { if (mkdtemp(xauthdir) != NULL) {
do_unlink = 1; do_unlink = 1;
snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", snprintf(xauthfile, PATH_MAX, "%s/xauthfile",
xauthdir); xauthdir);
snprintf(cmd, sizeof(cmd), snprintf(cmd, sizeof(cmd),
"%s -f %s generate %s " SSH_X11_PROTO "%s -f %s generate %s " SSH_X11_PROTO

View File

@ -1,4 +1,4 @@
/* $OpenBSD: deattack.c,v 1.31 2015/01/19 19:52:16 markus Exp $ */ /* $OpenBSD: deattack.c,v 1.32 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Cryptographic attack detector for ssh - source code * Cryptographic attack detector for ssh - source code
* *
@ -20,7 +20,6 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

5
dh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: dh.c,v 1.54 2015/01/19 20:16:15 markus Exp $ */ /* $OpenBSD: dh.c,v 1.55 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000 Niels Provos. All rights reserved. * Copyright (c) 2000 Niels Provos. All rights reserved.
* *
@ -25,7 +25,7 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> #include <sys/param.h> /* MIN */
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/dh.h> #include <openssl/dh.h>
@ -34,6 +34,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "dh.h" #include "dh.h"
#include "pathnames.h" #include "pathnames.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: groupaccess.c,v 1.14 2013/05/17 00:13:13 djm Exp $ */ /* $OpenBSD: groupaccess.c,v 1.15 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001 Kevin Steves. All rights reserved. * Copyright (c) 2001 Kevin Steves. All rights reserved.
* *
@ -26,13 +26,13 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <grp.h> #include <grp.h>
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "xmalloc.h" #include "xmalloc.h"
#include "groupaccess.h" #include "groupaccess.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gss-genr.c,v 1.22 2013/11/08 00:39:15 djm Exp $ */ /* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
@ -31,6 +31,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gss-serv.c,v 1.27 2014/07/03 03:34:09 djm Exp $ */ /* $OpenBSD: gss-serv.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@ -29,7 +29,6 @@
#ifdef GSSAPI #ifdef GSSAPI
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>

4
kex.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: kex.c,v 1.102 2015/01/19 20:16:15 markus Exp $ */ /* $OpenBSD: kex.c,v 1.103 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* *
@ -25,7 +25,7 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> #include <sys/param.h> /* MAX roundup */
#include <signal.h> #include <signal.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kexgexs.c,v 1.22 2015/01/20 07:55:33 djm Exp $ */ /* $OpenBSD: kexgexs.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000 Niels Provos. All rights reserved. * Copyright (c) 2000 Niels Provos. All rights reserved.
* Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Markus Friedl. All rights reserved.
@ -28,7 +28,7 @@
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
#include <sys/param.h> #include <sys/param.h> /* MIN MAX */
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>

4
key.c
View File

@ -1,15 +1,15 @@
/* $OpenBSD: key.c,v 1.125 2015/01/08 10:14:08 djm Exp $ */ /* $OpenBSD: key.c,v 1.126 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* placed in the public domain * placed in the public domain
*/ */
#include "includes.h" #include "includes.h"
#include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#define SSH_KEY_NO_DEFINE #define SSH_KEY_NO_DEFINE
#include "key.h" #include "key.h"

4
krl.c
View File

@ -14,12 +14,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $OpenBSD: krl.c,v 1.28 2015/01/19 17:35:48 djm Exp $ */ /* $OpenBSD: krl.c,v 1.29 2015/01/20 23:14:00 deraadt Exp $ */
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <openbsd-compat/sys-tree.h> #include <openbsd-compat/sys-tree.h>
#include <openbsd-compat/sys-queue.h> #include <openbsd-compat/sys-queue.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: moduli.c,v 1.29 2014/08/21 01:08:52 doug Exp $ */ /* $OpenBSD: moduli.c,v 1.30 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright 1994 Phil Karn <karn@qualcomm.com> * Copyright 1994 Phil Karn <karn@qualcomm.com>
* Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
@ -41,7 +41,7 @@
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
#include <sys/param.h> #include <sys/param.h> /* MAX */
#include <sys/types.h> #include <sys/types.h>
#include <openssl/bn.h> #include <openssl/bn.h>
@ -54,6 +54,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "xmalloc.h" #include "xmalloc.h"
#include "dh.h" #include "dh.h"
@ -449,11 +450,11 @@ static void
write_checkpoint(char *cpfile, u_int32_t lineno) write_checkpoint(char *cpfile, u_int32_t lineno)
{ {
FILE *fp; FILE *fp;
char tmp[MAXPATHLEN]; char tmp[PATH_MAX];
int r; int r;
r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile);
if (r == -1 || r >= MAXPATHLEN) { if (r == -1 || r >= PATH_MAX) {
logit("write_checkpoint: temp pathname too long"); logit("write_checkpoint: temp pathname too long");
return; return;
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor.c,v 1.140 2015/01/19 20:16:15 markus Exp $ */ /* $OpenBSD: monitor.c,v 1.141 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright 2002 Niels Provos <provos@citi.umich.edu> * Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org> * Copyright 2002 Markus Friedl <markus@openbsd.org>
@ -28,7 +28,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include "openbsd-compat/sys-tree.h" #include "openbsd-compat/sys-tree.h"
#include <sys/wait.h> #include <sys/wait.h>
@ -42,6 +41,7 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor_mm.c,v 1.19 2014/01/04 17:50:55 tedu Exp $ */ /* $OpenBSD: monitor_mm.c,v 1.20 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright 2002 Niels Provos <provos@citi.umich.edu> * Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved. * All rights reserved.
@ -30,7 +30,6 @@
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#include <sys/param.h>
#include "openbsd-compat/sys-tree.h" #include "openbsd-compat/sys-tree.h"
#include <errno.h> #include <errno.h>
@ -38,6 +37,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "xmalloc.h" #include "xmalloc.h"
#include "ssh.h" #include "ssh.h"

3
mux.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: mux.c,v 1.49 2014/12/22 07:24:11 djm Exp $ */ /* $OpenBSD: mux.c,v 1.50 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
* *
@ -33,7 +33,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.c,v 1.202 2015/01/19 20:30:23 markus Exp $ */ /* $OpenBSD: packet.c,v 1.203 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -39,9 +39,9 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN roundup */
#include <sys/types.h> #include <sys/types.h>
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"
#include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
@ -57,6 +57,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sandbox-systrace.c,v 1.13 2014/07/17 00:10:56 djm Exp $ */ /* $OpenBSD: sandbox-systrace.c,v 1.14 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2011 Damien Miller <djm@mindrot.org> * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
* *
@ -20,7 +20,6 @@
#ifdef SANDBOX_SYSTRACE #ifdef SANDBOX_SYSTRACE
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -37,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "atomicio.h" #include "atomicio.h"
#include "log.h" #include "log.h"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: serverloop.c,v 1.175 2015/01/19 20:16:15 markus Exp $ */ /* $OpenBSD: serverloop.c,v 1.176 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -37,8 +37,8 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN MAX */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-client.c,v 1.116 2015/01/14 13:54:13 djm Exp $ */ /* $OpenBSD: sftp-client.c,v 1.117 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -22,8 +22,8 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN MAX */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATVFS_H #ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h> #include <sys/statvfs.h>
#endif #endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-common.c,v 1.27 2015/01/14 13:54:13 djm Exp $ */ /* $OpenBSD: sftp-common.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001 Markus Friedl. All rights reserved. * Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2001 Damien Miller. All rights reserved. * Copyright (c) 2001 Damien Miller. All rights reserved.
@ -26,9 +26,9 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MAX */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include <grp.h> #include <grp.h>
#include <pwd.h> #include <pwd.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp-server.c,v 1.104 2015/01/14 13:54:13 djm Exp $ */ /* $OpenBSD: sftp-server.c,v 1.105 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved. * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
* *
@ -17,8 +17,8 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
@ -1055,7 +1055,7 @@ process_readdir(u_int32_t id)
send_status(id, SSH2_FX_FAILURE); send_status(id, SSH2_FX_FAILURE);
} else { } else {
struct stat st; struct stat st;
char pathname[MAXPATHLEN]; char pathname[PATH_MAX];
Stat *stats; Stat *stats;
int nstats = 10, count = 0, i; int nstats = 10, count = 0, i;
@ -1150,7 +1150,7 @@ process_rmdir(u_int32_t id)
static void static void
process_realpath(u_int32_t id) process_realpath(u_int32_t id)
{ {
char resolvedname[MAXPATHLEN]; char resolvedname[PATH_MAX];
char *path; char *path;
int r; int r;
@ -1238,7 +1238,7 @@ static void
process_readlink(u_int32_t id) process_readlink(u_int32_t id)
{ {
int r, len; int r, len;
char buf[MAXPATHLEN]; char buf[PATH_MAX];
char *path; char *path;
if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0) if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)

6
sftp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp.c,v 1.169 2015/01/14 13:54:13 djm Exp $ */ /* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -17,6 +17,7 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* MIN MAX */
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
@ -46,6 +47,7 @@
#else #else
typedef void EditLine; typedef void EditLine;
#endif #endif
#include <limits.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -1401,7 +1403,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
int cmdnum, i; int cmdnum, i;
unsigned long n_arg = 0; unsigned long n_arg = 0;
Attrib a, *aa; Attrib a, *aa;
char path_buf[MAXPATHLEN]; char path_buf[PATH_MAX];
int err = 0; int err = 0;
glob_t g; glob_t g;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keyscan.c,v 1.95 2015/01/19 20:32:39 markus Exp $ */ /* $OpenBSD: ssh-keyscan.c,v 1.96 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
* *
@ -10,7 +10,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include "openbsd-compat/sys-queue.h" #include "openbsd-compat/sys-queue.h"
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-pkcs11-helper.c,v 1.9 2014/12/11 08:20:09 djm Exp $ */ /* $OpenBSD: ssh-pkcs11-helper.c,v 1.10 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2010 Markus Friedl. All rights reserved. * Copyright (c) 2010 Markus Friedl. All rights reserved.
* *
@ -18,7 +18,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif

8
ssh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.413 2015/01/16 07:19:48 djm Exp $ */ /* $OpenBSD: ssh.c,v 1.414 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -48,7 +48,6 @@
#endif #endif
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -67,6 +66,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@ -454,7 +454,7 @@ resolve_canonicalize(char **hostp, int port)
static void static void
process_config_files(const char *host_arg, struct passwd *pw, int post_canon) process_config_files(const char *host_arg, struct passwd *pw, int post_canon)
{ {
char buf[MAXPATHLEN]; char buf[PATH_MAX];
int r; int r;
if (config != NULL) { if (config != NULL) {
@ -505,7 +505,7 @@ int
main(int ac, char **av) main(int ac, char **av)
{ {
int i, r, opt, exit_status, use_syslog, config_test = 0; int i, r, opt, exit_status, use_syslog, config_test = 0;
char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg, *logfile; char *p, *cp, *line, *argv0, buf[PATH_MAX], *host_arg, *logfile;
char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
char cname[NI_MAXHOST]; char cname[NI_MAXHOST];
struct stat st; struct stat st;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshbuf.c,v 1.2 2014/06/25 14:16:09 deraadt Exp $ */ /* $OpenBSD: sshbuf.c,v 1.3 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Copyright (c) 2011 Damien Miller * Copyright (c) 2011 Damien Miller
* *
@ -18,8 +18,8 @@
#define SSHBUF_INTERNAL #define SSHBUF_INTERNAL
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* roundup */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshconnect.c,v 1.255 2015/01/19 20:20:20 markus Exp $ */ /* $OpenBSD: sshconnect.c,v 1.256 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -15,8 +15,8 @@
#include "includes.h" #include "includes.h"
#include <sys/param.h> /* roundup */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>

10
sshd.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshd.c,v 1.437 2015/01/20 20:16:21 markus Exp $ */ /* $OpenBSD: sshd.c,v 1.438 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -45,7 +45,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
@ -72,6 +71,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#ifdef WITH_OPENSSL #ifdef WITH_OPENSSL
#include <openssl/dh.h> #include <openssl/dh.h>
@ -229,7 +229,7 @@ u_char *session_id2 = NULL;
u_int session_id2_len = 0; u_int session_id2_len = 0;
/* record remote hostname or ip */ /* record remote hostname or ip */
u_int utmp_len = MAXHOSTNAMELEN; u_int utmp_len = HOST_NAME_MAX+1;
/* options.max_startup sized array of fd ints */ /* options.max_startup sized array of fd ints */
int *startup_pipes = NULL; int *startup_pipes = NULL;
@ -1544,8 +1544,8 @@ main(int ac, char **av)
exit(1); exit(1);
break; break;
case 'u': case 'u':
utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); utmp_len = (u_int)strtonum(optarg, 0, HOST_NAME_MAX+1+1, NULL);
if (utmp_len > MAXHOSTNAMELEN) { if (utmp_len > HOST_NAME_MAX+1) {
fprintf(stderr, "Invalid utmp length.\n"); fprintf(stderr, "Invalid utmp length.\n");
exit(1); exit(1);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshlogin.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */ /* $OpenBSD: sshlogin.c,v 1.31 2015/01/20 23:14:00 deraadt Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -42,7 +42,6 @@
#include "includes.h" #include "includes.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> /* MAXHOSTNAMELEN */
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -54,6 +53,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "loginrec.h" #include "loginrec.h"
#include "log.h" #include "log.h"
@ -88,7 +88,7 @@ static void
store_lastlog_message(const char *user, uid_t uid) store_lastlog_message(const char *user, uid_t uid)
{ {
#ifndef NO_SSH_LASTLOG #ifndef NO_SSH_LASTLOG
char *time_string, hostname[MAXHOSTNAMELEN] = "", buf[512]; char *time_string, hostname[HOST_NAME_MAX+1] = "", buf[512];
time_t last_login_time; time_t last_login_time;
if (!options.print_lastlog) if (!options.print_lastlog)