diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | auth2.c | 17 | ||||
-rw-r--r-- | dispatch.c | 28 | ||||
-rw-r--r-- | dispatch.h | 4 | ||||
-rw-r--r-- | kex.c | 9 |
5 files changed, 44 insertions, 25 deletions
@@ -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 | ||
133 | 20020121 | 142 | 20020121 |
@@ -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 $ |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2.c,v 1.80 2001/12/28 15:06:00 markus Exp $"); | 26 | RCSID("$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 | ||
72 | static void input_service_request(int, u_int32_t, void *); | 72 | static void input_service_request(int, u_int32_t, void *); |
73 | static void input_userauth_request(int, u_int32_t, void *); | 73 | static void input_userauth_request(int, u_int32_t, void *); |
74 | static void protocol_error(int, u_int32_t, void *); | ||
75 | 74 | ||
76 | /* helper */ | 75 | /* helper */ |
77 | static Authmethod *authmethod_lookup(const char *); | 76 | static 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 | ||
132 | static void | 131 | static void |
133 | protocol_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 | |||
142 | static void | ||
143 | input_service_request(int type, u_int32_t seq, void *ctxt) | 132 | input_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" |
25 | RCSID("$OpenBSD: dispatch.c,v 1.14 2001/12/28 15:06:00 markus Exp $"); | 25 | RCSID("$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]; | |||
39 | void | 39 | void |
40 | dispatch_protocol_error(int type, u_int32_t seq, void *ctxt) | 40 | dispatch_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 | } | ||
50 | void | ||
51 | dispatch_protocol_ignore(int type, u_int32_t seq, void *ctxt) | ||
52 | { | ||
53 | log("dispatch_protocol_ignore: type %d seq %u", type, seq); | ||
43 | } | 54 | } |
44 | void | 55 | void |
45 | dispatch_init(dispatch_fn *dflt) | 56 | dispatch_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 | } |
51 | void | 62 | void |
63 | dispatch_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 | } | ||
73 | void | ||
52 | dispatch_set(int type, dispatch_fn *fn) | 74 | dispatch_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 | ||
33 | void dispatch_init(dispatch_fn *); | 33 | void dispatch_init(dispatch_fn *); |
34 | void dispatch_set(int, dispatch_fn *); | 34 | void dispatch_set(int, dispatch_fn *); |
35 | void dispatch_range(u_int, u_int, dispatch_fn *); | ||
35 | void dispatch_run(int, int *, void *); | 36 | void dispatch_run(int, int *, void *); |
36 | void dispatch_protocol_error(int, u_int32_t, void *); | 37 | void dispatch_protocol_error(int, u_int32_t, void *); |
38 | void dispatch_protocol_ignore(int, u_int32_t, void *); | ||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.41 2001/12/28 15:06:00 markus Exp $"); | 26 | RCSID("$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) | |||
115 | static void | 115 | static void |
116 | kex_clear_dispatch(void) | 116 | kex_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 | ||
125 | void | 122 | void |