diff svr-session.c @ 22:c1e5d9195402

merge of abac2150ee4f4031a98016241fbd136d24fed127 and ffa047425729e478a5b49b1ab0f8ec71c08a1421
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Jun 2004 07:14:16 +0000
parents 5ae28f6101c1
children 469950e86d0f
line wrap: on
line diff
--- a/svr-session.c	Mon Jun 07 11:36:07 2004 +0000
+++ b/svr-session.c	Wed Jun 23 07:14:16 2004 +0000
@@ -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 @@
 	/* 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 @@
 	/* 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 @@
 			/* 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();
 			}
 		}