diff svr-chansession.c @ 7:425ed5c20157

Chantype handling is sorted
author Matt Johnston <matt@ucc.asn.au>
date Wed, 02 Jun 2004 04:59:49 +0000
parents ab00ef513e97
children 7f77962de998
line wrap: on
line diff
--- a/svr-chansession.c	Tue Jun 01 10:48:46 2004 +0000
+++ b/svr-chansession.c	Wed Jun 02 04:59:49 2004 +0000
@@ -56,16 +56,6 @@
 static void send_exitsignalstatus(struct Channel *channel);
 static int sesscheckclose(struct Channel *channel);
 
-const struct ChanType svrchansess = {
-	0, /* sepfds */
-	"session", /* name */
-	newchansess, /* inithandler */
-	sesscheckclose, /* checkclosehandler */
-	chansessionrequest, /* reqhandler */
-	closechansess, /* closehandler */
-};
-
-
 
 /* required to clear environment */
 extern char** environ;
@@ -75,25 +65,6 @@
 	return chansess->exited;
 }
 
-/* Set up the general chansession environment, in particular child-exit
- * handling */
-void svr_chansessinitialise() {
-
-	struct sigaction sa_chld;
-
-	/* single child process intially */
-	svr_ses.childpids = (struct ChildPid*)m_malloc(sizeof(struct ChildPid));
-	svr_ses.childpids[0].pid = -1; /* unused */
-	svr_ses.childpids[0].chansess = NULL;
-	svr_ses.childpidsize = 1;
-	sa_chld.sa_handler = sesssigchild_handler;
-	sa_chld.sa_flags = SA_NOCLDSTOP;
-	if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) {
-		dropbear_exit("signal() error");
-	}
-	
-}
-
 /* handler for childs exiting, store the state for return to the client */
 static void sesssigchild_handler(int dummy) {
 
@@ -254,7 +225,7 @@
 
 	chansess = (struct ChanSess*)channel->typedata;
 
-	send_exitsignalstatus(chansess);
+	send_exitsignalstatus(channel);
 
 	TRACE(("enter closechansess"));
 	if (chansess == NULL) {
@@ -911,6 +882,35 @@
 	dropbear_exit("child failed");
 }
 	
+const struct ChanType svrchansess = {
+	0, /* sepfds */
+	"session", /* name */
+	newchansess, /* inithandler */
+	sesscheckclose, /* checkclosehandler */
+	chansessionrequest, /* reqhandler */
+	closechansess, /* closehandler */
+};
+
+
+/* Set up the general chansession environment, in particular child-exit
+ * handling */
+void svr_chansessinitialise() {
+
+	struct sigaction sa_chld;
+
+	/* single child process intially */
+	svr_ses.childpids = (struct ChildPid*)m_malloc(sizeof(struct ChildPid));
+	svr_ses.childpids[0].pid = -1; /* unused */
+	svr_ses.childpids[0].chansess = NULL;
+	svr_ses.childpidsize = 1;
+	sa_chld.sa_handler = sesssigchild_handler;
+	sa_chld.sa_flags = SA_NOCLDSTOP;
+	if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) {
+		dropbear_exit("signal() error");
+	}
+	
+}
+
 /* add a new environment variable, allocating space for the entry */
 void addnewvar(const char* param, const char* var) {