aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/telnetd.c
AgeCommit message (Collapse)Author
2021-04-27Don't send reverse DNS lookups out into the world for something that'sRob Landley
mostly only safe to use behind a firewall or through a VPN these days.
2021-04-24telnetd: handle TIME_WAIT better.Elliott Hughes
After a network outage, a long-running telnetd was spinning trying to read from a socket that was in TIME_WAIT. It's easy to reproduce this by using the regular telnet client and typing ^]^D to exit abruptly. I don't think these sockets should ever have been non-blocking, and we want to give up on the client if we hit EOF. All of this needs rewriting to be less complicated (and not use select(2)), but this seems to be a minimal fix for the spin without harming normal usage (where by "usage" I mean "testing the telnet client").
2021-04-24telnetd: pass `-h hostname` to login(1).Elliott Hughes
Handling utmp is login's job: telnetd should just pass the appropriate option to login. (I was investigating a different bug that caused telnetd to take 100% CPU after a network outage and noticed an unexpected utmp fd. It turned out to not be relevant to my actual problem, but it did remind me that this utmp code isn't right in small details like that, but also in the bigger picture: it's writing the wrong information, and only on logout, not login. But rather than try to fix it, let's just let login do its job.)
2021-03-18telnetd: don't exit if waitpid() returns 0.Elliott Hughes
Noticed while using telnetd to manually test some telnet fixes: telnetd would sometimes exit when I'd disconnect because it couldn't find pid 0 on its list of sessions. I've not seen obscure exits because select() times out, but I've also changed that `return` to an error_exit() so we'll at least know what's happened if that ever occurs. Also use <arpa/telnet.h> rather than manually #define'ing its constants, use the FLAG() macro throughout, and xsetsockopt(). Don't pointlessly set errno to 0 at the start of main and then never look at it again.
2020-04-16Weed-whack a few warnings out of pending so allyesconfig is less noisy.Rob Landley
2019-07-11bind/connect cleanup.Elliott Hughes
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room for new xbind/xconnect that are more like 'x' versions of the regular bind and connect. Move explicit bind/connect callers over to xbind/xconnect. Of the affected commands, only netcat is actually used by Android. It was the most recent patch to netcat that made the lack of a more traditional xbind/xconnect apparent.
2015-01-16AOSP master has <pty.h> and builds netcat/nc.Elliott Hughes
2014-11-19probe for getspnam(), forkpty(), utmpx, replace sethostname()Isaac Dunham
Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals.
2014-07-17Use libc daemon() instead of pending daemonize.Rob Landley
2014-05-21Make telnetd use generic_signal(), inline kill_session(), close race window ↵Rob Landley
where a SIGCHLD could get lost.
2013-12-23telnet and telnetd from Ashwini Sharma's guys.Rob Landley