aboutsummaryrefslogtreecommitdiff
path: root/networking/telnetd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-02-02 23:43:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-02-02 23:43:57 +0000
commitd814c986929b0f8deba5a733250c3f59d7678277 (patch)
tree6c9e7705722486f2c2f743fd22684cd9669c6c7a /networking/telnetd.c
parent04158e04591efea20f34c8dc83002e19056a5590 (diff)
downloadbusybox-w32-d814c986929b0f8deba5a733250c3f59d7678277.tar.gz
busybox-w32-d814c986929b0f8deba5a733250c3f59d7678277.tar.bz2
busybox-w32-d814c986929b0f8deba5a733250c3f59d7678277.zip
telnetd: do not advertise TELNET_LFLOW, we do not support
it properly.
Diffstat (limited to 'networking/telnetd.c')
-rw-r--r--networking/telnetd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 481c932db..59d609bc8 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -35,8 +35,8 @@
35/* Structure that describes a session */ 35/* Structure that describes a session */
36struct tsession { 36struct tsession {
37 struct tsession *next; 37 struct tsession *next;
38 pid_t shell_pid;
38 int sockfd_read, sockfd_write, ptyfd; 39 int sockfd_read, sockfd_write, ptyfd;
39 int shell_pid;
40 40
41 /* two circular buffers */ 41 /* two circular buffers */
42 /*char *buf1, *buf2;*/ 42 /*char *buf1, *buf2;*/
@@ -247,7 +247,8 @@ make_new_session(
247 static const char iacs_to_send[] ALIGN1 = { 247 static const char iacs_to_send[] ALIGN1 = {
248 IAC, DO, TELOPT_ECHO, 248 IAC, DO, TELOPT_ECHO,
249 IAC, DO, TELOPT_NAWS, 249 IAC, DO, TELOPT_NAWS,
250 IAC, DO, TELOPT_LFLOW, 250 /* This requires telnetd.ctrlSQ.patch (incomplete) */
251 /* IAC, DO, TELOPT_LFLOW, */
251 IAC, WILL, TELOPT_ECHO, 252 IAC, WILL, TELOPT_ECHO,
252 IAC, WILL, TELOPT_SGA 253 IAC, WILL, TELOPT_SGA
253 }; 254 };
@@ -284,13 +285,13 @@ make_new_session(
284 /* Child */ 285 /* Child */
285 /* Careful - we are after vfork! */ 286 /* Careful - we are after vfork! */
286 287
287 /* make new session and process group */ 288 /* Restore default signal handling ASAP */
288 setsid();
289
290 /* Restore default signal handling */
291 bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL); 289 bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
292 290
293 /* open the child's side of the tty. */ 291 /* Make new session and process group */
292 setsid();
293
294 /* Open the child's side of the tty. */
294 /* NB: setsid() disconnects from any previous ctty's. Therefore 295 /* NB: setsid() disconnects from any previous ctty's. Therefore
295 * we must open child's side of the tty AFTER setsid! */ 296 * we must open child's side of the tty AFTER setsid! */
296 close(0); 297 close(0);
@@ -360,7 +361,7 @@ free_session(struct tsession *ts)
360 * doesn't send SIGKILL. When we close ptyfd, 361 * doesn't send SIGKILL. When we close ptyfd,
361 * kernel sends SIGHUP to processes having slave side opened. */ 362 * kernel sends SIGHUP to processes having slave side opened. */
362 kill(ts->shell_pid, SIGKILL); 363 kill(ts->shell_pid, SIGKILL);
363 wait4(ts->shell_pid, NULL, 0, NULL); 364 waitpid(ts->shell_pid, NULL, 0);
364#endif 365#endif
365 close(ts->ptyfd); 366 close(ts->ptyfd);
366 close(ts->sockfd_read); 367 close(ts->sockfd_read);