Commit Graph
100 Commits
Author SHA1 Message Date
Michael Adam 9acb0cb16c Fix CVE-2017-11747: Create PID file before dropping privileges.
Resolves #106

Signed-off-by: Michael Adam <obnox@samba.org>
2018-02-09 15:21:14 +01:00
Michael Adam 86a9a6729e Merge pull request #100 from dmd/patch-1
tinyproxy configure does not actually support enable-static
2017-08-24 22:48:46 +02:00
Michael Adam cb6f868739 Merge pull request #86 from obnoxxx/getipstring1
honor result of inet_ntop in get_ip_string()
2017-03-30 00:52:43 +02:00
Michael Adam 46cbe5357c network: honour result of inet_ntop in get_ip_string()
Signed-off-by: Michael Adam <obnox@samba.org>
2017-03-29 23:57:08 +02:00
Michael Adam a71cebb094 network: let get_ip_string() return const char * instead of const char
Signed-off-by: Michael Adam <obnox@samba.org>
2017-03-29 23:56:48 +02:00
Michael Adam f149b62475 Merge pull request #66 from rofl0r/configure_trim
Configure trim
2017-03-29 23:26:45 +02:00
Michael Adam 3f6179a1fd Merge pull request #67 from dmz-uk/patch-1
Prevent child from calling exit() on interrupt
2017-03-29 09:19:55 +02:00
Michael Adam 2c574e9afe Merge pull request #85 from rofl0r/fix_72
src/Makefile.am: fix spaces vs TAB
2017-03-29 09:15:22 +02:00
Michael Adam 1e93411810 Merge pull request #59 from gmp216/pull
Fix OS X build
2017-01-04 16:21:27 +01:00
Michael Adam 302738dee5 Merge pull request #71 from gmp216/lookup
Move lookup_variable from html-error.c to hashmap.c
2017-01-04 13:59:14 +01:00
Michael Adam e4ae0d10d2 Merge pull request #70 from obnoxxx/compile
add 'compile' to gitignore
2016-12-24 03:09:33 +01:00
Michael Adam 06281857a4 Merge pull request #69 from obnoxxx/readme
README: mention --enable-reverse configure option
2016-12-24 03:07:57 +01:00
Michael Adam 6c98f2cc27 add 'compile' to gitignore
it's generated by autogen

Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-24 03:04:50 +01:00
Michael Adam ff880a5e13 README: mention --enable-reverse configure option
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-24 03:02:27 +01:00
Michael Adam 67fc3b54ba Merge pull request #68 from obnoxxx/travis
Enable travis-ci: add .travis.yml
2016-12-24 03:01:34 +01:00
Michael Adam 841fed4afd Enable travis-ci: add .travis.yml
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-24 02:54:26 +01:00
Michael Adam 90df510932 Merge pull request #63 from rofl0r/fix_manpage_gen
ship manpages as part of the dist tarball
2016-12-20 22:27:11 +01:00
Michael Adam 4e0951afd9 Merge pull request #62 from obnoxxx/bundle-readme-md
build: add README.md to the bundled files
2016-12-20 19:28:59 +01:00
Michael Adam 2f4e6403f9 build: add README.md to the bundled files
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:26:48 +01:00
Michael Adam 1bb255c3f8 Merge pull request #61 from obnoxxx/cleanup-readme
Cleanup readme and fix installation instructions
2016-12-20 19:24:28 +01:00
Michael Adam 85c73d68bd Add placeholder ChangeLog to keep automake happy
Closes #60

Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:22:17 +01:00
Michael Adam 7f3fe02d47 README: update install instructions
Closes #30

Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:22:17 +01:00
Michael Adam 271c4ecdcb README: add README pointing to README.md to make automake happy
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:22:17 +01:00
Michael Adam 0d3ca13398 README: Rename README --> README.md
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:04:56 +01:00
Michael Adam 82ce991b3d REAMDE: convert README to github markdown
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:04:47 +01:00
Michael Adam af6e236521 README: cleanup readme from legacy content
Signed-off-by: Michael Adam <obnox@samba.org>
2016-12-20 19:04:43 +01:00
Michael Adam e541456ee7 Merge pull request #36 from obnoxxx/issue-21
build: remove foreign from AM_INIT_AUTOMAKE - generate INSTALL again
2016-09-11 00:16:30 +02:00
Michael Adam 60e5fc7c57 build: remove foreign from AM_INIT_AUTOMAKE - generate INSTALL again
Closes #21

Signed-off-by: Michael Adam <obnox@samba.org>
2016-09-11 00:11:21 +02:00
Michael Adam b036d2e055 Merge pull request #6 from rofl0r/url
update URL
2016-01-03 23:58:17 +01:00
Michael Adam 800c3a250c BB#110 Increase number of hash buckets from 32 to 256.
This should make hash processing generally faster.

There is a treadeoff between memory footprint and
speed of processing. 10 KB instead of 1.2 KB of
hash table per process should not be a huge problem
even on very limited current systems.

Who really needs to stick to 32 buckets could
recompile. We could also think about making
this configurable at some point.

Signed-off-by: Michael Adam <obnox@samba.org>
2014-12-13 01:41:56 +01:00
Michael Adam 545463c75d BB#110 limit the number of headers per request to prevent DoS
Based on patch provided by gpernot@praksys.org on bugzilla.

Signed-off-by: Michael Adam <obnox@samba.org>
2014-12-13 01:28:07 +01:00
Michael Adam 308305d827 BB#110 secure the hashmaps by adding a seed
Based on a patch provided by gpernot@praksys.org on bugzilla.

Signed-off-by: Michael Adam <obnox@samba.org>
2014-12-13 01:21:02 +01:00
Michael Adam b59ecd0c66 buffer: fix log message in read_buffer().
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-23 12:21:59 +01:00
Michael Adam ffa3a56ab8 buffer: reduce indentation in read_buffer()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-23 12:09:59 +01:00
Michael Adam 76bd008cf9 reqs: fix typo in a debug message in get_request_entity()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-23 11:59:47 +01:00
Michael Adam b3ac7d2c7b transparent: make transparent support compile after introduction of multi Listen
I seem to have forgotten to compile with transparent support enabled...
This belongs to the fix for bug BB#63.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-23 00:18:04 +01:00
Michael Adam b92d70be07 child: remove use of config.listen_addrs in child_listening_sockets()
This was accidentially used instead of the function parameter listen_addrs
This still belongs to the fix for bug BB#63.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-23 00:17:55 +01:00
Michael Adam 3710accf72 reqs: Fix CID 1130969 (part 3) - unchecked return value from library.
Check the return value of socket_blocking (fcntl) at the
end of relay_connection() for client socket.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 21:56:39 +01:00
Michael Adam e07c363df2 reqs: Fix CID 1130969 (part 2) - unchecked return value from library.
Check the return value of socket_blocking (fcntl) at the
end of relay_connection().

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 21:44:12 +01:00
Michael Adam c82840bfcb reqs: Fix CID 1130972 - remove logically dead code.
url == NULL is caught above.

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:58:19 +01:00
Michael Adam 49c55ed26c network: Fix CID 113095 - unchecked return value from library
Check return of "recv" in readline().

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:54:22 +01:00
Michael Adam 198600ce42 child: check return code of socket_blocking for accept in child_main
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:49:45 +01:00
Michael Adam 38ef36d998 child: Fix CID 1130966 - unchecked return value from library
check the return code of fcntl via socket_nonblocking
on the listen sockets in child_main()

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:49:45 +01:00
Michael Adam 0a99803425 reqs: Fix CID 1130967 - unchecked return value from library.
Check the return code of fcntl via socket_blocking
in pull_client_data().

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:49:45 +01:00
Michael Adam 9efa5799f0 reqs: Fix CID 1130968 - unchecked return value from library
Check the return code of fcntl via socket_nonblocking
in pull_client_data()

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:49:45 +01:00
Michael Adam c27b6d15e2 reqs: rename a variable.
ret will be used in enclosing scope.
so rename this special varibale.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 18:49:45 +01:00
Michael Adam 68bd0b61b5 reqs: fix CID 1130969 - unchecked return code from library
Effectively, the return code of fcntl was not checked
by not checking the return code of socket_nonblocking()
for the server fd.

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 17:35:59 +01:00
Michael Adam 2004abc1e3 reqs: fix CID 1130970 - unchecked return code from library
Effectively, the return code of fcntl was not checked
by not checking the return code of socket_nonblocking()
for the client fd.

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 17:35:54 +01:00
Michael Adam a244c1d4aa conf: Fix CID 1130973 - resource leak.
Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-22 16:08:47 +01:00
Michael Adam 0f18e4fc3a BB#106: remove now unused extract_ssl_url.
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 15:26:06 +01:00
Michael Adam 9f43cfd488 BB#106: fix CONNECT requsts with IPv6 literal addresses as host.
Use extract_url instead of the old extract_ssl_url:
extract_url is generic and handles ipv6 literal addresses correctly.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 15:25:44 +01:00
Michael Adam 98f77ef8c7 BB#106: add default_port argument to extract_http_url and rename it to extract_url
There is in fact nothing http-specific any more about this function, hence
the rename. The input has been stripped of the <proto>:// header anyways.

This in preparation of fixing bug BB#106: ssl fails with literal ipv6 addrs.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 15:09:48 +01:00
Michael Adam 69c348ce6d req: move a variable into the scope where it is used in extract_http_url()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 13:10:03 +01:00
Michael Adam bb2e894e0d BB#116: fix invalid free when connecting to ipv6 literal address
When removing the '[' and ']' characers from the ipv6 literal address, make sure
the pointer that is later free'd stays a malloced pointer by memmoving the
string one place left.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 13:07:19 +01:00
Michael Adam 7e1d8154de build: check for memmove
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 13:07:09 +01:00
Michael Adam 836d4534d6 sock: add debug messages to opensock()
log entering opensock and successful return of getaddrinfo.
This allows to detect dns timeouts from looking at the logs.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-16 11:30:07 +01:00
Michael Adam e82080a5f6 [BB#63] conf: Allow multiple Listen statements in the config.
This introduces a list (vector) of addresses instead of
having just one address string.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam d0732f9ade [BB#81] allow listening on multiple families when no Listen is provided in config
This is achieved by not stopping at the first result of getaddrinfo
that we managed to listen on: Without "Listen" in the config, we
call getraddrinfo with NULL address. With AI_PASSIVE, this gives results
for both IPv4 and IPv6 wildcard addresses (if both are supported).

This lets tinyproxy listen on both IPv4 and IPv6 wildcard if the system
supports them.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam e40b91974a sock: add a starting debug message to listen_sock()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 22587d3d41 sock: update introductory comment for listen_sock()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 0698e4d180 sock: set IPV6_V6ONLY on the socket before binding an IPv6 address
so that we can bind wildcard for both IPv4 and IPv6.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam d7f67768eb sock: factor listening on one socket out of the gai-result-loop in listen_sock()
for clarity of the code

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 157879d4f6 sock: in listen_sock(), move variable for setsockopt() into scope
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam a7898a2c98 sock: log each result of getaddrinfo() in listen_sock()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 947e255d19 sock: in listen_sock(), add a log message for when bind() has failed
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam b41d140984 sock: in listen_sock(), detect and log failure to call setsockopt()
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 5392e9829c sock: in listen_sock(), add debug message when socket() call failed.
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam fa26ad4d56 sock: move listen() into the getaddrinfo result loop in listen_sock()
This also reverses the exit logic of the loop.
It prepares listening on multiple addresses.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 2ebfd456ef child: use a list of listen_fds instead of one single listenfd.
This prepares listenting on multiple sockets, which will be ussed to
fix listening on the wildcard (listen on both ipv6 and ipv4) and
help add the support for multiple Listen statements in the config

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 070d621534 child: add addr argument to child_listening_sock().
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 2bd919f01e sock: add addr argument to listen_sock()
instead of using config.ipAddr internally.
This is in preparation to make it possible
to call it for multiple addresses.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 7eea1638bc sock/child: remove global variable addrlen.
This changes listen_sock() to not return the
addrlen of the used address from getaddrinfo call
to the caller, stored in global addrlen in child.c.

This was only used to be able to allocate enough space for the
arguments to the later accept call depending on whether
IPv4 or IPv6 is used.

This removes the need to pass this info by always allocating
sizeof(struct sockaddr_storage) instead, which is enough
to carry both sockaddr_in and sockaddr_in6.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 4bbd6e8626 [BB#109] Fix crash (infinite loop) when writing to log file fails.
Fall back to syslog logging in that case.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam d652681e8a log: remove extra newline characters in log messages.
Signed-off-by: Michael Adam <obnox@samba.org>
2013-11-09 13:34:33 +01:00
Michael Adam 3cc59ec3be [BB#112] build: fix build with autoconf >= 2.69
Use AC_CONFIG_HEADERS instead of obsolete AM_CONFIG_HEADER.

Signed-off-by: Michael Adam <obnox@samba.org>
2013-04-09 22:35:20 +02:00
Michael Adam 8fd3808ad3 [BB#95] remove two comments that have become wrong by the fix. 2010-12-01 22:25:44 +01:00
Michael Adam 58ac635a17 README: correctly list --enable-transparent
--enable-transparent-proxy was renamed to --enable-transparent
in August 2004... :-)
2010-12-01 21:40:07 +01:00
Michael Adam b672ca03fe [BB#91] Fix upstream proxy support.
Patch by Jordi Mallach.
2010-08-24 22:47:35 +02:00
Michael Adam 52cad36352 upstream: clarify debug messages
There are frequent questions "what does 'No proxy for ...' mean?"
on the mailing list and IRC. Be more specific. (No upstream proxy ...)
Correspondingly, log "Found upstream proxy ... for ..."
2010-08-24 22:46:10 +02:00
Michael Adam 243526d493 Comment out the LogFile and PidFile options in the example tinyproxy.conf.
These are compiled in defaults now.

Michael
2010-03-02 23:41:37 +01:00
Michael Adam e87c856487 change the default pid file location to "@LOCALSTATEDIR@/run/tinyproxy/tinyproxy.pid"
I.e., add a tinyproxy subdirectory.
This is meant to ease running tinyproxy as non-root user.
The subdirectory can be used to give the tinyproxy user
write permission.

Michael
2010-03-02 23:39:30 +01:00
Michael Adam cfa5792880 change the default log file location to "@LOCALSTATEDIR@/log/tinyproxy/tinyproxy.log"
i.e. add a tinyproxy subdirectory.
This is meant to ease running tinyproxy as non-root user
the subdirectory can be used to give the tinyproxy user
write permission.

Michael
2010-03-02 23:39:21 +01:00
Michael Adam f640c6fbb1 main: some tabs->spaces 2010-03-02 22:17:34 +01:00
Michael Adam fcf5fd2129 main: move a log message. 2010-03-02 22:05:28 +01:00
Michael Adam 7a9abc2a04 main: drop privileges right after reading the config
This is the second part of fixing bug #74.
I lets tinyproxy create its log and pid files as the
user as which it is running, so that later on at SIGHUP,
the log file can successfully be reopened.

Michael
2010-03-02 22:02:46 +01:00
Michael Adam 2235a97f05 main: separate loading of config and setup_logging at startup
This is the first part of a fix for bug #74
(making reloading of config work if running as non-privileged user)

Michael
2010-03-02 21:57:03 +01:00
Michael Adam f923649a11 tinyproxy.conf: fix LogFile to proper CamelCase for consistency 2010-02-23 08:06:55 +01:00
Michael Adam 3f1632603c tests: fix bug #80: keep track of errors in return codes
Michael
2010-02-23 00:18:29 +01:00
Michael Adam 7c15563430 tests: fix a typo in run_tests.sh 2010-02-23 00:17:21 +01:00
Michael Adam ee1f1e38f2 test: add make target "make valgrind-test-wait" 2010-02-22 23:31:40 +01:00
Michael Adam 752e4419a6 tests: add a new make target "make test-wait" 2010-02-22 23:17:39 +01:00
Michael Adam d133eee36b tests: Fix bug #79. Finish "make test" without waiting for user input.
Old behaviour is preserved by passing in the environment variable
TINYPROXY_TESTS_WAIT=yes.

Michael
2010-02-22 23:12:51 +01:00
Michael Adam 9c500d06f2 Fix bug #68: Allow all ports for CONNECT at absence of ConnectPort in config. 2010-01-17 13:41:02 +01:00
Michael Adam 8070023643 log: when opening the log file fails, fall back to syslog logging. 2010-01-17 01:10:21 +01:00
Michael Adam 54a613b9db conf: reduce indentation in load_config_file()
This replaces a do { ... } while (0) with break statements
ba gotos. Imho, this is much clearer.

Michael
2010-01-16 13:26:18 +01:00
Michael Adam 157a79216f NEWS: add David Shanks to the list of contributors. 2010-01-14 08:34:09 +01:00
Michael Adam a61f6018f2 NEWS: document some more new features in the release notes
Michael
2010-01-14 08:33:11 +01:00
Michael Adam a639f3fca2 NEWS: add list of bugs fixed since 1.7.1
Muks: please verify - thes are current the fixed bugs
with milestone 1.8.0 (i.e. the renamed 1.7.2).

I hope this is correct!
I also hope this was the intended scheme - have bug
lists per version section. Please feel free to edit...

Michael
2010-01-14 08:25:44 +01:00
Michael Adam 3baa5f6f7c NEWS: mention change of XTinyProxy to be a global bool
Michael
2010-01-14 08:14:01 +01:00
Michael Adam 8963c84dad NEWS: move the changes after 1.7.1 to new section 1.7.2
Michael
2010-01-13 23:26:20 +01:00