Commit Graph

146 Commits

Author SHA1 Message Date
rofl0r
aa1b9df2cb overhaul README
especially mentioning that proxychains is a HACK so it may not work.
it is a hack because it modifies existing programs in a way not
originally intended by its authors.
additionally it relies on a very complicated and fragile dynamic
linker infrastructure which can easily break, as is the case with
glibc-linked programs that use dlopen() (see issue #10).
2013-02-10 09:54:03 +01:00
rofl0r
f3af1239a9 better regex for obsolete proxyresolv script (thx yhzarcali)
closes #11
2013-01-29 18:43:21 +01:00
rofl0r
1da09e49e5 hook close() to prevent rude programs like ssh to close our pipes
those pipes are needed to talk with the dns-name allocator thread.

closes #9
2013-01-21 01:54:45 +01:00
rofl0r
a8e8cced6d README: add disclaimer. 2013-01-06 21:42:02 +01:00
rofl0r
2efe207dde README: add bold warnings about risks 2013-01-06 21:23:44 +01:00
rofl0r
5d7715551d Makefile: add install-data to .PHONY 2013-01-06 19:33:34 +01:00
rofl0r
5d9148a900 README: mention install-config 2013-01-06 19:32:55 +01:00
rofl0r
4f7363efbc Makefile: put include config later so the program name can be overridden 2013-01-06 19:26:01 +01:00
rofl0r
173b90368e update proxyresolv 2013-01-06 19:20:44 +01:00
rofl0r
5f433adfed fine-tune configure for BSD 2013-01-06 19:18:04 +01:00
rofl0r
52cbc8f87d post-release update of README 2013-01-06 19:14:43 +01:00
rofl0r
c8bfdc15e6 remove old proxychains launcher script 2013-01-06 19:12:15 +01:00
rofl0r
5526afb56d FreeBSD support 2012-12-25 19:08:05 +01:00
rofl0r
be4efc0fd5 fix no-newline warnings on old compilers 2012-12-25 18:01:11 +01:00
rofl0r
ab4fb353b6 fix for mac build error
closes #6
2012-12-18 09:42:17 +01:00
rofl0r
5ecd5ac51d fix compilation on musl libc 2012-12-18 09:38:32 +01:00
rofl0r
d888e4ebf4 add test for getnameinfo 2012-12-17 23:22:25 +01:00
rofl0r
1c265b9628 getnameinfo: check size and family of salen 2012-12-17 23:21:58 +01:00
rofl0r
346474a43b getnameinfo: return error if buffers are too small 2012-12-17 22:41:51 +01:00
rofl0r
ce655fdac8 fix the never-ending issues with the wrong glibc prototype of getnameinfo
this bug was fixed shortly before 2.14 release, so we checked for that.
however some distros decided to backport this fix to earlier versions,
breaking our compiletime check.

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=e4ecafe004b3d4270b3a9dace8f970047400ed38

the portable solution is to stick the function into a separate comilation
unit that does not see the glibc prototype.

closes #7
2012-12-17 22:17:04 +01:00
rofl0r
b255484a42 update README for 4.3 release 2012-12-12 04:04:38 +01:00
rofl0r
af5c6f0c6a replace hostent lookup with better performing in-memory copy.
the central dns resolver function proxy_gethostbyname() used
to iterate over the gethostent() db (/etc/hosts) on each dns
request.
since this is not threadsafe, we synchronized access to it
previously using mutexes. the parsing of this file is slow,
and blocking all threads to do it even moreso.
since gethostent_r() is only available on a few platforms,
i decided to read the hostent db once and then use a quick
in-memory lookup on further usage.

+ some further refactoring.
2012-11-08 01:18:19 +01:00
rofl0r
c698d48c03 move stringfromipv4 into common.c 2012-11-07 22:00:03 +01:00
rofl0r
8b19829de4 README: remove paragraph about now fixed fork problems. 2012-11-07 21:55:34 +01:00
rofl0r
03ee84060e remove THREAD_SAFE ifdefs. from now on, pthreads are required.
additionally we have some explicit init and deinit routines for
core.c now, so that we dont need to share variables with
libproxychains.c.
2012-11-07 21:31:19 +01:00
rofl0r
bd07ca49b9 use pipe instead of pipe2 2012-11-07 21:31:18 +01:00
rofl0r
f570a66902 use mutexes also to protect the pipe communication
wasn't threadsafe before.
2012-11-07 21:31:18 +01:00
rofl0r
d0abc93c74 preliminary first fork-safe version
instead of allocating memory in the child, we now use the allocator
thread to do all the necessary allocations himself.
additionally we provide a clean API to query the ip <-> dns mapping.
these functions connect via a pipe to the allocator thread, and
exchange messages.

further cleanup is needed, but it seems to work so far.
thread-safety is not yet guaranteed.

closes #1
2012-11-07 21:31:11 +01:00
rofl0r
25afe98b20 failed attempt to use shared memory for the ip <-> dns mapping
this is in order to get irssi, which forks for DNS lookups,
and similar programs, to work as intended.

in a previous attempt i learned that shared memory created in a
child process is not visible to the parent;
in this attempt i spin off a thread from the parent which listens
on a pipe and manages the shared memory allocation from the parent
address-space. however this doesnt work as expected:
memory allocated in the parent after the child forked is not visi-
ble to the child as well.

so what happens is: irssi starts a child process, the thread allocs
memory and hands it to the child, the child attempts to write and
segfaults. however irssi doesnt crash. since now the memory is
already allocated, doing the dns lookup again will succeed.

i.e. the dns lookup works now in irssi by luck.
all but the first dns lookups will suceed.

however this is not good enough for me to be satisfied, i commit
this only for documentation purposes.
2012-11-07 16:49:14 +01:00
rofl0r
7bca3ba5ef main.c: fixed forgotten initialization for second loop using i
this caused the combination of -q -f somefile to not find the dll
in the current dir, because it started iterating the directory
list with 2 instead of 0.
2012-11-04 06:14:33 +01:00
rofl0r
f011ff99dd update .gitignore 2012-11-04 05:26:34 +01:00
rofl0r
e05cafc8e2 put a mutex lock around gethostent() usage, to prevent internal
races. the external usage was covered by the latest commit.
2012-11-04 05:23:51 +01:00
rofl0r
8ce1e51a60 add some test/debug programs 2012-11-04 05:10:50 +01:00
rofl0r
2d58820635 proxy_gethostbyname: fix thread safety issues arising from ...
gethostent() usage.

also set hostent.h_aliases member to a valid pointer.
2012-11-04 05:02:57 +01:00
rofl0r
b851b39a37 add RcB tags to core.h
this is handy as it allows me to do quick testprograms using my RcB program,
without specifying dozens of things on the command line.
2012-11-04 05:01:38 +01:00
rofl0r
e8d49b02e8 gethostbyaddr hook: also set aliases.
i inspected behaviour of libc's and they all seem to set a valid
h_aliases pointer, of which the first one should be NULL, if no
aliases exist.
2012-11-04 04:58:48 +01:00
rofl0r
859dabb302 common.h: supply a default for SYSCONFDIR if not passed via CFLAGS 2012-11-04 04:57:45 +01:00
rofl0r
6f35888528 fix issues with pthread and dlsym symbols on ubuntu 12.04
for some reason, the linker needs --no-as-needed for both
libdl and libpthread.

closes #4

thanks to @tomsawyer for discovering this.

the proposed -pthread change was not needed though,
and this is a good thing since it seems not portable.
2012-11-04 01:21:29 +01:00
rofl0r
bddb79a286 fix bug which lead to segfault in ubuntu 12.04 telnet
it called gethostbyname and expected that the h->h_name was set.

this code path here which gets only active if the passed name
equals the gethostname() result failed to set a couple of values.

additionally fixed usage of strncpy, which causes the entire
memory buffer to be written, even when the string is much shorter.

a similar bugfix was independently discovered by semion laptev, but my
version is threadsafe - his version introduces a new static buffer,
even though we have plenty of thread-safe space reserved exactly
for this usage case, thus causing a regression.
2012-11-04 01:00:58 +01:00
rofl0r
c2c719e25d fix AUTHORS. it wrongly assigned some work to the wrong author.
localnet was written by jianingy
poll_retry() by coling cross.
2012-09-02 01:58:15 +02:00
rofl0r
6515bc4d82 Merge pull request #3 from guanqun/master
fix typo in help message
2012-08-27 14:46:05 -07:00
guanqun
bbf8b7aab0 fix typo in help message 2012-08-27 23:30:45 +08:00
rofl0r
01b8c81e90 add some default localnets (commented) to config 2012-08-16 16:44:51 +02:00
rofl0r
ddd9e48fc1 update README for 4.1 release 2012-08-06 01:34:23 +02:00
rofl0r
923c4f1026 fix core.h to be usable on its own 2012-08-06 01:26:34 +02:00
rofl0r
108610e30e core.c: add getservbyname_r replacement function for mac 2012-08-06 01:26:03 +02:00
rofl0r
0f1bc719fd put base64 variable to the place it gets used 2012-08-04 17:55:37 +02:00
rofl0r
068e088a8b tunnel_to: use better suited type 2012-08-03 10:43:59 +02:00
rofl0r
40bb78b53f fix omission in common.c 2012-07-16 02:42:09 +02:00
rofl0r
a4f3dd0538 Makefile: put config into new install-config target 2012-07-16 02:36:35 +02:00