[patch] fix broken --stdin-stdout that writes to stdin
"Israel G. Lugo" <[email protected]> Wed, 20 Jun 2007 21:35:32 +0100
| Newsgroups | gmane.comp.gnu.httptunnel.bugs |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------040900070204090107020507 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Greetings, There is a bug in the current development version of httptunnel (3.3), where common.c:handle_tunnel_input( ) is calling write_all on stdin. This breaks anything calling htc or hts with --stdin-stdout, unless stdin happens to be something which can be written to (e.g. a socket or a pseudo-terminal). In particular, it breaks OpenSSH using htc as ProxyCommand (causes an infinite connect/disconnect loop where htc connects, gets the banner from the server, then dies when trying to pass it to the ssh client). The code already includes a check for fd == 0, intending to write to stdout instead in such cases - however, the check is broken, since it is passing 0 instead of 1. I am attaching a patch to fix the problem, made against http://www.nocrew.org/software/httptunnel/httptunnel-3.3.tar.gz. ChangeLog entry: 2007-06-20 Israel G. Lugo <[email protected]> * common.c (handle_tunnel_input): really write to stdout if fd == 0. Regards, Israel G. Lugo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGeY+Sgn9msFnMGkcRAkgLAKCDz82gWJst6WGOSaFS19d8oFP/dgCggloB d3Z2Eu74Imhz5wgew7sRAgc= =g59Y -----END PGP SIGNATURE----- --------------040900070204090107020507 Content-Type: text/plain; name="httptunnel-3.3-fix_write_stdin.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="httptunnel-3.3-fix_write_stdin.patch" diff -dur httptunnel-3.3/common.c httptunnel-3.3-fix_write_stdin/common.c --- httptunnel-3.3/common.c 2001-02-25 12:45:41.000000000 +0100 +++ httptunnel-3.3-fix_write_stdin/common.c 2007-06-20 21:38:54.000000000 +0200 @@ -314,7 +314,7 @@ /* If fd == 0, then we are using --stdin-stdout so write to stdout, * not fd. */ - m = write_all (fd ? fd : 0, buf, (size_t)n); + m = write_all (fd ? fd : 1, buf, (size_t)n); log_annoying ("write_all (%d, %p, %d) = %d", fd ? fd : 1, buf, n, m); return m; } --------------040900070204090107020507 Content-Type: text/plain; name="httptunnel-3.3-fix_write_stdin.patch.asc" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="httptunnel-3.3-fix_write_stdin.patch.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGeYtSgn9msFnMGkcRAtrRAJ4pW1Rtgd4KFMt93B7Yx3fhwUq/wwCgizDV wL3E2ORZF+xv85fy+U7U0EM= =W+wS -----END PGP SIGNATURE----- --------------040900070204090107020507 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-httptunnel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-httptunnel --------------040900070204090107020507--