- More OpenBSD updates:
   - deraadt@cvs.openbsd.org 2000/08/24 15:46:59
     [scp.c]
     off_t in sink, to fix files > 2GB, i think, test is still running ;-)
   - deraadt@cvs.openbsd.org 2000/08/25 10:10:06
     [session.c]
     Wall
   - markus@cvs.openbsd.org  2000/08/26 04:33:43
     [compat.c]
     ssh.com-2.3.0
   - markus@cvs.openbsd.org  2000/08/27 12:18:05
     [compat.c]
     compatibility with future ssh.com versions
   - deraadt@cvs.openbsd.org 2000/08/27 21:50:55
     [auth-krb4.c session.c ssh-add.c sshconnect.c uidswap.c]
     print uid/gid as unsigned
   - markus@cvs.openbsd.org  2000/08/28 13:51:00
     [ssh.c]
     enable -n and -f for ssh2
   - markus@cvs.openbsd.org  2000/08/28 14:19:53
     [ssh.c]
     allow combination of -N and -f
   - markus@cvs.openbsd.org  2000/08/28 14:20:56
     [util.c]
     util.c
   - markus@cvs.openbsd.org  2000/08/28 14:22:02
     [util.c]
     undo
   - markus@cvs.openbsd.org  2000/08/28 14:23:38
     [util.c]
     don't complain if setting NONBLOCK fails with ENODEV
diff --git a/ChangeLog b/ChangeLog
index 19e8ca3..79bdcd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,37 @@
  - (djm) Fix ^C ignored issue on Solaris. Diagnosis from Gert 
    Doering <gert@greenie.muc.de>, John Horne <J.Horne@plymouth.ac.uk> and 
    Garrick James <garrick@james.net>
+ - More OpenBSD updates:
+   - deraadt@cvs.openbsd.org 2000/08/24 15:46:59
+     [scp.c]
+     off_t in sink, to fix files > 2GB, i think, test is still running ;-)
+   - deraadt@cvs.openbsd.org 2000/08/25 10:10:06
+     [session.c]
+     Wall
+   - markus@cvs.openbsd.org  2000/08/26 04:33:43
+     [compat.c]
+     ssh.com-2.3.0
+   - markus@cvs.openbsd.org  2000/08/27 12:18:05
+     [compat.c]
+     compatibility with future ssh.com versions
+   - deraadt@cvs.openbsd.org 2000/08/27 21:50:55
+     [auth-krb4.c session.c ssh-add.c sshconnect.c uidswap.c]
+     print uid/gid as unsigned
+   - markus@cvs.openbsd.org  2000/08/28 13:51:00
+     [ssh.c]
+     enable -n and -f for ssh2
+   - markus@cvs.openbsd.org  2000/08/28 14:19:53
+     [ssh.c]
+     allow combination of -N and -f
+   - markus@cvs.openbsd.org  2000/08/28 14:20:56
+     [util.c]
+     util.c
+   - markus@cvs.openbsd.org  2000/08/28 14:22:02
+     [util.c]
+     undo
+   - markus@cvs.openbsd.org  2000/08/28 14:23:38
+     [util.c]
+     don't complain if setting NONBLOCK fails with ENODEV
 
 20000823
  - (djm) Define USE_PIPES to avoid socketpair problems on HPUX 10 and SunOS 4
diff --git a/acconfig.h b/acconfig.h
index eeee4ea..c16ec2b 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -203,6 +203,7 @@
 #undef MAIL_DIRECTORY
 
 /* Data types */
+#undef HAVE_U_INT
 #undef HAVE_INTXX_T
 #undef HAVE_U_INTXX_T
 #undef HAVE_UINTXX_T
diff --git a/auth-krb4.c b/auth-krb4.c
index ae2b2a3..8715dc0 100644
--- a/auth-krb4.c
+++ b/auth-krb4.c
@@ -9,7 +9,7 @@
 #include "ssh.h"
 #include "servconf.h"
 
-RCSID("$OpenBSD: auth-krb4.c,v 1.16 2000/08/02 17:27:04 provos Exp $");
+RCSID("$OpenBSD: auth-krb4.c,v 1.17 2000/08/28 03:50:54 deraadt Exp $");
 
 #ifdef KRB4
 char *ticket = NULL;
@@ -154,7 +154,7 @@
 		if (lstat("/ticket", &st) != -1)
 			tkt_root = "/ticket/";
 #endif /* AFS */
-		snprintf(ticket, MAXPATHLEN, "%s%d_%d", tkt_root, uid, getpid());
+		snprintf(ticket, MAXPATHLEN, "%s%u_%d", tkt_root, uid, getpid());
 		(void) krb_set_tkt_string(ticket);
 	}
 	/* Register ticket cleanup in case of fatal error. */
diff --git a/compat.c b/compat.c
index 595a0a3..5d3940a 100644
--- a/compat.c
+++ b/compat.c
@@ -28,7 +28,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: compat.c,v 1.19 2000/07/09 01:27:32 ho Exp $");
+RCSID("$OpenBSD: compat.c,v 1.21 2000/08/27 18:18:04 markus Exp $");
 
 #include "ssh.h"
 #include "packet.h"
@@ -61,11 +61,12 @@
 		char	*version;
 		int	bugs;
 	} check[] = {
-		{"2.2.0",	SSH_BUG_HMAC|SSH_COMPAT_SESSIONID_ENCODING},
 		{"2.1.0",	SSH_BUG_SIGBLOB|SSH_BUG_HMAC},
 		{"2.0.1",	SSH_BUG_SIGBLOB|SSH_BUG_HMAC|SSH_BUG_PUBKEYAUTH|SSH_BUG_X11FWD},
+		{"2.",		SSH_BUG_HMAC|SSH_COMPAT_SESSIONID_ENCODING},
 		{NULL,		0}
 	};
+	/* process table, return first match */
 	for (i = 0; check[i].version; i++) {
 		len = strlen(check[i].version);
 		if (strlen(version) >= len &&
diff --git a/configure.in b/configure.in
index 02287b8..824ff5c 100644
--- a/configure.in
+++ b/configure.in
@@ -465,6 +465,19 @@
 AC_CHECK_SIZEOF(long long int, 8)
 
 # More checks for data types
+AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
+	AC_TRY_COMPILE(
+		[ #include <sys/types.h> ], 
+		[ u_int a; a = 1;], 
+		[ ac_cv_have_u_int="yes" ],
+		[ ac_cv_have_u_int="no" ]
+	)
+])
+if test "x$ac_cv_have_u_int" = "xyes" ; then
+	AC_DEFINE(HAVE_U_INT)
+	have_u_int=1
+fi
+
 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
 	AC_TRY_COMPILE(
 		[ #include <sys/types.h> ], 
@@ -491,7 +504,6 @@
 	have_u_intxx_t=1
 fi
 
-
 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
 then
diff --git a/defines.h b/defines.h
index 1fe74a9..6bbb516 100644
--- a/defines.h
+++ b/defines.h
@@ -102,6 +102,11 @@
 
 /* If sys/types.h does not supply intXX_t, supply them ourselves */
 /* (or die trying) */
+
+#ifndef HAVE_U_INT
+typedef unsigned int u_int;
+#endif
+
 #ifndef HAVE_INTXX_T
 # if (SIZEOF_CHAR == 1)
 typedef char int8_t;
diff --git a/scp.c b/scp.c
index d2e4224..5a5d0f4 100644
--- a/scp.c
+++ b/scp.c
@@ -47,7 +47,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.35 2000/08/19 02:50:07 deraadt Exp $");
+RCSID("$OpenBSD: scp.c,v 1.36 2000/08/24 21:46:59 deraadt Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -680,7 +680,8 @@
 	BUF *bp;
 	off_t i, j;
 	int amt, count, exists, first, mask, mode, ofd, omode;
-	int setimes, size, targisdir, wrerrno = 0;
+	off_t size;
+	int setimes, targisdir, wrerrno = 0;
 	char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
 	struct utimbuf ut;
 	int dummy_usec;
diff --git a/session.c b/session.c
index 82096c3..4a77eef 100644
--- a/session.c
+++ b/session.c
@@ -8,7 +8,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.29 2000/08/21 16:23:31 millert Exp $");
+RCSID("$OpenBSD: session.c,v 1.31 2000/08/28 03:50:54 deraadt Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -1014,7 +1014,7 @@
 #endif /* HAVE_OSF_SIA */
 
 		if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid)
-			fatal("Failed to set uids to %d.", (int) pw->pw_uid);
+			fatal("Failed to set uids to %u.", (u_int) pw->pw_uid);
 	}
 	/*
 	 * Get the shell from the password data.  An empty shell field is
@@ -1229,7 +1229,7 @@
 					if (screen != NULL)
 						fprintf(stderr,
 						    "Adding %.*s/unix%s %s %s\n",
-						    screen-display, display,
+						    (int)(screen-display), display,
 						    screen, auth_proto, auth_data);
 				}
 				snprintf(cmd, sizeof cmd, "%s -q -",
@@ -1240,7 +1240,7 @@
 					    auth_proto, auth_data);
 					if (screen != NULL) 
 						fprintf(f, "add %.*s/unix%s %s %s\n",
-						    screen-display, display,
+						    (int)(screen-display), display,
 						    screen, auth_proto, auth_data);
 					pclose(f);
 				} else {
diff --git a/ssh-add.1 b/ssh-add.1
index d2d0c20..8e9d33b 100644
--- a/ssh-add.1
+++ b/ssh-add.1
@@ -9,7 +9,7 @@
 .\"
 .\" Created: Sat Apr 22 23:55:14 1995 ylo
 .\"
-.\" $Id: ssh-add.1,v 1.14 2000/08/23 00:46:24 djm Exp $
+.\" $Id: ssh-add.1,v 1.15 2000/08/29 00:33:51 djm Exp $
 .\"
 .Dd September 25, 1999
 .Dt SSH-ADD 1
diff --git a/ssh-add.c b/ssh-add.c
index a51f477..e24a94d 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.19 2000/08/19 21:34:43 markus Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.20 2000/08/28 03:50:54 deraadt Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/rsa.h>
@@ -260,7 +260,8 @@
 	if (no_files) {
 		pw = getpwuid(getuid());
 		if (!pw) {
-			fprintf(stderr, "No user found with uid %d\n", (int) getuid());
+			fprintf(stderr, "No user found with uid %u\n",
+			    (u_int)getuid());
 			ssh_close_authentication_connection(ac);
 			exit(1);
 		}
diff --git a/ssh-agent.1 b/ssh-agent.1
index 0aa1ecf..3de67eb 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-agent.1,v 1.14 2000/08/19 21:34:43 markus Exp $
+.\" $OpenBSD: ssh-agent.1,v 1.15 2000/08/25 16:16:15 deraadt Exp $
 .\"
 .\"  -*- nroff -*-
 .\"
diff --git a/ssh.1 b/ssh.1
index 39368e0..67dc3df 100644
--- a/ssh.1
+++ b/ssh.1
@@ -9,7 +9,7 @@
 .\"
 .\" Created: Sat Apr 22 21:55:14 1995 ylo
 .\"
-.\" $Id: ssh.1,v 1.29 2000/08/18 03:59:06 djm Exp $
+.\" $Id: ssh.1,v 1.30 2000/08/29 00:33:51 djm Exp $
 .\"
 .Dd September 25, 1999
 .Dt SSH 1
diff --git a/ssh.c b/ssh.c
index 39512c5..71d8f96 100644
--- a/ssh.c
+++ b/ssh.c
@@ -11,7 +11,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.61 2000/08/20 18:42:40 millert Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.63 2000/08/28 20:19:52 markus Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/dsa.h>
@@ -461,7 +461,7 @@
 	}
 
 	/* Cannot fork to background if no command. */
-	if (fork_after_authentication_flag && buffer_len(&command) == 0)
+	if (fork_after_authentication_flag && buffer_len(&command) == 0 && !no_shell_flag)
 		fatal("Cannot fork into background without a command to execute.");
 
 	/* Allocate a tty by default if no command specified. */
@@ -959,21 +959,25 @@
 	int window, packetmax, id;
 	int in, out, err;
 
+	if (stdin_null_flag) {
+		in = open("/dev/null", O_RDONLY);
+	} else {
+		in = dup(STDIN_FILENO);
+	}
+	out = dup(STDOUT_FILENO);
+	err = dup(STDERR_FILENO);
+
+	if (in < 0 || out < 0 || err < 0)
+		fatal("dup() in/out/err failed");
+
+	/* should be pre-session */
+	init_local_fwd();
+	
 	/* If requested, let ssh continue in the background. */
 	if (fork_after_authentication_flag)
 		if (daemon(1, 1) < 0)
 			fatal("daemon() failed: %.200s", strerror(errno));
 
-	in  = dup(STDIN_FILENO);
-	out = dup(STDOUT_FILENO);
-	err = dup(STDERR_FILENO);
-
-	if (in < 0 || out < 0 || err < 0)
-		fatal("dump in/out/err failed");
-
-	/* should be pre-session */
-	init_local_fwd();
-	
 	window = 32*1024;
 	if (tty_flag) {
 		packetmax = window/8;
diff --git a/sshconnect.c b/sshconnect.c
index 79b6856..21eff6c 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -8,7 +8,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.76 2000/06/17 20:30:10 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.77 2000/08/28 03:50:54 deraadt Exp $");
 
 #include <openssl/bn.h>
 #include <openssl/dsa.h>
@@ -193,8 +193,8 @@
 	int gaierr;
 	struct linger linger;
 
-	debug("ssh_connect: getuid %d geteuid %d anon %d",
-	      (int) getuid(), (int) geteuid(), anonymous);
+	debug("ssh_connect: getuid %u geteuid %u anon %d",
+	      (u_int) getuid(), (u_int) geteuid(), anonymous);
 
 	/* Get default port if port has not been set. */
 	if (port == 0) {
@@ -669,7 +669,7 @@
 	/* Get local user name.  Use it as server user if no user name was given. */
 	pw = getpwuid(original_real_uid);
 	if (!pw)
-		fatal("User id %d not found from user database.", original_real_uid);
+		fatal("User id %u not found from user database.", original_real_uid);
 	local_user = xstrdup(pw->pw_name);
 	server_user = options.user ? options.user : local_user;
 
diff --git a/sshd.8 b/sshd.8
index c8b99df..d710baa 100644
--- a/sshd.8
+++ b/sshd.8
@@ -9,7 +9,7 @@
 .\"
 .\" Created: Sat Apr 22 21:55:14 1995 ylo
 .\"
-.\" $Id: sshd.8,v 1.26 2000/08/18 03:59:06 djm Exp $
+.\" $Id: sshd.8,v 1.27 2000/08/29 00:33:51 djm Exp $
 .\"
 .Dd September 25, 1999
 .Dt SSHD 8
diff --git a/uidswap.c b/uidswap.c
index 7745a97..96ff931 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -7,7 +7,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: uidswap.c,v 1.7 2000/06/20 01:39:45 markus Exp $");
+RCSID("$OpenBSD: uidswap.c,v 1.8 2000/08/28 03:50:54 deraadt Exp $");
 
 #include "ssh.h"
 #include "uidswap.h"
@@ -47,15 +47,15 @@
 
 	/* Set the effective uid to the given (unprivileged) uid. */
 	if (seteuid(uid) == -1)
-		debug("seteuid %d: %.100s", (int) uid, strerror(errno));
+		debug("seteuid %u: %.100s", (u_int) uid, strerror(errno));
 #else /* SAVED_IDS_WORK_WITH_SETUID */
 	/* Propagate the privileged uid to all of our uids. */
 	if (setuid(geteuid()) < 0)
-		debug("setuid %d: %.100s", (int) geteuid(), strerror(errno));
+		debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno));
 
 	/* Set the effective uid to the given (unprivileged) uid. */
 	if (seteuid(uid) == -1)
-		debug("seteuid %d: %.100s", (int) uid, strerror(errno));
+		debug("seteuid %u: %.100s", (u_int) uid, strerror(errno));
 #endif /* SAVED_IDS_WORK_WITH_SETEUID */
 }
 
@@ -68,7 +68,7 @@
 #ifdef SAVED_IDS_WORK_WITH_SETEUID
 	/* Set the effective uid back to the saved uid. */
 	if (seteuid(saved_euid) < 0)
-		debug("seteuid %d: %.100s", (int) saved_euid, strerror(errno));
+		debug("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno));
 #else /* SAVED_IDS_WORK_WITH_SETEUID */
 	/*
 	 * We are unable to restore the real uid to its unprivileged value.
@@ -95,5 +95,5 @@
 #endif /* WITH_IRIX_AUDIT */
 
 	if (setuid(uid) < 0)
-		debug("setuid %d: %.100s", (int) uid, strerror(errno));
+		debug("setuid %u: %.100s", (u_int) uid, strerror(errno));
 }
diff --git a/util.c b/util.c
index 3b22192..16c8c50 100644
--- a/util.c
+++ b/util.c
@@ -1,5 +1,5 @@
 #include "includes.h"
-RCSID("$OpenBSD: util.c,v 1.1 2000/08/01 19:01:42 provos Exp $");
+RCSID("$OpenBSD: util.c,v 1.4 2000/08/28 20:23:37 markus Exp $");
 
 #include "ssh.h"
 
@@ -37,7 +37,9 @@
 	debug("fd %d setting O_NONBLOCK", fd);
 	val |= O_NONBLOCK;
 	if (fcntl(fd, F_SETFL, val) == -1)
-		error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
+		if (errno != ENODEV)
+			error("fcntl(%d, F_SETFL, O_NONBLOCK): %s",
+			    fd, strerror(errno));
 }
 
 /* Characters considered whitespace in strsep calls. */