Commit Graph

58 Commits

Author SHA1 Message Date
Mukund Sivaraman
d37a6b2c12 Revert "Revert "Pass address family when binding to outgoing socket""
This reverts commit 70885bf029. It looks
like bug #69 needs this fix after all.
2010-03-09 17:08:37 +05:30
Mukund Sivaraman
2f86b79d85 Use AI_PASSIVE flag to make tinyproxy listen on wildcard interface
Signed-off-by: Michael Adam <obnox@samba.org>
2010-03-03 01:03:45 +01:00
Mukund Sivaraman
70885bf029 Revert "Pass address family when binding to outgoing socket"
This reverts commit 65ef313cc4.
This patch could've been the reason for BB#69.
2010-01-21 06:29:15 +05:30
Mukund Sivaraman
65ef313cc4 Pass address family when binding to outgoing socket 2010-01-10 19:51:24 +05:30
Michael Adam
d522221668 Fix restarting of tinyproxy: call setsockopt with REUSEADDR _before_ calling bind
Somehow this got moved too far down in the ipv6 changes.
Thanks to Mathew Mrosko for helping me debugging this.

Michael
2009-12-08 01:24:31 +01:00
Michael Adam
7290691142 Move definition of "struct config_s" from main.h to conf.h
Michael
2009-12-07 22:33:27 +01:00
Mukund Sivaraman
4b6a25ac06 Use snprintf() with size of the portstr buf 2009-11-17 01:44:21 +05:30
Mukund Sivaraman
cd834de190 Close listenfd upon errors 2009-11-09 11:16:38 +05:30
Mukund Sivaraman
c978015af1 Add IPV6 support to listen_sock() 2009-11-09 01:13:41 +05:30
Mukund Sivaraman
7b9234f394 Indent code to Tinyproxy coding style
The modified files were indented with GNU indent using the
following command:

indent -npro -kr -i8 -ts8 -sob -l80 -ss -cs -cp1 -bs -nlps -nprs -pcs \
    -saf -sai -saw -sc -cdw -ce -nut -il0

No other changes of any sort were made.
2009-09-15 01:11:25 +05:30
Mukund Sivaraman
a21cd7e3ed Rename tinyproxy.[ch] to main.[ch] 2009-08-07 03:42:53 +05:30
Mukund Sivaraman
024b317de0 Convert tabs to spaces 2008-12-08 13:39:44 +00:00
Mukund Sivaraman
a257703e59 Reformat code to GNU coding style
This is a commit which simply ran all C source code files
through GNU indent. No other modifications were made.
2008-12-01 15:01:11 +00:00
Mukund Sivaraman
249d4b7f33 Updated copyright, license notices in source code
The notices have been changed to a more GNU look. Documentation
comments have been separated from the copyright header. I've tried to
keep all copyright notices intact. Some author contact details have
been updated.
2008-05-24 13:35:49 +05:30
Mukund Sivaraman
8848b647d7 Corrected datatype of salen to fix compiler warning 2008-03-13 15:09:21 -07:00
Robert James Kaes
c0299e1868 * [Indent] Ran Source Through indent
I re-indented the source code using indent with the following options:

indent -kr -bad -bap -nut -i8 -l80 -psl -sob -ss -ncs

There are now _no_ tabs in the source files, and all indentation is
eight spaces.  Lines are 80 characters long, and the procedure type is
on it's own line.  Read the indent manual for more information about
what each option means.
2005-08-15 03:54:31 +00:00
Robert James Kaes
38f0b3a103 * Specified Correct typedef in getsock_ip()
Changed the variable type for the namelen variable to the correct
socklen_t type.  The configure script already checked for it, but for
some reason I never got around to actually using it in this function.
2005-07-12 20:34:26 +00:00
Robert James Kaes
18df4910a4 Added the "BindSame" configure directive from Oswald Buddenhagen.
This allows tinyproxy to respond to a request bound to the same
interface that the request came in on.  As Oswald explains:

  "attached is a patch that adds the BindSame option. it causes
  binding an outgoing connection to the ip address of the respective
  incoming connection. that way one can simulate an entire proxy farm
  with a single instance of tinyproxy on a multi-homed machine."

Cool.
2004-04-27 18:53:14 +00:00
Robert James Kaes
5ecd9157ce Converted the various socket functions to work with both IPv4 and IPv6
addresses.
2004-02-18 20:18:53 +00:00
Robert James Kaes
745c40650b #Style formatting change. 2002-10-03 20:50:59 +00:00
Robert James Kaes
f548ce72b2 (getpeer_information): Fixed a problem retrieving the FQDN of a host because I was passing in an incorrect parameter to gethostbyaddr(). D'oh. 2002-05-31 18:08:01 +00:00
Robert James Kaes
83a1a32f2a (opensock): Changed a comment around to better state what the code is actually doing. 2002-05-27 01:57:48 +00:00
Robert James Kaes
523f2003fa Removed the DNS API calls and replaced them with the standard
gethostbyname() and gethostbyaddr() functions.  This is possible
because tinyproxy now uses a standard pre-forked() method.
2002-05-26 18:51:17 +00:00
Robert James Kaes
a34db10d65 Fixed some spelling mistakes, and removed the getpeer_ip() and
getpeer_string() functions as they've been replaced by the
getpeer_information() function.
2002-05-24 04:44:36 +00:00
Robert James Kaes
478030c6ff Changed the lookup_domain() function to use the new "dnsserver" API.
Also moved safe_write(), safe_read(), readline(), and write_message()
functions into their own file.
2002-05-23 18:25:55 +00:00
Robert James Kaes
d7c3f23610 bind_address has been moved inside the config structure. Fixed up a
problem where "data" was being freed even if it had not been allocated
(because of an error condition.)
2002-04-24 16:48:34 +00:00
Robert James Kaes
08077cc9e1 The "Bind" directive sets a binding address which the outgoing connections
will use.
2002-04-22 19:35:24 +00:00
Robert James Kaes
aa68eb8540 Whoops. The previous include only had the code conditionally removed.
Remove for real this time.
2002-04-18 21:54:50 +00:00
Robert James Kaes
1db154464e Removed the call to inet_aton() since the gethostbyname() function handles
the dotted-decimal case itself.
2002-04-18 21:53:33 +00:00
Robert James Kaes
73a53daf38 Removed the call to hstrerror() in the getpeer_string() function. It's
not available on all machines.
2002-04-18 18:48:22 +00:00
Robert James Kaes
3e60a5b819 Removed the LOOKUP_LOCK() and LOOKUP_UNLOCK() macros since I believe I
need locking around both gethostbyname() and gethostbyaddr() at the same
time.
2002-04-17 20:56:13 +00:00
Robert James Kaes
0e4436a070 Tightened the lookup_domain() function. 2002-04-16 03:21:46 +00:00
Robert James Kaes
4b7de22999 Added a test to make sure the "whole_buffer" could be allocated. 2002-04-15 04:16:01 +00:00
Robert James Kaes
c86d22226f Added additional error handling for the bind() and listen() system calls
when setting up the listening socket.
2002-04-13 19:03:18 +00:00
Robert James Kaes
be47c1791d Modified the opensock() function to respect the Listen directive. If it's
set, bind all outgoing addresses to this local address.
2002-04-13 05:20:19 +00:00
Robert James Kaes
b10221fa07 Added the write_message() function (from reqs.c) 2001-12-24 00:01:32 +00:00
Robert James Kaes
7240af4333 Changed the calls to write() to send() so that we can use send(...,
MSG_NOSIGNAL) and not get signals sent to the process. (easier for
debugging and the system doesn't need to worry about signals.)
2001-12-19 20:41:28 +00:00
Robert James Kaes
fdb4952e5f Added the assert() calls to safe_write() to make sure the arguments are
sane.
2001-12-17 00:00:24 +00:00
Robert James Kaes
b969ed4302 Changed safe_write() to fully send all the data in the buffer it was
passed. Also safe_write() and safe_read() now use char pointer buffers
rather than the void pointer style.
2001-12-15 20:04:04 +00:00
Robert James Kaes
a4934e2232 Added the host name lookup code (which use to be in the DNS caching
system.)
2001-12-15 05:58:30 +00:00
Robert James Kaes
8dc7035fbc Add support to limit the maximum size of the input line (to 128KB which
should be _more_ than enough for any header line. :)
2001-11-25 02:21:46 +00:00
Robert James Kaes
fd3b313e9f Style changes. Also replaces all mallocs with safemalloc, etc. 2001-11-23 01:18:43 +00:00
Robert James Kaes
d08d088d4a Replaced the readline() function with a new version which has no
restrictions on the length of a line (unless you fill memory of course.)
Reformated the source.
2001-11-22 00:19:18 +00:00
Robert James Kaes
dde4e9adcc Changed the read() call into a recv() call with a flag of NOSIGNAL since I
don't want signals messing up my calling conventions.
2001-11-12 21:10:51 +00:00
Robert James Kaes
5f8ee4fae3 Bit of source code clean up. 2001-10-25 05:10:32 +00:00
Robert James Kaes
b7b4d08758 Error message cleanup to make the information more informative. 2001-10-24 00:37:23 +00:00
Robert James Kaes
7d7958b0d7 Fixed a spelling problem in a log message. 2001-10-23 16:43:08 +00:00
Robert James Kaes
a746b9d0b2 Moved the zero-length string setting to outside the tests in getpeer_*()
functions. Also added a more robust error reporting for DNS errors.
2001-10-23 03:57:34 +00:00
Robert James Kaes
a6a026cb9e Changed the getpeer_*() functions to return the reason why the name or IP
address could not be looked up.
2001-10-22 16:52:34 +00:00
Robert James Kaes
ad743c1e41 Fixed a problem where a user's variable would be uninitialized if a DNS
lookup failed.
2001-10-22 15:56:11 +00:00