One way to massive patch.  <sigh>  It compiles and works under Linux..
And I think I have all the bits right from the OpenBSD tree.
20001222
 - Updated RCSID for pty.c
 - (bal) OpenBSD CVS Updates:
  - markus@cvs.openbsd.org 2000/12/21 15:10:16
    [auth-rh-rsa.c hostfile.c hostfile.h sshconnect.c]
    print keyfile:line for changed hostkeys, for deraadt@, ok deraadt@
  - markus@cvs.openbsd.org 2000/12/20 19:26:56
    [authfile.c]
    allow ssh -i userkey for root
  - markus@cvs.openbsd.org 2000/12/20 19:37:21
    [authfd.c authfd.h kex.c sshconnect2.c sshd.c uidswap.c uidswap.h]
    fix prototypes; from stevesk@pobox.com
  - markus@cvs.openbsd.org 2000/12/20 19:32:08
    [sshd.c]
    init pointer to NULL; report from Jan.Ivan@cern.ch
  - markus@cvs.openbsd.org 2000/12/19 23:17:54
    [auth-krb4.c auth-options.c auth-options.h auth-rhosts.c auth-rsa.c
     auth1.c auth2-skey.c auth2.c authfd.c authfd.h authfile.c bufaux.c
     bufaux.h buffer.c canohost.c channels.c clientloop.c compress.c
     crc32.c deattack.c getput.h hmac.c hmac.h hostfile.c kex.c kex.h
     key.c key.h log.c login.c match.c match.h mpaux.c mpaux.h packet.c
     packet.h radix.c readconf.c rsa.c scp.c servconf.c servconf.h
     serverloop.c session.c sftp-server.c ssh-agent.c ssh-dss.c ssh-dss.h
     ssh-keygen.c ssh-keyscan.c ssh-rsa.c ssh-rsa.h ssh.c ssh.h  uuencode.c
     uuencode.h sshconnect1.c sshconnect2.c sshd.c tildexpand.c]
    replace 'unsigned bla' with 'u_bla' everywhere. also replace 'char
    unsigned' with u_char.
diff --git a/ChangeLog b/ChangeLog
index 16898e1..db18b72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+20001222
+ - Updated RCSID for pty.c
+ - (bal) OpenBSD CVS Updates:
+  - markus@cvs.openbsd.org 2000/12/21 15:10:16
+    [auth-rh-rsa.c hostfile.c hostfile.h sshconnect.c]
+    print keyfile:line for changed hostkeys, for deraadt@, ok deraadt@
+  - markus@cvs.openbsd.org 2000/12/20 19:26:56
+    [authfile.c]
+    allow ssh -i userkey for root
+  - markus@cvs.openbsd.org 2000/12/20 19:37:21
+    [authfd.c authfd.h kex.c sshconnect2.c sshd.c uidswap.c uidswap.h]
+    fix prototypes; from stevesk@pobox.com
+  - markus@cvs.openbsd.org 2000/12/20 19:32:08
+    [sshd.c]
+    init pointer to NULL; report from Jan.Ivan@cern.ch
+  - markus@cvs.openbsd.org 2000/12/19 23:17:54
+    [auth-krb4.c auth-options.c auth-options.h auth-rhosts.c auth-rsa.c
+     auth1.c auth2-skey.c auth2.c authfd.c authfd.h authfile.c bufaux.c
+     bufaux.h buffer.c canohost.c channels.c clientloop.c compress.c
+     crc32.c deattack.c getput.h hmac.c hmac.h hostfile.c kex.c kex.h
+     key.c key.h log.c login.c match.c match.h mpaux.c mpaux.h packet.c
+     packet.h radix.c readconf.c rsa.c scp.c servconf.c servconf.h
+     serverloop.c session.c sftp-server.c ssh-agent.c ssh-dss.c ssh-dss.h
+     ssh-keygen.c ssh-keyscan.c ssh-rsa.c ssh-rsa.h ssh.c ssh.h  uuencode.c
+     uuencode.h sshconnect1.c sshconnect2.c sshd.c tildexpand.c]
+    replace 'unsigned bla' with 'u_bla' everywhere. also replace 'char
+    unsigned' with u_char.
+
 20001221
  - (stevesk) OpenBSD CVS updates:
    - markus@cvs.openbsd.org 2000/12/19 15:43:45
diff --git a/auth-krb4.c b/auth-krb4.c
index 21a9625..80e8f42 100644
--- a/auth-krb4.c
+++ b/auth-krb4.c
@@ -28,7 +28,7 @@
 #include "ssh.h"
 #include "servconf.h"
 
-RCSID("$OpenBSD: auth-krb4.c,v 1.19 2000/10/03 18:03:02 markus Exp $");
+RCSID("$OpenBSD: auth-krb4.c,v 1.20 2000/12/19 23:17:54 markus Exp $");
 
 #ifdef KRB4
 char *ticket = NULL;
@@ -46,7 +46,7 @@
 	AUTH_DAT adata;
 	KTEXT_ST tkt;
 	struct hostent *hp;
-	unsigned long faddr;
+	u_long faddr;
 	char localhost[MAXHOSTNAMELEN];
 	char phost[INST_SZ];
 	char realm[REALM_SZ];
diff --git a/auth-options.c b/auth-options.c
index 181bf73..c598f70 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth-options.c,v 1.6 2000/11/15 22:31:36 markus Exp $");
+RCSID("$OpenBSD: auth-options.c,v 1.7 2000/12/19 23:17:54 markus Exp $");
 
 #include "ssh.h"
 #include "packet.h"
@@ -54,7 +54,7 @@
 
 /* return 1 if access is granted, 0 if not. side effect: sets key option flags */
 int
-auth_parse_options(struct passwd *pw, char *options, unsigned long linenum)
+auth_parse_options(struct passwd *pw, char *options, u_long linenum)
 {
 	const char *cp;
 	if (!options)
diff --git a/auth-options.h b/auth-options.h
index 00fae22..76d420d 100644
--- a/auth-options.h
+++ b/auth-options.h
@@ -11,7 +11,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* $OpenBSD: auth-options.h,v 1.5 2000/10/16 09:38:44 djm Exp $ */
+/* $OpenBSD: auth-options.h,v 1.6 2000/12/19 23:17:55 markus Exp $ */
 
 #ifndef AUTH_OPTIONS_H
 #define AUTH_OPTIONS_H
@@ -24,7 +24,7 @@
 extern struct envstring *custom_environment;
 
 /* return 1 if access is granted, 0 if not. side effect: sets key option flags */
-int	auth_parse_options(struct passwd *pw, char *options, unsigned long linenum);
+int	auth_parse_options(struct passwd *pw, char *options, u_long linenum);
 /* reset options flags */
 void	auth_clear_options(void);
 
diff --git a/auth-rh-rsa.c b/auth-rh-rsa.c
index a9f17ef..48c075e 100644
--- a/auth-rh-rsa.c
+++ b/auth-rh-rsa.c
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth-rh-rsa.c,v 1.18 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: auth-rh-rsa.c,v 1.19 2000/12/21 15:10:16 markus Exp $");
 
 #include "packet.h"
 #include "ssh.h"
@@ -60,7 +60,7 @@
 
 	/* Check if we know the host and its host key. */
 	host_status = check_host_in_hostfile(SSH_SYSTEM_HOSTFILE, canonical_hostname,
-	    client_key, found);
+	    client_key, found, NULL);
 
 	/* Check user host file unless ignored. */
 	if (host_status != HOST_OK && !options.ignore_user_known_hosts) {
@@ -80,7 +80,7 @@
 			/* XXX race between stat and the following open() */
 			temporarily_use_uid(pw->pw_uid);
 			host_status = check_host_in_hostfile(user_hostfile, canonical_hostname,
-			    client_key, found);
+			    client_key, found, NULL);
 			restore_uid();
 		}
 		xfree(user_hostfile);
diff --git a/auth-rhosts.c b/auth-rhosts.c
index 8314e23..fb7dabe 100644
--- a/auth-rhosts.c
+++ b/auth-rhosts.c
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth-rhosts.c,v 1.16 2000/10/03 18:03:03 markus Exp $");
+RCSID("$OpenBSD: auth-rhosts.c,v 1.17 2000/12/19 23:17:55 markus Exp $");
 
 #include "packet.h"
 #include "ssh.h"
@@ -152,7 +152,7 @@
 	const char *hostname, *ipaddr;
 	struct stat st;
 	static const char *rhosts_files[] = {".shosts", ".rhosts", NULL};
-	unsigned int rhosts_file_index;
+	u_int rhosts_file_index;
 
 	/* no user given */
 	if (pw == NULL)
diff --git a/auth-rsa.c b/auth-rsa.c
index 72cb909..3daf4d1 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth-rsa.c,v 1.33 2000/11/14 23:42:40 markus Exp $");
+RCSID("$OpenBSD: auth-rsa.c,v 1.34 2000/12/19 23:17:55 markus Exp $");
 
 #include "rsa.h"
 #include "packet.h"
@@ -37,7 +37,7 @@
  * Session identifier that is used to bind key exchange and authentication
  * responses to a particular session.
  */
-extern unsigned char session_id[16];
+extern u_char session_id[16];
 
 /*
  * The .ssh/authorized_keys file contains public keys, one per line, in the
@@ -60,9 +60,9 @@
 {
 	BIGNUM *challenge, *encrypted_challenge;
 	BN_CTX *ctx;
-	unsigned char buf[32], mdbuf[16], response[16];
+	u_char buf[32], mdbuf[16], response[16];
 	MD5_CTX md;
-	unsigned int i;
+	u_int i;
 	int plen, len;
 
 	encrypted_challenge = BN_new();
@@ -122,9 +122,9 @@
 {
 	char line[8192], file[1024];
 	int authenticated;
-	unsigned int bits;
+	u_int bits;
 	FILE *f;
-	unsigned long linenum = 0;
+	u_long linenum = 0;
 	struct stat st;
 	RSA *pk;
 
diff --git a/auth1.c b/auth1.c
index fec73e3..5c906b6 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.7 2000/11/10 01:04:40 markus Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.8 2000/12/19 23:17:55 markus Exp $");
 
 #ifdef HAVE_OSF_SIA
 # include <sia.h>
@@ -81,14 +81,14 @@
 {
 	int authenticated = 0;
 	int attempt = 0;
-	unsigned int bits;
+	u_int bits;
 	RSA *client_host_key;
 	BIGNUM *n;
 	char *client_user, *password;
 	char user[1024];
-	unsigned int dlen;
+	u_int dlen;
 	int plen, nlen, elen;
-	unsigned int ulen;
+	u_int ulen;
 	int type = 0;
 	void (*authlog) (const char *fmt,...) = verbose;
 
@@ -149,7 +149,7 @@
 				/* Try Kerberos v4 authentication. */
 				KTEXT_ST auth;
 				char *tkt_user = NULL;
-				char *kdata = packet_get_string((unsigned int *) &auth.length);
+				char *kdata = packet_get_string((u_int *) &auth.length);
 				packet_integrity_check(plen, 4 + auth.length, type);
 
 				if (auth.length < MAX_KTXT_LEN)
@@ -394,7 +394,7 @@
 {
 	struct passwd *pw, pwcopy;
 	int plen;
-	unsigned int ulen;
+	u_int ulen;
 	char *user;
 
 	/* Get the name of the user that we wish to log in as. */
diff --git a/auth2-skey.c b/auth2-skey.c
index e29205d..dbf24f6 100644
--- a/auth2-skey.c
+++ b/auth2-skey.c
@@ -1,5 +1,5 @@
 #include "includes.h"
-RCSID("$OpenBSD: auth2-skey.c,v 1.1 2000/10/11 20:14:38 markus Exp $");
+RCSID("$OpenBSD: auth2-skey.c,v 1.2 2000/12/19 23:17:55 markus Exp $");
 
 #ifdef SKEY
 #include "ssh.h"
@@ -62,7 +62,7 @@
 {
 	Authctxt *authctxt = ctxt;
 	int authenticated = 0;
-	unsigned int nresp, rlen;
+	u_int nresp, rlen;
 	char *resp, *method;
 
 	if (authctxt == NULL)
diff --git a/auth2.c b/auth2.c
index 030e28d..a0e6d57 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.22 2000/12/03 11:15:02 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.23 2000/12/19 23:17:55 markus Exp $");
 
 #ifdef HAVE_OSF_SIA
 # include <sia.h>
@@ -57,7 +57,7 @@
 
 /* import */
 extern ServerOptions options;
-extern unsigned char *session_id2;
+extern u_char *session_id2;
 extern int session_id2_len;
 
 #ifdef WITH_AIXAUTHENTICATE
@@ -151,7 +151,7 @@
 input_service_request(int type, int plen, void *ctxt)
 {
 	Authctxt *authctxt = ctxt;
-	unsigned int len;
+	u_int len;
 	int accept = 0;
 	char *service = packet_get_string(&len);
 	packet_done();
@@ -363,7 +363,7 @@
 	char *password;
 	int authenticated = 0;
 	int change;
-	unsigned int len;
+	u_int len;
 	change = packet_get_char();
 	if (change)
 		log("password change not supported");
@@ -425,7 +425,7 @@
 	Buffer b;
 	Key *key;
 	char *pkalg, *pkblob, *sig;
-	unsigned int alen, blen, slen;
+	u_int alen, blen, slen;
 	int have_sig, pktype;
 	int authenticated = 0;
 
@@ -539,7 +539,7 @@
 authmethods_get(void)
 {
 	Authmethod *method = NULL;
-	unsigned int size = 0;
+	u_int size = 0;
 	char *list;
 
 	for (method = authmethods; method->name != NULL; method++) {
@@ -588,7 +588,7 @@
 	char line[8192], file[1024];
 	int found_key = 0;
 	FILE *f;
-	unsigned long linenum = 0;
+	u_long linenum = 0;
 	struct stat st;
 	Key *found;
 
diff --git a/authfd.c b/authfd.c
index 9036a8d..e2456e3 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.30 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.32 2000/12/20 19:37:21 markus Exp $");
 
 #include "ssh.h"
 #include "rsa.h"
@@ -62,7 +62,7 @@
 /* Returns the number of the authentication fd, or -1 if there is none. */
 
 int
-ssh_get_authentication_socket()
+ssh_get_authentication_socket(void)
 {
 	const char *authsocket;
 	int sock, len;
@@ -171,7 +171,7 @@
  */
 
 AuthenticationConnection *
-ssh_get_authentication_connection()
+ssh_get_authentication_connection(void)
 {
 	AuthenticationConnection *auth;
 	int sock;
@@ -272,9 +272,9 @@
 Key *
 ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int version)
 {
-	unsigned int bits;
-	unsigned char *blob;
-	unsigned int blen;
+	u_int bits;
+	u_char *blob;
+	u_int blen;
 	Key *key = NULL;
 
 	/* Return failure if no more entries. */
@@ -322,9 +322,9 @@
 int
 ssh_decrypt_challenge(AuthenticationConnection *auth,
     Key* key, BIGNUM *challenge,
-    unsigned char session_id[16],
-    unsigned int response_type,
-    unsigned char response[16])
+    u_char session_id[16],
+    u_int response_type,
+    u_char response[16])
 {
 	Buffer buffer;
 	int success = 0;
@@ -373,13 +373,13 @@
 int
 ssh_agent_sign(AuthenticationConnection *auth,
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
 	extern int datafellows;
 	Buffer msg;
-	unsigned char *blob;
-	unsigned int blen;
+	u_char *blob;
+	u_int blen;
 	int type, flags = 0;
 	int ret = -1;
 
@@ -502,8 +502,8 @@
 {
 	Buffer msg;
 	int type;
-	unsigned char *blob;
-	unsigned int blen;
+	u_char *blob;
+	u_int blen;
 
 	buffer_init(&msg);
 
diff --git a/authfd.h b/authfd.h
index 65471ad..29d1847 100644
--- a/authfd.h
+++ b/authfd.h
@@ -11,7 +11,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: authfd.h,v 1.14 2000/11/12 19:50:37 markus Exp $"); */
+/* RCSID("$OpenBSD: authfd.h,v 1.16 2000/12/20 19:37:21 markus Exp $"); */
 
 #ifndef AUTHFD_H
 #define AUTHFD_H
@@ -51,7 +51,7 @@
 }       AuthenticationConnection;
 
 /* Returns the number of the authentication fd, or -1 if there is none. */
-int     ssh_get_authentication_socket();
+int     ssh_get_authentication_socket(void);
 
 /*
  * This should be called for any descriptor returned by
@@ -66,7 +66,7 @@
  * connection could not be opened.  The connection should be closed by the
  * caller by calling ssh_close_authentication_connection().
  */
-AuthenticationConnection *ssh_get_authentication_connection();
+AuthenticationConnection *ssh_get_authentication_connection(void);
 
 /*
  * Closes the connection to the authentication agent and frees any associated
@@ -101,16 +101,16 @@
 int
 ssh_decrypt_challenge(AuthenticationConnection *auth,
     Key *key, BIGNUM * challenge,
-    unsigned char session_id[16],
-    unsigned int response_type,
-    unsigned char response[16]);
+    u_char session_id[16],
+    u_int response_type,
+    u_char response[16]);
 
 /* Requests the agent to sign data using key */
 int
 ssh_agent_sign(AuthenticationConnection *auth,
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen);
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen);
 
 /*
  * Adds an identity to the authentication server.  This call is not meant to
diff --git a/authfile.c b/authfile.c
index 86dcdee..7a1b74a 100644
--- a/authfile.c
+++ b/authfile.c
@@ -131,8 +131,8 @@
 	buffer_append_space(&encrypted, &cp, buffer_len(&buffer));
 
 	cipher_set_key_string(&ciphercontext, cipher, passphrase);
-	cipher_encrypt(&ciphercontext, (unsigned char *) cp,
-	    (unsigned char *) buffer_ptr(&buffer), buffer_len(&buffer));
+	cipher_encrypt(&ciphercontext, (u_char *) cp,
+	    (u_char *) buffer_ptr(&buffer), buffer_len(&buffer));
 	memset(&ciphercontext, 0, sizeof(ciphercontext));
 
 	/* Destroy temporary data. */
@@ -258,7 +258,7 @@
 	 * Make sure it begins with the id string.  Consume the id string
 	 * from the buffer.
 	 */
-	for (i = 0; i < (unsigned int) strlen(AUTHFILE_ID_STRING) + 1; i++)
+	for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)
 		if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {
 			debug3("Bad RSA1 key file %.200s.", filename);
 			buffer_free(&buffer);
@@ -348,7 +348,7 @@
 	 * Make sure it begins with the id string.  Consume the id string
 	 * from the buffer.
 	 */
-	for (i = 0; i < (unsigned int) strlen(AUTHFILE_ID_STRING) + 1; i++)
+	for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)
 		if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {
 			debug3("Bad RSA1 key file %.200s.", filename);
 			buffer_free(&buffer);
@@ -383,8 +383,8 @@
 
 	/* Rest of the buffer is encrypted.  Decrypt it using the passphrase. */
 	cipher_set_key_string(&ciphercontext, cipher, passphrase);
-	cipher_decrypt(&ciphercontext, (unsigned char *) cp,
-	    (unsigned char *) buffer_ptr(&buffer), buffer_len(&buffer));
+	cipher_decrypt(&ciphercontext, (u_char *) cp,
+	    (u_char *) buffer_ptr(&buffer), buffer_len(&buffer));
 	memset(&ciphercontext, 0, sizeof(ciphercontext));
 	buffer_free(&buffer);
 
@@ -508,7 +508,7 @@
 	if (check_ntsec(filename))
 #endif
 	if (fstat(fd, &st) < 0 ||
-	    (st.st_uid != 0 && st.st_uid != getuid()) ||
+	    (st.st_uid != 0 && getuid() != 0 && st.st_uid != getuid()) ||
 	    (st.st_mode & 077) != 0) {
 		close(fd);
 		error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
diff --git a/bufaux.c b/bufaux.c
index a3f220f..5853ee6 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: bufaux.c,v 1.13 2000/09/07 20:27:50 deraadt Exp $");
+RCSID("$OpenBSD: bufaux.c,v 1.14 2000/12/19 23:17:55 markus Exp $");
 
 #include "ssh.h"
 #include <openssl/bn.h>
@@ -54,7 +54,7 @@
 {
 	int bits = BN_num_bits(value);
 	int bin_size = (bits + 7) / 8;
-	char unsigned *buf = xmalloc(bin_size);
+	u_char *buf = xmalloc(bin_size);
 	int oi;
 	char msg[2];
 
@@ -81,7 +81,7 @@
 buffer_get_bignum(Buffer *buffer, BIGNUM *value)
 {
 	int bits, bytes;
-	unsigned char buf[2], *bin;
+	u_char buf[2], *bin;
 
 	/* Get the number for bits. */
 	buffer_get(buffer, (char *) buf, 2);
@@ -90,7 +90,7 @@
 	bytes = (bits + 7) / 8;
 	if (buffer_len(buffer) < bytes)
 		fatal("buffer_get_bignum: input buffer too small");
-	bin = (unsigned char*) buffer_ptr(buffer);
+	bin = (u_char*) buffer_ptr(buffer);
 	BN_bin2bn(bin, bytes, value);
 	buffer_consume(buffer, bytes);
 
@@ -104,7 +104,7 @@
 buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
 {
 	int bytes = BN_num_bytes(value) + 1;
-	unsigned char *buf = xmalloc(bytes);
+	u_char *buf = xmalloc(bytes);
 	int oi;
 	int hasnohigh = 0;
 	buf[0] = '\0';
@@ -117,7 +117,7 @@
 	if (value->neg) {
 		/**XXX should be two's-complement */
 		int i, carry;
-		unsigned char *uc = buf;
+		u_char *uc = buf;
 		log("negativ!");
 		for(i = bytes-1, carry = 1; i>=0; i--) {
 			uc[i] ^= 0xff;
@@ -135,7 +135,7 @@
 {
 	/**XXX should be two's-complement */
 	int len;
-	unsigned char *bin = (unsigned char *)buffer_get_string(buffer, (unsigned int *)&len);
+	u_char *bin = (u_char *)buffer_get_string(buffer, (u_int *)&len);
 	BN_bin2bn(bin, len, value);
 	xfree(bin);
 	return len;
@@ -144,10 +144,10 @@
 /*
  * Returns an integer from the buffer (4 bytes, msb first).
  */
-unsigned int
+u_int
 buffer_get_int(Buffer *buffer)
 {
-	unsigned char buf[4];
+	u_char buf[4];
 	buffer_get(buffer, (char *) buf, 4);
 	return GET_32BIT(buf);
 }
@@ -156,7 +156,7 @@
  * Stores an integer in the buffer in 4 bytes, msb first.
  */
 void
-buffer_put_int(Buffer *buffer, unsigned int value)
+buffer_put_int(Buffer *buffer, u_int value)
 {
 	char buf[4];
 	PUT_32BIT(buf, value);
@@ -172,9 +172,9 @@
  * to the returned string, and is not counted in length.
  */
 char *
-buffer_get_string(Buffer *buffer, unsigned int *length_ptr)
+buffer_get_string(Buffer *buffer, u_int *length_ptr)
 {
-	unsigned int len;
+	u_int len;
 	char *value;
 	/* Get the length. */
 	len = buffer_get_int(buffer);
@@ -196,7 +196,7 @@
  * Stores and arbitrary binary string in the buffer.
  */
 void
-buffer_put_string(Buffer *buffer, const void *buf, unsigned int len)
+buffer_put_string(Buffer *buffer, const void *buf, u_int len)
 {
 	buffer_put_int(buffer, len);
 	buffer_append(buffer, buf, len);
@@ -215,7 +215,7 @@
 {
 	char ch;
 	buffer_get(buffer, &ch, 1);
-	return (unsigned char) ch;
+	return (u_char) ch;
 }
 
 /*
diff --git a/bufaux.h b/bufaux.h
index 4f53858..6c73d4f 100644
--- a/bufaux.h
+++ b/bufaux.h
@@ -10,7 +10,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: bufaux.h,v 1.8 2000/09/07 20:27:50 deraadt Exp $"); */
+/* RCSID("$OpenBSD: bufaux.h,v 1.9 2000/12/19 23:17:55 markus Exp $"); */
 
 #ifndef BUFAUX_H
 #define BUFAUX_H
@@ -29,10 +29,10 @@
 int	buffer_get_bignum2(Buffer *buffer, BIGNUM * value);
 
 /* Returns an integer from the buffer (4 bytes, msb first). */
-unsigned int buffer_get_int(Buffer * buffer);
+u_int buffer_get_int(Buffer * buffer);
 
 /* Stores an integer in the buffer in 4 bytes, msb first. */
-void    buffer_put_int(Buffer * buffer, unsigned int value);
+void    buffer_put_int(Buffer * buffer, u_int value);
 
 /* Returns a character from the buffer (0 - 255). */
 int     buffer_get_char(Buffer * buffer);
@@ -48,10 +48,10 @@
  * stored there.  A null character will be automatically appended to the
  * returned string, and is not counted in length.
  */
-char   *buffer_get_string(Buffer * buffer, unsigned int *length_ptr);
+char   *buffer_get_string(Buffer * buffer, u_int *length_ptr);
 
 /* Stores and arbitrary binary string in the buffer. */
-void    buffer_put_string(Buffer * buffer, const void *buf, unsigned int len);
+void    buffer_put_string(Buffer * buffer, const void *buf, u_int len);
 void	buffer_put_cstring(Buffer *buffer, const char *s);
 
 #endif				/* BUFAUX_H */
diff --git a/buffer.c b/buffer.c
index d993c8b..668c173 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: buffer.c,v 1.8 2000/09/07 20:27:50 deraadt Exp $");
+RCSID("$OpenBSD: buffer.c,v 1.9 2000/12/19 23:17:55 markus Exp $");
 
 #include "xmalloc.h"
 #include "buffer.h"
@@ -53,7 +53,7 @@
 /* Appends data to the buffer, expanding it if necessary. */
 
 void
-buffer_append(Buffer *buffer, const char *data, unsigned int len)
+buffer_append(Buffer *buffer, const char *data, u_int len)
 {
 	char *cp;
 	buffer_append_space(buffer, &cp, len);
@@ -67,7 +67,7 @@
  */
 
 void
-buffer_append_space(Buffer *buffer, char **datap, unsigned int len)
+buffer_append_space(Buffer *buffer, char **datap, u_int len)
 {
 	/* If the buffer is empty, start using it from the beginning. */
 	if (buffer->offset == buffer->end) {
@@ -100,7 +100,7 @@
 
 /* Returns the number of bytes of data in the buffer. */
 
-unsigned int
+u_int
 buffer_len(Buffer *buffer)
 {
 	return buffer->end - buffer->offset;
@@ -109,7 +109,7 @@
 /* Gets data from the beginning of the buffer. */
 
 void
-buffer_get(Buffer *buffer, char *buf, unsigned int len)
+buffer_get(Buffer *buffer, char *buf, u_int len)
 {
 	if (len > buffer->end - buffer->offset)
 		fatal("buffer_get: trying to get more bytes than in buffer");
@@ -120,7 +120,7 @@
 /* Consumes the given number of bytes from the beginning of the buffer. */
 
 void
-buffer_consume(Buffer *buffer, unsigned int bytes)
+buffer_consume(Buffer *buffer, u_int bytes)
 {
 	if (bytes > buffer->end - buffer->offset)
 		fatal("buffer_consume: trying to get more bytes than in buffer");
@@ -130,7 +130,7 @@
 /* Consumes the given number of bytes from the end of the buffer. */
 
 void
-buffer_consume_end(Buffer *buffer, unsigned int bytes)
+buffer_consume_end(Buffer *buffer, u_int bytes)
 {
 	if (bytes > buffer->end - buffer->offset)
 		fatal("buffer_consume_end: trying to get more bytes than in buffer");
@@ -151,7 +151,7 @@
 buffer_dump(Buffer *buffer)
 {
 	int i;
-	unsigned char *ucp = (unsigned char *) buffer->buf;
+	u_char *ucp = (u_char *) buffer->buf;
 
 	for (i = buffer->offset; i < buffer->end; i++)
 		fprintf(stderr, " %02x", ucp[i]);
diff --git a/buffer.h b/buffer.h
index 522036a..f3c509d 100644
--- a/buffer.h
+++ b/buffer.h
@@ -11,16 +11,16 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: buffer.h,v 1.6 2000/09/07 20:27:50 deraadt Exp $"); */
+/* RCSID("$OpenBSD: buffer.h,v 1.7 2000/12/19 23:17:55 markus Exp $"); */
 
 #ifndef BUFFER_H
 #define BUFFER_H
 
 typedef struct {
 	char   *buf;		/* Buffer for data. */
-	unsigned int alloc;	/* Number of bytes allocated for data. */
-	unsigned int offset;	/* Offset of first byte containing data. */
-	unsigned int end;	/* Offset of last byte containing data. */
+	u_int alloc;	/* Number of bytes allocated for data. */
+	u_int offset;	/* Offset of first byte containing data. */
+	u_int end;	/* Offset of last byte containing data. */
 }       Buffer;
 /* Initializes the buffer structure. */
 void    buffer_init(Buffer * buffer);
@@ -33,26 +33,26 @@
 void    buffer_clear(Buffer * buffer);
 
 /* Appends data to the buffer, expanding it if necessary. */
-void    buffer_append(Buffer * buffer, const char *data, unsigned int len);
+void    buffer_append(Buffer * buffer, const char *data, u_int len);
 
 /*
  * Appends space to the buffer, expanding the buffer if necessary. This does
  * not actually copy the data into the buffer, but instead returns a pointer
  * to the allocated region.
  */
-void    buffer_append_space(Buffer * buffer, char **datap, unsigned int len);
+void    buffer_append_space(Buffer * buffer, char **datap, u_int len);
 
 /* Returns the number of bytes of data in the buffer. */
-unsigned int buffer_len(Buffer * buffer);
+u_int buffer_len(Buffer * buffer);
 
 /* Gets data from the beginning of the buffer. */
-void    buffer_get(Buffer * buffer, char *buf, unsigned int len);
+void    buffer_get(Buffer * buffer, char *buf, u_int len);
 
 /* Consumes the given number of bytes from the beginning of the buffer. */
-void    buffer_consume(Buffer * buffer, unsigned int bytes);
+void    buffer_consume(Buffer * buffer, u_int bytes);
 
 /* Consumes the given number of bytes from the end of the buffer. */
-void    buffer_consume_end(Buffer * buffer, unsigned int bytes);
+void    buffer_consume_end(Buffer * buffer, u_int bytes);
 
 /* Returns a pointer to the first used byte in the buffer. */
 char   *buffer_ptr(Buffer * buffer);
diff --git a/canohost.c b/canohost.c
index 6d36dd1..506446d 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: canohost.c,v 1.16 2000/10/21 17:04:22 markus Exp $");
+RCSID("$OpenBSD: canohost.c,v 1.17 2000/12/19 23:17:55 markus Exp $");
 
 #include "packet.h"
 #include "xmalloc.h"
@@ -136,7 +136,7 @@
 	 */
 	/* IP options -- IPv4 only */
 	if (from.ss_family == AF_INET) {
-		unsigned char options[200], *ucp;
+		u_char options[200], *ucp;
 		char text[1024], *cp;
 		socklen_t option_size;
 		int ipproto;
diff --git a/channels.c b/channels.c
index 8c0a7a4..3c2f15f 100644
--- a/channels.c
+++ b/channels.c
@@ -40,7 +40,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.76 2000/12/19 22:43:44 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.77 2000/12/19 23:17:56 markus Exp $");
 
 #include "ssh.h"
 #include "packet.h"
@@ -95,14 +95,14 @@
 
 /* Saved X11 authentication data.  This is the real data. */
 char *x11_saved_data = NULL;
-unsigned int x11_saved_data_len = 0;
+u_int x11_saved_data_len = 0;
 
 /*
  * Fake X11 authentication data.  This is what the server will be sending us;
  * we should replace any occurrences of this by the real data.
  */
 char *x11_fake_data = NULL;
-unsigned int x11_fake_data_len;
+u_int x11_fake_data_len;
 
 /*
  * Data structure for storing which hosts are permitted for forward requests.
@@ -436,15 +436,15 @@
 int
 x11_open_helper(Channel *c)
 {
-	unsigned char *ucp;
-	unsigned int proto_len, data_len;
+	u_char *ucp;
+	u_int proto_len, data_len;
 
 	/* Check if the fixed size part of the packet is in buffer. */
 	if (buffer_len(&c->output) < 12)
 		return 0;
 
 	/* Parse the lengths of variable-length fields. */
-	ucp = (unsigned char *) buffer_ptr(&c->output);
+	ucp = (u_char *) buffer_ptr(&c->output);
 	if (ucp[0] == 0x42) {	/* Byte order MSB first. */
 		proto_len = 256 * ucp[6] + ucp[7];
 		data_len = 256 * ucp[8] + ucp[9];
@@ -1066,7 +1066,7 @@
 {
 	int id;
 	char *data;
-	unsigned int data_len;
+	u_int data_len;
 	Channel *c;
 
 	/* Get the channel number and verify it. */
@@ -1112,7 +1112,7 @@
 	int id;
 	int tcode;
 	char *data;
-	unsigned int data_len;
+	u_int data_len;
 	Channel *c;
 
 	/* Get the channel number and verify it. */
@@ -1155,7 +1155,7 @@
 int
 channel_not_very_much_buffered_data()
 {
-	unsigned int i;
+	u_int i;
 	Channel *c;
 
 	for (i = 0; i < channels_alloc; i++) {
@@ -1423,7 +1423,7 @@
 int
 channel_still_open()
 {
-	unsigned int i;
+	u_int i;
 	for (i = 0; i < channels_alloc; i++)
 		switch (channels[i].type) {
 		case SSH_CHANNEL_FREE:
@@ -1786,7 +1786,7 @@
 	u_short host_port;
 	char *host, *originator_string;
 	int remote_channel, sock = -1, newch, i, denied;
-	unsigned int host_len, originator_len;
+	u_int host_len, originator_len;
 
 	/* Get remote channel number. */
 	remote_channel = packet_get_int();
@@ -1996,7 +1996,7 @@
 
 static
 int
-connect_local_xsocket(unsigned int dnr)
+connect_local_xsocket(u_int dnr)
 {
 	static const char *const x_sockets[] = {
 		X_UNIX_PATH "%u",
@@ -2129,7 +2129,7 @@
 {
 	int remote_channel, sock = 0, newch;
 	char *remote_host;
-	unsigned int remote_len;
+	u_int remote_len;
 
 	/* Get remote channel number. */
 	remote_channel = packet_get_int();
@@ -2200,8 +2200,8 @@
 x11_request_forwarding_with_spoofing(int client_session_id,
     const char *proto, const char *data)
 {
-	unsigned int data_len = (unsigned int) strlen(data) / 2;
-	unsigned int i, value;
+	u_int data_len = (u_int) strlen(data) / 2;
+	u_int i, value;
 	char *new_data;
 	int screen_number;
 	const char *cp;
@@ -2241,7 +2241,7 @@
 	/* Convert the fake data into hex. */
 	new_data = xmalloc(2 * data_len + 1);
 	for (i = 0; i < data_len; i++)
-		sprintf(new_data + 2 * i, "%02x", (unsigned char) x11_fake_data[i]);
+		sprintf(new_data + 2 * i, "%02x", (u_char) x11_fake_data[i]);
 
 	/* Send the request packet. */
 	if (compat20) {
diff --git a/cipher.c b/cipher.c
index 788028c..89e3c27 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: cipher.c,v 1.40 2000/12/09 13:41:52 markus Exp $");
+RCSID("$OpenBSD: cipher.c,v 1.41 2000/12/19 23:17:56 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -177,7 +177,7 @@
 void
 blowfish_setkey(CipherContext *cc, const u_char *key, u_int keylen)
 {
-	BF_set_key(&cc->u.bf.key, keylen, (unsigned char *)key);
+	BF_set_key(&cc->u.bf.key, keylen, (u_char *)key);
 }
 void
 blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen)
@@ -207,7 +207,7 @@
  * and after encryption/decryption. Thus the swap_bytes stuff (yuk).
  */
 static void
-swap_bytes(const unsigned char *src, unsigned char *dst, int n)
+swap_bytes(const u_char *src, u_char *dst, int n)
 {
 	char c[4];
 
@@ -260,7 +260,7 @@
 void
 cast_setkey(CipherContext *cc, const u_char *key, u_int keylen)
 {
-	CAST_set_key(&cc->u.cast.key, keylen, (unsigned char *) key);
+	CAST_set_key(&cc->u.cast.key, keylen, (u_char *) key);
 }
 void
 cast_setiv(CipherContext *cc, const u_char *iv, u_int ivlen)
@@ -419,10 +419,10 @@
 
 /*--*/
 
-unsigned int
+u_int
 cipher_mask_ssh1(int client)
 {
-	unsigned int mask = 0;
+	u_int mask = 0;
 	mask |= 1 << SSH_CIPHER_3DES;           /* Mandatory */
 	mask |= 1 << SSH_CIPHER_BLOWFISH;
 	if (client) {
@@ -541,7 +541,7 @@
     const char *passphrase)
 {
 	MD5_CTX md;
-	unsigned char digest[16];
+	u_char digest[16];
 
 	MD5_Init(&md);
 	MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
diff --git a/cipher.h b/cipher.h
index 752d034..6d929aa 100644
--- a/cipher.h
+++ b/cipher.h
@@ -32,7 +32,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* RCSID("$OpenBSD: cipher.h,v 1.24 2000/12/09 13:41:52 markus Exp $"); */
+/* RCSID("$OpenBSD: cipher.h,v 1.25 2000/12/19 23:17:56 markus Exp $"); */
 
 #ifndef CIPHER_H
 #define CIPHER_H
@@ -103,7 +103,7 @@
 	void	(*decrypt)(CipherContext *, u_char *, const u_char *, u_int);
 };
 
-unsigned int cipher_mask_ssh1(int client);
+u_int cipher_mask_ssh1(int client);
 Cipher *cipher_by_name(const char *name);
 Cipher *cipher_by_number(int id);
 int cipher_number(const char *name);
diff --git a/clientloop.c b/clientloop.c
index 3a0f977..44a79d0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.41 2000/12/05 20:34:10 markus Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.42 2000/12/19 23:17:56 markus Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -123,8 +123,8 @@
 static Buffer stdin_buffer;	/* Buffer for stdin data. */
 static Buffer stdout_buffer;	/* Buffer for stdout data. */
 static Buffer stderr_buffer;	/* Buffer for stderr data. */
-static unsigned long stdin_bytes, stdout_bytes, stderr_bytes;
-static unsigned int buffer_high;/* Soft max buffer size. */
+static u_long stdin_bytes, stdout_bytes, stderr_bytes;
+static u_int buffer_high;/* Soft max buffer size. */
 static int max_fd;		/* Maximum file descriptor number in select(). */
 static int connection_in;	/* Connection to server (input). */
 static int connection_out;	/* Connection to server (output). */
@@ -280,7 +280,7 @@
 			 * and also process it as an escape character if
 			 * appropriate.
 			 */
-			if ((unsigned char) buf[0] == escape_char)
+			if ((u_char) buf[0] == escape_char)
 				escape_pending = 1;
 			else {
 				buffer_append(&stdin_buffer, buf, 1);
@@ -300,7 +300,7 @@
 void
 client_make_packets_from_stdin_data()
 {
-	unsigned int len;
+	u_int len;
 
 	/* Send buffered stdin data to the server. */
 	while (buffer_len(&stdin_buffer) > 0 &&
@@ -522,8 +522,8 @@
 	char string[1024];
 	pid_t pid;
 	int bytes = 0;
-	unsigned int i;
-	unsigned char ch;
+	u_int i;
+	u_char ch;
 	char *s;
 
 	for (i = 0; i < len; i++) {
@@ -984,7 +984,7 @@
 void
 client_input_stdout_data(int type, int plen, void *ctxt)
 {
-	unsigned int data_len;
+	u_int data_len;
 	char *data = packet_get_string(&data_len);
 	packet_integrity_check(plen, 4 + data_len, type);
 	buffer_append(&stdout_buffer, data, data_len);
@@ -995,7 +995,7 @@
 void
 client_input_stderr_data(int type, int plen, void *ctxt)
 {
-	unsigned int data_len;
+	u_int data_len;
 	char *data = packet_get_string(&data_len);
 	packet_integrity_check(plen, 4 + data_len, type);
 	buffer_append(&stderr_buffer, data, data_len);
@@ -1113,7 +1113,7 @@
 {
 	Channel *c = NULL;
 	char *ctype;
-	unsigned int len;
+	u_int len;
 	int rchan;
 	int rmaxpack;
 	int rwindow;
@@ -1213,7 +1213,7 @@
 client_input_channel_req(int id, void *arg)
 {
 	Channel *c = NULL;
-	unsigned int len;
+	u_int len;
 	int success = 0;
 	int reply;
 	char *rtype;
diff --git a/compress.c b/compress.c
index 93266ed..3c05886 100644
--- a/compress.c
+++ b/compress.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: compress.c,v 1.9 2000/09/07 20:27:50 deraadt Exp $");
+RCSID("$OpenBSD: compress.c,v 1.10 2000/12/19 23:17:56 markus Exp $");
 
 #include "ssh.h"
 #include "buffer.h"
@@ -73,13 +73,13 @@
 		return;
 
 	/* Input is the contents of the input buffer. */
-	outgoing_stream.next_in = (unsigned char *) buffer_ptr(input_buffer);
+	outgoing_stream.next_in = (u_char *) buffer_ptr(input_buffer);
 	outgoing_stream.avail_in = buffer_len(input_buffer);
 
 	/* Loop compressing until deflate() returns with avail_out != 0. */
 	do {
 		/* Set up fixed-size output buffer. */
-		outgoing_stream.next_out = (unsigned char *)buf;
+		outgoing_stream.next_out = (u_char *)buf;
 		outgoing_stream.avail_out = sizeof(buf);
 
 		/* Compress as much data into the buffer as possible. */
@@ -112,12 +112,12 @@
 	char buf[4096];
 	int status;
 
-	incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer);
+	incoming_stream.next_in = (u_char *) buffer_ptr(input_buffer);
 	incoming_stream.avail_in = buffer_len(input_buffer);
 
 	for (;;) {
 		/* Set up fixed-size output buffer. */
-		incoming_stream.next_out = (unsigned char *) buf;
+		incoming_stream.next_out = (u_char *) buf;
 		incoming_stream.avail_out = sizeof(buf);
 
 		status = inflate(&incoming_stream, Z_PARTIAL_FLUSH);
diff --git a/crc32.c b/crc32.c
index a4e1f27..4774c8b 100644
--- a/crc32.c
+++ b/crc32.c
@@ -31,7 +31,7 @@
  *      tions for all combinations of data and CRC register values
  *
  *      The values must be right-shifted by eight bits by the "updcrc
- *      logic; the shift must be unsigned (bring in zeroes).  On some
+ *      logic; the shift must be u_(bring in zeroes).  On some
  *      hardware you could probably optimize the shift in assembler by
  *      using byte-swap instructions
  *      polynomial $edb88320
@@ -39,11 +39,11 @@
 
 
 #include "includes.h"
-RCSID("$OpenBSD: crc32.c,v 1.7 2000/09/07 20:27:51 deraadt Exp $");
+RCSID("$OpenBSD: crc32.c,v 1.8 2000/12/19 23:17:56 markus Exp $");
 
 #include "crc32.h"
 
-static unsigned int crc32_tab[] = {
+static u_int crc32_tab[] = {
 	0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
 	0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
 	0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
@@ -100,11 +100,11 @@
 
 /* Return a 32-bit CRC of the contents of the buffer. */
 
-unsigned int
-ssh_crc32(const unsigned char *s, unsigned int len)
+u_int
+ssh_crc32(const u_char *s, u_int len)
 {
-	unsigned int i;
-	unsigned int crc32val;
+	u_int i;
+	u_int crc32val;
 
 	crc32val = 0;
 	for (i = 0;  i < len;  i ++) {
diff --git a/crc32.h b/crc32.h
index 58c4fba..88e7869 100644
--- a/crc32.h
+++ b/crc32.h
@@ -11,7 +11,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: crc32.h,v 1.8 2000/09/07 20:27:51 deraadt Exp $"); */
+/* RCSID("$OpenBSD: crc32.h,v 1.9 2000/12/19 23:17:56 markus Exp $"); */
 
 #ifndef CRC32_H
 #define CRC32_H
@@ -20,6 +20,6 @@
  * This computes a 32 bit CRC of the data in the buffer, and returns the CRC.
  * The polynomial used is 0xedb88320.
  */
-unsigned int ssh_crc32(const unsigned char *buf, unsigned int len);
+u_int ssh_crc32(const u_char *buf, u_int len);
 
 #endif				/* CRC32_H */
diff --git a/deattack.c b/deattack.c
index df1d224..c3c3f08 100644
--- a/deattack.c
+++ b/deattack.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: deattack.c,v 1.10 2000/10/31 13:18:53 markus Exp $	*/
+/*	$OpenBSD: deattack.c,v 1.11 2000/12/19 23:17:56 markus Exp $	*/
 
 /*
  * Cryptographic attack detector for ssh - source code
@@ -51,16 +51,16 @@
 crc_update(u_int32_t *a, u_int32_t b)
 {
 	b ^= *a;
-	*a = ssh_crc32((unsigned char *) &b, sizeof(b));
+	*a = ssh_crc32((u_char *) &b, sizeof(b));
 }
 
 /* detect if a block is used in a particular pattern */
 int
-check_crc(unsigned char *S, unsigned char *buf, u_int32_t len,
-	  unsigned char *IV)
+check_crc(u_char *S, u_char *buf, u_int32_t len,
+	  u_char *IV)
 {
 	u_int32_t crc;
-	unsigned char *c;
+	u_char *c;
 
 	crc = 0;
 	if (IV && !CMP(S, IV)) {
@@ -82,14 +82,14 @@
 
 /* Detect a crc32 compensation attack on a packet */
 int
-detect_attack(unsigned char *buf, u_int32_t len, unsigned char *IV)
+detect_attack(u_char *buf, u_int32_t len, u_char *IV)
 {
 	static u_int16_t *h = (u_int16_t *) NULL;
 	static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE;
 	register u_int32_t i, j;
 	u_int32_t l;
-	register unsigned char *c;
-	unsigned char *d;
+	register u_char *c;
+	u_char *d;
 
 	if (len > (SSH_MAXBLOCKS * SSH_BLOCKSIZE) ||
 	    len % SSH_BLOCKSIZE != 0) {
diff --git a/deattack.h b/deattack.h
index 6ce54de..22930f6 100644
--- a/deattack.h
+++ b/deattack.h
@@ -24,5 +24,5 @@
 #define DEATTACK_OK		0
 #define DEATTACK_DETECTED	1
 
-int     detect_attack(unsigned char *buf, u_int32_t len, unsigned char IV[8]);
+int     detect_attack(u_char *buf, u_int32_t len, u_char IV[8]);
 #endif
diff --git a/getput.h b/getput.h
index 19ff5e1..b8e8345 100644
--- a/getput.h
+++ b/getput.h
@@ -11,20 +11,20 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: getput.h,v 1.5 2000/09/07 20:27:51 deraadt Exp $"); */
+/* RCSID("$OpenBSD: getput.h,v 1.6 2000/12/19 23:17:56 markus Exp $"); */
 
 #ifndef GETPUT_H
 #define GETPUT_H
 
 /*------------ macros for storing/extracting msb first words -------------*/
 
-#define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \
-		       ((unsigned long)(unsigned char)(cp)[1] << 16) | \
-		       ((unsigned long)(unsigned char)(cp)[2] << 8) | \
-		       ((unsigned long)(unsigned char)(cp)[3]))
+#define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \
+		       ((u_long)(u_char)(cp)[1] << 16) | \
+		       ((u_long)(u_char)(cp)[2] << 8) | \
+		       ((u_long)(u_char)(cp)[3]))
 
-#define GET_16BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 8) | \
-		       ((unsigned long)(unsigned char)(cp)[1]))
+#define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \
+		       ((u_long)(u_char)(cp)[1]))
 
 #define PUT_32BIT(cp, value) do { \
   (cp)[0] = (value) >> 24; \
@@ -39,14 +39,14 @@
 /*------------ macros for storing/extracting lsb first words -------------*/
 
 #define GET_32BIT_LSB_FIRST(cp) \
-  (((unsigned long)(unsigned char)(cp)[0]) | \
-  ((unsigned long)(unsigned char)(cp)[1] << 8) | \
-  ((unsigned long)(unsigned char)(cp)[2] << 16) | \
-  ((unsigned long)(unsigned char)(cp)[3] << 24))
+  (((u_long)(u_char)(cp)[0]) | \
+  ((u_long)(u_char)(cp)[1] << 8) | \
+  ((u_long)(u_char)(cp)[2] << 16) | \
+  ((u_long)(u_char)(cp)[3] << 24))
 
 #define GET_16BIT_LSB_FIRST(cp) \
-  (((unsigned long)(unsigned char)(cp)[0]) | \
-  ((unsigned long)(unsigned char)(cp)[1] << 8))
+  (((u_long)(u_char)(cp)[0]) | \
+  ((u_long)(u_char)(cp)[1] << 8))
 
 #define PUT_32BIT_LSB_FIRST(cp, value) do { \
   (cp)[0] = (value); \
diff --git a/hmac.c b/hmac.c
index 48a1763..6c3883e 100644
--- a/hmac.c
+++ b/hmac.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: hmac.c,v 1.4 2000/09/07 20:27:51 deraadt Exp $");
+RCSID("$OpenBSD: hmac.c,v 1.5 2000/12/19 23:17:56 markus Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -31,16 +31,16 @@
 
 #include <openssl/hmac.h>
 
-unsigned char *
+u_char *
 hmac(
     EVP_MD *evp_md,
-    unsigned int seqno,
-    unsigned char *data, int datalen,
-    unsigned char *key, int keylen)
+    u_int seqno,
+    u_char *data, int datalen,
+    u_char *key, int keylen)
 {
 	HMAC_CTX c;
-	static unsigned char m[EVP_MAX_MD_SIZE];
-	unsigned char b[4];
+	static u_char m[EVP_MAX_MD_SIZE];
+	u_char b[4];
 
 	if (key == NULL)
 		fatal("hmac: no key");
diff --git a/hmac.h b/hmac.h
index 281300e..9872b29 100644
--- a/hmac.h
+++ b/hmac.h
@@ -24,11 +24,11 @@
 #ifndef HMAC_H
 #define HMAC_H
 
-unsigned char *
+u_char *
 hmac(
     EVP_MD *evp_md,
-    unsigned int seqno,
-    unsigned char *data, int datalen,
-    unsigned char *key, int len);
+    u_int seqno,
+    u_char *data, int datalen,
+    u_char *key, int len);
 
 #endif
diff --git a/hostfile.c b/hostfile.c
index 3b0f286..1c3fb22 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: hostfile.c,v 1.21 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: hostfile.c,v 1.23 2000/12/21 15:10:16 markus Exp $");
 
 #include "packet.h"
 #include "match.h"
@@ -52,7 +52,7 @@
  */
 
 int
-hostfile_read_key(char **cpp, unsigned int *bitsp, Key *ret)
+hostfile_read_key(char **cpp, u_int *bitsp, Key *ret)
 {
 	char *cp;
 
@@ -74,7 +74,7 @@
 }
 
 int
-auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n)
+auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n)
 {
 	Key *k = key_new(KEY_RSA1);
 	int ret = hostfile_read_key(cpp, bitsp, k);
@@ -107,12 +107,13 @@
  */
 
 HostStatus
-check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found)
+check_host_in_hostfile(const char *filename, const char *host, Key *key,
+    Key *found, int *numret)
 {
 	FILE *f;
 	char line[8192];
 	int linenum = 0;
-	unsigned int kbits, hostlen;
+	u_int kbits, hostlen;
 	char *cp, *cp2;
 	HostStatus end_return;
 
@@ -149,7 +150,7 @@
 			;
 
 		/* Check if the host name matches. */
-		if (match_hostname(host, cp, (unsigned int) (cp2 - cp)) != 1)
+		if (match_hostname(host, cp, (u_int) (cp2 - cp)) != 1)
 			continue;
 
 		/* Got a match.  Skip host name. */
@@ -164,6 +165,9 @@
 		if (!hostfile_check_key(kbits, found, host, filename, linenum))
 			continue;
 
+		if (numret != NULL)
+			*numret = linenum;
+
 		/* Check if the current key is the same as the given key. */
 		if (key_equal(key, found)) {
 			/* Ok, they match. */
diff --git a/hostfile.h b/hostfile.h
index 9c2353b..dbdbd8f 100644
--- a/hostfile.h
+++ b/hostfile.h
@@ -21,8 +21,10 @@
 typedef enum {
 	HOST_OK, HOST_NEW, HOST_CHANGED
 }       HostStatus;
+
 HostStatus
-check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found);
+check_host_in_hostfile(const char *filename, const char *host, Key *key,
+    Key *found, int *line);
 
 /*
  * Appends an entry to the host file.  Returns false if the entry could not
diff --git a/kex.c b/kex.c
index 3a74fda..de31570 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: kex.c,v 1.14 2000/12/15 17:30:14 provos Exp $");
+RCSID("$OpenBSD: kex.c,v 1.16 2000/12/20 19:37:22 markus Exp $");
 
 #include "ssh.h"
 #include "ssh2.h"
@@ -51,7 +51,7 @@
 kex_init(char *myproposal[PROPOSAL_MAX])
 {
 	int first_kex_packet_follows = 0;
-	unsigned char cookie[KEX_COOKIE_LEN];
+	u_char cookie[KEX_COOKIE_LEN];
 	u_int32_t rand = 0;
 	int i;
 	Buffer *ki = xmalloc(sizeof(*ki));
@@ -190,7 +190,7 @@
 }
 
 DH *
-dh_new_group1()
+dh_new_group1(void)
 {
 	static char *gen = "2", *group1 =
 	    "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1"
@@ -204,7 +204,7 @@
 }
 
 void
-dump_digest(unsigned char *digest, int len)
+dump_digest(u_char *digest, int len)
 {
 	int i;
 	for (i = 0; i< len; i++){
@@ -215,7 +215,7 @@
 	fprintf(stderr, "\n");
 }
 
-unsigned char *
+u_char *
 kex_hash(
     char *client_version_string,
     char *server_version_string,
@@ -227,7 +227,7 @@
     BIGNUM *shared_secret)
 {
 	Buffer b;
-	static unsigned char digest[EVP_MAX_MD_SIZE];
+	static u_char digest[EVP_MAX_MD_SIZE];
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
 
@@ -264,7 +264,7 @@
 	return digest;
 }
 
-unsigned char *
+u_char *
 kex_hash_gex(
     char *client_version_string,
     char *server_version_string,
@@ -277,7 +277,7 @@
     BIGNUM *shared_secret)
 {
 	Buffer b;
-	static unsigned char digest[EVP_MAX_MD_SIZE];
+	static u_char digest[EVP_MAX_MD_SIZE];
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
 
@@ -317,8 +317,8 @@
 	return digest;
 }
 
-unsigned char *
-derive_key(int id, int need, char unsigned *hash, BIGNUM *shared_secret)
+u_char *
+derive_key(int id, int need, u_char *hash, BIGNUM *shared_secret)
 {
 	Buffer b;
 	EVP_MD *evp_md = EVP_sha1();
@@ -326,7 +326,7 @@
 	char c = id;
 	int have;
 	int mdsz = evp_md->md_size;
-	unsigned char *digest = xmalloc(((need+mdsz-1)/mdsz)*mdsz);
+	u_char *digest = xmalloc(((need+mdsz-1)/mdsz)*mdsz);
 
 	buffer_init(&b);
 	buffer_put_bignum2(&b, shared_secret);
@@ -512,12 +512,12 @@
 }
 
 int
-kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret)
+kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret)
 {
 	int i;
 	int mode;
 	int ctos;
-	unsigned char *keys[NKEYS];
+	u_char *keys[NKEYS];
 
 	for (i = 0; i < NKEYS; i++)
 		keys[i] = derive_key('A'+i, k->we_need, hash, shared_secret);
diff --git a/kex.h b/kex.h
index b445cee..143769a 100644
--- a/kex.h
+++ b/kex.h
@@ -62,15 +62,15 @@
 	char		*name;
 	Cipher		*cipher;
 	int		enabled;
-	unsigned char	*key;
-	unsigned char	*iv;
+	u_char	*key;
+	u_char	*iv;
 };
 struct Mac {
 	char		*name;
 	int		enabled;
 	EVP_MD		*md;
 	int		mac_len;
-	unsigned char	*key;
+	u_char	*key;
 	int		key_len;
 };
 struct Comp {
@@ -97,15 +97,15 @@
 Kex *
 kex_choose_conf(char *cprop[PROPOSAL_MAX],
     char *sprop[PROPOSAL_MAX], int server);
-int	kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret);
+int	kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret);
 void	packet_set_kex(Kex *k);
 int	dh_pub_is_valid(DH *dh, BIGNUM *dh_pub);
 DH	*dh_new_group_asc(const char *, const char *);
 DH	*dh_new_group(BIGNUM *, BIGNUM *);
-void	dh_gen_key();
-DH	*dh_new_group1();
+void	dh_gen_key(DH *);
+DH	*dh_new_group1(void);
 
-unsigned char *
+u_char *
 kex_hash(
     char *client_version_string,
     char *server_version_string,
@@ -116,7 +116,7 @@
     BIGNUM *server_dh_pub,
     BIGNUM *shared_secret);
 
-unsigned char *
+u_char *
 kex_hash_gex(
     char *client_version_string,
     char *server_version_string,
diff --git a/key.c b/key.c
index a6b25b7..f9474b1 100644
--- a/key.c
+++ b/key.c
@@ -46,7 +46,7 @@
 #include "buffer.h"
 #include "bufaux.h"
 
-RCSID("$OpenBSD: key.c,v 1.12 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: key.c,v 1.13 2000/12/19 23:17:56 markus Exp $");
 
 Key *
 key_new(int type)
@@ -163,7 +163,7 @@
 key_fingerprint(Key *k)
 {
 	static char retval[(EVP_MAX_MD_SIZE+1)*3];
-	unsigned char *blob = NULL;
+	u_char *blob = NULL;
 	int len = 0;
 	int nlen, elen;
 
@@ -190,7 +190,7 @@
 	}
 	if (blob != NULL) {
 		int i;
-		unsigned char digest[EVP_MAX_MD_SIZE];
+		u_char digest[EVP_MAX_MD_SIZE];
 		EVP_MD *md = EVP_md5();
 		EVP_MD_CTX ctx;
 		EVP_DigestInit(&ctx, md);
@@ -273,7 +273,7 @@
 	char *cp, *space;
 	int len, n, type;
 	u_int bits;
-	unsigned char *blob;
+	u_char *blob;
 
 	cp = *cpp;
 
@@ -380,7 +380,7 @@
 key_write(Key *key, FILE *f)
 {
 	int success = 0;
-	unsigned int bits = 0;
+	u_int bits = 0;
 
 	if (key->type == KEY_RSA1 && key->rsa != NULL) {
 		/* size of modulus 'n' */
@@ -395,7 +395,7 @@
 	} else if ((key->type == KEY_DSA && key->dsa != NULL) ||
 	    (key->type == KEY_RSA && key->rsa != NULL)) {
 		int len, n;
-		unsigned char *blob, *uu;
+		u_char *blob, *uu;
 		key_to_blob(key, &blob, &len);
 		uu = xmalloc(2*len);
 		n = uuencode(blob, len, uu, 2*len);
@@ -452,7 +452,7 @@
 }
 
 RSA *
-rsa_generate_private_key(unsigned int bits)
+rsa_generate_private_key(u_int bits)
 {
         RSA *private;
         private = RSA_generate_key(bits, 35, NULL, NULL);
@@ -462,7 +462,7 @@
 }
 
 DSA*
-dsa_generate_private_key(unsigned int bits)
+dsa_generate_private_key(u_int bits)
 {
 	DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL);
 	if (private == NULL)
@@ -475,7 +475,7 @@
 }
 
 Key *
-key_generate(int type, unsigned int bits)
+key_generate(int type, u_int bits)
 {
 	Key *k = key_new(KEY_UNSPEC);
 	switch (type) {
@@ -587,11 +587,11 @@
 }
 
 int
-key_to_blob(Key *key, unsigned char **blobp, unsigned int *lenp)
+key_to_blob(Key *key, u_char **blobp, u_int *lenp)
 {
 	Buffer b;
 	int len;
-	unsigned char *buf;
+	u_char *buf;
 
 	if (key == NULL) {
 		error("key_to_blob: key == NULL");
@@ -630,8 +630,8 @@
 int
 key_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
 	switch(key->type){
 	case KEY_DSA:
@@ -650,8 +650,8 @@
 int
 key_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen)
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen)
 {
 	switch(key->type){
 	case KEY_DSA:
diff --git a/key.h b/key.h
index b6c3eb0..91f4d00 100644
--- a/key.h
+++ b/key.h
@@ -47,24 +47,24 @@
 int	key_read(Key *key, char **cpp);
 u_int	key_size(Key *k);
 
-Key	*key_generate(int type, unsigned int bits);
+Key	*key_generate(int type, u_int bits);
 Key	*key_from_private(Key *k);
 int	key_type_from_name(char *name);
 
 Key	*key_from_blob(char *blob, int blen);
-int	key_to_blob(Key *key, unsigned char **blobp, unsigned int *lenp);
+int	key_to_blob(Key *key, u_char **blobp, u_int *lenp);
 char	*key_ssh_name(Key *k);
 
 int
 key_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen);
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen);
 
 int
 key_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen);
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen);
 
 #endif
diff --git a/log.c b/log.c
index e75c6c4..896bd23 100644
--- a/log.c
+++ b/log.c
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: log.c,v 1.11 2000/09/30 16:27:43 markus Exp $");
+RCSID("$OpenBSD: log.c,v 1.12 2000/12/19 23:17:57 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -155,7 +155,7 @@
 		}
 	}
 	fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx\n",
-	      (unsigned long) proc, (unsigned long) context);
+	      (u_long) proc, (u_long) context);
 }
 
 /* Cleanup and exit */
@@ -172,7 +172,7 @@
 	for (cu = fatal_cleanups; cu; cu = next_cu) {
 		next_cu = cu->next;
 		debug("Calling cleanup 0x%lx(0x%lx)",
-		      (unsigned long) cu->proc, (unsigned long) cu->context);
+		      (u_long) cu->proc, (u_long) cu->context);
 		(*cu->proc) (cu->context);
 	}
 	exit(255);
diff --git a/login.c b/login.c
index b13b84d..649648f 100644
--- a/login.c
+++ b/login.c
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: login.c,v 1.15 2000/09/07 20:27:52 deraadt Exp $");
+RCSID("$OpenBSD: login.c,v 1.16 2000/12/19 23:17:57 markus Exp $");
 
 #include "loginrec.h"
 
@@ -49,9 +49,9 @@
  * The host the user logged in from will be returned in buf.
  */
 
-unsigned long
+u_long
 get_last_login_time(uid_t uid, const char *logname,
-		    char *buf, unsigned int bufsize)
+		    char *buf, u_int bufsize)
 {
   struct logininfo li;
 
diff --git a/match.c b/match.c
index c373129..895ecab 100644
--- a/match.c
+++ b/match.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: match.c,v 1.9 2000/09/07 20:27:52 deraadt Exp $");
+RCSID("$OpenBSD: match.c,v 1.10 2000/12/19 23:17:57 markus Exp $");
 
 #include "ssh.h"
 
@@ -87,12 +87,12 @@
  */
 
 int
-match_hostname(const char *host, const char *pattern, unsigned int len)
+match_hostname(const char *host, const char *pattern, u_int len)
 {
 	char sub[1024];
 	int negated;
 	int got_positive;
-	unsigned int i, subi;
+	u_int i, subi;
 
 	got_positive = 0;
 	for (i = 0; i < len;) {
diff --git a/match.h b/match.h
index 564f5ab..5afbe32 100644
--- a/match.h
+++ b/match.h
@@ -26,6 +26,6 @@
  * indicate negation).  Returns -1 if negation matches, 1 if there is
  * a positive match, 0 if there is no match at all.
  */
-int     match_hostname(const char *host, const char *pattern, unsigned int len);
+int     match_hostname(const char *host, const char *pattern, u_int len);
 
 #endif
diff --git a/mpaux.c b/mpaux.c
index 1ee8df1..6b586ec 100644
--- a/mpaux.c
+++ b/mpaux.c
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: mpaux.c,v 1.14 2000/09/07 20:27:52 deraadt Exp $");
+RCSID("$OpenBSD: mpaux.c,v 1.15 2000/12/19 23:17:57 markus Exp $");
 
 #include <openssl/bn.h>
 #include "getput.h"
@@ -22,15 +22,15 @@
 #include <openssl/md5.h>
 
 void
-compute_session_id(unsigned char session_id[16],
-    unsigned char cookie[8],
+compute_session_id(u_char session_id[16],
+    u_char cookie[8],
     BIGNUM* host_key_n,
     BIGNUM* session_key_n)
 {
-	unsigned int host_key_bytes = BN_num_bytes(host_key_n);
-	unsigned int session_key_bytes = BN_num_bytes(session_key_n);
-	unsigned int bytes = host_key_bytes + session_key_bytes;
-	unsigned char *buf = xmalloc(bytes);
+	u_int host_key_bytes = BN_num_bytes(host_key_n);
+	u_int session_key_bytes = BN_num_bytes(session_key_n);
+	u_int bytes = host_key_bytes + session_key_bytes;
+	u_char *buf = xmalloc(bytes);
 	MD5_CTX md;
 
 	BN_bn2bin(host_key_n, buf);
diff --git a/mpaux.h b/mpaux.h
index 9de1727..b3f15e4 100644
--- a/mpaux.h
+++ b/mpaux.h
@@ -12,7 +12,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: mpaux.h,v 1.8 2000/09/07 20:27:52 deraadt Exp $"); */
+/* RCSID("$OpenBSD: mpaux.h,v 1.9 2000/12/19 23:17:57 markus Exp $"); */
 
 #ifndef MPAUX_H
 #define MPAUX_H
@@ -23,8 +23,8 @@
  * representations of host_key_n, session_key_n, and the cookie.
  */
 void
-compute_session_id(unsigned char session_id[16],
-    unsigned char cookie[8],
+compute_session_id(u_char session_id[16],
+    u_char cookie[8],
     BIGNUM * host_key_n,
     BIGNUM * session_key_n);
 
diff --git a/packet.c b/packet.c
index 3e8ab23..f055c4f 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: packet.c,v 1.39 2000/12/06 22:58:15 markus Exp $");
+RCSID("$OpenBSD: packet.c,v 1.40 2000/12/19 23:17:57 markus Exp $");
 
 #include "xmalloc.h"
 #include "buffer.h"
@@ -84,7 +84,7 @@
 static int cipher_type = SSH_CIPHER_NONE;
 
 /* Protocol flags for the remote side. */
-static unsigned int remote_protocol_flags = 0;
+static u_int remote_protocol_flags = 0;
 
 /* Encryption context for receiving data.  This is only used for decryption. */
 static CipherContext receive_context;
@@ -167,8 +167,8 @@
 	connection_in = fd_in;
 	connection_out = fd_out;
 	cipher_type = SSH_CIPHER_NONE;
-	cipher_init(&send_context, none, (unsigned char *) "", 0, NULL, 0);
-	cipher_init(&receive_context, none, (unsigned char *) "", 0, NULL, 0);
+	cipher_init(&send_context, none, (u_char *) "", 0, NULL, 0);
+	cipher_init(&receive_context, none, (u_char *) "", 0, NULL, 0);
 	if (!initialized) {
 		initialized = 1;
 		buffer_init(&input);
@@ -281,7 +281,7 @@
 /* Sets remote side protocol flags. */
 
 void
-packet_set_protocol_flags(unsigned int protocol_flags)
+packet_set_protocol_flags(u_int protocol_flags)
 {
 	remote_protocol_flags = protocol_flags;
 	channel_set_options((protocol_flags & SSH_PROTOFLAG_HOST_IN_FWD_OPEN) != 0);
@@ -289,7 +289,7 @@
 
 /* Returns the remote protocol flags set earlier by the above function. */
 
-unsigned int
+u_int
 packet_get_protocol_flags()
 {
 	return remote_protocol_flags;
@@ -318,7 +318,7 @@
 
 void
 packet_encrypt(CipherContext * cc, void *dest, void *src,
-    unsigned int bytes)
+    u_int bytes)
 {
 	cipher_encrypt(cc, dest, src, bytes);
 }
@@ -329,7 +329,7 @@
  */
 
 void
-packet_decrypt(CipherContext *context, void *dest, void *src, unsigned int bytes)
+packet_decrypt(CipherContext *context, void *dest, void *src, u_int bytes)
 {
 	/*
 	 * Cryptographic attack detector for ssh - Modifications for packet.c
@@ -350,7 +350,7 @@
  */
 
 void
-packet_set_encryption_key(const unsigned char *key, unsigned int keylen,
+packet_set_encryption_key(const u_char *key, u_int keylen,
     int number)
 {
 	Cipher *cipher = cipher_by_number(number);
@@ -410,7 +410,7 @@
 /* Appends an integer to the packet data. */
 
 void
-packet_put_int(unsigned int value)
+packet_put_int(u_int value)
 {
 	buffer_put_int(&outgoing_packet, value);
 }
@@ -418,7 +418,7 @@
 /* Appends a string to packet data. */
 
 void
-packet_put_string(const char *buf, unsigned int len)
+packet_put_string(const char *buf, u_int len)
 {
 	buffer_put_string(&outgoing_packet, buf, len);
 }
@@ -429,7 +429,7 @@
 }
 
 void
-packet_put_raw(const char *buf, unsigned int len)
+packet_put_raw(const char *buf, u_int len)
 {
 	buffer_append(&outgoing_packet, buf, len);
 }
@@ -458,7 +458,7 @@
 {
 	char buf[8], *cp;
 	int i, padding, len;
-	unsigned int checksum;
+	u_int checksum;
 	u_int32_t rand = 0;
 
 	/*
@@ -493,7 +493,7 @@
 	buffer_consume(&outgoing_packet, 8 - padding);
 
 	/* Add check bytes. */
-	checksum = ssh_crc32((unsigned char *) buffer_ptr(&outgoing_packet),
+	checksum = ssh_crc32((u_char *) buffer_ptr(&outgoing_packet),
 	    buffer_len(&outgoing_packet));
 	PUT_32BIT(buf, checksum);
 	buffer_append(&outgoing_packet, buf, 4);
@@ -530,12 +530,12 @@
 void
 packet_send2()
 {
-	unsigned char *macbuf = NULL;
+	u_char *macbuf = NULL;
 	char *cp;
-	unsigned int packet_length = 0;
-	unsigned int i, padlen, len;
+	u_int packet_length = 0;
+	u_int i, padlen, len;
 	u_int32_t rand = 0;
-	static unsigned int seqnr = 0;
+	static u_int seqnr = 0;
 	int type;
 	Enc *enc   = NULL;
 	Mac *mac   = NULL;
@@ -604,7 +604,7 @@
 	/* compute MAC over seqnr and packet(length fields, payload, padding) */
 	if (mac && mac->enabled) {
 		macbuf = hmac( mac->md, seqnr,
-		    (unsigned char *) buffer_ptr(&outgoing_packet),
+		    (u_char *) buffer_ptr(&outgoing_packet),
 		    buffer_len(&outgoing_packet),
 		    mac->key, mac->key_len
 		);
@@ -742,16 +742,16 @@
 int
 packet_read_poll1(int *payload_len_ptr)
 {
-	unsigned int len, padded_len;
-	unsigned char *ucp;
+	u_int len, padded_len;
+	u_char *ucp;
 	char buf[8], *cp;
-	unsigned int checksum, stored_checksum;
+	u_int checksum, stored_checksum;
 
 	/* Check if input size is less than minimum packet size. */
 	if (buffer_len(&input) < 4 + 8)
 		return SSH_MSG_NONE;
 	/* Get length of incoming packet. */
-	ucp = (unsigned char *) buffer_ptr(&input);
+	ucp = (u_char *) buffer_ptr(&input);
 	len = GET_32BIT(ucp);
 	if (len < 1 + 2 + 2 || len > 256 * 1024)
 		packet_disconnect("Bad packet length %d.", len);
@@ -778,7 +778,7 @@
 #endif
 
 	/* Compute packet checksum. */
-	checksum = ssh_crc32((unsigned char *) buffer_ptr(&incoming_packet),
+	checksum = ssh_crc32((u_char *) buffer_ptr(&incoming_packet),
 	    buffer_len(&incoming_packet) - 4);
 
 	/* Skip padding. */
@@ -790,7 +790,7 @@
 		packet_disconnect("packet_read_poll: len %d != buffer_len %d.",
 		    len, buffer_len(&incoming_packet));
 
-	ucp = (unsigned char *) buffer_ptr(&incoming_packet) + len - 4;
+	ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4;
 	stored_checksum = GET_32BIT(ucp);
 	if (checksum != stored_checksum)
 		packet_disconnect("Corrupted check bytes on input.");
@@ -811,18 +811,18 @@
 	*payload_len_ptr = buffer_len(&incoming_packet);
 
 	/* Return type. */
-	return (unsigned char) buf[0];
+	return (u_char) buf[0];
 }
 
 int
 packet_read_poll2(int *payload_len_ptr)
 {
-	unsigned int padlen, need;
-	unsigned char buf[8], *macbuf;
-	unsigned char *ucp;
+	u_int padlen, need;
+	u_char buf[8], *macbuf;
+	u_char *ucp;
 	char *cp;
-	static unsigned int packet_length = 0;
-	static unsigned int seqnr = 0;
+	static u_int packet_length = 0;
+	static u_int seqnr = 0;
 	int type;
 	int maclen, block_size;
 	Enc *enc   = NULL;
@@ -848,7 +848,7 @@
 		buffer_append_space(&incoming_packet, &cp, block_size);
 		packet_decrypt(&receive_context, cp, buffer_ptr(&input),
 		    block_size);
-		ucp = (unsigned char *) buffer_ptr(&incoming_packet);
+		ucp = (u_char *) buffer_ptr(&incoming_packet);
 		packet_length = GET_32BIT(ucp);
 		if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
 			buffer_dump(&incoming_packet);
@@ -883,7 +883,7 @@
 	 */
 	if (mac && mac->enabled) {
 		macbuf = hmac( mac->md, seqnr,
-		    (unsigned char *) buffer_ptr(&incoming_packet),
+		    (u_char *) buffer_ptr(&incoming_packet),
 		    buffer_len(&incoming_packet),
 		    mac->key, mac->key_len
 		);
@@ -926,7 +926,7 @@
 	packet_length = 0;
 
 	/* extract packet type */
-	type = (unsigned char)buf[0];
+	type = (u_char)buf[0];
 
 	if (type == SSH2_MSG_NEWKEYS) {
 		if (kex==NULL || mac==NULL || enc==NULL || comp==NULL)
@@ -949,7 +949,7 @@
 	fprintf(stderr, "read/plain[%d]:\r\n",type);
 	buffer_dump(&incoming_packet);
 #endif
-	return (unsigned char)type;
+	return (u_char)type;
 }
 
 int
@@ -1018,24 +1018,24 @@
  */
 
 void
-packet_process_incoming(const char *buf, unsigned int len)
+packet_process_incoming(const char *buf, u_int len)
 {
 	buffer_append(&input, buf, len);
 }
 
 /* Returns a character from the packet. */
 
-unsigned int
+u_int
 packet_get_char()
 {
 	char ch;
 	buffer_get(&incoming_packet, &ch, 1);
-	return (unsigned char) ch;
+	return (u_char) ch;
 }
 
 /* Returns an integer from the packet data. */
 
-unsigned int
+u_int
 packet_get_int()
 {
 	return buffer_get_int(&incoming_packet);
@@ -1081,7 +1081,7 @@
  */
 
 char *
-packet_get_string(unsigned int *length_ptr)
+packet_get_string(u_int *length_ptr)
 {
 	return buffer_get_string(&incoming_packet, length_ptr);
 }
diff --git a/packet.h b/packet.h
index 7a39353..597fbb1 100644
--- a/packet.h
+++ b/packet.h
@@ -11,7 +11,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: packet.h,v 1.17 2000/09/07 20:27:52 deraadt Exp $"); */
+/* RCSID("$OpenBSD: packet.h,v 1.18 2000/12/19 23:17:57 markus Exp $"); */
 
 #ifndef PACKET_H
 #define PACKET_H
@@ -46,17 +46,17 @@
  * encrypted independently of each other.  Cipher types are defined in ssh.h.
  */
 void
-packet_set_encryption_key(const unsigned char *key, unsigned int keylen,
+packet_set_encryption_key(const u_char *key, u_int keylen,
     int cipher_type);
 
 /*
  * Sets remote side protocol flags for the current connection.  This can be
  * called at any time.
  */
-void    packet_set_protocol_flags(unsigned int flags);
+void    packet_set_protocol_flags(u_int flags);
 
 /* Returns the remote protocol flags set earlier by the above function. */
-unsigned int packet_get_protocol_flags(void);
+u_int packet_get_protocol_flags(void);
 
 /* Enables compression in both directions starting from the next packet. */
 void    packet_start_compression(int level);
@@ -77,16 +77,16 @@
 void    packet_put_char(int ch);
 
 /* Appends an integer to the packet data. */
-void    packet_put_int(unsigned int value);
+void    packet_put_int(u_int value);
 
 /* Appends an arbitrary precision integer to packet data. */
 void    packet_put_bignum(BIGNUM * value);
 void    packet_put_bignum2(BIGNUM * value);
 
 /* Appends a string to packet data. */
-void    packet_put_string(const char *buf, unsigned int len);
+void    packet_put_string(const char *buf, u_int len);
 void    packet_put_cstring(const char *str);
-void    packet_put_raw(const char *buf, unsigned int len);
+void    packet_put_raw(const char *buf, u_int len);
 
 /*
  * Finalizes and sends the packet.  If the encryption key has been set,
@@ -117,13 +117,13 @@
  * Buffers the given amount of input characters.  This is intended to be used
  * together with packet_read_poll.
  */
-void    packet_process_incoming(const char *buf, unsigned int len);
+void    packet_process_incoming(const char *buf, u_int len);
 
 /* Returns a character (0-255) from the packet data. */
-unsigned int packet_get_char(void);
+u_int packet_get_char(void);
 
 /* Returns an integer from the packet data. */
-unsigned int packet_get_int(void);
+u_int packet_get_int(void);
 
 /*
  * Returns an arbitrary precision integer from the packet data.  The integer
@@ -139,7 +139,7 @@
  * no longer needed.  The length_ptr argument may be NULL, or point to an
  * integer into which the length of the string is stored.
  */
-char   *packet_get_string(unsigned int *length_ptr);
+char   *packet_get_string(u_int *length_ptr);
 
 /*
  * Logs the error in syslog using LOG_INFO, constructs and sends a disconnect
diff --git a/pty.c b/pty.c
index d05cb89..37a9078 100644
--- a/pty.c
+++ b/pty.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: pty.c,v 1.18 2000/12/13 06:36:05 deraadt Exp $");
+RCSID("$OpenBSD: pty.c,v 1.19 2000/12/20 20:00:34 markus Exp $");
 
 #ifdef HAVE_UTIL_H
 # include <util.h>
diff --git a/radix.c b/radix.c
index 8429204..939d0f7 100644
--- a/radix.c
+++ b/radix.c
@@ -25,14 +25,14 @@
 #include "includes.h"
 #include "uuencode.h"
 
-RCSID("$OpenBSD: radix.c,v 1.13 2000/09/07 20:27:52 deraadt Exp $");
+RCSID("$OpenBSD: radix.c,v 1.14 2000/12/19 23:17:57 markus Exp $");
 
 #ifdef AFS
 #include <krb.h>
 
-typedef unsigned char my_u_char;
-typedef unsigned int my_u_int32_t;
-typedef unsigned short my_u_short;
+typedef u_char my_u_char;
+typedef u_int my_u_int32_t;
+typedef u_short my_u_short;
 
 /* Nasty macros from BIND-4.9.2 */
 
@@ -89,7 +89,7 @@
 
 
 int
-creds_to_radix(CREDENTIALS *creds, unsigned char *buf, size_t buflen)
+creds_to_radix(CREDENTIALS *creds, u_char *buf, size_t buflen)
 {
 	char *p, *s;
 	int len;
@@ -123,8 +123,8 @@
 
 	PUTLONG(creds->issue_date, p);
 	{
-		unsigned int endTime;
-		endTime = (unsigned int) krb_life_to_time(creds->issue_date,
+		u_int endTime;
+		endTime = (u_int) krb_life_to_time(creds->issue_date,
 							  creds->lifetime);
 		PUTLONG(endTime, p);
 	}
@@ -139,7 +139,7 @@
 	p += creds->ticket_st.length;
 	len = p - temp;
 
-	return (uuencode((unsigned char *)temp, len, (char *)buf, buflen));
+	return (uuencode((u_char *)temp, len, (char *)buf, buflen));
 }
 
 int
@@ -151,7 +151,7 @@
 	char version;
 	char temp[2048];
 
-	len = uudecode(buf, (unsigned char *)temp, sizeof(temp));
+	len = uudecode(buf, (u_char *)temp, sizeof(temp));
 	if (len < 0)
 		return 0;
 
@@ -184,7 +184,7 @@
 	GETLONG(creds->issue_date, p);
 	len -= 4;
 	{
-		unsigned int endTime;
+		u_int endTime;
 		GETLONG(endTime, p);
 		len -= 4;
 		creds->lifetime = krb_time_to_life(creds->issue_date, endTime);
diff --git a/readconf.c b/readconf.c
index c821d84..6f5ac8c 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.50 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.51 2000/12/19 23:17:57 markus Exp $");
 
 #include "ssh.h"
 #include "readconf.h"
@@ -215,7 +215,7 @@
 static OpCodes
 parse_token(const char *cp, const char *filename, int linenum)
 {
-	unsigned int i;
+	u_int i;
 
 	for (i = 0; keywords[i].name; i++)
 		if (strcasecmp(cp, keywords[i].name) == 0)
@@ -573,10 +573,10 @@
 		if (!arg || *arg == '\0')
 			fatal("%.200s line %d: Missing argument.", filename, linenum);
 		if (arg[0] == '^' && arg[2] == 0 &&
-		    (unsigned char) arg[1] >= 64 && (unsigned char) arg[1] < 128)
-			value = (unsigned char) arg[1] & 31;
+		    (u_char) arg[1] >= 64 && (u_char) arg[1] < 128)
+			value = (u_char) arg[1] & 31;
 		else if (strlen(arg) == 1)
-			value = (unsigned char) arg[0];
+			value = (u_char) arg[0];
 		else if (strcmp(arg, "none") == 0)
 			value = -2;
 		else {
diff --git a/rsa.c b/rsa.c
index 8ef7b22..e5eea29 100644
--- a/rsa.c
+++ b/rsa.c
@@ -60,7 +60,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: rsa.c,v 1.17 2000/11/12 19:50:37 markus Exp $");
+RCSID("$OpenBSD: rsa.c,v 1.18 2000/12/19 23:17:57 markus Exp $");
 
 #include "rsa.h"
 #include "ssh.h"
@@ -69,7 +69,7 @@
 void
 rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key)
 {
-	unsigned char *inbuf, *outbuf;
+	u_char *inbuf, *outbuf;
 	int len, ilen, olen;
 
 	if (BN_num_bits(key->e) < 2 || !BN_is_odd(key->e))
@@ -97,7 +97,7 @@
 void
 rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key)
 {
-	unsigned char *inbuf, *outbuf;
+	u_char *inbuf, *outbuf;
 	int len, ilen, olen;
 
 	olen = BN_num_bytes(key->n);
diff --git a/scp.c b/scp.c
index 0323409..1fb87f4 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.46 2000/12/16 09:53:57 markus Exp $");
+RCSID("$OpenBSD: scp.c,v 1.47 2000/12/19 23:17:57 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -115,7 +115,7 @@
 static struct timeval start;
 
 /* Number of bytes of current file transferred so far. */
-volatile unsigned long statbytes;
+volatile u_long statbytes;
 
 /* Total size of current file. */
 off_t totalbytes = 0;
@@ -547,16 +547,16 @@
 			 * versions expecting microseconds.
 			 */
 			(void) sprintf(buf, "T%lu 0 %lu 0\n",
-			    (unsigned long) stb.st_mtime,
-			    (unsigned long) stb.st_atime);
+			    (u_long) stb.st_mtime,
+			    (u_long) stb.st_atime);
 			(void) atomicio(write, remout, buf, strlen(buf));
 			if (response() < 0)
 				goto next;
 		}
 #define	FILEMODEMASK	(S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
 		sprintf(buf, "C%04o %lu %s\n",
-		    (unsigned int) (stb.st_mode & FILEMODEMASK),
-		    (unsigned long) stb.st_size, last);
+		    (u_int) (stb.st_mode & FILEMODEMASK),
+		    (u_long) stb.st_size, last);
 		if (verbose_mode) {
 			fprintf(stderr, "Sending file modes: %s", buf);
 			fflush(stderr);
@@ -624,8 +624,8 @@
 		last++;
 	if (pflag) {
 		(void) sprintf(path, "T%lu 0 %lu 0\n",
-		    (unsigned long) statp->st_mtime,
-		    (unsigned long) statp->st_atime);
+		    (u_long) statp->st_mtime,
+		    (u_long) statp->st_atime);
 		(void) atomicio(write, remout, path, strlen(path));
 		if (response() < 0) {
 			closedir(dirp);
@@ -633,7 +633,7 @@
 		}
 	}
 	(void) sprintf(path, "D%04o %d %.1024s\n",
-	    (unsigned int) (statp->st_mode & FILEMODEMASK), 0, last);
+	    (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
 	if (verbose_mode)
 		fprintf(stderr, "Entering directory: %s", path);
 	(void) atomicio(write, remout, path, strlen(path));
diff --git a/servconf.c b/servconf.c
index 5da55de..8dd6e7d 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: servconf.c,v 1.54 2000/11/12 19:50:38 markus Exp $");
+RCSID("$OpenBSD: servconf.c,v 1.55 2000/12/19 23:17:57 markus Exp $");
 
 #include "ssh.h"
 #include "servconf.h"
@@ -269,7 +269,7 @@
 parse_token(const char *cp, const char *filename,
 	    int linenum)
 {
-	unsigned int i;
+	u_int i;
 
 	for (i = 0; keywords[i].name; i++)
 		if (strcasecmp(cp, keywords[i].name) == 0)
diff --git a/servconf.h b/servconf.h
index 3ecf6a0..7d50166 100644
--- a/servconf.h
+++ b/servconf.h
@@ -11,7 +11,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: servconf.h,v 1.31 2000/11/12 19:50:38 markus Exp $"); */
+/* RCSID("$OpenBSD: servconf.h,v 1.32 2000/12/19 23:17:58 markus Exp $"); */
 
 #ifndef SERVCONF_H
 #define SERVCONF_H
@@ -26,8 +26,8 @@
 #define MAX_HOSTKEYS		256	/* Max # hostkeys. */
 
 typedef struct {
-	unsigned int num_ports;
-	unsigned int ports_from_cmdline;
+	u_int num_ports;
+	u_int ports_from_cmdline;
 	u_short ports[MAX_PORTS];	/* Port number to listen on. */
 	char   *listen_addr;		/* Address on which the server listens. */
 	struct addrinfo *listen_addrs;	/* Addresses on which the server listens. */
@@ -88,16 +88,16 @@
 					 * passwords. */
 	int     use_login;	/* If true, login(1) is used */
 	int	allow_tcp_forwarding;
-	unsigned int num_allow_users;
+	u_int num_allow_users;
 	char   *allow_users[MAX_ALLOW_USERS];
-	unsigned int num_deny_users;
+	u_int num_deny_users;
 	char   *deny_users[MAX_DENY_USERS];
-	unsigned int num_allow_groups;
+	u_int num_allow_groups;
 	char   *allow_groups[MAX_ALLOW_GROUPS];
-	unsigned int num_deny_groups;
+	u_int num_deny_groups;
 	char   *deny_groups[MAX_DENY_GROUPS];
 
-	unsigned int num_subsystems;
+	u_int num_subsystems;
 	char   *subsystem_name[MAX_SUBSYSTEMS];
 	char   *subsystem_command[MAX_SUBSYSTEMS];
 
diff --git a/serverloop.c b/serverloop.c
index 79ef360..57e7f1f 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.36 2000/12/05 20:34:10 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.38 2000/12/19 23:17:58 markus Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -70,7 +70,7 @@
 static int fderr_eof = 0;	/* EOF encountered readung from fderr. */
 static int connection_in;	/* Connection to client (input). */
 static int connection_out;	/* Connection to client (output). */
-static unsigned int buffer_high;/* "Soft" max buffer size. */
+static u_int buffer_high;/* "Soft" max buffer size. */
 static int max_fd;		/* Max file descriptor number for select(). */
 
 /*
@@ -179,7 +179,7 @@
  */
 void
 wait_until_can_do_something(fd_set * readset, fd_set * writeset,
-			    unsigned int max_time_milliseconds)
+			    u_int max_time_milliseconds)
 {
 	struct timeval tv, *tvp;
 	int ret;
@@ -402,9 +402,9 @@
 	int wait_status;	/* Status returned by wait(). */
 	pid_t wait_pid;		/* pid returned by wait(). */
 	int waiting_termination = 0;	/* Have displayed waiting close message. */
-	unsigned int max_time_milliseconds;
-	unsigned int previous_stdout_buffer_bytes;
-	unsigned int stdout_buffer_bytes;
+	u_int max_time_milliseconds;
+	u_int previous_stdout_buffer_bytes;
+	u_int stdout_buffer_bytes;
 	int type;
 
 	debug("Entering interactive session.");
@@ -578,7 +578,7 @@
 
 	/* Wait for the child to exit.  Get its exit status. */
 	wait_pid = wait(&wait_status);
-	if (wait_pid < 0) {
+	if (wait_pid == -1) {
 		/*
 		 * It is possible that the wait was handled by SIGCHLD
 		 * handler.  This may result in either: this call
@@ -683,7 +683,7 @@
 server_input_stdin_data(int type, int plen, void *ctxt)
 {
 	char *data;
-	unsigned int data_len;
+	u_int data_len;
 
 	/* Stdin data from the client.  Append it to the buffer. */
 	/* Ignore any data if the client has closed stdin. */
@@ -789,7 +789,7 @@
 {
 	Channel *c = NULL;
 	char *ctype;
-	unsigned int len;
+	u_int len;
 	int rchan;
 	int rmaxpack;
 	int rwindow;
diff --git a/session.c b/session.c
index 1e996f9..a376aa9 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.44 2000/11/14 23:44:19 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.45 2000/12/19 23:17:58 markus Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -137,7 +137,7 @@
 extern char *__progname;
 extern int log_stderr;
 extern int debug_flag;
-extern unsigned int utmp_len;
+extern u_int utmp_len;
 
 extern int startup_pipe;
 
@@ -218,7 +218,7 @@
 	char *command;
 	int n_bytes;
 	int plen;
-	unsigned int proto_len, data_len, dlen;
+	u_int proto_len, data_len, dlen;
 
 	/*
 	 * Cancel the alarm we set to limit the time taken for
@@ -783,10 +783,10 @@
  * already exists, its value is overriden.
  */
 void
-child_set_env(char ***envp, unsigned int *envsizep, const char *name,
+child_set_env(char ***envp, u_int *envsizep, const char *name,
 	      const char *value)
 {
-	unsigned int i, namelen;
+	u_int i, namelen;
 	char **env;
 
 	/*
@@ -824,7 +824,7 @@
  * and assignments of the form name=value.  No other forms are allowed.
  */
 void
-read_environment_file(char ***env, unsigned int *envsize,
+read_environment_file(char ***env, u_int *envsize,
 		      const char *filename)
 {
 	FILE *f;
@@ -1009,7 +1009,7 @@
 	char buf[256];
 	char cmd[1024];
 	FILE *f = NULL;
-	unsigned int envsize, i;
+	u_int envsize, i;
 	char **env;
 	extern char **environ;
 	struct stat st;
@@ -1579,7 +1579,7 @@
 int
 session_pty_req(Session *s)
 {
-	unsigned int len;
+	u_int len;
 	char *term_modes;	/* encoded terminal modes */
 
 	if (no_pty_flag)
@@ -1628,7 +1628,7 @@
 int
 session_subsystem_req(Session *s)
 {
-	unsigned int len;
+	u_int len;
 	int success = 0;
 	char *subsys = packet_get_string(&len);
 	int i;
@@ -1724,7 +1724,7 @@
 int
 session_exec_req(Session *s)
 {
-	unsigned int len;
+	u_int len;
 	char *command = packet_get_string(&len);
 	packet_done();
 	if (forced_command) {
@@ -1762,7 +1762,7 @@
 void
 session_input_channel_req(int id, void *arg)
 {
-	unsigned int len;
+	u_int len;
 	int reply;
 	int success = 0;
 	char *rtype;
diff --git a/sftp-server.c b/sftp-server.c
index 8a77e58..7113bce 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: sftp-server.c,v 1.8 2000/12/19 22:43:44 markus Exp $");
+RCSID("$OpenBSD: sftp-server.c,v 1.9 2000/12/19 23:17:58 markus Exp $");
 
 #include "ssh.h"
 #include "buffer.h"
@@ -944,13 +944,13 @@
 void
 process(void)
 {
-	unsigned int msg_len;
-	unsigned int type;
-	unsigned char *cp;
+	u_int msg_len;
+	u_int type;
+	u_char *cp;
 
 	if (buffer_len(&iqueue) < 5)
 		return;		/* Incomplete message. */
-	cp = (unsigned char *) buffer_ptr(&iqueue);
+	cp = (u_char *) buffer_ptr(&iqueue);
 	msg_len = GET_32BIT(cp);
 	if (msg_len > 256 * 1024) {
 		error("bad message ");
diff --git a/ssh-agent.c b/ssh-agent.c
index 00e8132..9c0a583 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ssh-agent.c,v 1.44 2000/12/19 22:43:45 markus Exp $	*/
+/*	$OpenBSD: ssh-agent.c,v 1.45 2000/12/19 23:17:58 markus Exp $	*/
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.44 2000/12/19 22:43:45 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.45 2000/12/19 23:17:58 markus Exp $");
 
 #include "ssh.h"
 #include "rsa.h"
@@ -66,7 +66,7 @@
 	Buffer output;
 } SocketEntry;
 
-unsigned int sockets_alloc = 0;
+u_int sockets_alloc = 0;
 SocketEntry *sockets = NULL;
 
 typedef struct {
@@ -151,8 +151,8 @@
 			buffer_put_bignum(&msg, id->key->rsa->e);
 			buffer_put_bignum(&msg, id->key->rsa->n);
 		} else {
-			unsigned char *blob;
-			unsigned int blen;
+			u_char *blob;
+			u_int blen;
 			key_to_blob(id->key, &blob, &blen);
 			buffer_put_string(&msg, blob, blen);
 			xfree(blob);
@@ -173,8 +173,8 @@
 	int i, len;
 	Buffer msg;
 	MD5_CTX md;
-	unsigned char buf[32], mdbuf[16], session_id[16];
-	unsigned int response_type;
+	u_char buf[32], mdbuf[16], session_id[16];
+	u_int response_type;
 
 	buffer_init(&msg);
 	key = key_new(KEY_RSA1);
@@ -235,8 +235,8 @@
 {
 	extern int datafellows;
 	Key *key, *private;
-	unsigned char *blob, *data, *signature = NULL;
-	unsigned int blen, dlen, slen = 0;
+	u_char *blob, *data, *signature = NULL;
+	u_int blen, dlen, slen = 0;
 	int flags;
 	Buffer msg;
 	int ok = -1;
@@ -279,9 +279,9 @@
 process_remove_identity(SocketEntry *e, int version)
 {
 	Key *key = NULL, *private;
-	unsigned char *blob;
-	unsigned int blen;
-	unsigned int bits;
+	u_char *blob;
+	u_int blen;
+	u_int bits;
 	int success = 0;
 
 	switch(version){
@@ -339,7 +339,7 @@
 void
 process_remove_all_identities(SocketEntry *e, int version)
 {
-	unsigned int i;
+	u_int i;
 	Idtab *tab = idtab_lookup(version);
 
 	/* Loop over all identities and clear the keys. */
@@ -463,12 +463,12 @@
 void
 process_message(SocketEntry *e)
 {
-	unsigned int msg_len;
-	unsigned int type;
-	unsigned char *cp;
+	u_int msg_len;
+	u_int type;
+	u_char *cp;
 	if (buffer_len(&e->input) < 5)
 		return;		/* Incomplete message. */
-	cp = (unsigned char *) buffer_ptr(&e->input);
+	cp = (u_char *) buffer_ptr(&e->input);
 	msg_len = GET_32BIT(cp);
 	if (msg_len > 256 * 1024) {
 		shutdown(e->fd, SHUT_RDWR);
@@ -527,7 +527,7 @@
 void
 new_socket(int type, int fd)
 {
-	unsigned int i, old_alloc;
+	u_int i, old_alloc;
 	if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
 		error("fcntl O_NONBLOCK: %s", strerror(errno));
 
@@ -559,7 +559,7 @@
 void
 prepare_select(fd_set *readset, fd_set *writeset)
 {
-	unsigned int i;
+	u_int i;
 	for (i = 0; i < sockets_alloc; i++)
 		switch (sockets[i].type) {
 		case AUTH_SOCKET:
@@ -579,7 +579,7 @@
 void
 after_select(fd_set *readset, fd_set *writeset)
 {
-	unsigned int i;
+	u_int i;
 	int len, sock;
 	socklen_t slen;
 	char buf[1024];
diff --git a/ssh-dss.c b/ssh-dss.c
index fea1fe2..96b1565 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-dss.c,v 1.1 2000/11/12 19:50:38 markus Exp $");
+RCSID("$OpenBSD: ssh-dss.c,v 1.2 2000/12/19 23:17:58 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -44,18 +44,18 @@
 int
 ssh_dss_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
-	unsigned char *digest;
-	unsigned char *ret;
+	u_char *digest;
+	u_char *ret;
 	DSA_SIG *sig;
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
-	unsigned int rlen;
-	unsigned int slen;
-	unsigned int len;
-	unsigned char sigblob[SIGBLOB_LEN];
+	u_int rlen;
+	u_int slen;
+	u_int len;
+	u_char sigblob[SIGBLOB_LEN];
 	Buffer b;
 
 	if (key == NULL || key->type != KEY_DSA || key->dsa == NULL) {
@@ -113,17 +113,17 @@
 int
 ssh_dss_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen)
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen)
 {
 	Buffer b;
-	unsigned char *digest;
+	u_char *digest;
 	DSA_SIG *sig;
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
-	unsigned char *sigblob;
+	u_char *sigblob;
 	char *txt;
-	unsigned int len, dlen;
+	u_int len, dlen;
 	int rlen;
 	int ret;
 
@@ -159,7 +159,7 @@
 			buffer_free(&b);
 			return -1;
 		}
-		sigblob = (unsigned char *)buffer_get_string(&b, &len);
+		sigblob = (u_char *)buffer_get_string(&b, &len);
 		rlen = buffer_len(&b);
 		if(rlen != 0) {
 			error("remaining bytes in signature %d", rlen);
diff --git a/ssh-dss.h b/ssh-dss.h
index 7b376e8..4252f39 100644
--- a/ssh-dss.h
+++ b/ssh-dss.h
@@ -27,13 +27,13 @@
 int
 ssh_dss_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen);
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen);
 
 int
 ssh_dss_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen);
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen);
 
 #endif
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 89c03d9..533cf19 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.35 2000/11/25 17:19:33 markus Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.36 2000/12/19 23:17:58 markus Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/pem.h>
@@ -137,7 +137,7 @@
 {
 	Key *k;
 	int len;
-	unsigned char *blob;
+	u_char *blob;
 	struct stat st;
 
 	if (!have_identity)
@@ -171,7 +171,7 @@
 	int bytes = (bits + 7) / 8;
 	if (buffer_len(b) < bytes)
 		fatal("buffer_get_bignum_bits: input buffer too small");
-	BN_bin2bn((unsigned char *)buffer_ptr(b), bytes, value);
+	BN_bin2bn((u_char *)buffer_ptr(b), bytes, value);
 	buffer_consume(b, bytes);
 }
 
@@ -275,7 +275,7 @@
 		*p = '\0';
 		strlcat(encoded, line, sizeof(encoded));
 	}
-	blen = uudecode(encoded, (unsigned char *)blob, sizeof(blob));
+	blen = uudecode(encoded, (u_char *)blob, sizeof(blob));
 	if (blen < 0) {
 		fprintf(stderr, "uudecode failed.\n");
 		exit(1);
@@ -332,7 +332,7 @@
 	Key *public;
 	char *comment = NULL, *cp, *ep, line[16*1024];
 	int i, skip = 0, num = 1, invalid = 1, success = 0;
-	unsigned int ignore;
+	u_int ignore;
 	struct stat st;
 
 	if (!have_identity)
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index bd20fea..d85cc33 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -8,7 +8,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-keyscan.c,v 1.5 2000/12/19 22:48:08 markus Exp $");
+RCSID("$OpenBSD: ssh-keyscan.c,v 1.6 2000/12/19 23:17:58 markus Exp $");
 
 #ifdef HAVE_SYS_QUEUE_H
 #include <sys/queue.h>
@@ -53,7 +53,7 @@
  * associated with file descriptor n is held in fdcon[n].
  */
 typedef struct Connection {
-	unsigned char c_status;	/* State of connection on this file desc. */
+	u_char c_status;	/* State of connection on this file desc. */
 #define CS_UNUSED 0		/* File descriptor unused */
 #define CS_CON 1		/* Waiting to connect/read greeting */
 #define CS_SIZE 2		/* Waiting to read initial packet size */
@@ -83,7 +83,7 @@
 
 typedef struct {
 	char *buf;
-	unsigned int size;
+	u_int size;
 	int lineno;
 	const char *filename;
 	FILE *stream;
diff --git a/ssh-rsa.c b/ssh-rsa.c
index cc31154..0f44051 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-rsa.c,v 1.1 2000/11/12 19:50:38 markus Exp $");
+RCSID("$OpenBSD: ssh-rsa.c,v 1.2 2000/12/19 23:17:58 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -44,13 +44,13 @@
 int
 ssh_rsa_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
-	unsigned char *digest, *sig, *ret;
-	unsigned int slen, dlen, len;
+	u_char *digest, *sig, *ret;
+	u_int slen, dlen, len;
 	int ok;
 	Buffer b;
 
@@ -109,15 +109,15 @@
 int
 ssh_rsa_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen)
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen)
 {
 	Buffer b;
 	EVP_MD *evp_md = EVP_sha1();
 	EVP_MD_CTX md;
 	char *ktype;
-	unsigned char *sigblob, *digest;
-	unsigned int len, dlen;
+	u_char *sigblob, *digest;
+	u_int len, dlen;
 	int rlen;
 	int ret;
 
@@ -135,7 +135,7 @@
 		return -1;
 	}
 	xfree(ktype);
-	sigblob = (unsigned char *)buffer_get_string(&b, &len);
+	sigblob = (u_char *)buffer_get_string(&b, &len);
 	rlen = buffer_len(&b);
 	buffer_free(&b);
 	if(rlen != 0) {
diff --git a/ssh-rsa.h b/ssh-rsa.h
index 29a0c02..fac96c7 100644
--- a/ssh-rsa.h
+++ b/ssh-rsa.h
@@ -27,13 +27,13 @@
 int
 ssh_rsa_sign(
     Key *key,
-    unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen);
+    u_char **sigp, int *lenp,
+    u_char *data, int datalen);
 
 int
 ssh_rsa_verify(
     Key *key,
-    unsigned char *signature, int signaturelen,
-    unsigned char *data, int datalen);
+    u_char *signature, int signaturelen,
+    u_char *data, int datalen);
 
 #endif
diff --git a/ssh.c b/ssh.c
index c4ff5ee..92564b9 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.77 2000/12/12 23:11:48 markus Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.78 2000/12/19 23:17:58 markus Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/dsa.h>
@@ -400,10 +400,10 @@
 			break;
 		case 'e':
 			if (optarg[0] == '^' && optarg[2] == 0 &&
-			    (unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128)
-				options.escape_char = (unsigned char) optarg[1] & 31;
+			    (u_char) optarg[1] >= 64 && (u_char) optarg[1] < 128)
+				options.escape_char = (u_char) optarg[1] & 31;
 			else if (strlen(optarg) == 1)
-				options.escape_char = (unsigned char) optarg[0];
+				options.escape_char = (u_char) optarg[0];
 			else if (strcmp(optarg, "none") == 0)
 				options.escape_char = -2;
 			else {
diff --git a/ssh.h b/ssh.h
index 996b504..5300067 100644
--- a/ssh.h
+++ b/ssh.h
@@ -12,7 +12,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-/* RCSID("$OpenBSD: ssh.h,v 1.55 2000/11/25 17:19:33 markus Exp $"); */
+/* RCSID("$OpenBSD: ssh.h,v 1.56 2000/12/19 23:17:58 markus Exp $"); */
 
 #ifndef SSH_H
 #define SSH_H
@@ -296,9 +296,9 @@
  * information is not available.  This must be called before record_login.
  * The host from which the user logged in is stored in buf.
  */
-unsigned long
+u_long
 get_last_login_time(uid_t uid, const char *logname,
-    char *buf, unsigned int bufsize);
+    char *buf, u_int bufsize);
 
 /*
  * Records that the user has logged in.  This does many things normally done
@@ -377,7 +377,7 @@
  * Parses an RSA key (number of bits, e, n) from a string.  Moves the pointer
  * over the key.  Skips any whitespace at the beginning and at end.
  */
-int     auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n);
+int     auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n);
 
 /*
  * Returns the name of the machine at the other end of the socket.  The
@@ -543,7 +543,7 @@
 int     auth_kerberos_tgt(struct passwd * pw, const char *string);
 int     auth_afs_token(struct passwd * pw, const char *token_string);
 
-int     creds_to_radix(CREDENTIALS * creds, unsigned char *buf, size_t buflen);
+int     creds_to_radix(CREDENTIALS * creds, u_char *buf, size_t buflen);
 int     radix_to_creds(const char *buf, CREDENTIALS * creds);
 #endif				/* AFS */
 
diff --git a/sshconnect.c b/sshconnect.c
index b54e75a..647aec7 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.83 2000/11/30 22:53:35 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.85 2000/12/21 15:10:17 markus Exp $");
 
 #include <openssl/bn.h>
 #include <openssl/dsa.h>
@@ -472,6 +472,8 @@
 	int local = 0, host_ip_differ = 0;
 	int salen;
 	char ntop[NI_MAXHOST];
+	int host_line = -1, ip_line = -1;
+	const char *host_file = NULL, *ip_file = NULL;
 
 	/*
 	 * Force accepting of the host key for loopback/localhost. The
@@ -508,11 +510,17 @@
 	if (options.proxy_command != NULL && options.check_host_ip)
 		options.check_host_ip = 0;
 
-  	if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop),
-  			NULL, 0, NI_NUMERICHOST) != 0)
-  		fatal("check_host_key: getnameinfo failed");
-  	ip = xstrdup(ntop);
-  
+
+
+ 	if (options.proxy_command == NULL) {
+ 		if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop),
+ 				NULL, 0, NI_NUMERICHOST) != 0)
+ 			fatal("check_host_key: getnameinfo failed");
+ 		ip = xstrdup(ntop);
+ 	} else {
+ 		ip = xstrdup("<no hostip for proxy command>");
+ 	}
+
 	/*
 	 * Store the host key from the known host file in here so that we can
 	 * compare it with the key for the IP address.
@@ -523,19 +531,25 @@
 	 * Check if the host key is present in the user\'s list of known
 	 * hosts or in the systemwide list.
 	 */
-	host_status = check_host_in_hostfile(user_hostfile, host, host_key, file_key);
-	if (host_status == HOST_NEW)
-		host_status = check_host_in_hostfile(system_hostfile, host, host_key, file_key);
+	host_file = user_hostfile;
+	host_status = check_host_in_hostfile(host_file, host, host_key, file_key, &host_line);
+	if (host_status == HOST_NEW) {
+		host_file = system_hostfile;
+		host_status = check_host_in_hostfile(host_file, host, host_key, file_key, &host_line);
+	}
 	/*
 	 * Also perform check for the ip address, skip the check if we are
 	 * localhost or the hostname was an ip address to begin with
 	 */
 	if (options.check_host_ip && !local && strcmp(host, ip)) {
 		Key *ip_key = key_new(host_key->type);
-		ip_status = check_host_in_hostfile(user_hostfile, ip, host_key, ip_key);
 
-		if (ip_status == HOST_NEW)
-			ip_status = check_host_in_hostfile(system_hostfile, ip, host_key, ip_key);
+		ip_file = user_hostfile;
+		ip_status = check_host_in_hostfile(ip_file, ip, host_key, ip_key, &ip_line);
+		if (ip_status == HOST_NEW) {
+			ip_file = system_hostfile;
+			ip_status = check_host_in_hostfile(ip_file, ip, host_key, ip_key, &ip_line);
+		}
 		if (host_status == HOST_CHANGED &&
 		    (ip_status != HOST_CHANGED || !key_equal(ip_key, file_key)))
 			host_ip_differ = 1;
@@ -551,6 +565,7 @@
 		/* The host is known and the key matches. */
 		debug("Host '%.200s' is known and matches the %s host key.",
 		    host, type);
+		debug("Found key in %s:%d", host_file, host_line);
 		if (options.check_host_ip) {
 			if (ip_status == HOST_NEW) {
 				if (!add_host_to_hostfile(user_hostfile, ip, host_key))
@@ -559,9 +574,13 @@
 				else
 					log("Warning: Permanently added the %s host key for IP address '%.30s' to the list of known hosts.",
 					    type, ip);
-			} else if (ip_status != HOST_OK)
+			} else if (ip_status != HOST_OK) {
 				log("Warning: the %s host key for '%.200s' differs from the key for the IP address '%.30s'",
 				    type, host, ip);
+				log("Found key in %s:%d", host_file, host_line);
+				if (ip_line != -1)
+					log("Offending key for IP in %s:%d", ip_file, ip_line);
+			}
 		}
 		break;
 	case HOST_NEW:
@@ -612,7 +631,9 @@
 			error("and the key for the according IP address %s", ip);
 			error("%s. This could either mean that", msg);
 			error("DNS SPOOFING is happening or the IP address for the host");
-			error("and its host key have changed at the same time");
+			error("and its host key have changed at the same time.");
+			if (ip_line != -1)
+				error("Offending key for IP in %s:%d", ip_file, ip_line);
 		}
 		/* The host key has changed. */
 		error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
@@ -624,6 +645,7 @@
 		error("Please contact your system administrator.");
 		error("Add correct host key in %.100s to get rid of this message.",
 		      user_hostfile);
+		error("Offending key in %s:%d", host_file, host_line);
 
 		/*
 		 * If strict host key checking is in use, the user will have
diff --git a/sshconnect1.c b/sshconnect1.c
index f95c031..d623052 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect1.c,v 1.12 2000/12/10 17:01:53 markus Exp $");
+RCSID("$OpenBSD: sshconnect1.c,v 1.13 2000/12/19 23:17:58 markus Exp $");
 
 #include <openssl/bn.h>
 #include <openssl/dsa.h>
@@ -34,8 +34,8 @@
 #include "authfile.h"
 
 /* Session id for the current session. */
-unsigned char session_id[16];
-unsigned int supported_authentications = 0;
+u_char session_id[16];
+u_int supported_authentications = 0;
 
 extern Options options;
 extern char *__progname;
@@ -50,8 +50,8 @@
 	int type;
 	char *comment;
 	AuthenticationConnection *auth;
-	unsigned char response[16];
-	unsigned int i;
+	u_char response[16];
+	u_int i;
 	int plen, clen;
 	Key *key;
 	BIGNUM *challenge;
@@ -146,7 +146,7 @@
 void
 respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv)
 {
-	unsigned char buf[32], response[16];
+	u_char buf[32], response[16];
 	MD5_CTX md;
 	int i, len;
 
@@ -441,7 +441,7 @@
 		debug("Kerberos V4 authentication accepted.");
 
 		/* Get server's response. */
-		reply = packet_get_string((unsigned int *) &auth.length);
+		reply = packet_get_string((u_int *) &auth.length);
 		memcpy(auth.dat, reply, auth.length);
 		xfree(reply);
 
@@ -506,7 +506,7 @@
 		debug("Kerberos V4 ticket expired: %s", TKT_FILE);
 		return 0;
 	}
-	creds_to_radix(creds, (unsigned char *)buffer, sizeof buffer);
+	creds_to_radix(creds, (u_char *)buffer, sizeof buffer);
 	xfree(creds);
 
 	packet_start(SSH_CMSG_HAVE_KERBEROS_TGT);
@@ -545,10 +545,10 @@
 		p = buf;
 
 		/* Get secret token. */
-		memcpy(&creds.ticket_st.length, p, sizeof(unsigned int));
+		memcpy(&creds.ticket_st.length, p, sizeof(u_int));
 		if (creds.ticket_st.length > MAX_KTXT_LEN)
 			break;
-		p += sizeof(unsigned int);
+		p += sizeof(u_int);
 		memcpy(creds.ticket_st.dat, p, creds.ticket_st.length);
 		p += creds.ticket_st.length;
 
@@ -574,7 +574,7 @@
 		creds.pinst[0] = '\0';
 
 		/* Encode token, ship it off. */
-		if (creds_to_radix(&creds, (unsigned char*) buffer, sizeof buffer) <= 0)
+		if (creds_to_radix(&creds, (u_char*) buffer, sizeof buffer) <= 0)
 			break;
 		packet_start(SSH_CMSG_HAVE_AFS_TOKEN);
 		packet_put_string(buffer, strlen(buffer));
@@ -603,7 +603,7 @@
 {
 	int type, i;
 	int payload_len;
-	unsigned int clen;
+	u_int clen;
 	char prompt[1024];
 	char *challenge, *response;
 
@@ -702,10 +702,10 @@
 	Key k;
 	int bits, rbits;
 	int ssh_cipher_default = SSH_CIPHER_3DES;
-	unsigned char session_key[SSH_SESSION_KEY_LENGTH];
-	unsigned char cookie[8];
-	unsigned int supported_ciphers;
-	unsigned int server_flags, client_flags;
+	u_char session_key[SSH_SESSION_KEY_LENGTH];
+	u_char cookie[8];
+	u_int supported_ciphers;
+	u_int server_flags, client_flags;
 	int payload_len, clen, sum_len = 0;
 	u_int32_t rand = 0;
 
diff --git a/sshconnect2.c b/sshconnect2.c
index ea03622..aee547f 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect2.c,v 1.31 2000/12/15 17:30:14 provos Exp $");
+RCSID("$OpenBSD: sshconnect2.c,v 1.33 2000/12/20 19:37:22 markus Exp $");
 
 #include <openssl/bn.h>
 #include <openssl/rsa.h>
@@ -63,7 +63,7 @@
  * SSH2 key exchange
  */
 
-unsigned char *session_id2 = NULL;
+u_char *session_id2 = NULL;
 int session_id2_len = 0;
 
 void
@@ -151,17 +151,17 @@
 	int i;
 #endif
 	int plen, dlen;
-	unsigned int klen, kout;
+	u_int klen, kout;
 	char *signature = NULL;
-	unsigned int slen;
+	u_int slen;
 	char *server_host_key_blob = NULL;
 	Key *server_host_key;
-	unsigned int sbloblen;
+	u_int sbloblen;
 	DH *dh;
 	BIGNUM *dh_server_pub = 0;
 	BIGNUM *shared_secret = 0;
-	unsigned char *kbuf;
-	unsigned char *hash;
+	u_char *kbuf;
+	u_char *hash;
 
 	debug("Sending SSH2_MSG_KEXDH_INIT.");
 	/* generate and send 'e', client DH public key */
@@ -253,7 +253,7 @@
 		fprintf(stderr, "%02x", (hash[i])&0xff);
 	fprintf(stderr, "\n");
 #endif
-	if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1)
+	if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1)
 		fatal("key_verify failed for server_host_key");
 	key_free(server_host_key);
 
@@ -295,18 +295,18 @@
 	int i;
 #endif
 	int plen, dlen;
-	unsigned int klen, kout;
+	u_int klen, kout;
 	char *signature = NULL;
-	unsigned int slen, nbits;
+	u_int slen, nbits;
 	char *server_host_key_blob = NULL;
 	Key *server_host_key;
-	unsigned int sbloblen;
+	u_int sbloblen;
 	DH *dh;
 	BIGNUM *dh_server_pub = 0;
 	BIGNUM *shared_secret = 0;
 	BIGNUM *p = 0, *g = 0;
-	unsigned char *kbuf;
-	unsigned char *hash;
+	u_char *kbuf;
+	u_char *hash;
 
 	nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8);
 
@@ -426,7 +426,7 @@
 		fprintf(stderr, "%02x", (hash[i])&0xff);
 	fprintf(stderr, "\n");
 #endif
-	if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1)
+	if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1)
 		fatal("key_verify failed for server_host_key");
 	key_free(server_host_key);
 
@@ -448,7 +448,7 @@
 
 typedef int sign_cb_fn(
     Authctxt *authctxt, Key *key,
-    unsigned char **sigp, int *lenp, unsigned char *data, int datalen);
+    u_char **sigp, int *lenp, u_char *data, int datalen);
 
 struct Authctxt {
 	const char *server_user;
@@ -475,7 +475,7 @@
 int	userauth_passwd(Authctxt *authctxt);
 int	userauth_kbdint(Authctxt *authctxt);
 
-void	authmethod_clear();
+void	authmethod_clear(void);
 Authmethod *authmethod_get(char *authlist);
 Authmethod *authmethod_lookup(const char *name);
 
@@ -644,7 +644,7 @@
 sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback)
 {
 	Buffer b;
-	unsigned char *blob, *signature;
+	u_char *blob, *signature;
 	int bloblen, slen;
 	int skip = 0;
 	int ret = -1;
@@ -725,8 +725,8 @@
 }
 
 /* sign callback */
-int key_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+int key_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
 	return key_sign(key, sigp, lenp, data, datalen);
 }
@@ -777,8 +777,8 @@
 }
 
 /* sign callback */
-int agent_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp,
-    unsigned char *data, int datalen)
+int agent_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp,
+    u_char *data, int datalen)
 {
 	return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen);
 }
@@ -869,7 +869,7 @@
 	char *lang = NULL;
 	char *prompt = NULL;
 	char *response = NULL;
-	unsigned int num_prompts, i;
+	u_int num_prompts, i;
 	int echo = 0;
 
 	debug2("input_userauth_info_req");
@@ -933,7 +933,7 @@
  * finished processing server list to free resources.
  */
 void
-authmethod_clear()
+authmethod_clear(void)
 {
 	if (authlist_current != NULL) {
 		xfree(authlist_current);
diff --git a/sshd.c b/sshd.c
index b5d66ac..e10e530 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.139 2000/12/15 17:30:14 provos Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.142 2000/12/20 19:37:22 markus Exp $");
 
 #include "xmalloc.h"
 #include "rsa.h"
@@ -162,18 +162,18 @@
 int received_sighup = 0;
 
 /* session identifier, used by RSA-auth */
-unsigned char session_id[16];
+u_char session_id[16];
 
 /* same for ssh2 */
-unsigned char *session_id2 = NULL;
+u_char *session_id2 = NULL;
 int session_id2_len = 0;
 
 /* record remote hostname or ip */
-unsigned int utmp_len = MAXHOSTNAMELEN;
+u_int utmp_len = MAXHOSTNAMELEN;
 
 /* Prototypes for various functions defined later in this file. */
-void do_ssh1_kex();
-void do_ssh2_kex();
+void do_ssh1_kex(void);
+void do_ssh2_kex(void);
 
 void ssh_dh1_server(Kex *, Buffer *_kexinit, Buffer *);
 void ssh_dhgex_server(Kex *, Buffer *_kexinit, Buffer *);
@@ -692,6 +692,8 @@
 
 	/* load private host keys */
 	sensitive_data.host_keys = xmalloc(options.num_host_key_files*sizeof(Key*));
+	for(i = 0; i < options.num_host_key_files; i++)
+		sensitive_data.host_keys[i] = NULL;
 	sensitive_data.server_key = NULL;
 	sensitive_data.ssh1_host_key = NULL;
 	sensitive_data.have_ssh1_key = 0;
@@ -882,7 +884,7 @@
 			 */
 			f = fopen(options.pid_file, "wb");
 			if (f) {
-				fprintf(f, "%u\n", (unsigned int) getpid());
+				fprintf(f, "%u\n", (u_int) getpid());
 				fclose(f);
 			}
 		}
@@ -1172,14 +1174,14 @@
  * SSH1 key exchange
  */
 void
-do_ssh1_kex()
+do_ssh1_kex(void)
 {
 	int i, len;
 	int plen, slen;
 	BIGNUM *session_key_int;
-	unsigned char session_key[SSH_SESSION_KEY_LENGTH];
-	unsigned char cookie[8];
-	unsigned int cipher_type, auth_mask, protocol_flags;
+	u_char session_key[SSH_SESSION_KEY_LENGTH];
+	u_char cookie[8];
+	u_int cipher_type, auth_mask, protocol_flags;
 	u_int32_t rand = 0;
 
 	/*
@@ -1363,7 +1365,7 @@
  * SSH2 key exchange: diffie-hellman-group1-sha1
  */
 void
-do_ssh2_kex()
+do_ssh2_kex(void)
 {
 	Buffer *server_kexinit;
 	Buffer *client_kexinit;
@@ -1436,12 +1438,12 @@
 #endif
 	int payload_len, dlen;
 	int slen;
-	unsigned char *signature = NULL;
-	unsigned char *server_host_key_blob = NULL;
-	unsigned int sbloblen;
-	unsigned int klen, kout;
-	unsigned char *kbuf;
-	unsigned char *hash;
+	u_char *signature = NULL;
+	u_char *server_host_key_blob = NULL;
+	u_int sbloblen;
+	u_int klen, kout;
+	u_char *kbuf;
+	u_char *hash;
 	BIGNUM *shared_secret = 0;
 	DH *dh;
 	BIGNUM *dh_client_pub = 0;
@@ -1565,12 +1567,12 @@
 #endif
 	int payload_len, dlen;
 	int slen, nbits;
-	unsigned char *signature = NULL;
-	unsigned char *server_host_key_blob = NULL;
-	unsigned int sbloblen;
-	unsigned int klen, kout;
-	unsigned char *kbuf;
-	unsigned char *hash;
+	u_char *signature = NULL;
+	u_char *server_host_key_blob = NULL;
+	u_int sbloblen;
+	u_int klen, kout;
+	u_char *kbuf;
+	u_char *hash;
 	BIGNUM *shared_secret = 0;
 	DH *dh;
 	BIGNUM *dh_client_pub = 0;
diff --git a/tildexpand.c b/tildexpand.c
index f25f7d9..b091d51 100644
--- a/tildexpand.c
+++ b/tildexpand.c
@@ -11,7 +11,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: tildexpand.c,v 1.8 2000/09/07 20:27:55 deraadt Exp $");
+RCSID("$OpenBSD: tildexpand.c,v 1.9 2000/12/19 23:17:59 markus Exp $");
 
 #include "xmalloc.h"
 #include "ssh.h"
@@ -24,7 +24,7 @@
 tilde_expand_filename(const char *filename, uid_t my_uid)
 {
 	const char *cp;
-	unsigned int userlen;
+	u_int userlen;
 	char *expanded;
 	struct passwd *pw;
 	char user[100];
diff --git a/uidswap.c b/uidswap.c
index 19fc11b..8af46d4 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: uidswap.c,v 1.10 2000/12/17 09:33:40 markus Exp $");
+RCSID("$OpenBSD: uidswap.c,v 1.11 2000/12/20 19:37:22 markus Exp $");
 
 #include "ssh.h"
 #include "uidswap.h"
@@ -65,7 +65,7 @@
  * Restores to the original uid.
  */
 void
-restore_uid()
+restore_uid(void)
 {
 #ifdef SAVED_IDS_WORK_WITH_SETEUID
 	/* Set the effective uid back to the saved uid. */
diff --git a/uidswap.h b/uidswap.h
index ff6fad4..72f17d0 100644
--- a/uidswap.h
+++ b/uidswap.h
@@ -23,7 +23,7 @@
  * Restores the original effective user id after temporarily_use_uid().
  * This should only be called while temporarily_use_uid is effective.
  */
-void    restore_uid();
+void    restore_uid(void);
 
 /*
  * Permanently sets all uids to the given uid.  This cannot be called while
diff --git a/uuencode.c b/uuencode.c
index a37618d..01b8457 100644
--- a/uuencode.c
+++ b/uuencode.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: uuencode.c,v 1.7 2000/09/07 20:27:55 deraadt Exp $	*/
+/*	$OpenBSD: uuencode.c,v 1.8 2000/12/19 23:17:59 markus Exp $	*/
 
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
@@ -27,17 +27,17 @@
 #include "includes.h"
 #include "xmalloc.h"
 
-RCSID("$OpenBSD: uuencode.c,v 1.7 2000/09/07 20:27:55 deraadt Exp $");
+RCSID("$OpenBSD: uuencode.c,v 1.8 2000/12/19 23:17:59 markus Exp $");
 
 int
-uuencode(unsigned char *src, unsigned int srclength,
+uuencode(u_char *src, u_int srclength,
     char *target, size_t targsize)
 {
 	return __b64_ntop(src, srclength, target, targsize);
 }
 
 int
-uudecode(const char *src, unsigned char *target, size_t targsize)
+uudecode(const char *src, u_char *target, size_t targsize)
 {
 	int len;
 	char *encoded, *p;
@@ -57,9 +57,9 @@
 }
 
 void
-dump_base64(FILE *fp, unsigned char *data, int len)
+dump_base64(FILE *fp, u_char *data, int len)
 {
-	unsigned char *buf = xmalloc(2*len);
+	u_char *buf = xmalloc(2*len);
 	int i, n;
 	n = uuencode(data, len, buf, 2*len);
 	for (i = 0; i < n; i++) {
diff --git a/uuencode.h b/uuencode.h
index dca80ec..2972e2d 100644
--- a/uuencode.h
+++ b/uuencode.h
@@ -24,7 +24,7 @@
 
 #ifndef UUENCODE_H
 #define UUENCODE_H
-int	uuencode(unsigned char *src, unsigned int srclength, char *target, size_t targsize);
-int	uudecode(const char *src, unsigned char *target, size_t targsize);
-void	dump_base64(FILE *fp, unsigned char *data, int len);
+int	uuencode(u_char *src, u_int srclength, char *target, size_t targsize);
+int	uudecode(const char *src, u_char *target, size_t targsize);
+void	dump_base64(FILE *fp, u_char *data, int len);
 #endif