summaryrefslogtreecommitdiff
path: root/dispatch.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-10-04 11:23:58 +0100
committerColin Watson <cjwatson@debian.org>2017-10-05 23:58:12 +0100
commit0556ea972b15607b7e13ff31bc05840881c91dd3 (patch)
treed6b8d48062d0278b5ae0eeff42d0e9afa9f26860 /dispatch.c
parentdb2122d97eb1ecdd8d99b7bf79b0dd2b5addfd92 (diff)
parent801a62eedaaf47b20dbf4b426dc3e084bf0c8d49 (diff)
New upstream release (7.6p1)
Diffstat (limited to 'dispatch.c')
-rw-r--r--dispatch.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/dispatch.c b/dispatch.c
index aac933e0a..0b3ea614e 100644
--- a/dispatch.c
+++ b/dispatch.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dispatch.c,v 1.27 2015/05/01 07:10:01 djm Exp $ */ 1/* $OpenBSD: dispatch.c,v 1.31 2017/05/31 07:00:13 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -30,7 +30,6 @@
30#include <signal.h> 30#include <signal.h>
31#include <stdarg.h> 31#include <stdarg.h>
32 32
33#include "ssh1.h"
34#include "ssh2.h" 33#include "ssh2.h"
35#include "log.h" 34#include "log.h"
36#include "dispatch.h" 35#include "dispatch.h"
@@ -39,14 +38,11 @@
39#include "ssherr.h" 38#include "ssherr.h"
40 39
41int 40int
42dispatch_protocol_error(int type, u_int32_t seq, void *ctx) 41dispatch_protocol_error(int type, u_int32_t seq, struct ssh *ssh)
43{ 42{
44 struct ssh *ssh = active_state; /* XXX */
45 int r; 43 int r;
46 44
47 logit("dispatch_protocol_error: type %d seq %u", type, seq); 45 logit("dispatch_protocol_error: type %d seq %u", type, seq);
48 if (!compat20)
49 fatal("protocol error");
50 if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 || 46 if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
51 (r = sshpkt_put_u32(ssh, seq)) != 0 || 47 (r = sshpkt_put_u32(ssh, seq)) != 0 ||
52 (r = sshpkt_send(ssh)) != 0 || 48 (r = sshpkt_send(ssh)) != 0 ||
@@ -56,7 +52,7 @@ dispatch_protocol_error(int type, u_int32_t seq, void *ctx)
56} 52}
57 53
58int 54int
59dispatch_protocol_ignore(int type, u_int32_t seq, void *ssh) 55dispatch_protocol_ignore(int type, u_int32_t seq, struct ssh *ssh)
60{ 56{
61 logit("dispatch_protocol_ignore: type %d seq %u", type, seq); 57 logit("dispatch_protocol_ignore: type %d seq %u", type, seq);
62 return 0; 58 return 0;
@@ -89,8 +85,7 @@ ssh_dispatch_set(struct ssh *ssh, int type, dispatch_fn *fn)
89} 85}
90 86
91int 87int
92ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done, 88ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done)
93 void *ctxt)
94{ 89{
95 int r; 90 int r;
96 u_char type; 91 u_char type;
@@ -115,8 +110,7 @@ ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done,
115 ssh->dispatch_skip_packets--; 110 ssh->dispatch_skip_packets--;
116 continue; 111 continue;
117 } 112 }
118 /* XXX 'ssh' will replace 'ctxt' later */ 113 r = (*ssh->dispatch[type])(type, seqnr, ssh);
119 r = (*ssh->dispatch[type])(type, seqnr, ctxt);
120 if (r != 0) 114 if (r != 0)
121 return r; 115 return r;
122 } else { 116 } else {
@@ -132,11 +126,10 @@ ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done,
132} 126}
133 127
134void 128void
135ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done, 129ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done)
136 void *ctxt)
137{ 130{
138 int r; 131 int r;
139 132
140 if ((r = ssh_dispatch_run(ssh, mode, done, ctxt)) != 0) 133 if ((r = ssh_dispatch_run(ssh, mode, done)) != 0)
141 sshpkt_fatal(ssh, __func__, r); 134 sshpkt_fatal(ssh, __func__, r);
142} 135}