[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@
This commit is contained in:
Damien Miller 2002-02-05 12:23:08 +11:00
parent 50e884d125
commit 67f0bc043c
4 changed files with 18 additions and 21 deletions

View File

@ -64,6 +64,11 @@
- markus@cvs.openbsd.org 2002/02/03 17:55:55 - markus@cvs.openbsd.org 2002/02/03 17:55:55
[channels.c channels.h] [channels.c channels.h]
remove unused channel_input_channel_request 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 20020130
- (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@ -7466,4 +7471,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - 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 $

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #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 "ssh.h"
#include "ssh1.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_name = remote_name;
c->remote_window = 0; c->remote_window = 0;
c->remote_maxpacket = 0; c->remote_maxpacket = 0;
c->cb_fn = NULL;
c->cb_arg = NULL;
c->cb_event = 0;
c->force_drain = 0; c->force_drain = 0;
c->single_connection = 0; c->single_connection = 0;
c->detach_user = NULL; c->detach_user = NULL;
c->confirm = NULL;
c->input_filter = NULL; c->input_filter = NULL;
debug("channel %d: new [%s]", found, remote_name); debug("channel %d: new [%s]", found, remote_name);
return c; return c;
@ -610,16 +608,14 @@ channel_request_start(int id, char *service, int wantconfirm)
packet_put_char(wantconfirm); packet_put_char(wantconfirm);
} }
void 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); Channel *c = channel_lookup(id);
if (c == NULL) { if (c == NULL) {
log("channel_register_callback: %d: bad id", id); log("channel_register_comfirm: %d: bad id", id);
return; return;
} }
c->cb_event = mtype; c->confirm = fn;
c->cb_fn = fn;
c->cb_arg = arg;
} }
void void
channel_register_cleanup(int id, channel_callback_fn *fn) 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) { if (compat20) {
c->remote_window = packet_get_int(); c->remote_window = packet_get_int();
c->remote_maxpacket = packet_get_int(); c->remote_maxpacket = packet_get_int();
if (c->cb_fn != NULL && c->cb_event == type) { if (c->confirm) {
debug2("callback start"); debug2("callback start");
c->cb_fn(c->self, c->cb_arg); c->confirm(c->self, NULL);
debug2("callback done"); debug2("callback done");
} }
debug("channel %d: open confirm rwindow %d rmax %d", c->self, debug("channel %d: open confirm rwindow %d rmax %d", c->self,

View File

@ -32,7 +32,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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 #ifndef CHANNEL_H
#define CHANNEL_H #define CHANNEL_H
@ -101,9 +101,7 @@ struct Channel {
char *ctype; /* type */ char *ctype; /* type */
/* callback */ /* callback */
channel_callback_fn *cb_fn; channel_callback_fn *confirm;
void *cb_arg;
int cb_event;
channel_callback_fn *detach_user; channel_callback_fn *detach_user;
/* filter */ /* filter */
@ -149,8 +147,8 @@ void channel_stop_listening(void);
void channel_send_open(int); void channel_send_open(int);
void channel_request(int, char *, int); void channel_request(int, char *, int);
void channel_request_start(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_cleanup(int, channel_callback_fn *);
void channel_register_confirm(int, channel_callback_fn *);
void channel_register_filter(int, channel_filter_fn *); void channel_register_filter(int, channel_filter_fn *);
void channel_cancel_cleanup(int); void channel_cancel_cleanup(int);
int channel_close_fd(int *); int channel_close_fd(int *);

6
ssh.c
View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #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 <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -1161,9 +1161,7 @@ ssh_session2_open(void)
channel_send_open(c->self); channel_send_open(c->self);
if (!no_shell_flag) if (!no_shell_flag)
channel_register_callback(c->self, channel_register_confirm(c->self, ssh_session2_setup);
SSH2_MSG_CHANNEL_OPEN_CONFIRMATION,
ssh_session2_setup, (void *)0);
return c->self; return c->self;
} }