From 0cc2a476749e366d54afa842c5cc77d629deed29 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Sat, 9 Nov 2002 15:41:39 +0000 Subject: - markus@cvs.openbsd.org 2002/10/23 10:32:13 [packet.c] use %u for u_int --- packet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packet.c') diff --git a/packet.c b/packet.c index bd347ef0f..5078630e7 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.97 2002/07/04 08:12:15 deraadt Exp $"); +RCSID("$OpenBSD: packet.c,v 1.98 2002/10/23 10:32:13 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -840,7 +840,7 @@ packet_read_poll1(void) cp = buffer_ptr(&input); len = GET_32BIT(cp); if (len < 1 + 2 + 2 || len > 256 * 1024) - packet_disconnect("Bad packet length %d.", len); + packet_disconnect("Bad packet length %u.", len); padded_len = (len + 8) & ~7; /* Check if the packet has been entirely received. */ @@ -936,9 +936,9 @@ packet_read_poll2(u_int32_t *seqnr_p) packet_length = GET_32BIT(cp); if (packet_length < 1 + 4 || packet_length > 256 * 1024) { buffer_dump(&incoming_packet); - packet_disconnect("Bad packet length %d.", packet_length); + packet_disconnect("Bad packet length %u.", packet_length); } - DBG(debug("input: packet len %d", packet_length+4)); + DBG(debug("input: packet len %u", packet_length+4)); buffer_consume(&input, block_size); } /* we have a partial packet of block_size bytes */ -- cgit v1.2.3 From 9bda7ae4c695a0ff78e570151c067a62c5e44de6 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Sat, 9 Nov 2002 15:46:24 +0000 Subject: - markus@cvs.openbsd.org 2002/11/04 10:09:51 [packet.c] log before send disconnect; ok djm@ --- ChangeLog | 5 ++++- packet.c | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'packet.c') diff --git a/ChangeLog b/ChangeLog index 5536cfda2..be51642cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ [auth.c] don't compare against pw_home if realpath fails for pw_home (seen on AFS); ok djm@ + - markus@cvs.openbsd.org 2002/11/04 10:09:51 + [packet.c] + log before send disconnect; ok djm@ 20021021 - (djm) Bug #400: Kill ssh-rand-helper children on timeout, patch from @@ -790,4 +793,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2503 2002/11/09 15:45:12 mouring Exp $ +$Id: ChangeLog,v 1.2504 2002/11/09 15:46:24 mouring Exp $ diff --git a/packet.c b/packet.c index 5078630e7..6400ad9b1 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.98 2002/10/23 10:32:13 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.99 2002/11/04 10:09:51 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -1226,6 +1226,9 @@ packet_disconnect(const char *fmt,...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); + /* Display the error locally */ + log("Disconnecting: %.100s", buf); + /* Send the disconnect message to the other side, and wait for it to get sent. */ if (compat20) { packet_start(SSH2_MSG_DISCONNECT); @@ -1245,8 +1248,6 @@ packet_disconnect(const char *fmt,...) /* Close the connection. */ packet_close(); - /* Display the error locally and exit. */ - log("Disconnecting: %.100s", buf); fatal_cleanup(); } -- cgit v1.2.3 From 064496feaab2183b6dc5db0b0bebe0b226e2d31d Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 23 Dec 2002 02:04:22 +0000 Subject: - markus@cvs.openbsd.org 2002/11/21 22:45:31 [cipher.c kex.c packet.c sshconnect.c sshconnect2.c] debug->debug2, unify debug messages --- ChangeLog | 5 ++++- cipher.c | 4 ++-- kex.c | 6 +++--- packet.c | 6 +++--- sshconnect.c | 4 ++-- sshconnect2.c | 14 ++++++-------- 6 files changed, 20 insertions(+), 19 deletions(-) (limited to 'packet.c') diff --git a/ChangeLog b/ChangeLog index 40381ec6f..514d8ab50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ - markus@cvs.openbsd.org 2002/11/21 22:22:50 [dh.c] debug->debug2 + - markus@cvs.openbsd.org 2002/11/21 22:45:31 + [cipher.c kex.c packet.c sshconnect.c sshconnect2.c] + debug->debug2, unify debug messages 20021205 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org @@ -848,4 +851,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2518 2002/12/23 02:03:02 mouring Exp $ +$Id: ChangeLog,v 1.2519 2002/12/23 02:04:22 mouring Exp $ diff --git a/cipher.c b/cipher.c index 1933d3eab..b5d38747e 100644 --- a/cipher.c +++ b/cipher.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: cipher.c,v 1.61 2002/07/12 15:50:17 markus Exp $"); +RCSID("$OpenBSD: cipher.c,v 1.62 2002/11/21 22:45:31 markus Exp $"); #include "xmalloc.h" #include "log.h" @@ -239,7 +239,7 @@ cipher_init(CipherContext *cc, Cipher *cipher, cipher->name); klen = EVP_CIPHER_CTX_key_length(&cc->evp); if (klen > 0 && keylen != klen) { - debug("cipher_init: set keylen (%d -> %d)", klen, keylen); + debug2("cipher_init: set keylen (%d -> %d)", klen, keylen); if (EVP_CIPHER_CTX_set_key_length(&cc->evp, keylen) == 0) fatal("cipher_init: set keylen failed (%d -> %d)", klen, keylen); diff --git a/kex.c b/kex.c index bdbf3882c..113663598 100644 --- a/kex.c +++ b/kex.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kex.c,v 1.51 2002/06/24 14:55:38 markus Exp $"); +RCSID("$OpenBSD: kex.c,v 1.52 2002/11/21 22:45:31 markus Exp $"); #include @@ -135,7 +135,7 @@ kex_finish(Kex *kex) /* packet_write_wait(); */ debug("SSH2_MSG_NEWKEYS sent"); - debug("waiting for SSH2_MSG_NEWKEYS"); + debug("expecting SSH2_MSG_NEWKEYS"); packet_read_expect(SSH2_MSG_NEWKEYS); packet_check_eom(); debug("SSH2_MSG_NEWKEYS received"); @@ -433,7 +433,7 @@ kex_derive_keys(Kex *kex, u_char *hash, BIGNUM *shared_secret) for (i = 0; i < NKEYS; i++) keys[i] = derive_key(kex, 'A'+i, kex->we_need, hash, shared_secret); - debug("kex_derive_keys"); + debug2("kex_derive_keys"); for (mode = 0; mode < MODE_MAX; mode++) { current_keys[mode] = kex->newkeys[mode]; kex->newkeys[mode] = NULL; diff --git a/packet.c b/packet.c index 6400ad9b1..0a8baa5b2 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.99 2002/11/04 10:09:51 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.100 2002/11/21 22:45:31 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -564,7 +564,7 @@ set_newkeys(int mode) CipherContext *cc; int encrypt; - debug("newkeys: mode %d", mode); + debug2("set_newkeys: mode %d", mode); if (mode == MODE_OUT) { cc = &send_context; @@ -574,7 +574,7 @@ set_newkeys(int mode) encrypt = CIPHER_DECRYPT; } if (newkeys[mode] != NULL) { - debug("newkeys: rekeying"); + debug("set_newkeys: rekeying"); cipher_cleanup(cc); enc = &newkeys[mode]->enc; mac = &newkeys[mode]->mac; diff --git a/sshconnect.c b/sshconnect.c index 776d72065..f99fe0257 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.135 2002/09/19 01:58:18 djm Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.136 2002/11/21 22:45:31 markus Exp $"); #include @@ -247,7 +247,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, */ int full_failure = 1; - debug("ssh_connect: needpriv %d", needpriv); + debug2("ssh_connect: needpriv %d", needpriv); /* Get default port if port has not been set. */ if (port == 0) { diff --git a/sshconnect2.c b/sshconnect2.c index 703d0721f..755be5cca 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect2.c,v 1.107 2002/07/01 19:48:46 markus Exp $"); +RCSID("$OpenBSD: sshconnect2.c,v 1.108 2002/11/21 22:45:31 markus Exp $"); #include "ssh.h" #include "ssh2.h" @@ -128,7 +128,6 @@ ssh_kex2(char *host, struct sockaddr *hostaddr) packet_send(); packet_write_wait(); #endif - debug("done: ssh_kex2."); } /* @@ -224,24 +223,23 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, if (options.challenge_response_authentication) options.kbd_interactive_authentication = 1; - debug("send SSH2_MSG_SERVICE_REQUEST"); packet_start(SSH2_MSG_SERVICE_REQUEST); packet_put_cstring("ssh-userauth"); packet_send(); + debug("SSH2_MSG_SERVICE_REQUEST sent"); packet_write_wait(); type = packet_read(); - if (type != SSH2_MSG_SERVICE_ACCEPT) { - fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type); - } + if (type != SSH2_MSG_SERVICE_ACCEPT) + fatal("Server denied authentication request: %d", type); if (packet_remaining() > 0) { char *reply = packet_get_string(NULL); - debug("service_accept: %s", reply); + debug2("service_accept: %s", reply); xfree(reply); } else { debug("buggy server: service_accept w/o service"); } packet_check_eom(); - debug("got SSH2_MSG_SERVICE_ACCEPT"); + debug("SSH2_MSG_SERVICE_ACCEPT received"); if (options.preferred_authentications == NULL) options.preferred_authentications = authmethods_get(); -- cgit v1.2.3 From a743398d04d2bb40b95b8d508152fb15601e2329 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 23 Dec 2002 02:41:41 +0000 Subject: - markus@cvs.openbsd.org 2002/12/10 19:26:50 [packet.c] move tos handling to packet_set_tos; ok provos/henning/deraadt --- ChangeLog | 5 ++++- packet.c | 49 ++++++++++++++++++------------------------------- 2 files changed, 22 insertions(+), 32 deletions(-) (limited to 'packet.c') diff --git a/ChangeLog b/ChangeLog index 892c87e24..8a8fc00bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,9 @@ [session.c] Make sure $SHELL points to the shell from the password file, even if shell is overridden from login.conf; bug#453; semen at online.sinor.ru; ok millert@ + - markus@cvs.openbsd.org 2002/12/10 19:26:50 + [packet.c] + move tos handling to packet_set_tos; ok provos/henning/deraadt 20021205 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org @@ -894,4 +897,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2531 2002/12/23 02:26:08 mouring Exp $ +$Id: ChangeLog,v 1.2532 2002/12/23 02:41:41 mouring Exp $ diff --git a/packet.c b/packet.c index 0a8baa5b2..d06ac904a 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.100 2002/11/21 22:45:31 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.101 2002/12/10 19:26:50 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -1314,16 +1314,26 @@ packet_not_very_much_data_to_write(void) return buffer_len(&output) < 128 * 1024; } +void +packet_set_tos(int interactive) +{ + int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; + + if (!packet_connection_is_on_socket() || + !packet_connection_is_ipv4()) + return; + if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &tos, + sizeof(tos)) < 0) + error("setsockopt IP_TOS %d: %.100s:", + tos, strerror(errno)); +} + /* Informs that the current session is interactive. Sets IP flags for that. */ void packet_set_interactive(int interactive) { static int called = 0; -#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) - int lowdelay = IPTOS_LOWDELAY; - int throughput = IPTOS_THROUGHPUT; -#endif if (called) return; @@ -1334,35 +1344,12 @@ packet_set_interactive(int interactive) /* Only set socket options if using a socket. */ if (!packet_connection_is_on_socket()) - return; - /* - * IPTOS_LOWDELAY and IPTOS_THROUGHPUT are IPv4 only - */ - if (interactive) { - /* - * Set IP options for an interactive connection. Use - * IPTOS_LOWDELAY and TCP_NODELAY. - */ -#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) - if (packet_connection_is_ipv4()) { - if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, - &lowdelay, sizeof(lowdelay)) < 0) - error("setsockopt IPTOS_LOWDELAY: %.100s", - strerror(errno)); - } -#endif + if (interactive) set_nodelay(connection_in); - } else if (packet_connection_is_ipv4()) { - /* - * Set IP options for a non-interactive connection. Use - * IPTOS_THROUGHPUT. - */ #if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN) - if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, &throughput, - sizeof(throughput)) < 0) - error("setsockopt IPTOS_THROUGHPUT: %.100s", strerror(errno)); + packet_set_tos(interactive); #endif - } + } /* Returns true if the current connection is interactive. */ -- cgit v1.2.3 From faa1ea8c20f6f234e14b192705ddaeb1bc67f7de Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 23 Dec 2002 02:42:52 +0000 Subject: - markus@cvs.openbsd.org 2002/12/10 19:47:14 [packet.c] static --- ChangeLog | 5 ++++- packet.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'packet.c') diff --git a/ChangeLog b/ChangeLog index 8a8fc00bf..c75b2890e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,9 @@ - markus@cvs.openbsd.org 2002/12/10 19:26:50 [packet.c] move tos handling to packet_set_tos; ok provos/henning/deraadt + - markus@cvs.openbsd.org 2002/12/10 19:47:14 + [packet.c] + static 20021205 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org @@ -897,4 +900,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2532 2002/12/23 02:41:41 mouring Exp $ +$Id: ChangeLog,v 1.2533 2002/12/23 02:42:52 mouring Exp $ diff --git a/packet.c b/packet.c index d06ac904a..3e2d1249d 100644 --- a/packet.c +++ b/packet.c @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.101 2002/12/10 19:26:50 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.102 2002/12/10 19:47:14 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -1314,7 +1314,7 @@ packet_not_very_much_data_to_write(void) return buffer_len(&output) < 128 * 1024; } -void +static void packet_set_tos(int interactive) { int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; -- cgit v1.2.3