summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--auth1.c3
-rw-r--r--serverloop.c33
-rw-r--r--session.c37
-rw-r--r--session.h4
5 files changed, 51 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index baef6fabd..bcdce1860 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,13 @@
54 - markus@cvs.openbsd.org 2002/01/31 15:00:05 54 - markus@cvs.openbsd.org 2002/01/31 15:00:05
55 [serverloop.c] 55 [serverloop.c]
56 no need for WNOHANG; ok stevesk@ 56 no need for WNOHANG; ok stevesk@
57 - markus@cvs.openbsd.org 2002/02/03 17:53:25
58 [auth1.c serverloop.c session.c session.h]
59 don't use channel_input_channel_request and callback
60 use new server_input_channel_req() instead:
61 server_input_channel_req does generic request parsing on server side
62 session_input_channel_req handles just session specific things now
63 ok djm@
57 64
5820020130 6520020130
59 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ 66 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@@ -7456,4 +7463,4 @@
7456 - Wrote replacements for strlcpy and mkdtemp 7463 - Wrote replacements for strlcpy and mkdtemp
7457 - Released 1.0pre1 7464 - Released 1.0pre1
7458 7465
7459$Id: ChangeLog,v 1.1814 2002/02/05 01:20:16 djm Exp $ 7466$Id: ChangeLog,v 1.1815 2002/02/05 01:21:42 djm Exp $
diff --git a/auth1.c b/auth1.c
index 73fffec35..bae00fb53 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.34 2001/12/28 14:50:54 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $");
14 14
15#include "xmalloc.h" 15#include "xmalloc.h"
16#include "rsa.h" 16#include "rsa.h"
@@ -22,6 +22,7 @@ RCSID("$OpenBSD: auth1.c,v 1.34 2001/12/28 14:50:54 markus Exp $");
22#include "servconf.h" 22#include "servconf.h"
23#include "compat.h" 23#include "compat.h"
24#include "auth.h" 24#include "auth.h"
25#include "channels.h"
25#include "session.h" 26#include "session.h"
26#include "misc.h" 27#include "misc.h"
27#include "uidswap.h" 28#include "uidswap.h"
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 */
diff --git a/session.c b/session.c
index 2b4bbb66a..c6e527ffd 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.122 2002/01/29 22:46:41 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.123 2002/02/03 17:53:25 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -1729,28 +1729,18 @@ session_auth_agent_req(Session *s)
1729 } 1729 }
1730} 1730}
1731 1731
1732void 1732int
1733session_input_channel_req(int id, void *arg) 1733session_input_channel_req(Channel *c, const char *rtype)
1734{ 1734{
1735 u_int len;
1736 int reply;
1737 int success = 0; 1735 int success = 0;
1738 char *rtype;
1739 Session *s; 1736 Session *s;
1740 Channel *c;
1741
1742 rtype = packet_get_string(&len);
1743 reply = packet_get_char();
1744
1745 s = session_by_channel(id);
1746 if (s == NULL)
1747 fatal("session_input_channel_req: channel %d: no session", id);
1748 c = channel_lookup(id);
1749 if (c == NULL)
1750 fatal("session_input_channel_req: channel %d: bad channel", id);
1751 1737
1752 debug("session_input_channel_req: session %d channel %d request %s reply %d", 1738 if ((s = session_by_channel(c->self)) == NULL) {
1753 s->self, id, rtype, reply); 1739 log("session_input_channel_req: no session %d req %.100s",
1740 c->self, rtype);
1741 return 0;
1742 }
1743 debug("session_input_channel_req: session %d req %s", s->self, rtype);
1754 1744
1755 /* 1745 /*
1756 * a session is in LARVAL state until a shell, a command 1746 * a session is in LARVAL state until a shell, a command
@@ -1774,14 +1764,7 @@ session_input_channel_req(int id, void *arg)
1774 if (strcmp(rtype, "window-change") == 0) { 1764 if (strcmp(rtype, "window-change") == 0) {
1775 success = session_window_change_req(s); 1765 success = session_window_change_req(s);
1776 } 1766 }
1777 1767 return success;
1778 if (reply) {
1779 packet_start(success ?
1780 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
1781 packet_put_int(c->remote_id);
1782 packet_send();
1783 }
1784 xfree(rtype);
1785} 1768}
1786 1769
1787void 1770void
diff --git a/session.h b/session.h
index 6d5b8e699..ec8284a5f 100644
--- a/session.h
+++ b/session.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.h,v 1.13 2001/10/10 22:18:47 markus Exp $ */ 1/* $OpenBSD: session.h,v 1.14 2002/02/03 17:53:25 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -29,7 +29,7 @@
29void do_authenticated(Authctxt *); 29void do_authenticated(Authctxt *);
30 30
31int session_open(Authctxt*, int); 31int session_open(Authctxt*, int);
32void session_input_channel_req(int, void *); 32int session_input_channel_req(Channel *, const char *);
33void session_close_by_pid(pid_t, int); 33void session_close_by_pid(pid_t, int);
34void session_close_by_channel(int, void *); 34void session_close_by_channel(int, void *);
35void session_destroy_all(void); 35void session_destroy_all(void);