diff options
author | Peter Korsgaard <jacmet@sunsite.dk> | 2009-06-11 12:34:01 +0200 |
---|---|---|
committer | Peter Korsgaard <jacmet@sunsite.dk> | 2009-06-11 12:34:01 +0200 |
commit | e491611316943fb5a44c94f27efecb9a9117a3c5 (patch) | |
tree | 3d57c94548ddb379670edf0a81f44c5ab8f2af1d /package/busybox/busybox-1.14.1-telnetd.patch | |
parent | 6fac68300eeddb0a3eec2e745b208e4f39ff5811 (diff) |
busybox: additional 1.14.1 fixes
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/busybox/busybox-1.14.1-telnetd.patch')
-rw-r--r-- | package/busybox/busybox-1.14.1-telnetd.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/package/busybox/busybox-1.14.1-telnetd.patch b/package/busybox/busybox-1.14.1-telnetd.patch new file mode 100644 index 000000000..099e5eb83 --- /dev/null +++ b/package/busybox/busybox-1.14.1-telnetd.patch @@ -0,0 +1,85 @@ +diff -urpN busybox-1.14.1/networking/telnetd.c busybox-1.14.1-telnetd/networking/telnetd.c +--- busybox-1.14.1/networking/telnetd.c 2009-05-27 18:00:23.000000000 +0200 ++++ busybox-1.14.1-telnetd/networking/telnetd.c 2009-06-09 22:54:06.000000000 +0200 +@@ -199,9 +199,17 @@ static size_t iac_safe_write(int fd, con + return total + rc; + } + ++/* Must match getopt32 string */ ++enum { ++ OPT_WATCHCHILD = (1 << 2), /* -K */ ++ OPT_INETD = (1 << 3) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -i */ ++ OPT_PORT = (1 << 4) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -p */ ++ OPT_FOREGROUND = (1 << 6) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -F */ ++}; ++ + static struct tsession * + make_new_session( +- USE_FEATURE_TELNETD_STANDALONE(int sock) ++ USE_FEATURE_TELNETD_STANDALONE(int master_fd, int sock) + SKIP_FEATURE_TELNETD_STANDALONE(void) + ) { + const char *login_argv[2]; +@@ -288,9 +296,29 @@ make_new_session( + /* Restore default signal handling ASAP */ + bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL); + ++#if ENABLE_FEATURE_TELNETD_STANDALONE ++ if (!(option_mask32 & OPT_INETD)) { ++ struct tsession *tp = sessions; ++ while (tp) { ++ close(tp->ptyfd); ++ close(tp->sockfd_read); ++ /* sockfd_write == sockfd_read for standalone telnetd */ ++ /*close(tp->sockfd_write);*/ ++ tp = tp->next; ++ } ++ } ++#endif ++ + /* Make new session and process group */ + setsid(); + ++ close(fd); ++#if ENABLE_FEATURE_TELNETD_STANDALONE ++ close(sock); ++ if (master_fd >= 0) ++ close(master_fd); ++#endif ++ + /* Open the child's side of the tty. */ + /* NB: setsid() disconnects from any previous ctty's. Therefore + * we must open child's side of the tty AFTER setsid! */ +@@ -329,14 +357,6 @@ make_new_session( + _exit(EXIT_FAILURE); /*bb_perror_msg_and_die("execv %s", loginpath);*/ + } + +-/* Must match getopt32 string */ +-enum { +- OPT_WATCHCHILD = (1 << 2), /* -K */ +- OPT_INETD = (1 << 3) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -i */ +- OPT_PORT = (1 << 4) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -p */ +- OPT_FOREGROUND = (1 << 6) * ENABLE_FEATURE_TELNETD_STANDALONE, /* -F */ +-}; +- + #if ENABLE_FEATURE_TELNETD_STANDALONE + + static void +@@ -465,7 +485,7 @@ int telnetd_main(int argc UNUSED_PARAM, + + #if ENABLE_FEATURE_TELNETD_STANDALONE + if (IS_INETD) { +- sessions = make_new_session(0); ++ sessions = make_new_session(-1, 0); + if (!sessions) /* pty opening or vfork problem, exit */ + return 1; /* make_new_session prints error message */ + } else { +@@ -553,7 +573,7 @@ int telnetd_main(int argc UNUSED_PARAM, + if (fd < 0) + goto again; + /* Create a new session and link it into our active list */ +- new_ts = make_new_session(fd); ++ new_ts = make_new_session(master_fd, fd); + if (new_ts) { + new_ts->next = sessions; + sessions = new_ts; |