summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--auth2.c17
-rw-r--r--dispatch.c28
-rw-r--r--dispatch.h4
-rw-r--r--kex.c9
5 files changed, 44 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index d29993ab7..e4e88111d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -128,6 +128,15 @@
128 - markus@cvs.openbsd.org 2002/01/11 13:36:43 128 - markus@cvs.openbsd.org 2002/01/11 13:36:43
129 [ssh2.h] 129 [ssh2.h]
130 add defines for msg type ranges 130 add defines for msg type ranges
131 - markus@cvs.openbsd.org 2002/01/11 13:39:36
132 [auth2.c dispatch.c dispatch.h kex.c]
133 a single dispatch_protocol_error() that sends a message of
134 type 'UNIMPLEMENTED'
135 dispatch_range(): set handler for a ranges message types
136 use dispatch_protocol_ignore() for authentication requests after
137 successful authentication (the drafts requirement).
138 serverloop/clientloop now send a 'UNIMPLEMENTED' message instead
139 of exiting.
131 140
132 141
13320020121 14220020121
@@ -7276,4 +7285,4 @@
7276 - Wrote replacements for strlcpy and mkdtemp 7285 - Wrote replacements for strlcpy and mkdtemp
7277 - Released 1.0pre1 7286 - Released 1.0pre1
7278 7287
7279$Id: ChangeLog,v 1.1760 2002/01/22 12:23:41 djm Exp $ 7288$Id: ChangeLog,v 1.1761 2002/01/22 12:24:13 djm Exp $
diff --git a/auth2.c b/auth2.c
index e48bed7c1..dc35a55f4 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2.c,v 1.80 2001/12/28 15:06:00 markus Exp $"); 26RCSID("$OpenBSD: auth2.c,v 1.81 2002/01/11 13:39:36 markus Exp $");
27 27
28#include <openssl/evp.h> 28#include <openssl/evp.h>
29 29
@@ -71,7 +71,6 @@ struct Authmethod {
71 71
72static void input_service_request(int, u_int32_t, void *); 72static void input_service_request(int, u_int32_t, void *);
73static void input_userauth_request(int, u_int32_t, void *); 73static void input_userauth_request(int, u_int32_t, void *);
74static void protocol_error(int, u_int32_t, void *);
75 74
76/* helper */ 75/* helper */
77static Authmethod *authmethod_lookup(const char *); 76static Authmethod *authmethod_lookup(const char *);
@@ -123,23 +122,13 @@ do_authentication2(void)
123 if (options.pam_authentication_via_kbd_int) 122 if (options.pam_authentication_via_kbd_int)
124 options.kbd_interactive_authentication = 1; 123 options.kbd_interactive_authentication = 1;
125 124
126 dispatch_init(&protocol_error); 125 dispatch_init(&dispatch_protocol_error);
127 dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request); 126 dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
128 dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt); 127 dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
129 do_authenticated(authctxt); 128 do_authenticated(authctxt);
130} 129}
131 130
132static void 131static void
133protocol_error(int type, u_int32_t seq, void *ctxt)
134{
135 log("auth: protocol error: type %d", type);
136 packet_start(SSH2_MSG_UNIMPLEMENTED);
137 packet_put_int(seq);
138 packet_send();
139 packet_write_wait();
140}
141
142static void
143input_service_request(int type, u_int32_t seq, void *ctxt) 132input_service_request(int type, u_int32_t seq, void *ctxt)
144{ 133{
145 Authctxt *authctxt = ctxt; 134 Authctxt *authctxt = ctxt;
@@ -265,7 +254,7 @@ userauth_finish(Authctxt *authctxt, int authenticated, char *method)
265 /* XXX todo: check if multiple auth methods are needed */ 254 /* XXX todo: check if multiple auth methods are needed */
266 if (authenticated == 1) { 255 if (authenticated == 1) {
267 /* turn off userauth */ 256 /* turn off userauth */
268 dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error); 257 dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &dispatch_protocol_ignore);
269 packet_start(SSH2_MSG_USERAUTH_SUCCESS); 258 packet_start(SSH2_MSG_USERAUTH_SUCCESS);
270 packet_send(); 259 packet_send();
271 packet_write_wait(); 260 packet_write_wait();
diff --git a/dispatch.c b/dispatch.c
index 157c25cbb..ce32bc22f 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.14 2001/12/28 15:06:00 markus Exp $"); 25RCSID("$OpenBSD: dispatch.c,v 1.15 2002/01/11 13:39:36 markus Exp $");
26 26
27#include "ssh1.h" 27#include "ssh1.h"
28#include "ssh2.h" 28#include "ssh2.h"
@@ -39,16 +39,38 @@ dispatch_fn *dispatch[DISPATCH_MAX];
39void 39void
40dispatch_protocol_error(int type, u_int32_t seq, void *ctxt) 40dispatch_protocol_error(int type, u_int32_t seq, void *ctxt)
41{ 41{
42 fatal("dispatch_protocol_error: type %d seq %u", type, seq); 42 log("dispatch_protocol_error: type %d seq %u", type, seq);
43 if (!compat20)
44 fatal("protocol error");
45 packet_start(SSH2_MSG_UNIMPLEMENTED);
46 packet_put_int(seq);
47 packet_send();
48 packet_write_wait();
49}
50void
51dispatch_protocol_ignore(int type, u_int32_t seq, void *ctxt)
52{
53 log("dispatch_protocol_ignore: type %d seq %u", type, seq);
43} 54}
44void 55void
45dispatch_init(dispatch_fn *dflt) 56dispatch_init(dispatch_fn *dflt)
46{ 57{
47 int i; 58 u_int i;
48 for (i = 0; i < DISPATCH_MAX; i++) 59 for (i = 0; i < DISPATCH_MAX; i++)
49 dispatch[i] = dflt; 60 dispatch[i] = dflt;
50} 61}
51void 62void
63dispatch_range(u_int from, u_int to, dispatch_fn *fn)
64{
65 u_int i;
66
67 for (i = from; i <= to; i++) {
68 if (i >= DISPATCH_MAX)
69 break;
70 dispatch[i] = fn;
71 }
72}
73void
52dispatch_set(int type, dispatch_fn *fn) 74dispatch_set(int type, dispatch_fn *fn)
53{ 75{
54 dispatch[type] = fn; 76 dispatch[type] = fn;
diff --git a/dispatch.h b/dispatch.h
index 78786b3ff..a82e2165b 100644
--- a/dispatch.h
+++ b/dispatch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dispatch.h,v 1.8 2001/12/28 15:06:00 markus Exp $ */ 1/* $OpenBSD: dispatch.h,v 1.9 2002/01/11 13:39:36 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -32,5 +32,7 @@ typedef void dispatch_fn(int, u_int32_t, void *);
32 32
33void dispatch_init(dispatch_fn *); 33void dispatch_init(dispatch_fn *);
34void dispatch_set(int, dispatch_fn *); 34void dispatch_set(int, dispatch_fn *);
35void dispatch_range(u_int, u_int, dispatch_fn *);
35void dispatch_run(int, int *, void *); 36void dispatch_run(int, int *, void *);
36void dispatch_protocol_error(int, u_int32_t, void *); 37void dispatch_protocol_error(int, u_int32_t, void *);
38void dispatch_protocol_ignore(int, u_int32_t, void *);
diff --git a/kex.c b/kex.c
index 255cc7431..c74f1e4a2 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.41 2001/12/28 15:06:00 markus Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.42 2002/01/11 13:39:36 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29 29
@@ -115,11 +115,8 @@ kex_protocol_error(int type, u_int32_t seq, void *ctxt)
115static void 115static void
116kex_clear_dispatch(void) 116kex_clear_dispatch(void)
117{ 117{
118 int i; 118 dispatch_range(SSH2_MSG_TRANSPORT_MIN,
119 119 SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error);
120 /* Numbers 30-49 are used for kex packets */
121 for (i = 30; i <= 49; i++)
122 dispatch_set(i, &kex_protocol_error);
123} 120}
124 121
125void 122void