diff --git a/ChangeLog b/ChangeLog index 898159d14..e03885052 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,11 @@ - markus@cvs.openbsd.org 2002/02/03 17:55:55 [channels.c channels.h] remove unused channel_input_channel_request + - markus@cvs.openbsd.org 2002/02/03 17:58:21 + [channels.c channels.h ssh.c] + generic callbacks are not really used, remove and + add a callback for msg of type SSH2_MSG_CHANNEL_OPEN_CONFIRMATION + ok djm@ 20020130 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ @@ -7466,4 +7471,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1816 2002/02/05 01:22:08 djm Exp $ +$Id: ChangeLog,v 1.1817 2002/02/05 01:23:08 djm Exp $ diff --git a/channels.c b/channels.c index 568779dff..e5f910ed7 100644 --- a/channels.c +++ b/channels.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.164 2002/02/03 17:55:55 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.165 2002/02/03 17:58:21 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -260,12 +260,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, c->remote_name = remote_name; c->remote_window = 0; c->remote_maxpacket = 0; - c->cb_fn = NULL; - c->cb_arg = NULL; - c->cb_event = 0; c->force_drain = 0; c->single_connection = 0; c->detach_user = NULL; + c->confirm = NULL; c->input_filter = NULL; debug("channel %d: new [%s]", found, remote_name); return c; @@ -610,16 +608,14 @@ channel_request_start(int id, char *service, int wantconfirm) packet_put_char(wantconfirm); } void -channel_register_callback(int id, int mtype, channel_callback_fn *fn, void *arg) +channel_register_confirm(int id, channel_callback_fn *fn) { Channel *c = channel_lookup(id); if (c == NULL) { - log("channel_register_callback: %d: bad id", id); + log("channel_register_comfirm: %d: bad id", id); return; } - c->cb_event = mtype; - c->cb_fn = fn; - c->cb_arg = arg; + c->confirm = fn; } void channel_register_cleanup(int id, channel_callback_fn *fn) @@ -1882,9 +1878,9 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) if (compat20) { c->remote_window = packet_get_int(); c->remote_maxpacket = packet_get_int(); - if (c->cb_fn != NULL && c->cb_event == type) { + if (c->confirm) { debug2("callback start"); - c->cb_fn(c->self, c->cb_arg); + c->confirm(c->self, NULL); debug2("callback done"); } debug("channel %d: open confirm rwindow %d rmax %d", c->self, diff --git a/channels.h b/channels.h index fa43b8ea6..781c49d47 100644 --- a/channels.h +++ b/channels.h @@ -32,7 +32,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* RCSID("$OpenBSD: channels.h,v 1.61 2002/02/03 17:55:55 markus Exp $"); */ +/* RCSID("$OpenBSD: channels.h,v 1.62 2002/02/03 17:58:21 markus Exp $"); */ #ifndef CHANNEL_H #define CHANNEL_H @@ -101,9 +101,7 @@ struct Channel { char *ctype; /* type */ /* callback */ - channel_callback_fn *cb_fn; - void *cb_arg; - int cb_event; + channel_callback_fn *confirm; channel_callback_fn *detach_user; /* filter */ @@ -149,8 +147,8 @@ void channel_stop_listening(void); void channel_send_open(int); void channel_request(int, char *, int); void channel_request_start(int, char *, int); -void channel_register_callback(int, int mtype, channel_callback_fn *, void *); void channel_register_cleanup(int, channel_callback_fn *); +void channel_register_confirm(int, channel_callback_fn *); void channel_register_filter(int, channel_filter_fn *); void channel_cancel_cleanup(int); int channel_close_fd(int *); diff --git a/ssh.c b/ssh.c index 46d9d747a..5ec27219e 100644 --- a/ssh.c +++ b/ssh.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.159 2002/01/27 18:08:17 stevesk Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.160 2002/02/03 17:58:21 markus Exp $"); #include #include @@ -1161,9 +1161,7 @@ ssh_session2_open(void) channel_send_open(c->self); if (!no_shell_flag) - channel_register_callback(c->self, - SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, - ssh_session2_setup, (void *)0); + channel_register_confirm(c->self, ssh_session2_setup); return c->self; }