Mercurial > dropbear
comparison svr-chansession.c @ 1829:a7cc3332d8ab
Replace ChanType.sepfds with Channel.bidir_fd
This handles the case where a svrchansess has separate FDs
for nopty, but a single FD for pty mode.
The use of sepfds was also previously incorrect for X11 and
agent forwarding
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 11 Oct 2021 15:42:14 +0800 |
parents | 3f0ac6bc58a1 |
children | c32976db772f |
comparison
equal
deleted
inserted
replaced
1828:3f0ac6bc58a1 | 1829:a7cc3332d8ab |
---|---|
62 static void send_msg_chansess_exitsignal(const struct Channel * channel, | 62 static void send_msg_chansess_exitsignal(const struct Channel * channel, |
63 const struct ChanSess * chansess); | 63 const struct ChanSess * chansess); |
64 static void get_termmodes(const struct ChanSess *chansess); | 64 static void get_termmodes(const struct ChanSess *chansess); |
65 | 65 |
66 const struct ChanType svrchansess = { | 66 const struct ChanType svrchansess = { |
67 0, /* sepfds */ | |
68 "session", /* name */ | 67 "session", /* name */ |
69 newchansess, /* inithandler */ | 68 newchansess, /* inithandler */ |
70 sesscheckclose, /* checkclosehandler */ | 69 sesscheckclose, /* checkclosehandler */ |
71 chansessionrequest, /* reqhandler */ | 70 chansessionrequest, /* reqhandler */ |
72 closechansess, /* closehandler */ | 71 closechansess, /* closehandler */ |
767 } | 766 } |
768 | 767 |
769 ses.maxfd = MAX(ses.maxfd, channel->writefd); | 768 ses.maxfd = MAX(ses.maxfd, channel->writefd); |
770 ses.maxfd = MAX(ses.maxfd, channel->readfd); | 769 ses.maxfd = MAX(ses.maxfd, channel->readfd); |
771 ses.maxfd = MAX(ses.maxfd, channel->errfd); | 770 ses.maxfd = MAX(ses.maxfd, channel->errfd); |
771 channel->bidir_fd = 0; | |
772 | 772 |
773 addchildpid(chansess, chansess->pid); | 773 addchildpid(chansess, chansess->pid); |
774 | 774 |
775 if (svr_ses.lastexit.exitpid != -1) { | 775 if (svr_ses.lastexit.exitpid != -1) { |
776 unsigned int i; | 776 unsigned int i; |
893 close(chansess->slave); | 893 close(chansess->slave); |
894 channel->writefd = chansess->master; | 894 channel->writefd = chansess->master; |
895 channel->readfd = chansess->master; | 895 channel->readfd = chansess->master; |
896 /* don't need to set stderr here */ | 896 /* don't need to set stderr here */ |
897 ses.maxfd = MAX(ses.maxfd, chansess->master); | 897 ses.maxfd = MAX(ses.maxfd, chansess->master); |
898 channel->bidir_fd = 1; | |
898 | 899 |
899 setnonblocking(chansess->master); | 900 setnonblocking(chansess->master); |
900 | 901 |
901 } | 902 } |
902 | 903 |