comparison svr-chansession.c @ 108:10f4d3319780

- added circular buffering for channels - added stderr support for the client - cleaned up a bunch of "unused" warnings, duplicated header definitions - added exit-status support for the client
author Matt Johnston <matt@ucc.asn.au>
date Thu, 26 Aug 2004 13:16:40 +0000
parents b8e36c1a5520
children 2e9d1f29c50f
comparison
equal deleted inserted replaced
107:d3eb1fa8484e 108:10f4d3319780
53 static void closechansess(struct Channel *channel); 53 static void closechansess(struct Channel *channel);
54 static int newchansess(struct Channel *channel); 54 static int newchansess(struct Channel *channel);
55 static void chansessionrequest(struct Channel *channel); 55 static void chansessionrequest(struct Channel *channel);
56 56
57 static void send_exitsignalstatus(struct Channel *channel); 57 static void send_exitsignalstatus(struct Channel *channel);
58 static void send_msg_chansess_exitstatus(struct Channel * channel,
59 struct ChanSess * chansess);
60 static void send_msg_chansess_exitsignal(struct Channel * channel,
61 struct ChanSess * chansess);
58 static int sesscheckclose(struct Channel *channel); 62 static int sesscheckclose(struct Channel *channel);
59 static void get_termmodes(struct ChanSess *chansess); 63 static void get_termmodes(struct ChanSess *chansess);
60 64
61 65
62 /* required to clear environment */ 66 /* required to clear environment */
66 struct ChanSess *chansess = (struct ChanSess*)channel->typedata; 70 struct ChanSess *chansess = (struct ChanSess*)channel->typedata;
67 return chansess->exited; 71 return chansess->exited;
68 } 72 }
69 73
70 /* handler for childs exiting, store the state for return to the client */ 74 /* handler for childs exiting, store the state for return to the client */
71 static void sesssigchild_handler(int dummy) { 75 static void sesssigchild_handler(int UNUSED(dummy)) {
72 76
73 int status; 77 int status;
74 pid_t pid; 78 pid_t pid;
75 unsigned int i; 79 unsigned int i;
76 struct ChanSess * chansess; 80 struct ChanSess * chansess;
496 TRACE(("leave sessionpty: term len too long")); 500 TRACE(("leave sessionpty: term len too long"));
497 return DROPBEAR_FAILURE; 501 return DROPBEAR_FAILURE;
498 } 502 }
499 503
500 /* allocate the pty */ 504 /* allocate the pty */
501 assert(chansess->master == -1); /* haven't already got one */ 505 if (chansess->master != -1) {
506 dropbear_exit("multiple pty requests");
507 }
502 if (pty_allocate(&chansess->master, &chansess->slave, namebuf, 64) == 0) { 508 if (pty_allocate(&chansess->master, &chansess->slave, namebuf, 64) == 0) {
503 TRACE(("leave sessionpty: failed to allocate pty")); 509 TRACE(("leave sessionpty: failed to allocate pty"));
504 return DROPBEAR_FAILURE; 510 return DROPBEAR_FAILURE;
505 } 511 }
506 512