diff options
author | Matt Johnston <matt@ucc.asn.au> | 2004-06-23 07:14:16 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2004-06-23 07:14:16 +0000 |
commit | 09b50641ff656b22cf1f24e43d8504a1a7f3afec (patch) | |
tree | 287484eb2d40c1dd174f1073a16dd959952ac25a /svr-session.c | |
parent | 8977fbbd97d30ed5a064e2f514abfeb22b7f05dd (diff) | |
parent | 18bfb4dd4812ab1e30bb4b2ecb6674ea2d368322 (diff) |
merge of abac2150ee4f4031a98016241fbd136d24fed127
and ffa047425729e478a5b49b1ab0f8ec71c08a1421
--HG--
extra : convert_revision : e9b7d4eda64d70aff736f48cc8dea680b153139b
Diffstat (limited to 'svr-session.c')
-rw-r--r-- | svr-session.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/svr-session.c b/svr-session.c index 4310e2b..d3094ea 100644 --- a/svr-session.c +++ b/svr-session.c @@ -36,18 +36,39 @@ #include "chansession.h" #include "atomicio.h" #include "tcpfwd-direct.h" +#include "service.h" +#include "auth.h" +#include "tcpfwd-remote.h" static void svr_remoteclosed(); struct serversession svr_ses; -const struct ChanType *chantypes[] = { +static const packettype svr_packettypes[] = { + /* TYPE, AUTHREQUIRED, FUNCTION */ + {SSH_MSG_SERVICE_REQUEST, recv_msg_service_request}, // server + {SSH_MSG_USERAUTH_REQUEST, recv_msg_userauth_request}, //server + {SSH_MSG_KEXINIT, recv_msg_kexinit}, + {SSH_MSG_KEXDH_INIT, recv_msg_kexdh_init}, + {SSH_MSG_NEWKEYS, recv_msg_newkeys}, + {SSH_MSG_CHANNEL_DATA, recv_msg_channel_data}, + {SSH_MSG_CHANNEL_WINDOW_ADJUST, recv_msg_channel_window_adjust}, + {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp}, + {SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request}, + {SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open}, + {SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof}, + {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close}, + {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation}, + {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure}, + {0, 0} /* End */ +}; + +static const struct ChanType *svr_chantypes[] = { &svrchansess, &chan_tcpdirect, NULL /* Null termination is mandatory. */ }; - void svr_session(int sock, runopts *opts, int childpipe, struct sockaddr* remoteaddr) { @@ -64,7 +85,7 @@ void svr_session(int sock, runopts *opts, int childpipe, /* Initialise server specific parts of the session */ svr_ses.childpipe = childpipe; authinitialise(); - chaninitialise(chantypes); + chaninitialise(svr_chantypes); svr_chansessinitialise(); if (gettimeofday(&timeout, 0) < 0) { @@ -76,6 +97,9 @@ void svr_session(int sock, runopts *opts, int childpipe, /* set up messages etc */ session_remoteclosed = svr_remoteclosed; + /* packet handlers */ + ses.packettypes = svr_packettypes; + /* We're ready to go now */ sessinitdone = 1; @@ -145,7 +169,7 @@ void svr_session(int sock, runopts *opts, int childpipe, /* Process the decrypted packet. After this, the read buffer * will be ready for a new packet */ if (ses.payload != NULL) { - svr_process_packet(); + process_packet(); } } |