Skip to content

Commit

Permalink
upstream commit
Browse files Browse the repository at this point in the history
Reduce use of <sys/param.h> and transition to <limits.h>
 throughout. ok djm markus
  • Loading branch information
deraadt@openbsd.org authored and djmdjm committed Jan 26, 2015
1 parent 57e783c commit 087266e
Show file tree
Hide file tree
Showing 31 changed files with 82 additions and 79 deletions.
8 changes: 4 additions & 4 deletions auth.c
@@ -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.
*
Expand Down Expand Up @@ -27,7 +27,6 @@

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>

#include <netinet/in.h>

Expand All @@ -50,6 +49,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>

#include "xmalloc.h"
#include "match.h"
Expand Down Expand Up @@ -376,7 +376,7 @@ auth_root_allowed(const char *method)
char *
expand_authorized_keys(const char *filename, struct passwd *pw)
{
char *file, ret[MAXPATHLEN];
char *file, ret[PATH_MAX];
int i;

file = percent_expand(filename, "h", pw->pw_dir,
Expand Down Expand Up @@ -468,7 +468,7 @@ int
auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
uid_t uid, char *err, size_t errlen)
{
char buf[MAXPATHLEN], homedir[MAXPATHLEN];
char buf[PATH_MAX], homedir[PATH_MAX];
char *cp;
int comparehome = 0;
struct stat st;
Expand Down
6 changes: 3 additions & 3 deletions authfile.c
@@ -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.
*
Expand Down Expand Up @@ -27,7 +27,6 @@

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/uio.h>

#include <errno.h>
Expand All @@ -37,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>

#include "cipher.h"
#include "key.h"
Expand Down Expand Up @@ -335,7 +335,7 @@ int
sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
{
struct sshkey *pub = NULL;
char file[MAXPATHLEN];
char file[PATH_MAX];
int r, fd;

if (keyp != NULL)
Expand Down
5 changes: 3 additions & 2 deletions channels.c
@@ -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>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Expand Down Expand Up @@ -42,7 +42,7 @@
#include "includes.h"

#include <sys/types.h>
#include <sys/param.h>
#include <sys/param.h> /* MIN MAX */
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/un.h>
Expand All @@ -62,6 +62,7 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <limits.h>
#include <stdarg.h>

#include "openbsd-compat/sys-queue.h"
Expand Down
13 changes: 7 additions & 6 deletions clientloop.c
@@ -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>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Expand Down Expand Up @@ -61,9 +61,9 @@

#include "includes.h"

#include <sys/param.h> /* MIN MAX */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
Expand All @@ -85,6 +85,7 @@
#include <termios.h>
#include <pwd.h>
#include <unistd.h>
#include <limits.h>

#include "openbsd-compat/sys-queue.h"
#include "xmalloc.h"
Expand Down Expand Up @@ -339,12 +340,12 @@ client_x11_get_proto(const char *display, const char *xauth_path,
display = xdisplay;
}
if (trusted == 0) {
xauthdir = xmalloc(MAXPATHLEN);
xauthfile = xmalloc(MAXPATHLEN);
mktemp_proto(xauthdir, MAXPATHLEN);
xauthdir = xmalloc(PATH_MAX);
xauthfile = xmalloc(PATH_MAX);
mktemp_proto(xauthdir, PATH_MAX);
if (mkdtemp(xauthdir) != NULL) {
do_unlink = 1;
snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile",
snprintf(xauthfile, PATH_MAX, "%s/xauthfile",
xauthdir);
snprintf(cmd, sizeof(cmd),
"%s -f %s generate %s " SSH_X11_PROTO
Expand Down
3 changes: 1 addition & 2 deletions deattack.c
@@ -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
*
Expand All @@ -20,7 +20,6 @@

#include "includes.h"

#include <sys/param.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
5 changes: 3 additions & 2 deletions dh.c
@@ -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.
*
Expand All @@ -25,7 +25,7 @@

#include "includes.h"

#include <sys/param.h>
#include <sys/param.h> /* MIN */

#include <openssl/bn.h>
#include <openssl/dh.h>
Expand All @@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include "dh.h"
#include "pathnames.h"
Expand Down
4 changes: 2 additions & 2 deletions groupaccess.c
@@ -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.
*
Expand Down Expand Up @@ -26,13 +26,13 @@
#include "includes.h"

#include <sys/types.h>
#include <sys/param.h>

#include <grp.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include "xmalloc.h"
#include "groupaccess.h"
Expand Down
3 changes: 2 additions & 1 deletion gss-genr.c
@@ -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.
Expand Down Expand Up @@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/param.h>

#include <limits.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
Expand Down
3 changes: 1 addition & 2 deletions gss-serv.c
@@ -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.
Expand Down Expand Up @@ -29,7 +29,6 @@
#ifdef GSSAPI

#include <sys/types.h>
#include <sys/param.h>

#include <stdarg.h>
#include <string.h>
Expand Down
4 changes: 2 additions & 2 deletions kex.c
@@ -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.
*
Expand All @@ -25,7 +25,7 @@

#include "includes.h"

#include <sys/param.h>
#include <sys/param.h> /* MAX roundup */

#include <signal.h>
#include <stdarg.h>
Expand Down
4 changes: 2 additions & 2 deletions kexgexs.c
@@ -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) 2001 Markus Friedl. All rights reserved.
Expand Down Expand Up @@ -28,7 +28,7 @@

#ifdef WITH_OPENSSL

#include <sys/param.h>
#include <sys/param.h> /* MIN MAX */

#include <stdarg.h>
#include <stdio.h>
Expand Down
4 changes: 2 additions & 2 deletions key.c
@@ -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
*/

#include "includes.h"

#include <sys/param.h>
#include <sys/types.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>

#define SSH_KEY_NO_DEFINE
#include "key.h"
Expand Down
4 changes: 2 additions & 2 deletions krl.c
Expand Up @@ -14,12 +14,12 @@
* 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 <sys/param.h> /* MIN */
#include <sys/types.h>
#include <sys/param.h>
#include <openbsd-compat/sys-tree.h>
#include <openbsd-compat/sys-queue.h>

Expand Down
9 changes: 5 additions & 4 deletions moduli.c
@@ -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 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
Expand Down Expand Up @@ -41,7 +41,7 @@

#ifdef WITH_OPENSSL

#include <sys/param.h>
#include <sys/param.h> /* MAX */
#include <sys/types.h>

#include <openssl/bn.h>
Expand All @@ -54,6 +54,7 @@
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
#include <limits.h>

#include "xmalloc.h"
#include "dh.h"
Expand Down Expand Up @@ -449,11 +450,11 @@ static void
write_checkpoint(char *cpfile, u_int32_t lineno)
{
FILE *fp;
char tmp[MAXPATHLEN];
char tmp[PATH_MAX];
int r;

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");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions monitor.c
@@ -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 Markus Friedl <markus@openbsd.org>
Expand Down Expand Up @@ -28,7 +28,6 @@
#include "includes.h"

#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include "openbsd-compat/sys-tree.h"
#include <sys/wait.h>
Expand All @@ -42,6 +41,7 @@
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
Expand Down
4 changes: 2 additions & 2 deletions monitor_mm.c
@@ -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>
* All rights reserved.
Expand Down Expand Up @@ -30,14 +30,14 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <sys/param.h>
#include "openbsd-compat/sys-tree.h"

#include <errno.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#include "xmalloc.h"
#include "ssh.h"
Expand Down
3 changes: 1 addition & 2 deletions mux.c
@@ -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>
*
Expand Down Expand Up @@ -33,7 +33,6 @@
#include "includes.h"

#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
Expand Down

0 comments on commit 087266e

Please sign in to comment.