]> andersk Git - openssh.git/commitdiff
- markus@cvs.openbsd.org 2002/02/03 17:53:25
authordjm <djm>
Tue, 5 Feb 2002 01:21:42 +0000 (01:21 +0000)
committerdjm <djm>
Tue, 5 Feb 2002 01:21:42 +0000 (01:21 +0000)
     [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@

ChangeLog
auth1.c
serverloop.c
session.c
session.h

index 261bf33b107172a580bd2d6f684b8bc53ad64c30..dfda5f567230fd9787ba750cdb5b24bd1bdad948 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - markus@cvs.openbsd.org 2002/01/31 15:00:05
      [serverloop.c]
      no need for WNOHANG; ok stevesk@
+   - 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@
 
 20020130
  - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
diff --git a/auth1.c b/auth1.c
index 73fffec35e6284237c07cb341c65de401528163e..bae00fb53dd74e3421711e28c50e4d7921d6254e 100644 (file)
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.34 2001/12/28 14:50:54 markus Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $");
 
 #include "xmalloc.h"
 #include "rsa.h"
@@ -22,6 +22,7 @@ RCSID("$OpenBSD: auth1.c,v 1.34 2001/12/28 14:50:54 markus Exp $");
 #include "servconf.h"
 #include "compat.h"
 #include "auth.h"
+#include "channels.h"
 #include "session.h"
 #include "misc.h"
 #include "uidswap.h"
index bd1d048ef2a6819f10bb75b9e9c4bf22d1e7dabf..b8a5f1608fb1e7e329bc955c25e8cc2e207860de 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.96 2002/01/31 15:00:05 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.97 2002/02/03 17:53:25 markus Exp $");
 
 #include "xmalloc.h"
 #include "packet.h"
@@ -902,8 +902,6 @@ server_request_session(char *ctype)
                channel_free(c);
                return NULL;
        }
-       channel_register_callback(c->self, SSH2_MSG_CHANNEL_REQUEST,
-           session_input_channel_req, (void *)0);
        channel_register_cleanup(c->self, session_close_by_channel);
        return c;
 }
@@ -1004,6 +1002,33 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
        }
        xfree(rtype);
 }
+static void
+server_input_channel_req(int type, u_int32_t seq, void *ctxt)
+{
+       Channel *c;
+       int id, reply, success = 0;
+       char *rtype;
+
+       id = packet_get_int();
+       rtype = packet_get_string(NULL);
+       reply = packet_get_char();
+
+       debug("server_input_channel_req: channel %d request %s reply %d",
+           id, rtype, reply);
+
+       if ((c = channel_lookup(id)) == NULL)
+               packet_disconnect("server_input_channel_req: "
+                   "unknown channel %d", id);
+       if (c->type == SSH_CHANNEL_LARVAL || c->type == SSH_CHANNEL_OPEN)
+               success = session_input_channel_req(c, rtype);
+       if (reply) {
+               packet_start(success ?
+                   SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
+               packet_put_int(c->remote_id);
+               packet_send();
+       }
+       xfree(rtype);
+}
 
 static void
 server_init_dispatch_20(void)
@@ -1017,7 +1042,7 @@ server_init_dispatch_20(void)
        dispatch_set(SSH2_MSG_CHANNEL_OPEN, &server_input_channel_open);
        dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation);
        dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure);
-       dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &channel_input_channel_request);
+       dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &server_input_channel_req);
        dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust);
        dispatch_set(SSH2_MSG_GLOBAL_REQUEST, &server_input_global_request);
        /* client_alive */
index 2b4bbb66a7b05966c7926232eaea1ca44703f8a0..c6e527ffdb9d9cbf5469e9c54e41b7baf5becf62 100644 (file)
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.122 2002/01/29 22:46:41 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.123 2002/02/03 17:53:25 markus Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -1729,28 +1729,18 @@ session_auth_agent_req(Session *s)
        }
 }
 
-void
-session_input_channel_req(int id, void *arg)
+int
+session_input_channel_req(Channel *c, const char *rtype)
 {
-       u_int len;
-       int reply;
        int success = 0;
-       char *rtype;
        Session *s;
-       Channel *c;
-
-       rtype = packet_get_string(&len);
-       reply = packet_get_char();
-
-       s = session_by_channel(id);
-       if (s == NULL)
-               fatal("session_input_channel_req: channel %d: no session", id);
-       c = channel_lookup(id);
-       if (c == NULL)
-               fatal("session_input_channel_req: channel %d: bad channel", id);
 
-       debug("session_input_channel_req: session %d channel %d request %s reply %d",
-           s->self, id, rtype, reply);
+       if ((s = session_by_channel(c->self)) == NULL) {
+               log("session_input_channel_req: no session %d req %.100s",
+                   c->self, rtype);
+               return 0;
+       }
+       debug("session_input_channel_req: session %d req %s", s->self, rtype);
 
        /*
         * a session is in LARVAL state until a shell, a command
@@ -1774,14 +1764,7 @@ session_input_channel_req(int id, void *arg)
        if (strcmp(rtype, "window-change") == 0) {
                success = session_window_change_req(s);
        }
-
-       if (reply) {
-               packet_start(success ?
-                   SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
-               packet_put_int(c->remote_id);
-               packet_send();
-       }
-       xfree(rtype);
+       return success;
 }
 
 void
index 6d5b8e69922dd89bcee8e7c644b77d4c9d1ad90a..ec8284a5f68faf73b3ba8d72cbc42a125bb20ec5 100644 (file)
--- a/session.h
+++ b/session.h
@@ -1,4 +1,4 @@
-/*     $OpenBSD: session.h,v 1.13 2001/10/10 22:18:47 markus Exp $     */
+/*     $OpenBSD: session.h,v 1.14 2002/02/03 17:53:25 markus Exp $     */
 
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
@@ -29,7 +29,7 @@
 void    do_authenticated(Authctxt *);
 
 int     session_open(Authctxt*, int);
-void    session_input_channel_req(int, void *);
+int     session_input_channel_req(Channel *, const char *);
 void    session_close_by_pid(pid_t, int);
 void    session_close_by_channel(int, void *);
 void    session_destroy_all(void);
This page took 0.048385 seconds and 5 git commands to generate.