summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 12:23:08 +1100
committerDamien Miller <djm@mindrot.org>2002-02-05 12:23:08 +1100
commit67f0bc043c2d3b4edd1d0cabb10cf3f10f544fb5 (patch)
tree1022e07bcec61662ee5ad65bd8be166e2012470c
parent50e884d12512ddb500c09ac3dbad67094fe93f09 (diff)
- 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@
-rw-r--r--ChangeLog7
-rw-r--r--channels.c18
-rw-r--r--channels.h8
-rw-r--r--ssh.c6
4 files changed, 18 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 898159d14..e03885052 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -64,6 +64,11 @@
64 - markus@cvs.openbsd.org 2002/02/03 17:55:55 64 - markus@cvs.openbsd.org 2002/02/03 17:55:55
65 [channels.c channels.h] 65 [channels.c channels.h]
66 remove unused channel_input_channel_request 66 remove unused channel_input_channel_request
67 - markus@cvs.openbsd.org 2002/02/03 17:58:21
68 [channels.c channels.h ssh.c]
69 generic callbacks are not really used, remove and
70 add a callback for msg of type SSH2_MSG_CHANNEL_OPEN_CONFIRMATION
71 ok djm@
67 72
6820020130 7320020130
69 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ 74 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@@ -7466,4 +7471,4 @@
7466 - Wrote replacements for strlcpy and mkdtemp 7471 - Wrote replacements for strlcpy and mkdtemp
7467 - Released 1.0pre1 7472 - Released 1.0pre1
7468 7473
7469$Id: ChangeLog,v 1.1816 2002/02/05 01:22:08 djm Exp $ 7474$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 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.164 2002/02/03 17:55:55 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.165 2002/02/03 17:58:21 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -260,12 +260,10 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
260 c->remote_name = remote_name; 260 c->remote_name = remote_name;
261 c->remote_window = 0; 261 c->remote_window = 0;
262 c->remote_maxpacket = 0; 262 c->remote_maxpacket = 0;
263 c->cb_fn = NULL;
264 c->cb_arg = NULL;
265 c->cb_event = 0;
266 c->force_drain = 0; 263 c->force_drain = 0;
267 c->single_connection = 0; 264 c->single_connection = 0;
268 c->detach_user = NULL; 265 c->detach_user = NULL;
266 c->confirm = NULL;
269 c->input_filter = NULL; 267 c->input_filter = NULL;
270 debug("channel %d: new [%s]", found, remote_name); 268 debug("channel %d: new [%s]", found, remote_name);
271 return c; 269 return c;
@@ -610,16 +608,14 @@ channel_request_start(int id, char *service, int wantconfirm)
610 packet_put_char(wantconfirm); 608 packet_put_char(wantconfirm);
611} 609}
612void 610void
613channel_register_callback(int id, int mtype, channel_callback_fn *fn, void *arg) 611channel_register_confirm(int id, channel_callback_fn *fn)
614{ 612{
615 Channel *c = channel_lookup(id); 613 Channel *c = channel_lookup(id);
616 if (c == NULL) { 614 if (c == NULL) {
617 log("channel_register_callback: %d: bad id", id); 615 log("channel_register_comfirm: %d: bad id", id);
618 return; 616 return;
619 } 617 }
620 c->cb_event = mtype; 618 c->confirm = fn;
621 c->cb_fn = fn;
622 c->cb_arg = arg;
623} 619}
624void 620void
625channel_register_cleanup(int id, channel_callback_fn *fn) 621channel_register_cleanup(int id, channel_callback_fn *fn)
@@ -1882,9 +1878,9 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
1882 if (compat20) { 1878 if (compat20) {
1883 c->remote_window = packet_get_int(); 1879 c->remote_window = packet_get_int();
1884 c->remote_maxpacket = packet_get_int(); 1880 c->remote_maxpacket = packet_get_int();
1885 if (c->cb_fn != NULL && c->cb_event == type) { 1881 if (c->confirm) {
1886 debug2("callback start"); 1882 debug2("callback start");
1887 c->cb_fn(c->self, c->cb_arg); 1883 c->confirm(c->self, NULL);
1888 debug2("callback done"); 1884 debug2("callback done");
1889 } 1885 }
1890 debug("channel %d: open confirm rwindow %d rmax %d", c->self, 1886 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 @@
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35/* RCSID("$OpenBSD: channels.h,v 1.61 2002/02/03 17:55:55 markus Exp $"); */ 35/* RCSID("$OpenBSD: channels.h,v 1.62 2002/02/03 17:58:21 markus Exp $"); */
36 36
37#ifndef CHANNEL_H 37#ifndef CHANNEL_H
38#define CHANNEL_H 38#define CHANNEL_H
@@ -101,9 +101,7 @@ struct Channel {
101 char *ctype; /* type */ 101 char *ctype; /* type */
102 102
103 /* callback */ 103 /* callback */
104 channel_callback_fn *cb_fn; 104 channel_callback_fn *confirm;
105 void *cb_arg;
106 int cb_event;
107 channel_callback_fn *detach_user; 105 channel_callback_fn *detach_user;
108 106
109 /* filter */ 107 /* filter */
@@ -149,8 +147,8 @@ void channel_stop_listening(void);
149void channel_send_open(int); 147void channel_send_open(int);
150void channel_request(int, char *, int); 148void channel_request(int, char *, int);
151void channel_request_start(int, char *, int); 149void channel_request_start(int, char *, int);
152void channel_register_callback(int, int mtype, channel_callback_fn *, void *);
153void channel_register_cleanup(int, channel_callback_fn *); 150void channel_register_cleanup(int, channel_callback_fn *);
151void channel_register_confirm(int, channel_callback_fn *);
154void channel_register_filter(int, channel_filter_fn *); 152void channel_register_filter(int, channel_filter_fn *);
155void channel_cancel_cleanup(int); 153void channel_cancel_cleanup(int);
156int channel_close_fd(int *); 154int 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 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.159 2002/01/27 18:08:17 stevesk Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.160 2002/02/03 17:58:21 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -1161,9 +1161,7 @@ ssh_session2_open(void)
1161 1161
1162 channel_send_open(c->self); 1162 channel_send_open(c->self);
1163 if (!no_shell_flag) 1163 if (!no_shell_flag)
1164 channel_register_callback(c->self, 1164 channel_register_confirm(c->self, ssh_session2_setup);
1165 SSH2_MSG_CHANNEL_OPEN_CONFIRMATION,
1166 ssh_session2_setup, (void *)0);
1167 1165
1168 return c->self; 1166 return c->self;
1169} 1167}