summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Fix: improve getpeername to actually worksgetpeernameDavid Goulet2014-10-12
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Test: add missing connection destroyDavid Goulet2014-10-01
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Test: possible double free in onion testDavid Goulet2014-10-01
| | | | | | Fix Coverity issue 1195191. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Test: fix memory leak in DNS testDavid Goulet2014-10-01
| | | | | | Fix Coverity issue 1243012. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add accept as an accepted value through syscall()David Goulet2014-09-28
| | | | | | | This commit adds the accept(2) value to syscall(2) so we can pass it on to Tor and not deny it blindly. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add cscope files to gitignoreDavid Goulet2014-09-09
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update version to v2.0.0v2.0.0David Goulet2014-08-11
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: compilation issue on Debian kfreebsd-i386David Goulet2014-08-11
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: add LICENSE file to repositoryDavid Goulet2014-08-11
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: add compilation requirements to README.mdDavid Goulet2014-07-14
| | | | | Reported-by: Jacob Appelbaum <jacob@appelbaum.net> Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update version to v2.0.0-rc7v2.0.0-rc7David Goulet2014-04-04
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: fix NULL dereference on errorDavid Goulet2014-04-03
| | | | | | Fixes coverity issue 1195182. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: memory leak in connect error pathDavid Goulet2014-04-03
| | | | | | Fixes coverity issue 1072757. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Delete old source directoryDavid Goulet2014-03-31
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: nullify constant that might be undefinedDavid Goulet2014-03-31
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Refactor the connect() code flow for clarityDavid Goulet2014-03-31
| | | | | | | | | | | | | This adds a "validate_socket()" function that is called first to make sure all criteria of a valid socket that torsocks can handle are met. This has been done to have a single callsite that can do this validation thus improving the clarity and flow of the code. It now also returns EPERM for things that we deny instead of EINVAL or EBADF. Because of that, the connect test has been changed to handle this new errno value. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Tests: add connect() testDavid Goulet2014-03-31
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Tests: add socket() testDavid Goulet2014-03-31
| | | | | | Add unit test for socket() and socketpair(). Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: socketpair() denied for INET[6] socketDavid Goulet2014-03-31
| | | | | | | | | | The SOCK_STREAM check was wrong since you could pass SOCK_DGRAM and match the check so the socketpair() now denies INET/INET6 socket. Note that socketpair() only supports AF_UNIX and AF_LOCAL on most *nix system. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: socket() type check SOCK_STREAMDavid Goulet2014-03-31
| | | | | | | | | | | | | | | Even though connect() makes a check, deny socket creation that are INET/INET6 but NOT of type SOCK_STREAM. This fix makes our wrapper handle socket type flags that can be passed to the kernel such as SOCK_NONBLOCK and SOCK_CLOEXEC. Furthermore, the type check was *not* right since having a type set to SOCK_DGRAM also matches SOCK_STREAM when using the & operator. A unit test is added for the IS_SOCK_STREAM(type) macro that test if a socket type is a SOCK_STREAM. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: add autogen.sh to installation proceduresDavid Goulet2014-03-26
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: change TSOCKS_LOOPBACK bitnessLunar2014-03-24
| | | | | | | | | This changes the loopback constant to be in host byte order and use htonl() when needed in network byte order. With this, tests pass on powerpc. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: support kfreebsd for mmap()Jérémy Bobbio2014-03-18
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update version to v2.0.0-rc6v2.0.0-rc6David Goulet2014-03-17
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: set addr len for getsockname in acceptDavid Goulet2014-03-17
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: use socket fd and NOT sockaddr in acceptDavid Goulet2014-03-17
| | | | | | | | | Major mistake in accept() which was checking the given sockaddr structure instead of the given socket fd. The address structure passed to accept is meant to be filled up by the accept function thus not containing any usable data. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update version to v2.0.0-rc5v2.0.0-rc5David Goulet2014-03-17
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: strict aliasing in libraryDavid Goulet2014-03-12
| | | | | | Fixes #28 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add fclose() supportDavid Goulet2014-03-08
| | | | | | Fixes #29 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: add torsocks.conf option typeDavid Goulet2014-03-04
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add option to allow inbound connectionsDavid Goulet2014-03-04
| | | | | | | | | | | | | This adds the possibility of telling torsocks to allow inbound connections meaning allowing listen() and accept()/accept4() for non localhost address. Add a AllowInbound 0|1 option to the configuration file along with a TORSOCKS_ALLOW_INBOUND environment variable to control that behavior. By default, Unix socket are allowed. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: handle NULL node in getaddrinfoDavid Goulet2014-03-04
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update version to v2.0.0-rc4v2.0.0-rc4David Goulet2014-03-03
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Extras: add bash and zsh completion fileDavid Goulet2014-03-03
| | | | | | | | | Those files need to be installed by hand or from your distribution package. They've been taken from the old torsocks (1.3) package. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: move functions in file and set hidden attributeDavid Goulet2014-03-03
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Update torsocks.1 man page with new options and some fixesDavid Goulet2014-03-03
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add -u/-p/-d to torsocks scriptDavid Goulet2014-03-03
| | | | | | | | | | The -u, --user and -p, --pass are for the SOCKS5 authentication where -d, --debug is to set torsocks in DEBUG mode. Improve the usage output and make sure torsocks on/off is being sourced else exit with error. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: check SOCKS5 user/pass before setting them in configDavid Goulet2014-03-03
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Test: add socks5 testsLuke Gallagher2014-03-02
| | | | | | | | | Introduce function pointers for send_data and recv_data so they can be replaced for testing. Closes #25 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: assert conn->fd typoLuke Gallagher2014-03-02
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Add SOCKS5 username/password authenticationDavid Goulet2014-03-02
| | | | | | | | | | Using RFC1929, implement username/password authentication for circuit isolation feature of Tor daemon. This adds SOCKS5Username and SOCKS5Password option to torsocks.conf and also environment variable to control them (TORSOCKS_USERNAME/PASSWORD). Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: handle conn. type domain name for socks5 connectDavid Goulet2014-02-25
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: check strdup return value in config-file.cDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: make tsock_tor_resolve support IPv6David Goulet2014-02-20
| | | | | | | Note that the tor daemon does not support IPv6 DNS resolution through the SOCKS port thus for now it is denied. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: overload listen and not bindDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: remove the use of IPv4 sockaddr in connectDavid Goulet2014-02-20
| | | | | | | | | | | This modifies the onion find by ip to use generic sockaddr structure. Also, a utils call is added to extract the port from a sockaddr structure depending on the family. This is a step in the direction of fully supported IPv6 thus removing the use of a cast sockaddr_in. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Tests: add one for utils_tokenize_ignore_commentsDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: use unsigned char for socks5 ABIDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: use connection_get_ref on creationDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>
* Fix: use strtok_r reentrant instead of strtokDavid Goulet2014-02-20
| | | | Signed-off-by: David Goulet <dgoulet@ev0ke.net>