bug-httptunnel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] fix broken --stdin-stdout that writes to stdin


From: Israel G. Lugo
Subject: [patch] fix broken --stdin-stdout that writes to stdin
Date: Wed, 20 Jun 2007 21:35:32 +0100
User-agent: Thunderbird 2.0.0.0 (X11/20070604)

-----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  <israel@lugosys.com>

    * 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-----

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;
     }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBGeYtSgn9msFnMGkcRAtrRAJ4pW1Rtgd4KFMt93B7Yx3fhwUq/wwCgizDV
wL3E2ORZF+xv85fy+U7U0EM=
=W+wS
-----END PGP SIGNATURE-----

reply via email to

[Prev in Thread] Current Thread [Next in Thread]