Commit Graph

350 Commits

Author SHA1 Message Date
rofl0r
cb70ab5f8f configure: use quotes for echo calls 2016-12-24 12:48:41 +00:00
Jatin Rungta
c91e6a09ef Fix configure so the right CC gets picked up
unlike one would expect, setting `CC?=gcc -m32` in config.mak did not actually
lead to `gcc -m32` being used as compiler when running make, even though CC
was not declared anywhere else.
it appears as if the CC variable is implicitly defined by GNU make, so using
the ?= assignment (meaning "assign only if not already assigned") did not have
an effect.
when this configure script and Makefile here were written, they were modeled
after the interface provided by GNU autoconf (so there are no surprises for the
user). the assumption was that environment variables passed during configure
are usually stored and used for the compile, but can be overridden when running
make by exporting the variables again.
in reality though they can not be overridden by environment when running make,
as tests showed.
because of that, the other user-supplied variables will now be hard-assigned as
well.

closes #152

commit message by @rofl0r.
2016-12-24 12:36:42 +00:00
rofl0r
bf6eeff75a check snprintf return value for error 2016-12-20 22:18:21 +00:00
rofl0r
6ae959e051 Makefile: suppress pedantic warnings in user CFLAGS 2016-12-13 20:42:50 +00:00
Carlos Maddela
5ed5089733 Avoid using %n$ operand number formats to compile cleanly with ISO C. 2016-12-13 20:27:56 +00:00
Carlos Maddela
8ddc8a6da3 Prevent empty translation units to satisfy ISO C compilers. 2016-12-13 20:27:15 +00:00
Carlos Maddela
167780ce36 Fix format ‘%p’ expects argument of type ‘void *’ warning. 2016-12-13 20:12:15 +00:00
Carlos Maddela
4b413c902f Fix format specifier for unsigned int. 2016-12-13 20:11:37 +00:00
Carlos Maddela
6dcaf533d1 Fix grammar in usage message to keep Lintian happy. 2016-12-05 18:37:11 +11:00
Carlos Maddela
0bd2130352 Fix spelling in log message: doesnt -> doesn't 2016-12-05 14:10:09 +11:00
forkbomber
cf9a16de06 core.c: add HOST header to each CONNECT request
fixes #92
closes #93
2016-10-16 19:43:00 +00:00
rofl0r
c883cd4940 configure: make buildsystem-set CPPFLAGS non-overridable
we temporarily store all buildsystem-set conditionals into
OUR_CPPFLAGS and write it into config.mak as an addition to eventually
user-supplied CPPFLAGS. this should prevent crucial things we set from
being overwritten by a user that has CPPFLAGS exported.

fixes #142
2016-10-16 11:28:05 +00:00
Jay Taylor
0f6b226b15 Fix random_chain on Mac OS X
On Mac OS X, random chain was broken and returned always the last proxy from the
config file.  Use fix as suggested by @ravomavain.

Closes #75.
2016-10-14 21:49:01 +00:00
rofl0r
260578d00e configure: do not use mktemp
apparently mktemp on OSX 10.9.5 requires a parameter.
instead of playing whack-a-mole with apple we now use the portable
code from musl's configure script which should work everywhere.

adresses #142
2016-10-08 21:02:13 +01:00
rofl0r
e527b9ee64 print error message instead of segfaulting for invalid chain_len
closes #126
2016-06-23 09:27:15 +01:00
Carlos Maddela
635ded3393 Fix build failure with -pie in user LDFLAGS
When hardening flags are set by Debian's auto build system,
the project fails to build due to usage of -pie, which tells the linker
to build a PIE binary, and since the user LDFLAGS are deliberately put
later in the command line to override things, this overrides -shared.
work around by putting it directly in the last position of the linker
command line.

closes #124
Commit message authored by commiter.
2016-06-09 21:07:33 +01:00
Carlos Maddela
993dfc059d Fix trivial compilation warning
Fix "missing braces around initializer" warning.
2016-06-09 12:09:51 +01:00
rofl0r
f1e5f2ba01 don't call dlsym() from close() hook
it turned out that calling dlsym() may call malloc() in turn,
so we end up with the same deadlock described in the latest commit.

we thus now put all the fds passed to close pre-init into a list
and close them at init time.

this may finally fix #119.
2016-05-26 19:11:18 +01:00
rofl0r
8870140ff0 don't call INIT() from close hook
it was observed that it is a bad idea to initialize the entire
infrastructure used by proxychains from the close hook,
because the following scenario will lead to a deadlock:

- it is possible that the dynlinker executes the initializer code of
  other shared libs first
- if that code directly or indirectly calls malloc()
- which calls close() if it decided to use an mmap based allocation
- will now call our close(), which does
- call pthread_once which requires a lock
- creates a thread which calls malloc()
- which in turn calls our close() another time
- and our close is still in locked state.

so it seems the only save thing to do is to just get the address
of the original close function, and call that when we're in a
pre-init state.
this may hold for other functions that do lazy initialization as well,
however for those just calling the original function is probably
undesired since that could result in unproxified connections.
it will be needed to analyze on a per-function basis what the best
thing to do is, and finally rely only on the execution of the init
function from the gcc initializer.

should fix #119
2016-05-26 10:48:32 +01:00
rofl0r
aea9172653 release 4.11 2016-02-09 20:12:51 +00:00
rofl0r
afdbfcf40c README: add 'Known Problems' section 2016-02-09 20:11:40 +00:00
rofl0r
058adbcac2 configure: whitespace cleanup in help text 2016-02-04 12:56:00 +00:00
rofl0r
b64c89e0e4 add check for broken OpenBSD fclose()
http://marc.info/?l=openbsd-bugs&m=145280872431093&w=2

closes #95
2016-02-04 12:49:49 +00:00
rofl0r
a1c31e73b6 improve hostsreader test code 2016-02-04 09:38:16 +00:00
Alexander Batischev
f85cecdabe Fix bug in hostsreader
hostsreader_get() used to assign the IP address to both `name` and `ip`
fields in `struct hostsreader`, which led to proxychains effectively
ignoring the contents of /etc/hosts.
2016-02-04 09:37:06 +00:00
rofl0r
672bf7661d getnameinfo: support ipv6 as well 2015-12-06 13:01:56 +00:00
rofl0r
4c3be5e1e3 test_getnameinfo: improve, check ipv6 2015-12-06 13:01:07 +00:00
rofl0r
0e0e35927c mute warning in debug mode 2015-12-06 12:57:45 +00:00
rofl0r
205004fa2a factor out setup_hooks() 2015-12-02 12:14:58 +00:00
rofl0r
50c84176da debug.c: fix for ipv6 changes
closes #94
2015-12-01 20:37:27 +00:00
rofl0r
1294d0a004 configure: check for availability of s6_addr16
this should fix the build of the recently added ipv6 code on MacOS X,
OpenBSD and eventually FreeBSD.

closes #83
closes #85

thanks to @cam13 and @vonnyfly for reporting/testing.
2015-10-01 14:14:23 +01:00
rofl0r
e9bf9623ba README: fix omission and whitespace 2015-09-19 11:09:41 +01:00
rofl0r
8a7081409e remove obsolete config.mak example
config.mak is autogenerated by the configure script since a long time.
there's no need to supply the example anymore, and it appears a lot
of people are looking into the directory expecting to find a binary
distribution.
2015-09-15 22:00:43 +01:00
rofl0r
32df7ff152 connect(): handle ipv4-mapped ipv6 addresses
if an ipv4-mapped ipv6 address is detected, the ip is converted
into v4 format because it may actually be one of our remote dns ips.
it was reported that a program called "maven", when getting handed our
fake ips in the remote dns subnet, converts the ip to v6 prior to calling
connect():
[proxychains] Strict chain ... 127.0.0.1:1080 ... ::ffff:224.0.0.1:443
<--socket error or timeout!

fixes #77
2015-09-15 21:19:51 +01:00
rofl0r
097c7f9125 add testcase for ipv4-mapped ipv6 address 2015-09-15 21:14:58 +01:00
rofl0r
2237749567 preliminary ipv6 support
only basic testing was done (with 2 socks5 proxies listening on ::1)
but seems to work as intended.

ipv6 support for the hostsreader (/etc/hosts) is not implemented so far.
2015-08-10 17:00:26 +01:00
rofl0r
9969dd3a22 fix socks5 bug: always requested user auth cap
since "user" always points to a statically allocated string buffer,
the test for if(user)... was bogus.
use ulen instead.

this bug should only be visible on socks servers that require auth
if username was not passed, so it was probably not really an issue.
2015-06-14 12:10:32 +01:00
rofl0r
d900b090fe put INIT() call consistently at beginning of hooked funcs 2015-06-14 11:16:59 +01:00
rofl0r
afe6171cad clean up some debug ifdefs 2015-06-14 10:53:33 +01:00
rofl0r
51b2eb91ce remove commented-out code [2] 2015-06-14 10:27:41 +01:00
rofl0r
ae16ae9fc9 remove commented-out code 2015-06-14 09:57:05 +01:00
rofl0r
338b9ce4e3 whitespace fixes for proxytype switch block 2015-06-13 20:32:15 +01:00
rofl0r
c6553c2cc5 replace string manip. in HTTP setup code with single snprintf 2015-06-13 20:21:59 +01:00
rofl0r
49adb6ce29 simplify socks5 buffer setup code 2015-06-13 19:02:11 +01:00
rofl0r
c7fa7bf86a simplify start_chain struct setup 2015-06-13 18:37:57 +01:00
rofl0r
29df9abec3 release 4.10 2015-06-09 08:23:28 +02:00
rofl0r
2182eff358 fix segfault in DNS mapping lookup code
the allocatorthread got pointers to RAM which were reallocated
behind the back, and if realloc() couldn't grow in-place, lead
to segfaults in applications that do a lot of DNS-lookups such
as webbrowsers.

closes #66
closes #31

thanks to @ravomavain for tracking down the issue.
2015-06-06 11:43:53 +01:00
rofl0r
53c6c2ca9b configure: respect user LDFLAGS without breaking link order 2015-06-04 21:11:08 +01:00
rofl0r
c9c51d6705 Revert "Fix LDFLAGS"
This reverts commit e79e05a228.

This commit broke link order for a number of people.
2015-06-04 21:04:30 +01:00
rofl0r
fda4ba37ec Revert "fix makefile link order"
This reverts commit 377b474b40.

There still are problems with the link order.
Revert to the known-good version.
2015-06-04 21:03:25 +01:00