diff options
Diffstat (limited to 'dispatch.c')
-rw-r--r-- | dispatch.c | 28 |
1 files changed, 25 insertions, 3 deletions
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; |