summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 12:21:42 +1100
committerDamien Miller <djm@mindrot.org>2002-02-05 12:21:42 +1100
commitc7ef63dd41aa3880271c5ec5f61dc38e6d74f900 (patch)
tree7026ceb6a544a18fa3c197589a338ba5a4697aa8 /serverloop.c
parent664d6b9a8eb4519f3a7f7658886f5745a943d3ef (diff)
- markus@cvs.openbsd.org 2002/02/03 17:53:25
[auth1.c serverloop.c session.c session.h] don't use channel_input_channel_request and callback use new server_input_channel_req() instead: server_input_channel_req does generic request parsing on server side session_input_channel_req handles just session specific things now ok djm@
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/serverloop.c b/serverloop.c
index bd1d048ef..b8a5f1608 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.96 2002/01/31 15:00:05 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.97 2002/02/03 17:53:25 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -902,8 +902,6 @@ server_request_session(char *ctype)
902 channel_free(c); 902 channel_free(c);
903 return NULL; 903 return NULL;
904 } 904 }
905 channel_register_callback(c->self, SSH2_MSG_CHANNEL_REQUEST,
906 session_input_channel_req, (void *)0);
907 channel_register_cleanup(c->self, session_close_by_channel); 905 channel_register_cleanup(c->self, session_close_by_channel);
908 return c; 906 return c;
909} 907}
@@ -1004,6 +1002,33 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
1004 } 1002 }
1005 xfree(rtype); 1003 xfree(rtype);
1006} 1004}
1005static void
1006server_input_channel_req(int type, u_int32_t seq, void *ctxt)
1007{
1008 Channel *c;
1009 int id, reply, success = 0;
1010 char *rtype;
1011
1012 id = packet_get_int();
1013 rtype = packet_get_string(NULL);
1014 reply = packet_get_char();
1015
1016 debug("server_input_channel_req: channel %d request %s reply %d",
1017 id, rtype, reply);
1018
1019 if ((c = channel_lookup(id)) == NULL)
1020 packet_disconnect("server_input_channel_req: "
1021 "unknown channel %d", id);
1022 if (c->type == SSH_CHANNEL_LARVAL || c->type == SSH_CHANNEL_OPEN)
1023 success = session_input_channel_req(c, rtype);
1024 if (reply) {
1025 packet_start(success ?
1026 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
1027 packet_put_int(c->remote_id);
1028 packet_send();
1029 }
1030 xfree(rtype);
1031}
1007 1032
1008static void 1033static void
1009server_init_dispatch_20(void) 1034server_init_dispatch_20(void)
@@ -1017,7 +1042,7 @@ server_init_dispatch_20(void)
1017 dispatch_set(SSH2_MSG_CHANNEL_OPEN, &server_input_channel_open); 1042 dispatch_set(SSH2_MSG_CHANNEL_OPEN, &server_input_channel_open);
1018 dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); 1043 dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation);
1019 dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); 1044 dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure);
1020 dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request); 1045 dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &server_input_channel_req);
1021 dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); 1046 dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust);
1022 dispatch_set(SSH2_MSG_GLOBAL_REQUEST, &server_input_global_request); 1047 dispatch_set(SSH2_MSG_GLOBAL_REQUEST, &server_input_global_request);
1023 /* client_alive */ 1048 /* client_alive */