summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-01-22 23:16:32 +1100
committerDamien Miller <djm@mindrot.org>2002-01-22 23:16:32 +1100
commitdff5099f13e2e679b93d3cfe7073c9cd92b19b06 (patch)
treef80cf1916ad026e5550e61da139e52899fa04629
parent76e1e368b561cabeb55c21dc205c3f6805179ad5 (diff)
- markus@cvs.openbsd.org 2001/12/28 14:50:54
[auth1.c auth-rsa.c channels.c dispatch.c kex.c kexdh.c kexgex.c packet.c packet.h serverloop.c session.c ssh.c sshconnect1.c sshconnect2.c sshd.c] packet_read* no longer return the packet length, since it's not used.
-rw-r--r--ChangeLog7
-rw-r--r--auth-rsa.c6
-rw-r--r--auth1.c8
-rw-r--r--channels.c6
-rw-r--r--dispatch.c9
-rw-r--r--kex.c6
-rw-r--r--kexdh.c9
-rw-r--r--kexgex.c14
-rw-r--r--packet.c36
-rw-r--r--packet.h12
-rw-r--r--serverloop.c5
-rw-r--r--session.c6
-rw-r--r--ssh.c11
-rw-r--r--sshconnect1.c61
-rw-r--r--sshconnect2.c7
-rw-r--r--sshd.c5
16 files changed, 95 insertions, 113 deletions
diff --git a/ChangeLog b/ChangeLog
index 366e803a6..ae6625e8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -66,6 +66,11 @@
66 - markus@cvs.openbsd.org 2001/12/28 14:13:13 66 - markus@cvs.openbsd.org 2001/12/28 14:13:13
67 [bufaux.c bufaux.h packet.c] 67 [bufaux.c bufaux.h packet.c]
68 buffer_get_bignum: int -> void 68 buffer_get_bignum: int -> void
69 - markus@cvs.openbsd.org 2001/12/28 14:50:54
70 [auth1.c auth-rsa.c channels.c dispatch.c kex.c kexdh.c kexgex.c]
71 [packet.c packet.h serverloop.c session.c ssh.c sshconnect1.c]
72 [sshconnect2.c sshd.c]
73 packet_read* no longer return the packet length, since it's not used.
69 74
70 75
7120020121 7620020121
@@ -7214,4 +7219,4 @@
7214 - Wrote replacements for strlcpy and mkdtemp 7219 - Wrote replacements for strlcpy and mkdtemp
7215 - Released 1.0pre1 7220 - Released 1.0pre1
7216 7221
7217$Id: ChangeLog,v 1.1742 2002/01/22 12:15:57 djm Exp $ 7222$Id: ChangeLog,v 1.1743 2002/01/22 12:16:32 djm Exp $
diff --git a/auth-rsa.c b/auth-rsa.c
index 4403c1490..f7ae03cfd 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: auth-rsa.c,v 1.49 2001/12/28 12:14:27 markus Exp $"); 17RCSID("$OpenBSD: auth-rsa.c,v 1.50 2001/12/28 14:50:54 markus Exp $");
18 18
19#include <openssl/rsa.h> 19#include <openssl/rsa.h>
20#include <openssl/md5.h> 20#include <openssl/md5.h>
@@ -66,7 +66,7 @@ auth_rsa_challenge_dialog(RSA *pk)
66 u_char buf[32], mdbuf[16], response[16]; 66 u_char buf[32], mdbuf[16], response[16];
67 MD5_CTX md; 67 MD5_CTX md;
68 u_int i; 68 u_int i;
69 int plen, len; 69 int len;
70 70
71 if ((encrypted_challenge = BN_new()) == NULL) 71 if ((encrypted_challenge = BN_new()) == NULL)
72 fatal("auth_rsa_challenge_dialog: BN_new() failed"); 72 fatal("auth_rsa_challenge_dialog: BN_new() failed");
@@ -91,7 +91,7 @@ auth_rsa_challenge_dialog(RSA *pk)
91 packet_write_wait(); 91 packet_write_wait();
92 92
93 /* Wait for a response. */ 93 /* Wait for a response. */
94 packet_read_expect(&plen, SSH_CMSG_AUTH_RSA_RESPONSE); 94 packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE);
95 for (i = 0; i < 16; i++) 95 for (i = 0; i < 16; i++)
96 response[i] = packet_get_char(); 96 response[i] = packet_get_char();
97 packet_check_eom(); 97 packet_check_eom();
diff --git a/auth1.c b/auth1.c
index 6585fa7c5..73fffec35 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.33 2001/12/28 13:57:33 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.34 2001/12/28 14:50:54 markus Exp $");
14 14
15#include "xmalloc.h" 15#include "xmalloc.h"
16#include "rsa.h" 16#include "rsa.h"
@@ -71,7 +71,6 @@ do_authloop(Authctxt *authctxt)
71 char *client_user, *password; 71 char *client_user, *password;
72 char info[1024]; 72 char info[1024];
73 u_int dlen; 73 u_int dlen;
74 int plen;
75 u_int ulen; 74 u_int ulen;
76 int type = 0; 75 int type = 0;
77 struct passwd *pw = authctxt->pw; 76 struct passwd *pw = authctxt->pw;
@@ -109,7 +108,7 @@ do_authloop(Authctxt *authctxt)
109 info[0] = '\0'; 108 info[0] = '\0';
110 109
111 /* Get a packet from the client. */ 110 /* Get a packet from the client. */
112 type = packet_read(&plen); 111 type = packet_read();
113 112
114 /* Process the packet. */ 113 /* Process the packet. */
115 switch (type) { 114 switch (type) {
@@ -360,12 +359,11 @@ do_authentication(void)
360{ 359{
361 Authctxt *authctxt; 360 Authctxt *authctxt;
362 struct passwd *pw; 361 struct passwd *pw;
363 int plen;
364 u_int ulen; 362 u_int ulen;
365 char *p, *user, *style = NULL; 363 char *p, *user, *style = NULL;
366 364
367 /* Get the name of the user that we wish to log in as. */ 365 /* Get the name of the user that we wish to log in as. */
368 packet_read_expect(&plen, SSH_CMSG_USER); 366 packet_read_expect(SSH_CMSG_USER);
369 367
370 /* Get the user name. */ 368 /* Get the user name. */
371 user = packet_get_string(&ulen); 369 user = packet_get_string(&ulen);
diff --git a/channels.c b/channels.c
index 163312c57..fd1b124ee 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.152 2001/12/28 12:14:27 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.153 2001/12/28 14:50:54 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2185,7 +2185,7 @@ void
2185channel_request_remote_forwarding(u_short listen_port, 2185channel_request_remote_forwarding(u_short listen_port,
2186 const char *host_to_connect, u_short port_to_connect) 2186 const char *host_to_connect, u_short port_to_connect)
2187{ 2187{
2188 int payload_len, type, success = 0; 2188 int type, success = 0;
2189 2189
2190 /* Record locally that connection to this host/port is permitted. */ 2190 /* Record locally that connection to this host/port is permitted. */
2191 if (num_permitted_opens >= SSH_MAX_FORWARDS_PER_DIRECTION) 2191 if (num_permitted_opens >= SSH_MAX_FORWARDS_PER_DIRECTION)
@@ -2212,7 +2212,7 @@ channel_request_remote_forwarding(u_short listen_port,
2212 packet_write_wait(); 2212 packet_write_wait();
2213 2213
2214 /* Wait for response from the remote side. */ 2214 /* Wait for response from the remote side. */
2215 type = packet_read(&payload_len); 2215 type = packet_read();
2216 switch (type) { 2216 switch (type) {
2217 case SSH_SMSG_SUCCESS: 2217 case SSH_SMSG_SUCCESS:
2218 success = 1; 2218 success = 1;
diff --git a/dispatch.c b/dispatch.c
index 036c0aaa5..871fa24d2 100644
--- a/dispatch.c
+++ b/dispatch.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: dispatch.c,v 1.12 2001/12/20 22:50:24 djm Exp $"); 25RCSID("$OpenBSD: dispatch.c,v 1.13 2001/12/28 14:50:54 markus Exp $");
26 26
27#include "ssh1.h" 27#include "ssh1.h"
28#include "ssh2.h" 28#include "ssh2.h"
@@ -58,19 +58,18 @@ void
58dispatch_run(int mode, int *done, void *ctxt) 58dispatch_run(int mode, int *done, void *ctxt)
59{ 59{
60 for (;;) { 60 for (;;) {
61 int plen;
62 int type; 61 int type;
63 u_int32_t seqnr; 62 u_int32_t seqnr;
64 63
65 if (mode == DISPATCH_BLOCK) { 64 if (mode == DISPATCH_BLOCK) {
66 type = packet_read_seqnr(&plen, &seqnr); 65 type = packet_read_seqnr(&seqnr);
67 } else { 66 } else {
68 type = packet_read_poll_seqnr(&plen, &seqnr); 67 type = packet_read_poll_seqnr(&seqnr);
69 if (type == SSH_MSG_NONE) 68 if (type == SSH_MSG_NONE)
70 return; 69 return;
71 } 70 }
72 if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL) 71 if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL)
73 (*dispatch[type])(type, plen, seqnr, ctxt); 72 (*dispatch[type])(type, 1234, seqnr, ctxt);
74 else 73 else
75 packet_disconnect("protocol error: rcvd type %d", type); 74 packet_disconnect("protocol error: rcvd type %d", type);
76 if (done != NULL && *done) 75 if (done != NULL && *done)
diff --git a/kex.c b/kex.c
index e4163214d..139a509c2 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kex.c,v 1.39 2001/12/28 12:14:27 markus Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.40 2001/12/28 14:50:54 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29 29
@@ -125,8 +125,6 @@ kex_clear_dispatch(void)
125void 125void
126kex_finish(Kex *kex) 126kex_finish(Kex *kex)
127{ 127{
128 int plen;
129
130 kex_clear_dispatch(); 128 kex_clear_dispatch();
131 129
132 packet_start(SSH2_MSG_NEWKEYS); 130 packet_start(SSH2_MSG_NEWKEYS);
@@ -135,7 +133,7 @@ kex_finish(Kex *kex)
135 debug("SSH2_MSG_NEWKEYS sent"); 133 debug("SSH2_MSG_NEWKEYS sent");
136 134
137 debug("waiting for SSH2_MSG_NEWKEYS"); 135 debug("waiting for SSH2_MSG_NEWKEYS");
138 packet_read_expect(&plen, SSH2_MSG_NEWKEYS); 136 packet_read_expect(SSH2_MSG_NEWKEYS);
139 debug("SSH2_MSG_NEWKEYS received"); 137 debug("SSH2_MSG_NEWKEYS received");
140 138
141 kex->done = 1; 139 kex->done = 1;
diff --git a/kexdh.c b/kexdh.c
index 226b81bc9..bc4700a2e 100644
--- a/kexdh.c
+++ b/kexdh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kexdh.c,v 1.11 2001/12/28 13:57:33 markus Exp $"); 26RCSID("$OpenBSD: kexdh.c,v 1.12 2001/12/28 14:50:54 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29#include <openssl/bn.h> 29#include <openssl/bn.h>
@@ -97,7 +97,6 @@ kexdh_client(Kex *kex)
97 u_char *server_host_key_blob = NULL, *signature = NULL; 97 u_char *server_host_key_blob = NULL, *signature = NULL;
98 u_char *kbuf, *hash; 98 u_char *kbuf, *hash;
99 u_int klen, kout, slen, sbloblen; 99 u_int klen, kout, slen, sbloblen;
100 int plen;
101 100
102 /* generate and send 'e', client DH public key */ 101 /* generate and send 'e', client DH public key */
103 dh = dh_new_group1(); 102 dh = dh_new_group1();
@@ -115,7 +114,7 @@ kexdh_client(Kex *kex)
115#endif 114#endif
116 115
117 debug("expecting SSH2_MSG_KEXDH_REPLY"); 116 debug("expecting SSH2_MSG_KEXDH_REPLY");
118 packet_read_expect(&plen, SSH2_MSG_KEXDH_REPLY); 117 packet_read_expect(SSH2_MSG_KEXDH_REPLY);
119 118
120 /* key, cert */ 119 /* key, cert */
121 server_host_key_blob = packet_get_string(&sbloblen); 120 server_host_key_blob = packet_get_string(&sbloblen);
@@ -201,14 +200,14 @@ kexdh_server(Kex *kex)
201 Key *server_host_key; 200 Key *server_host_key;
202 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 201 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
203 u_int sbloblen, klen, kout; 202 u_int sbloblen, klen, kout;
204 int slen, plen; 203 int slen;
205 204
206 /* generate server DH public key */ 205 /* generate server DH public key */
207 dh = dh_new_group1(); 206 dh = dh_new_group1();
208 dh_gen_key(dh, kex->we_need * 8); 207 dh_gen_key(dh, kex->we_need * 8);
209 208
210 debug("expecting SSH2_MSG_KEXDH_INIT"); 209 debug("expecting SSH2_MSG_KEXDH_INIT");
211 packet_read_expect(&plen, SSH2_MSG_KEXDH_INIT); 210 packet_read_expect(SSH2_MSG_KEXDH_INIT);
212 211
213 if (kex->load_host_key == NULL) 212 if (kex->load_host_key == NULL)
214 fatal("Cannot load hostkey"); 213 fatal("Cannot load hostkey");
diff --git a/kexgex.c b/kexgex.c
index 99344bbba..6b6d1d2ee 100644
--- a/kexgex.c
+++ b/kexgex.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: kexgex.c,v 1.14 2001/12/28 13:57:33 markus Exp $"); 27RCSID("$OpenBSD: kexgex.c,v 1.15 2001/12/28 14:50:54 markus Exp $");
28 28
29#include <openssl/bn.h> 29#include <openssl/bn.h>
30 30
@@ -107,7 +107,7 @@ kexgex_client(Kex *kex)
107 Key *server_host_key; 107 Key *server_host_key;
108 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 108 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
109 u_int klen, kout, slen, sbloblen; 109 u_int klen, kout, slen, sbloblen;
110 int plen, min, max, nbits; 110 int min, max, nbits;
111 DH *dh; 111 DH *dh;
112 112
113 nbits = dh_estimate(kex->we_need * 8); 113 nbits = dh_estimate(kex->we_need * 8);
@@ -138,7 +138,7 @@ kexgex_client(Kex *kex)
138 packet_send(); 138 packet_send();
139 139
140 debug("expecting SSH2_MSG_KEX_DH_GEX_GROUP"); 140 debug("expecting SSH2_MSG_KEX_DH_GEX_GROUP");
141 packet_read_expect(&plen, SSH2_MSG_KEX_DH_GEX_GROUP); 141 packet_read_expect(SSH2_MSG_KEX_DH_GEX_GROUP);
142 142
143 if ((p = BN_new()) == NULL) 143 if ((p = BN_new()) == NULL)
144 fatal("BN_new"); 144 fatal("BN_new");
@@ -169,7 +169,7 @@ kexgex_client(Kex *kex)
169 packet_send(); 169 packet_send();
170 170
171 debug("expecting SSH2_MSG_KEX_DH_GEX_REPLY"); 171 debug("expecting SSH2_MSG_KEX_DH_GEX_REPLY");
172 packet_read_expect(&plen, SSH2_MSG_KEX_DH_GEX_REPLY); 172 packet_read_expect(SSH2_MSG_KEX_DH_GEX_REPLY);
173 173
174 /* key, cert */ 174 /* key, cert */
175 server_host_key_blob = packet_get_string(&sbloblen); 175 server_host_key_blob = packet_get_string(&sbloblen);
@@ -261,7 +261,7 @@ kexgex_server(Kex *kex)
261 DH *dh = dh; 261 DH *dh = dh;
262 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 262 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
263 u_int sbloblen, klen, kout; 263 u_int sbloblen, klen, kout;
264 int min = -1, max = -1, nbits = -1, type, plen, slen; 264 int min = -1, max = -1, nbits = -1, type, slen;
265 265
266 if (kex->load_host_key == NULL) 266 if (kex->load_host_key == NULL)
267 fatal("Cannot load hostkey"); 267 fatal("Cannot load hostkey");
@@ -269,7 +269,7 @@ kexgex_server(Kex *kex)
269 if (server_host_key == NULL) 269 if (server_host_key == NULL)
270 fatal("Unsupported hostkey type %d", kex->hostkey_type); 270 fatal("Unsupported hostkey type %d", kex->hostkey_type);
271 271
272 type = packet_read(&plen); 272 type = packet_read();
273 switch (type) { 273 switch (type) {
274 case SSH2_MSG_KEX_DH_GEX_REQUEST: 274 case SSH2_MSG_KEX_DH_GEX_REQUEST:
275 debug("SSH2_MSG_KEX_DH_GEX_REQUEST received"); 275 debug("SSH2_MSG_KEX_DH_GEX_REQUEST received");
@@ -312,7 +312,7 @@ kexgex_server(Kex *kex)
312 dh_gen_key(dh, kex->we_need * 8); 312 dh_gen_key(dh, kex->we_need * 8);
313 313
314 debug("expecting SSH2_MSG_KEX_DH_GEX_INIT"); 314 debug("expecting SSH2_MSG_KEX_DH_GEX_INIT");
315 packet_read_expect(&plen, SSH2_MSG_KEX_DH_GEX_INIT); 315 packet_read_expect(SSH2_MSG_KEX_DH_GEX_INIT);
316 316
317 /* key, cert */ 317 /* key, cert */
318 if ((dh_client_pub = BN_new()) == NULL) 318 if ((dh_client_pub = BN_new()) == NULL)
diff --git a/packet.c b/packet.c
index 593fb707c..3b2522356 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.81 2001/12/28 14:13:13 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.82 2001/12/28 14:50:54 markus Exp $");
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "buffer.h" 43#include "buffer.h"
@@ -610,7 +610,7 @@ packet_send(void)
610 */ 610 */
611 611
612int 612int
613packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p) 613packet_read_seqnr(u_int32_t *seqnr_p)
614{ 614{
615 int type, len; 615 int type, len;
616 fd_set *setp; 616 fd_set *setp;
@@ -626,7 +626,7 @@ packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
626 /* Stay in the loop until we have received a complete packet. */ 626 /* Stay in the loop until we have received a complete packet. */
627 for (;;) { 627 for (;;) {
628 /* Try to read a packet from the buffer. */ 628 /* Try to read a packet from the buffer. */
629 type = packet_read_poll_seqnr(payload_len_ptr, seqnr_p); 629 type = packet_read_poll_seqnr(seqnr_p);
630 if (!compat20 && ( 630 if (!compat20 && (
631 type == SSH_SMSG_SUCCESS 631 type == SSH_SMSG_SUCCESS
632 || type == SSH_SMSG_FAILURE 632 || type == SSH_SMSG_FAILURE
@@ -666,9 +666,9 @@ packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
666} 666}
667 667
668int 668int
669packet_read(int *payload_len_ptr) 669packet_read(void)
670{ 670{
671 return packet_read_seqnr(payload_len_ptr, NULL); 671 return packet_read_seqnr(NULL);
672} 672}
673 673
674/* 674/*
@@ -677,11 +677,11 @@ packet_read(int *payload_len_ptr)
677 */ 677 */
678 678
679void 679void
680packet_read_expect(int *payload_len_ptr, int expected_type) 680packet_read_expect(int expected_type)
681{ 681{
682 int type; 682 int type;
683 683
684 type = packet_read(payload_len_ptr); 684 type = packet_read();
685 if (type != expected_type) 685 if (type != expected_type)
686 packet_disconnect("Protocol error: expected packet type %d, got %d", 686 packet_disconnect("Protocol error: expected packet type %d, got %d",
687 expected_type, type); 687 expected_type, type);
@@ -694,16 +694,10 @@ packet_read_expect(int *payload_len_ptr, int expected_type)
694 * SSH_MSG_DISCONNECT is handled specially here. Also, 694 * SSH_MSG_DISCONNECT is handled specially here. Also,
695 * SSH_MSG_IGNORE messages are skipped by this function and are never returned 695 * SSH_MSG_IGNORE messages are skipped by this function and are never returned
696 * to higher levels. 696 * to higher levels.
697 *
698 * The returned payload_len does include space consumed by:
699 * Packet length
700 * Padding
701 * Packet type
702 * Check bytes
703 */ 697 */
704 698
705static int 699static int
706packet_read_poll1(int *payload_len_ptr) 700packet_read_poll1(void)
707{ 701{
708 u_int len, padded_len; 702 u_int len, padded_len;
709 u_char *ucp, type; 703 u_char *ucp, type;
@@ -776,12 +770,11 @@ packet_read_poll1(int *payload_len_ptr)
776 buffer_len(&compression_buffer)); 770 buffer_len(&compression_buffer));
777 } 771 }
778 type = buffer_get_char(&incoming_packet); 772 type = buffer_get_char(&incoming_packet);
779 *payload_len_ptr = buffer_len(&incoming_packet);
780 return type; 773 return type;
781} 774}
782 775
783static int 776static int
784packet_read_poll2(int *payload_len_ptr, u_int32_t *seqnr_p) 777packet_read_poll2(u_int32_t *seqnr_p)
785{ 778{
786 static u_int32_t seqnr = 0; 779 static u_int32_t seqnr = 0;
787 static u_int packet_length = 0; 780 static u_int packet_length = 0;
@@ -887,7 +880,6 @@ packet_read_poll2(int *payload_len_ptr, u_int32_t *seqnr_p)
887 type = buffer_get_char(&incoming_packet); 880 type = buffer_get_char(&incoming_packet);
888 if (type == SSH2_MSG_NEWKEYS) 881 if (type == SSH2_MSG_NEWKEYS)
889 set_newkeys(MODE_IN); 882 set_newkeys(MODE_IN);
890 *payload_len_ptr = buffer_len(&incoming_packet);
891#ifdef PACKET_DEBUG 883#ifdef PACKET_DEBUG
892 fprintf(stderr, "read/plain[%d]:\r\n", type); 884 fprintf(stderr, "read/plain[%d]:\r\n", type);
893 buffer_dump(&incoming_packet); 885 buffer_dump(&incoming_packet);
@@ -898,7 +890,7 @@ packet_read_poll2(int *payload_len_ptr, u_int32_t *seqnr_p)
898} 890}
899 891
900int 892int
901packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p) 893packet_read_poll_seqnr(u_int32_t *seqnr_p)
902{ 894{
903 int reason; 895 int reason;
904 u_char type; 896 u_char type;
@@ -906,7 +898,7 @@ packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
906 898
907 for (;;) { 899 for (;;) {
908 if (compat20) { 900 if (compat20) {
909 type = packet_read_poll2(payload_len_ptr, seqnr_p); 901 type = packet_read_poll2(seqnr_p);
910 if (type) 902 if (type)
911 DBG(debug("received packet type %d", type)); 903 DBG(debug("received packet type %d", type));
912 switch (type) { 904 switch (type) {
@@ -933,7 +925,7 @@ packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
933 break; 925 break;
934 } 926 }
935 } else { 927 } else {
936 type = packet_read_poll1(payload_len_ptr); 928 type = packet_read_poll1();
937 switch (type) { 929 switch (type) {
938 case SSH_MSG_IGNORE: 930 case SSH_MSG_IGNORE:
939 break; 931 break;
@@ -960,9 +952,9 @@ packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p)
960} 952}
961 953
962int 954int
963packet_read_poll(int *payload_len_ptr) 955packet_read_poll(void)
964{ 956{
965 return packet_read_poll_seqnr(payload_len_ptr, NULL); 957 return packet_read_poll_seqnr(NULL);
966} 958}
967 959
968/* 960/*
diff --git a/packet.h b/packet.h
index dcf2a664f..4caca34c8 100644
--- a/packet.h
+++ b/packet.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: packet.h,v 1.31 2001/12/28 13:57:33 markus Exp $"); */ 14/* RCSID("$OpenBSD: packet.h,v 1.32 2001/12/28 14:50:54 markus Exp $"); */
15 15
16#ifndef PACKET_H 16#ifndef PACKET_H
17#define PACKET_H 17#define PACKET_H
@@ -40,12 +40,12 @@ void packet_put_cstring(const char *str);
40void packet_put_raw(const void *buf, u_int len); 40void packet_put_raw(const void *buf, u_int len);
41void packet_send(void); 41void packet_send(void);
42 42
43int packet_read(int *payload_len_ptr); 43int packet_read(void);
44void packet_read_expect(int *payload_len_ptr, int type); 44void packet_read_expect(int type);
45int packet_read_poll(int *packet_len_ptr); 45int packet_read_poll(void);
46void packet_process_incoming(const char *buf, u_int len); 46void packet_process_incoming(const char *buf, u_int len);
47int packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p); 47int packet_read_seqnr(u_int32_t *seqnr_p);
48int packet_read_poll_seqnr(int *packet_len_ptr, u_int32_t *seqnr_p); 48int packet_read_poll_seqnr(u_int32_t *seqnr_p);
49 49
50u_int packet_get_char(void); 50u_int packet_get_char(void);
51u_int packet_get_int(void); 51u_int packet_get_int(void);
diff --git a/serverloop.c b/serverloop.c
index aa74bf9a2..d2f8d3d61 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.91 2001/12/28 12:14:27 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.92 2001/12/28 14:50:54 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -691,8 +691,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
691 * the exit status. 691 * the exit status.
692 */ 692 */
693 do { 693 do {
694 int plen; 694 type = packet_read();
695 type = packet_read(&plen);
696 } 695 }
697 while (type != SSH_CMSG_EXIT_CONFIRMATION); 696 while (type != SSH_CMSG_EXIT_CONFIRMATION);
698 697
diff --git a/session.c b/session.c
index 43cbd00b9..a5ad077c9 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.116 2001/12/28 12:14:27 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.117 2001/12/28 14:50:54 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -233,7 +233,7 @@ do_authenticated1(Authctxt *authctxt)
233{ 233{
234 Session *s; 234 Session *s;
235 char *command; 235 char *command;
236 int success, type, plen, screen_flag; 236 int success, type, screen_flag;
237 int compression_level = 0, enable_compression_after_reply = 0; 237 int compression_level = 0, enable_compression_after_reply = 0;
238 u_int proto_len, data_len, dlen; 238 u_int proto_len, data_len, dlen;
239 239
@@ -249,7 +249,7 @@ do_authenticated1(Authctxt *authctxt)
249 success = 0; 249 success = 0;
250 250
251 /* Get a packet from the client. */ 251 /* Get a packet from the client. */
252 type = packet_read(&plen); 252 type = packet_read();
253 253
254 /* Process the packet. */ 254 /* Process the packet. */
255 switch (type) { 255 switch (type) {
diff --git a/ssh.c b/ssh.c
index 76d45c96a..6cf9f9b7a 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.155 2001/12/28 12:14:27 markus Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.156 2001/12/28 14:50:54 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -880,7 +880,6 @@ static int
880ssh_session(void) 880ssh_session(void)
881{ 881{
882 int type; 882 int type;
883 int plen;
884 int interactive = 0; 883 int interactive = 0;
885 int have_tty = 0; 884 int have_tty = 0;
886 struct winsize ws; 885 struct winsize ws;
@@ -898,7 +897,7 @@ ssh_session(void)
898 packet_put_int(options.compression_level); 897 packet_put_int(options.compression_level);
899 packet_send(); 898 packet_send();
900 packet_write_wait(); 899 packet_write_wait();
901 type = packet_read(&plen); 900 type = packet_read();
902 if (type == SSH_SMSG_SUCCESS) 901 if (type == SSH_SMSG_SUCCESS)
903 packet_start_compression(options.compression_level); 902 packet_start_compression(options.compression_level);
904 else if (type == SSH_SMSG_FAILURE) 903 else if (type == SSH_SMSG_FAILURE)
@@ -936,7 +935,7 @@ ssh_session(void)
936 packet_write_wait(); 935 packet_write_wait();
937 936
938 /* Read response from the server. */ 937 /* Read response from the server. */
939 type = packet_read(&plen); 938 type = packet_read();
940 if (type == SSH_SMSG_SUCCESS) { 939 if (type == SSH_SMSG_SUCCESS) {
941 interactive = 1; 940 interactive = 1;
942 have_tty = 1; 941 have_tty = 1;
@@ -955,7 +954,7 @@ ssh_session(void)
955 x11_request_forwarding_with_spoofing(0, proto, data); 954 x11_request_forwarding_with_spoofing(0, proto, data);
956 955
957 /* Read response from the server. */ 956 /* Read response from the server. */
958 type = packet_read(&plen); 957 type = packet_read();
959 if (type == SSH_SMSG_SUCCESS) { 958 if (type == SSH_SMSG_SUCCESS) {
960 interactive = 1; 959 interactive = 1;
961 } else if (type == SSH_SMSG_FAILURE) { 960 } else if (type == SSH_SMSG_FAILURE) {
@@ -975,7 +974,7 @@ ssh_session(void)
975 auth_request_forwarding(); 974 auth_request_forwarding();
976 975
977 /* Read response from the server. */ 976 /* Read response from the server. */
978 type = packet_read(&plen); 977 type = packet_read();
979 packet_check_eom(); 978 packet_check_eom();
980 if (type != SSH_SMSG_SUCCESS) 979 if (type != SSH_SMSG_SUCCESS)
981 log("Warning: Remote host denied authentication agent forwarding."); 980 log("Warning: Remote host denied authentication agent forwarding.");
diff --git a/sshconnect1.c b/sshconnect1.c
index e66f35040..8b577fb0a 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect1.c,v 1.46 2001/12/28 13:57:33 markus Exp $"); 16RCSID("$OpenBSD: sshconnect1.c,v 1.47 2001/12/28 14:50:54 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/evp.h> 19#include <openssl/evp.h>
@@ -67,7 +67,6 @@ try_agent_authentication(void)
67 AuthenticationConnection *auth; 67 AuthenticationConnection *auth;
68 u_char response[16]; 68 u_char response[16];
69 u_int i; 69 u_int i;
70 int plen;
71 Key *key; 70 Key *key;
72 BIGNUM *challenge; 71 BIGNUM *challenge;
73 72
@@ -94,7 +93,7 @@ try_agent_authentication(void)
94 packet_write_wait(); 93 packet_write_wait();
95 94
96 /* Wait for server's response. */ 95 /* Wait for server's response. */
97 type = packet_read(&plen); 96 type = packet_read();
98 97
99 /* The server sends failure if it doesn\'t like our key or 98 /* The server sends failure if it doesn\'t like our key or
100 does not support RSA authentication. */ 99 does not support RSA authentication. */
@@ -134,7 +133,7 @@ try_agent_authentication(void)
134 packet_write_wait(); 133 packet_write_wait();
135 134
136 /* Wait for response from the server. */ 135 /* Wait for response from the server. */
137 type = packet_read(&plen); 136 type = packet_read();
138 137
139 /* The server returns success if it accepted the authentication. */ 138 /* The server returns success if it accepted the authentication. */
140 if (type == SSH_SMSG_SUCCESS) { 139 if (type == SSH_SMSG_SUCCESS) {
@@ -209,7 +208,7 @@ try_rsa_authentication(int idx)
209 BIGNUM *challenge; 208 BIGNUM *challenge;
210 Key *public, *private; 209 Key *public, *private;
211 char buf[300], *passphrase, *comment, *authfile; 210 char buf[300], *passphrase, *comment, *authfile;
212 int i, type, quit, plen; 211 int i, type, quit;
213 212
214 public = options.identity_keys[idx]; 213 public = options.identity_keys[idx];
215 authfile = options.identity_files[idx]; 214 authfile = options.identity_files[idx];
@@ -224,7 +223,7 @@ try_rsa_authentication(int idx)
224 packet_write_wait(); 223 packet_write_wait();
225 224
226 /* Wait for server's response. */ 225 /* Wait for server's response. */
227 type = packet_read(&plen); 226 type = packet_read();
228 227
229 /* 228 /*
230 * The server responds with failure if it doesn\'t like our key or 229 * The server responds with failure if it doesn\'t like our key or
@@ -291,7 +290,7 @@ try_rsa_authentication(int idx)
291 packet_write_wait(); 290 packet_write_wait();
292 291
293 /* Expect the server to reject it... */ 292 /* Expect the server to reject it... */
294 packet_read_expect(&plen, SSH_SMSG_FAILURE); 293 packet_read_expect(SSH_SMSG_FAILURE);
295 BN_clear_free(challenge); 294 BN_clear_free(challenge);
296 return 0; 295 return 0;
297 } 296 }
@@ -307,7 +306,7 @@ try_rsa_authentication(int idx)
307 BN_clear_free(challenge); 306 BN_clear_free(challenge);
308 307
309 /* Wait for response from the server. */ 308 /* Wait for response from the server. */
310 type = packet_read(&plen); 309 type = packet_read();
311 if (type == SSH_SMSG_SUCCESS) { 310 if (type == SSH_SMSG_SUCCESS) {
312 debug("RSA authentication accepted by server."); 311 debug("RSA authentication accepted by server.");
313 return 1; 312 return 1;
@@ -327,7 +326,6 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
327{ 326{
328 int type; 327 int type;
329 BIGNUM *challenge; 328 BIGNUM *challenge;
330 int plen;
331 329
332 debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication."); 330 debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication.");
333 331
@@ -341,7 +339,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
341 packet_write_wait(); 339 packet_write_wait();
342 340
343 /* Wait for server's response. */ 341 /* Wait for server's response. */
344 type = packet_read(&plen); 342 type = packet_read();
345 343
346 /* The server responds with failure if it doesn't admit our 344 /* The server responds with failure if it doesn't admit our
347 .rhosts authentication or doesn't know our host key. */ 345 .rhosts authentication or doesn't know our host key. */
@@ -368,7 +366,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key)
368 BN_clear_free(challenge); 366 BN_clear_free(challenge);
369 367
370 /* Wait for response from the server. */ 368 /* Wait for response from the server. */
371 type = packet_read(&plen); 369 type = packet_read();
372 if (type == SSH_SMSG_SUCCESS) { 370 if (type == SSH_SMSG_SUCCESS) {
373 debug("Rhosts or /etc/hosts.equiv with RSA host authentication accepted by server."); 371 debug("Rhosts or /etc/hosts.equiv with RSA host authentication accepted by server.");
374 return 1; 372 return 1;
@@ -388,7 +386,7 @@ try_krb4_authentication(void)
388 char inst[INST_SZ]; 386 char inst[INST_SZ];
389 char *realm; 387 char *realm;
390 CREDENTIALS cred; 388 CREDENTIALS cred;
391 int r, type, plen; 389 int r, type;
392 socklen_t slen; 390 socklen_t slen;
393 Key_schedule schedule; 391 Key_schedule schedule;
394 u_long checksum, cksum; 392 u_long checksum, cksum;
@@ -447,7 +445,7 @@ try_krb4_authentication(void)
447 fatal_cleanup(); 445 fatal_cleanup();
448 } 446 }
449 /* Get server reply. */ 447 /* Get server reply. */
450 type = packet_read(&plen); 448 type = packet_read();
451 switch (type) { 449 switch (type) {
452 case SSH_SMSG_FAILURE: 450 case SSH_SMSG_FAILURE:
453 /* Should really be SSH_SMSG_AUTH_KERBEROS_FAILURE */ 451 /* Should really be SSH_SMSG_AUTH_KERBEROS_FAILURE */
@@ -509,7 +507,7 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context)
509 krb5_ccache ccache = NULL; 507 krb5_ccache ccache = NULL;
510 const char *remotehost; 508 const char *remotehost;
511 krb5_data ap; 509 krb5_data ap;
512 int type, payload_len; 510 int type;
513 krb5_ap_rep_enc_part *reply = NULL; 511 krb5_ap_rep_enc_part *reply = NULL;
514 int ret; 512 int ret;
515 513
@@ -559,7 +557,7 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context)
559 xfree(ap.data); 557 xfree(ap.data);
560 ap.length = 0; 558 ap.length = 0;
561 559
562 type = packet_read(&payload_len); 560 type = packet_read();
563 switch (type) { 561 switch (type) {
564 case SSH_SMSG_FAILURE: 562 case SSH_SMSG_FAILURE:
565 /* Should really be SSH_SMSG_AUTH_KERBEROS_FAILURE */ 563 /* Should really be SSH_SMSG_AUTH_KERBEROS_FAILURE */
@@ -605,7 +603,7 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context)
605static void 603static void
606send_krb5_tgt(krb5_context context, krb5_auth_context auth_context) 604send_krb5_tgt(krb5_context context, krb5_auth_context auth_context)
607{ 605{
608 int fd, type, payload_len; 606 int fd, type;
609 krb5_error_code problem; 607 krb5_error_code problem;
610 krb5_data outbuf; 608 krb5_data outbuf;
611 krb5_ccache ccache = NULL; 609 krb5_ccache ccache = NULL;
@@ -655,7 +653,7 @@ send_krb5_tgt(krb5_context context, krb5_auth_context auth_context)
655 packet_send(); 653 packet_send();
656 packet_write_wait(); 654 packet_write_wait();
657 655
658 type = packet_read(&payload_len); 656 type = packet_read();
659 657
660 if (type == SSH_SMSG_SUCCESS) { 658 if (type == SSH_SMSG_SUCCESS) {
661 char *pname; 659 char *pname;
@@ -690,7 +688,7 @@ send_krb4_tgt(void)
690 CREDENTIALS *creds; 688 CREDENTIALS *creds;
691 struct stat st; 689 struct stat st;
692 char buffer[4096], pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ]; 690 char buffer[4096], pname[ANAME_SZ], pinst[INST_SZ], prealm[REALM_SZ];
693 int problem, type, len; 691 int problem, type;
694 692
695 /* Don't do anything if we don't have any tickets. */ 693 /* Don't do anything if we don't have any tickets. */
696 if (stat(tkt_string(), &st) < 0) 694 if (stat(tkt_string(), &st) < 0)
@@ -717,7 +715,7 @@ send_krb4_tgt(void)
717 packet_send(); 715 packet_send();
718 packet_write_wait(); 716 packet_write_wait();
719 717
720 type = packet_read(&len); 718 type = packet_read();
721 719
722 if (type == SSH_SMSG_SUCCESS) 720 if (type == SSH_SMSG_SUCCESS)
723 debug("Kerberos v4 TGT forwarded (%s%s%s@%s).", 721 debug("Kerberos v4 TGT forwarded (%s%s%s@%s).",
@@ -795,7 +793,7 @@ send_afs_tokens(void)
795 793
796 /* Roger, Roger. Clearance, Clarence. What's your vector, 794 /* Roger, Roger. Clearance, Clarence. What's your vector,
797 Victor? */ 795 Victor? */
798 type = packet_read(&len); 796 type = packet_read();
799 797
800 if (type == SSH_SMSG_FAILURE) 798 if (type == SSH_SMSG_FAILURE)
801 debug("AFS token for cell %s rejected.", server_cell); 799 debug("AFS token for cell %s rejected.", server_cell);
@@ -814,7 +812,6 @@ static int
814try_challenge_response_authentication(void) 812try_challenge_response_authentication(void)
815{ 813{
816 int type, i; 814 int type, i;
817 int payload_len;
818 u_int clen; 815 u_int clen;
819 char prompt[1024]; 816 char prompt[1024];
820 char *challenge, *response; 817 char *challenge, *response;
@@ -827,7 +824,7 @@ try_challenge_response_authentication(void)
827 packet_send(); 824 packet_send();
828 packet_write_wait(); 825 packet_write_wait();
829 826
830 type = packet_read(&payload_len); 827 type = packet_read();
831 if (type != SSH_SMSG_FAILURE && 828 if (type != SSH_SMSG_FAILURE &&
832 type != SSH_SMSG_AUTH_TIS_CHALLENGE) { 829 type != SSH_SMSG_AUTH_TIS_CHALLENGE) {
833 packet_disconnect("Protocol error: got %d in response " 830 packet_disconnect("Protocol error: got %d in response "
@@ -858,7 +855,7 @@ try_challenge_response_authentication(void)
858 xfree(response); 855 xfree(response);
859 packet_send(); 856 packet_send();
860 packet_write_wait(); 857 packet_write_wait();
861 type = packet_read(&payload_len); 858 type = packet_read();
862 if (type == SSH_SMSG_SUCCESS) 859 if (type == SSH_SMSG_SUCCESS)
863 return 1; 860 return 1;
864 if (type != SSH_SMSG_FAILURE) 861 if (type != SSH_SMSG_FAILURE)
@@ -875,7 +872,7 @@ try_challenge_response_authentication(void)
875static int 872static int
876try_password_authentication(char *prompt) 873try_password_authentication(char *prompt)
877{ 874{
878 int type, i, payload_len; 875 int type, i;
879 char *password; 876 char *password;
880 877
881 debug("Doing password authentication."); 878 debug("Doing password authentication.");
@@ -892,7 +889,7 @@ try_password_authentication(char *prompt)
892 packet_send(); 889 packet_send();
893 packet_write_wait(); 890 packet_write_wait();
894 891
895 type = packet_read(&payload_len); 892 type = packet_read();
896 if (type == SSH_SMSG_SUCCESS) 893 if (type == SSH_SMSG_SUCCESS)
897 return 1; 894 return 1;
898 if (type != SSH_SMSG_FAILURE) 895 if (type != SSH_SMSG_FAILURE)
@@ -917,13 +914,12 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
917 u_char cookie[8]; 914 u_char cookie[8];
918 u_int supported_ciphers; 915 u_int supported_ciphers;
919 u_int server_flags, client_flags; 916 u_int server_flags, client_flags;
920 int payload_len;
921 u_int32_t rand = 0; 917 u_int32_t rand = 0;
922 918
923 debug("Waiting for server public key."); 919 debug("Waiting for server public key.");
924 920
925 /* Wait for a public key packet from the server. */ 921 /* Wait for a public key packet from the server. */
926 packet_read_expect(&payload_len, SSH_SMSG_PUBLIC_KEY); 922 packet_read_expect(SSH_SMSG_PUBLIC_KEY);
927 923
928 /* Get cookie from the packet. */ 924 /* Get cookie from the packet. */
929 for (i = 0; i < 8; i++) 925 for (i = 0; i < 8; i++)
@@ -1084,7 +1080,7 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
1084 * Expect a success message from the server. Note that this message 1080 * Expect a success message from the server. Note that this message
1085 * will be received in encrypted form. 1081 * will be received in encrypted form.
1086 */ 1082 */
1087 packet_read_expect(&payload_len, SSH_SMSG_SUCCESS); 1083 packet_read_expect(SSH_SMSG_SUCCESS);
1088 1084
1089 debug("Received encrypted confirmation."); 1085 debug("Received encrypted confirmation.");
1090} 1086}
@@ -1101,7 +1097,6 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
1101 krb5_auth_context auth_context = NULL; 1097 krb5_auth_context auth_context = NULL;
1102#endif 1098#endif
1103 int i, type; 1099 int i, type;
1104 int payload_len;
1105 1100
1106 if (supported_authentications == 0) 1101 if (supported_authentications == 0)
1107 fatal("ssh_userauth1: server supports no auth methods"); 1102 fatal("ssh_userauth1: server supports no auth methods");
@@ -1117,7 +1112,7 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
1117 * needed (the user has no password). Otherwise the server responds 1112 * needed (the user has no password). Otherwise the server responds
1118 * with failure. 1113 * with failure.
1119 */ 1114 */
1120 type = packet_read(&payload_len); 1115 type = packet_read();
1121 1116
1122 /* check whether the connection was accepted without authentication. */ 1117 /* check whether the connection was accepted without authentication. */
1123 if (type == SSH_SMSG_SUCCESS) 1118 if (type == SSH_SMSG_SUCCESS)
@@ -1131,7 +1126,7 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
1131 debug("Trying Kerberos v5 authentication."); 1126 debug("Trying Kerberos v5 authentication.");
1132 1127
1133 if (try_krb5_authentication(&context, &auth_context)) { 1128 if (try_krb5_authentication(&context, &auth_context)) {
1134 type = packet_read(&payload_len); 1129 type = packet_read();
1135 if (type == SSH_SMSG_SUCCESS) 1130 if (type == SSH_SMSG_SUCCESS)
1136 goto success; 1131 goto success;
1137 if (type != SSH_SMSG_FAILURE) 1132 if (type != SSH_SMSG_FAILURE)
@@ -1146,7 +1141,7 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
1146 debug("Trying Kerberos v4 authentication."); 1141 debug("Trying Kerberos v4 authentication.");
1147 1142
1148 if (try_krb4_authentication()) { 1143 if (try_krb4_authentication()) {
1149 type = packet_read(&payload_len); 1144 type = packet_read();
1150 if (type == SSH_SMSG_SUCCESS) 1145 if (type == SSH_SMSG_SUCCESS)
1151 goto success; 1146 goto success;
1152 if (type != SSH_SMSG_FAILURE) 1147 if (type != SSH_SMSG_FAILURE)
@@ -1168,7 +1163,7 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
1168 packet_write_wait(); 1163 packet_write_wait();
1169 1164
1170 /* The server should respond with success or failure. */ 1165 /* The server should respond with success or failure. */
1171 type = packet_read(&payload_len); 1166 type = packet_read();
1172 if (type == SSH_SMSG_SUCCESS) 1167 if (type == SSH_SMSG_SUCCESS)
1173 goto success; 1168 goto success;
1174 if (type != SSH_SMSG_FAILURE) 1169 if (type != SSH_SMSG_FAILURE)
diff --git a/sshconnect2.c b/sshconnect2.c
index cf873b8dd..cfc7b60d5 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.90 2001/12/28 12:14:27 markus Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.91 2001/12/28 14:50:54 markus Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/md5.h> 29#include <openssl/md5.h>
@@ -226,7 +226,6 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
226{ 226{
227 Authctxt authctxt; 227 Authctxt authctxt;
228 int type; 228 int type;
229 int plen;
230 229
231 if (options.challenge_response_authentication) 230 if (options.challenge_response_authentication)
232 options.kbd_interactive_authentication = 1; 231 options.kbd_interactive_authentication = 1;
@@ -236,12 +235,12 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
236 packet_put_cstring("ssh-userauth"); 235 packet_put_cstring("ssh-userauth");
237 packet_send(); 236 packet_send();
238 packet_write_wait(); 237 packet_write_wait();
239 type = packet_read(&plen); 238 type = packet_read();
240 if (type != SSH2_MSG_SERVICE_ACCEPT) { 239 if (type != SSH2_MSG_SERVICE_ACCEPT) {
241 fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type); 240 fatal("denied SSH2_MSG_SERVICE_ACCEPT: %d", type);
242 } 241 }
243 if (packet_remaining() > 0) { 242 if (packet_remaining() > 0) {
244 char *reply = packet_get_string(&plen); 243 char *reply = packet_get_string(NULL);
245 debug("service_accept: %s", reply); 244 debug("service_accept: %s", reply);
246 xfree(reply); 245 xfree(reply);
247 } else { 246 } else {
diff --git a/sshd.c b/sshd.c
index 39b58a43e..d86e683b1 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.221 2001/12/28 13:57:33 markus Exp $"); 43RCSID("$OpenBSD: sshd.c,v 1.222 2001/12/28 14:50:54 markus Exp $");
44 44
45#include <openssl/dh.h> 45#include <openssl/dh.h>
46#include <openssl/bn.h> 46#include <openssl/bn.h>
@@ -1251,7 +1251,6 @@ static void
1251do_ssh1_kex(void) 1251do_ssh1_kex(void)
1252{ 1252{
1253 int i, len; 1253 int i, len;
1254 int plen;
1255 int rsafail = 0; 1254 int rsafail = 0;
1256 BIGNUM *session_key_int; 1255 BIGNUM *session_key_int;
1257 u_char session_key[SSH_SESSION_KEY_LENGTH]; 1256 u_char session_key[SSH_SESSION_KEY_LENGTH];
@@ -1335,7 +1334,7 @@ do_ssh1_kex(void)
1335 BN_num_bits(sensitive_data.ssh1_host_key->rsa->n)); 1334 BN_num_bits(sensitive_data.ssh1_host_key->rsa->n));
1336 1335
1337 /* Read clients reply (cipher type and session key). */ 1336 /* Read clients reply (cipher type and session key). */
1338 packet_read_expect(&plen, SSH_CMSG_SESSION_KEY); 1337 packet_read_expect(SSH_CMSG_SESSION_KEY);
1339 1338
1340 /* Get cipher type and check whether we accept this. */ 1339 /* Get cipher type and check whether we accept this. */
1341 cipher_type = packet_get_char(); 1340 cipher_type = packet_get_char();