tor-commits
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 1 participants
- 216108 discussions
commit dfaf9e799092d1b901270b7492ab727739d60898
Author: Robert Hogan <robert(a)roberthogan.net>
Date: Mon Sep 20 20:19:46 2010 +0100
Always print error messages.
Allow error logging by default.
---
configure.in | 4 ----
src/tsocks.c | 7 +------
2 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/configure.in b/configure.in
index 9d8a1e2..9a41cf1 100644
--- a/configure.in
+++ b/configure.in
@@ -189,10 +189,6 @@ if test "${enable_oldmethod}" = "yes"; then
oldmethod="yes"
fi
-if test "x${enable_debug}" != "x"; then
- AC_DEFINE([ALLOW_MSG_OUTPUT],[],[Description])
-fi
-
AC_DEFINE([HOSTNAMES],[0],[Description])
if test "x${enable_hostnames}" = "xyes"; then
diff --git a/src/tsocks.c b/src/tsocks.c
index 3773bb0..80f7b9c 100644
--- a/src/tsocks.c
+++ b/src/tsocks.c
@@ -255,24 +255,19 @@ void tsocks_init(void)
static int get_environment()
{
static int done = 0;
-#ifdef ALLOW_MSG_OUTPUT
int loglevel = MSGERR;
char *logfile = NULL;
char *env;
-#endif
+
if (done)
return(0);
/* Determine the logging level */
-#ifndef ALLOW_MSG_OUTPUT
- set_log_options(-1, (char *)stderr, 0);
-#else
if ((env = getenv("TORSOCKS_DEBUG")))
loglevel = atoi(env);
if (((env = getenv("TORSOCKS_DEBUG_FILE"))) && !suid)
logfile = env;
set_log_options(loglevel, logfile, 1);
-#endif
done = 1;
1
0
23 Oct '11
commit 54f25db9d54c63052e789ec429d8a4296520e9d8
Author: mwenge <robert(a)roberthogan.net>
Date: Sat Nov 28 10:24:01 2009 +0000
Remove non-free RFC and replace with link.
---
doc/SOCKS5 | 2 +
doc/SOCKS5-rfc1928.txt | 507 ------------------------------------------------
2 files changed, 2 insertions(+), 507 deletions(-)
diff --git a/doc/SOCKS5 b/doc/SOCKS5
new file mode 100644
index 0000000..40dfcbd
--- /dev/null
+++ b/doc/SOCKS5
@@ -0,0 +1,2 @@
+http://www.ietf.org/rfc/rfc1928.txt
+
diff --git a/doc/SOCKS5-rfc1928.txt b/doc/SOCKS5-rfc1928.txt
deleted file mode 100644
index 46bf46e..0000000
--- a/doc/SOCKS5-rfc1928.txt
+++ /dev/null
@@ -1,507 +0,0 @@
-
-
-
-
-
-
-Network Working Group M. Leech
-Request for Comments: 1928 Bell-Northern Research Ltd
-Category: Standards Track M. Ganis
- International Business Machines
- Y. Lee
- NEC Systems Laboratory
- R. Kuris
- Unify Corporation
- D. Koblas
- Independent Consultant
- L. Jones
- Hewlett-Packard Company
- March 1996
-
-
- SOCKS Protocol Version 5
-
-Status of this Memo
-
- This document specifies an Internet standards track protocol for the
- Internet community, and requests discussion and suggestions for
- improvements. Please refer to the current edition of the "Internet
- Official Protocol Standards" (STD 1) for the standardization state
- and status of this protocol. Distribution of this memo is unlimited.
-
-Acknowledgments
-
- This memo describes a protocol that is an evolution of the previous
- version of the protocol, version 4 [1]. This new protocol stems from
- active discussions and prototype implementations. The key
- contributors are: Marcus Leech: Bell-Northern Research, David Koblas:
- Independent Consultant, Ying-Da Lee: NEC Systems Laboratory, LaMont
- Jones: Hewlett-Packard Company, Ron Kuris: Unify Corporation, Matt
- Ganis: International Business Machines.
-
-1. Introduction
-
- The use of network firewalls, systems that effectively isolate an
- organizations internal network structure from an exterior network,
- such as the INTERNET is becoming increasingly popular. These
- firewall systems typically act as application-layer gateways between
- networks, usually offering controlled TELNET, FTP, and SMTP access.
- With the emergence of more sophisticated application layer protocols
- designed to facilitate global information discovery, there exists a
- need to provide a general framework for these protocols to
- transparently and securely traverse a firewall.
-
-
-
-
-
-Leech, et al Standards Track [Page 1]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- There exists, also, a need for strong authentication of such
- traversal in as fine-grained a manner as is practical. This
- requirement stems from the realization that client-server
- relationships emerge between the networks of various organizations,
- and that such relationships need to be controlled and often strongly
- authenticated.
-
- The protocol described here is designed to provide a framework for
- client-server applications in both the TCP and UDP domains to
- conveniently and securely use the services of a network firewall.
- The protocol is conceptually a "shim-layer" between the application
- layer and the transport layer, and as such does not provide network-
- layer gateway services, such as forwarding of ICMP messages.
-
-2. Existing practice
-
- There currently exists a protocol, SOCKS Version 4, that provides for
- unsecured firewall traversal for TCP-based client-server
- applications, including TELNET, FTP and the popular information-
- discovery protocols such as HTTP, WAIS and GOPHER.
-
- This new protocol extends the SOCKS Version 4 model to include UDP,
- and extends the framework to include provisions for generalized
- strong authentication schemes, and extends the addressing scheme to
- encompass domain-name and V6 IP addresses.
-
- The implementation of the SOCKS protocol typically involves the
- recompilation or relinking of TCP-based client applications to use
- the appropriate encapsulation routines in the SOCKS library.
-
-Note:
-
- Unless otherwise noted, the decimal numbers appearing in packet-
- format diagrams represent the length of the corresponding field, in
- octets. Where a given octet must take on a specific value, the
- syntax X'hh' is used to denote the value of the single octet in that
- field. When the word 'Variable' is used, it indicates that the
- corresponding field has a variable length defined either by an
- associated (one or two octet) length field, or by a data type field.
-
-3. Procedure for TCP-based clients
-
- When a TCP-based client wishes to establish a connection to an object
- that is reachable only via a firewall (such determination is left up
- to the implementation), it must open a TCP connection to the
- appropriate SOCKS port on the SOCKS server system. The SOCKS service
- is conventionally located on TCP port 1080. If the connection
- request succeeds, the client enters a negotiation for the
-
-
-
-Leech, et al Standards Track [Page 2]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- authentication method to be used, authenticates with the chosen
- method, then sends a relay request. The SOCKS server evaluates the
- request, and either establishes the appropriate connection or denies
- it.
-
- Unless otherwise noted, the decimal numbers appearing in packet-
- format diagrams represent the length of the corresponding field, in
- octets. Where a given octet must take on a specific value, the
- syntax X'hh' is used to denote the value of the single octet in that
- field. When the word 'Variable' is used, it indicates that the
- corresponding field has a variable length defined either by an
- associated (one or two octet) length field, or by a data type field.
-
- The client connects to the server, and sends a version
- identifier/method selection message:
-
- +----+----------+----------+
- |VER | NMETHODS | METHODS |
- +----+----------+----------+
- | 1 | 1 | 1 to 255 |
- +----+----------+----------+
-
- The VER field is set to X'05' for this version of the protocol. The
- NMETHODS field contains the number of method identifier octets that
- appear in the METHODS field.
-
- The server selects from one of the methods given in METHODS, and
- sends a METHOD selection message:
-
- +----+--------+
- |VER | METHOD |
- +----+--------+
- | 1 | 1 |
- +----+--------+
-
- If the selected METHOD is X'FF', none of the methods listed by the
- client are acceptable, and the client MUST close the connection.
-
- The values currently defined for METHOD are:
-
- o X'00' NO AUTHENTICATION REQUIRED
- o X'01' GSSAPI
- o X'02' USERNAME/PASSWORD
- o X'03' to X'7F' IANA ASSIGNED
- o X'80' to X'FE' RESERVED FOR PRIVATE METHODS
- o X'FF' NO ACCEPTABLE METHODS
-
- The client and server then enter a method-specific sub-negotiation.
-
-
-
-Leech, et al Standards Track [Page 3]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- Descriptions of the method-dependent sub-negotiations appear in
- separate memos.
-
- Developers of new METHOD support for this protocol should contact
- IANA for a METHOD number. The ASSIGNED NUMBERS document should be
- referred to for a current list of METHOD numbers and their
- corresponding protocols.
-
- Compliant implementations MUST support GSSAPI and SHOULD support
- USERNAME/PASSWORD authentication methods.
-
-4. Requests
-
- Once the method-dependent subnegotiation has completed, the client
- sends the request details. If the negotiated method includes
- encapsulation for purposes of integrity checking and/or
- confidentiality, these requests MUST be encapsulated in the method-
- dependent encapsulation.
-
- The SOCKS request is formed as follows:
-
- +----+-----+-------+------+----------+----------+
- |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
- +----+-----+-------+------+----------+----------+
- | 1 | 1 | X'00' | 1 | Variable | 2 |
- +----+-----+-------+------+----------+----------+
-
- Where:
-
- o VER protocol version: X'05'
- o CMD
- o CONNECT X'01'
- o BIND X'02'
- o UDP ASSOCIATE X'03'
- o RSV RESERVED
- o ATYP address type of following address
- o IP V4 address: X'01'
- o DOMAINNAME: X'03'
- o IP V6 address: X'04'
- o DST.ADDR desired destination address
- o DST.PORT desired destination port in network octet
- order
-
- The SOCKS server will typically evaluate the request based on source
- and destination addresses, and return one or more reply messages, as
- appropriate for the request type.
-
-
-
-
-
-Leech, et al Standards Track [Page 4]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
-5. Addressing
-
- In an address field (DST.ADDR, BND.ADDR), the ATYP field specifies
- the type of address contained within the field:
-
- o X'01'
-
- the address is a version-4 IP address, with a length of 4 octets
-
- o X'03'
-
- the address field contains a fully-qualified domain name. The first
- octet of the address field contains the number of octets of name that
- follow, there is no terminating NUL octet.
-
- o X'04'
-
- the address is a version-6 IP address, with a length of 16 octets.
-
-6. Replies
-
- The SOCKS request information is sent by the client as soon as it has
- established a connection to the SOCKS server, and completed the
- authentication negotiations. The server evaluates the request, and
- returns a reply formed as follows:
-
- +----+-----+-------+------+----------+----------+
- |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |
- +----+-----+-------+------+----------+----------+
- | 1 | 1 | X'00' | 1 | Variable | 2 |
- +----+-----+-------+------+----------+----------+
-
- Where:
-
- o VER protocol version: X'05'
- o REP Reply field:
- o X'00' succeeded
- o X'01' general SOCKS server failure
- o X'02' connection not allowed by ruleset
- o X'03' Network unreachable
- o X'04' Host unreachable
- o X'05' Connection refused
- o X'06' TTL expired
- o X'07' Command not supported
- o X'08' Address type not supported
- o X'09' to X'FF' unassigned
- o RSV RESERVED
- o ATYP address type of following address
-
-
-
-Leech, et al Standards Track [Page 5]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- o IP V4 address: X'01'
- o DOMAINNAME: X'03'
- o IP V6 address: X'04'
- o BND.ADDR server bound address
- o BND.PORT server bound port in network octet order
-
- Fields marked RESERVED (RSV) must be set to X'00'.
-
- If the chosen method includes encapsulation for purposes of
- authentication, integrity and/or confidentiality, the replies are
- encapsulated in the method-dependent encapsulation.
-
-CONNECT
-
- In the reply to a CONNECT, BND.PORT contains the port number that the
- server assigned to connect to the target host, while BND.ADDR
- contains the associated IP address. The supplied BND.ADDR is often
- different from the IP address that the client uses to reach the SOCKS
- server, since such servers are often multi-homed. It is expected
- that the SOCKS server will use DST.ADDR and DST.PORT, and the
- client-side source address and port in evaluating the CONNECT
- request.
-
-BIND
-
- The BIND request is used in protocols which require the client to
- accept connections from the server. FTP is a well-known example,
- which uses the primary client-to-server connection for commands and
- status reports, but may use a server-to-client connection for
- transferring data on demand (e.g. LS, GET, PUT).
-
- It is expected that the client side of an application protocol will
- use the BIND request only to establish secondary connections after a
- primary connection is established using CONNECT. In is expected that
- a SOCKS server will use DST.ADDR and DST.PORT in evaluating the BIND
- request.
-
- Two replies are sent from the SOCKS server to the client during a
- BIND operation. The first is sent after the server creates and binds
- a new socket. The BND.PORT field contains the port number that the
- SOCKS server assigned to listen for an incoming connection. The
- BND.ADDR field contains the associated IP address. The client will
- typically use these pieces of information to notify (via the primary
- or control connection) the application server of the rendezvous
- address. The second reply occurs only after the anticipated incoming
- connection succeeds or fails.
-
-
-
-
-
-Leech, et al Standards Track [Page 6]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- In the second reply, the BND.PORT and BND.ADDR fields contain the
- address and port number of the connecting host.
-
-UDP ASSOCIATE
-
- The UDP ASSOCIATE request is used to establish an association within
- the UDP relay process to handle UDP datagrams. The DST.ADDR and
- DST.PORT fields contain the address and port that the client expects
- to use to send UDP datagrams on for the association. The server MAY
- use this information to limit access to the association. If the
- client is not in possesion of the information at the time of the UDP
- ASSOCIATE, the client MUST use a port number and address of all
- zeros.
-
- A UDP association terminates when the TCP connection that the UDP
- ASSOCIATE request arrived on terminates.
-
- In the reply to a UDP ASSOCIATE request, the BND.PORT and BND.ADDR
- fields indicate the port number/address where the client MUST send
- UDP request messages to be relayed.
-
-Reply Processing
-
- When a reply (REP value other than X'00') indicates a failure, the
- SOCKS server MUST terminate the TCP connection shortly after sending
- the reply. This must be no more than 10 seconds after detecting the
- condition that caused a failure.
-
- If the reply code (REP value of X'00') indicates a success, and the
- request was either a BIND or a CONNECT, the client may now start
- passing data. If the selected authentication method supports
- encapsulation for the purposes of integrity, authentication and/or
- confidentiality, the data are encapsulated using the method-dependent
- encapsulation. Similarly, when data arrives at the SOCKS server for
- the client, the server MUST encapsulate the data as appropriate for
- the authentication method in use.
-
-7. Procedure for UDP-based clients
-
- A UDP-based client MUST send its datagrams to the UDP relay server at
- the UDP port indicated by BND.PORT in the reply to the UDP ASSOCIATE
- request. If the selected authentication method provides
- encapsulation for the purposes of authenticity, integrity, and/or
- confidentiality, the datagram MUST be encapsulated using the
- appropriate encapsulation. Each UDP datagram carries a UDP request
- header with it:
-
-
-
-
-
-Leech, et al Standards Track [Page 7]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- +----+------+------+----------+----------+----------+
- |RSV | FRAG | ATYP | DST.ADDR | DST.PORT | DATA |
- +----+------+------+----------+----------+----------+
- | 2 | 1 | 1 | Variable | 2 | Variable |
- +----+------+------+----------+----------+----------+
-
- The fields in the UDP request header are:
-
- o RSV Reserved X'0000'
- o FRAG Current fragment number
- o ATYP address type of following addresses:
- o IP V4 address: X'01'
- o DOMAINNAME: X'03'
- o IP V6 address: X'04'
- o DST.ADDR desired destination address
- o DST.PORT desired destination port
- o DATA user data
-
- When a UDP relay server decides to relay a UDP datagram, it does so
- silently, without any notification to the requesting client.
- Similarly, it will drop datagrams it cannot or will not relay. When
- a UDP relay server receives a reply datagram from a remote host, it
- MUST encapsulate that datagram using the above UDP request header,
- and any authentication-method-dependent encapsulation.
-
- The UDP relay server MUST acquire from the SOCKS server the expected
- IP address of the client that will send datagrams to the BND.PORT
- given in the reply to UDP ASSOCIATE. It MUST drop any datagrams
- arriving from any source IP address other than the one recorded for
- the particular association.
-
- The FRAG field indicates whether or not this datagram is one of a
- number of fragments. If implemented, the high-order bit indicates
- end-of-fragment sequence, while a value of X'00' indicates that this
- datagram is standalone. Values between 1 and 127 indicate the
- fragment position within a fragment sequence. Each receiver will
- have a REASSEMBLY QUEUE and a REASSEMBLY TIMER associated with these
- fragments. The reassembly queue must be reinitialized and the
- associated fragments abandoned whenever the REASSEMBLY TIMER expires,
- or a new datagram arrives carrying a FRAG field whose value is less
- than the highest FRAG value processed for this fragment sequence.
- The reassembly timer MUST be no less than 5 seconds. It is
- recommended that fragmentation be avoided by applications wherever
- possible.
-
- Implementation of fragmentation is optional; an implementation that
- does not support fragmentation MUST drop any datagram whose FRAG
- field is other than X'00'.
-
-
-
-Leech, et al Standards Track [Page 8]
-
-RFC 1928 SOCKS Protocol Version 5 March 1996
-
-
- The programming interface for a SOCKS-aware UDP MUST report an
- available buffer space for UDP datagrams that is smaller than the
- actual space provided by the operating system:
-
- o if ATYP is X'01' - 10+method_dependent octets smaller
- o if ATYP is X'03' - 262+method_dependent octets smaller
- o if ATYP is X'04' - 20+method_dependent octets smaller
-
-8. Security Considerations
-
- This document describes a protocol for the application-layer
- traversal of IP network firewalls. The security of such traversal is
- highly dependent on the particular authentication and encapsulation
- methods provided in a particular implementation, and selected during
- negotiation between SOCKS client and SOCKS server.
-
- Careful consideration should be given by the administrator to the
- selection of authentication methods.
-
-9. References
-
- [1] Koblas, D., "SOCKS", Proceedings: 1992 Usenix Security Symposium.
-
-Author's Address
-
- Marcus Leech
- Bell-Northern Research Ltd
- P.O. Box 3511, Stn. C,
- Ottawa, ON
- CANADA K1Y 4H7
-
- Phone: (613) 763-9145
- EMail: mleech(a)bnr.ca
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Leech, et al Standards Track [Page 9]
-
1
0
[torsocks/osx] Manpage syntax fixes from Patrick Matthäi <pmatthaei@debian.org>
by hoganrobert@torproject.org 23 Oct '11
by hoganrobert@torproject.org 23 Oct '11
23 Oct '11
commit 2b42c80f106aae039d85458aa3c6624a6459febb
Author: mwenge <robert(a)roberthogan.net>
Date: Sun Nov 8 12:35:11 2009 +0000
Manpage syntax fixes from Patrick Matthäi <pmatthaei(a)debian.org>
---
src/torsocks.conf.5.in | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/torsocks.conf.5.in b/src/torsocks.conf.5.in
index b8ab870..7cd22d8 100644
--- a/src/torsocks.conf.5.in
+++ b/src/torsocks.conf.5.in
@@ -53,7 +53,7 @@ Obviously if a connection is not to a locally accessible network it will need
to be proxied over a SOCKS server. However, many installations have several
different SOCKS servers to be used to access different internal (and external)
networks. For this reason the configuration file allows the definition of
-'paths' as well as a default SOCKS server.
+`paths' as well as a default SOCKS server.
Paths are declared as blocks in the configuration file. That is, they begin
with a 'path {' line in the configuration file and end with a '}' line. Inside
@@ -97,7 +97,7 @@ The following directives are used in the torsocks configuration file:
.I server
The IP address of the SOCKS server (e.g "server = 10.1.4.253"). Only one
server may be specified per path block, or one outside a path
-block (to define the default server). Unless --disable-hostnames was
+block (to define the default server). Unless \-\-disable-hostnames was
specified to configure at compile time the server can be specified as
a hostname (e.g "server = socks.nec.com")
@@ -149,7 +149,7 @@ local, otherwise torsocks would need a SOCKS server to reach SOCKS servers.
.TP
.I reaches
This directive is only valid inside a path block. Its parameter is formed
-as IP[:startport[-endport]]/Subnet and it specifies a network (and a range
+as IP[:startport[\-endport]]/Subnet and it specifies a network (and a range
of ports on that network) that can be accessed by the SOCKS server specified
in this path block. For example, in a path block "reaches =
150.0.0.0:80-1024/255.0.0.0" indicates to torsocks that the SOCKS server
@@ -161,7 +161,7 @@ range 150.0.0.0 to 150.255.255.255 when the connection request is for ports
.I tordns_enable
This enables the use of the 'tordns' feature in torsocks, which overrides the
standard C library name resolution calls to use SOCKS. The default value is
-'true'.
+`true'.
.TP
.I tordns_deadpool_range
1
0
commit aacc9731963484958ac7b6daf165b36056e42345
Author: mwenge <robert(a)roberthogan.net>
Date: Sat Sep 26 09:43:00 2009 +0100
Remove kdevelop project file
---
torsocks.kdevelop | 266 -----------------------------------------------------
1 files changed, 0 insertions(+), 266 deletions(-)
diff --git a/torsocks.kdevelop b/torsocks.kdevelop
deleted file mode 100644
index f3322c6..0000000
--- a/torsocks.kdevelop
+++ /dev/null
@@ -1,266 +0,0 @@
-<?xml version = '1.0'?>
-<kdevelop>
- <general>
- <author>Robert Hogan</author>
- <email>robert(a)roberthogan.net</email>
- <version>0.1</version>
- <projectmanagement>KDevAutoProject</projectmanagement>
- <primarylanguage>C</primarylanguage>
- <keywords>
- <keyword>C</keyword>
- <keyword>Code</keyword>
- </keywords>
- <ignoreparts/>
- <projectname>torsocks</projectname>
- <projectdirectory>.</projectdirectory>
- <absoluteprojectpath>false</absoluteprojectpath>
- <description/>
- <defaultencoding/>
- <versioncontrol>kdevcvsservice</versioncontrol>
- </general>
- <kdevautoproject>
- <general>
- <activetarget>src/torsocks</activetarget>
- <useconfiguration>debug</useconfiguration>
- </general>
- <run>
- <mainprogram>/home/robert/Development/torsocks-svn/torsocks/debug/</mainprogram>
- <terminal>true</terminal>
- <programargs>ping google.com</programargs>
- <globaldebugarguments>ping www.google.com</globaldebugarguments>
- <globalcwd>/home/robert/Development/torsocks-svn/torsocks/</globalcwd>
- <useglobalprogram>true</useglobalprogram>
- <autocompile>false</autocompile>
- <autoinstall>false</autoinstall>
- <autokdesu>false</autokdesu>
- <envvars>
- <envvar value="debug/src/.libs/libtorsocks.so" name="LD_PRELOAD" />
- <envvar value="2" name="TSOCKS_DEBUG" />
- </envvars>
- </run>
- <configurations>
- <optimized>
- <builddir>optimized</builddir>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevg77options</f77compiler>
- <cflags>-O2 -g0 </cflags>
- </optimized>
- <debug>
- <configargs>--enable-debug=full --enable-gcc-warnings</configargs>
- <builddir>debug</builddir>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevg77options</f77compiler>
- <cflags>-O0 -g3 </cflags>
- <envvars/>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cxxflags/>
- <f77flags/>
- </debug>
- <default>
- <envvars/>
- <configargs>--enable-gcc-warnings</configargs>
- <builddir/>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevpgf77options</f77compiler>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags/>
- <cxxflags/>
- <f77flags/>
- </default>
- </configurations>
- <make>
- <envvars>
- <envvar value="1" name="WANT_AUTOCONF_2_5" />
- <envvar value="1" name="WANT_AUTOMAKE_1_6" />
- </envvars>
- <abortonerror>true</abortonerror>
- <runmultiplejobs>true</runmultiplejobs>
- <numberofjobs>3</numberofjobs>
- <dontact>false</dontact>
- <makebin/>
- <prio>0</prio>
- </make>
- </kdevautoproject>
- <kdevdoctreeview>
- <ignoretocs>
- <toc>ada</toc>
- <toc>ada_bugs_gcc</toc>
- <toc>bash</toc>
- <toc>bash_bugs</toc>
- <toc>clanlib</toc>
- <toc>w3c-dom-level2-html</toc>
- <toc>fortran_bugs_gcc</toc>
- <toc>gnome1</toc>
- <toc>gnustep</toc>
- <toc>gtk</toc>
- <toc>gtk_bugs</toc>
- <toc>haskell</toc>
- <toc>haskell_bugs_ghc</toc>
- <toc>java_bugs_gcc</toc>
- <toc>java_bugs_sun</toc>
- <toc>kde2book</toc>
- <toc>libstdc++</toc>
- <toc>opengl</toc>
- <toc>pascal_bugs_fp</toc>
- <toc>php</toc>
- <toc>php_bugs</toc>
- <toc>perl</toc>
- <toc>perl_bugs</toc>
- <toc>python</toc>
- <toc>python_bugs</toc>
- <toc>qt-kdev3</toc>
- <toc>ruby</toc>
- <toc>ruby_bugs</toc>
- <toc>sdl</toc>
- <toc>stl</toc>
- <toc>w3c-svg</toc>
- <toc>sw</toc>
- <toc>w3c-uaag10</toc>
- <toc>wxwidgets_bugs</toc>
- </ignoretocs>
- <ignoreqt_xml>
- <toc>Guide to the Qt Translation Tools</toc>
- <toc>Qt Assistant Manual</toc>
- <toc>Qt Designer Manual</toc>
- <toc>Qt Reference Documentation</toc>
- <toc>qmake User Guide</toc>
- </ignoreqt_xml>
- <ignoredoxygen>
- <toc>KDE Libraries (Doxygen)</toc>
- </ignoredoxygen>
- </kdevdoctreeview>
- <kdevfilecreate>
- <useglobaltypes>
- <type ext="c" />
- <type ext="h" />
- </useglobaltypes>
- </kdevfilecreate>
- <kdevfileview>
- <groups>
- <group pattern="*.h" name="Header files" />
- <group pattern="*.c" name="Source files" />
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <hidenonlocation>false</hidenonlocation>
- </groups>
- <tree>
- <hidepatterns>*.o,*.lo,CVS</hidepatterns>
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <showvcsfields>false</showvcsfields>
- </tree>
- </kdevfileview>
- <kdevdocumentation>
- <projectdoc>
- <docsystem>Doxygen Documentation Collection</docsystem>
- <docurl>torsocks.tag</docurl>
- </projectdoc>
- </kdevdocumentation>
- <substmap>
- <APPNAME>torsocks</APPNAME>
- <APPNAMELC>torsocks</APPNAMELC>
- <APPNAMESC>Torsocks</APPNAMESC>
- <APPNAMEUC>TORSOCKS</APPNAMEUC>
- <AUTHOR>Robert Hogan</AUTHOR>
- <CFLAGS/>
- <EMAIL>robert(a)roberthogan.net</EMAIL>
- <LICENSE>GPL</LICENSE>
- <LICENSEFILE>COPYING</LICENSEFILE>
- <OPT_INCS>-I/usr/include</OPT_INCS>
- <OPT_LIBS>-lm</OPT_LIBS>
- <VERSION>0.1</VERSION>
- <YEAR>2008</YEAR>
- <dest>/home/robert/Development/torsocks</dest>
- </substmap>
- <kdevcppsupport>
- <qt>
- <used>false</used>
- <version>3</version>
- <includestyle>3</includestyle>
- <root>/usr/share/qt3</root>
- <designerintegration>EmbeddedKDevDesigner</designerintegration>
- <qmake>/usr/bin/qmake-qt3</qmake>
- <designer>/usr/bin/designer-qt3</designer>
- <designerpluginpaths/>
- </qt>
- <codecompletion>
- <automaticCodeCompletion>false</automaticCodeCompletion>
- <automaticArgumentsHint>true</automaticArgumentsHint>
- <automaticHeaderCompletion>true</automaticHeaderCompletion>
- <codeCompletionDelay>250</codeCompletionDelay>
- <argumentsHintDelay>400</argumentsHintDelay>
- <headerCompletionDelay>250</headerCompletionDelay>
- <showOnlyAccessibleItems>false</showOnlyAccessibleItems>
- <completionBoxItemOrder>0</completionBoxItemOrder>
- <howEvaluationContextMenu>true</howEvaluationContextMenu>
- <showCommentWithArgumentHint>true</showCommentWithArgumentHint>
- <statusBarTypeEvaluation>false</statusBarTypeEvaluation>
- <namespaceAliases>std=_GLIBCXX_STD;__gnu_cxx=std</namespaceAliases>
- <processPrimaryTypes>true</processPrimaryTypes>
- <processFunctionArguments>false</processFunctionArguments>
- <preProcessAllHeaders>false</preProcessAllHeaders>
- <parseMissingHeadersExperimental>false</parseMissingHeadersExperimental>
- <resolveIncludePathsUsingMakeExperimental>false</resolveIncludePathsUsingMakeExperimental>
- <alwaysParseInBackground>true</alwaysParseInBackground>
- <usePermanentCaching>true</usePermanentCaching>
- <alwaysIncludeNamespaces>false</alwaysIncludeNamespaces>
- <includePaths>.;</includePaths>
- </codecompletion>
- <creategettersetter>
- <prefixGet/>
- <prefixSet>set</prefixSet>
- <prefixVariable>m_,_</prefixVariable>
- <parameterName>theValue</parameterName>
- <inlineGet>true</inlineGet>
- <inlineSet>true</inlineSet>
- </creategettersetter>
- <splitheadersource>
- <enabled>false</enabled>
- <synchronize>true</synchronize>
- <orientation>Vertical</orientation>
- </splitheadersource>
- <references/>
- </kdevcppsupport>
- <cppsupportpart>
- <filetemplates>
- <interfacesuffix>.h</interfacesuffix>
- <implementationsuffix>.cpp</implementationsuffix>
- </filetemplates>
- </cppsupportpart>
- <kdevdebugger>
- <general>
- <gdbpath/>
- <dbgshell>libtool</dbgshell>
- <configGdbScript/>
- <runShellScript/>
- <runGdbScript/>
- <breakonloadinglibs>true</breakonloadinglibs>
- <separatetty>false</separatetty>
- <floatingtoolbar>false</floatingtoolbar>
- <raiseGDBOnStart>false</raiseGDBOnStart>
- </general>
- <display>
- <staticmembers>false</staticmembers>
- <demanglenames>true</demanglenames>
- <outputradix>10</outputradix>
- </display>
- </kdevdebugger>
- <kdevcvsservice>
- <recursivewhenupdate>true</recursivewhenupdate>
- <prunedirswhenupdate>true</prunedirswhenupdate>
- <createdirswhenupdate>true</createdirswhenupdate>
- <recursivewhencommitremove>true</recursivewhencommitremove>
- <revertoptions>-C</revertoptions>
- </kdevcvsservice>
-</kdevelop>
1
0
commit 17839f73a638d562c726ec5a808842256d0cdc14
Author: mwenge <robert(a)roberthogan.net>
Date: Mon Dec 14 22:04:07 2009 +0000
Build fix for BSD.
Support presence of res_query in libc rather than libresolve.
---
configure.in | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure.in b/configure.in
index 390d08e..f7b1af9 100644
--- a/configure.in
+++ b/configure.in
@@ -129,11 +129,14 @@ if test "$tempdso" = "no"; then
"Check your system for libc.so and/or libdl.so."))
fi
-AC_CHECK_LIB(resolv, res_query, [ tempres="no" ],tempres="yes")
+AC_CHECK_LIB(resolv, res_query, [ tempres="yes" ],tempres="no")
if test "$tempres" = "no"; then
- AC_DEFINE([SUPPORT_RES_API],[],[Support the res_query family of calls])
+ AC_CHECK_LIB(c, res_query,,AC_MSG_ERROR("res_query() not found in libc or libresolve." \
+ "Check your system for libc.so and/or libresolve.so."))
fi
+AC_DEFINE([SUPPORT_RES_API],[],[Support the res_query family of calls])
+
dnl If we're using gcc here define _GNU_SOURCE
AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
AC_EGREP_CPP(yes,
1
0
[torsocks/osx] Improve compile-time detection of the res* family of system calls
by hoganrobert@torproject.org 23 Oct '11
by hoganrobert@torproject.org 23 Oct '11
23 Oct '11
commit a4d3828cfd09e16d5933e6cb763bc76cd3259035
Author: Robert Hogan <robert(a)webkit.org>
Date: Tue Jul 6 21:50:29 2010 +0100
Improve compile-time detection of the res* family of system calls
Some platforms need to explicitly include resolv.h so cater for
that.
Thanks to SwissTorExit for reporting and debugging assistance.
---
configure.in | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index b447fe3..04703e4 100644
--- a/configure.in
+++ b/configure.in
@@ -129,11 +129,20 @@ if test "$tempdso" = "no"; then
"Check your system for libc.so and/or libdl.so."))
fi
-AC_CHECK_LIB(resolv, res_query, [ tempres="yes" ],tempres="no")
-if test "$tempres" = "no"; then
- AC_CHECK_LIB(c, res_query,,AC_MSG_ERROR("res_query() not found in libc or libresolve." \
- "Check your system for libc.so and/or libresolve.so."))
-fi
+AC_CHECK_FUNC(res_query, ,
+ [AC_CHECK_LIB(resolv, res_query, [],
+ [ save_libs="$LIBS"
+ LIBS="-lresolv $LIBS"
+ AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])],
+ [ AC_MSG_RESULT(yes) ],
+ [ AC_MSG_RESULT(no)
+ LIBS="$save_libs"
+ AC_CHECK_LIB(resolv, res_query,
+ [], [ AC_MSG_ERROR(res_query not found in libc or libresolve. Check your system for libc.so and/or libresolve.so.) ] ) ] ) ] )
+ ]
+)
AC_DEFINE([SUPPORT_RES_API],[],[Support the res_query family of calls])
1
0
commit a6b6d147cea354ce54de6da981f621c1e21ac607
Author: Robert Hogan <robert(a)webkit.org>
Date: Sun Jun 20 13:06:00 2010 +0100
Update automake toolchain
Update the automake toolchain with 'autoreconf -fiv'. This is
necessary to allow most users to build with the latest version
of automake, autoconf etc.
---
config.guess | 107 ++++++++++++++++++++++++++++++--------------------------
config.sub | 67 +++++++++++++++++++++++++++--------
depcomp | 87 ++++++++++++++++++++++++++++++++++------------
install-sh | 5 ++-
ltmain.sh | 29 ++++++++-------
missing | 49 +++++++++++++++-----------
mkinstalldirs | 5 ++-
7 files changed, 222 insertions(+), 127 deletions(-)
diff --git a/config.guess b/config.guess
index f32079a..e3a2116 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2008-01-23'
+timestamp='2009-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
+ | grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -324,6 +324,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
@@ -331,7 +334,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -640,7 +656,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
+ grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -796,7 +812,7 @@ EOF
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- EM64T | authenticamd)
+ EM64T | authenticamd | genuineintel)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -806,6 +822,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -866,40 +885,17 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- mips:Linux:*:*)
+ mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef mips
- #undef mipsel
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
+ CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
+ CPU=${UNAME_MACHINE}
#else
CPU=
#endif
@@ -931,10 +927,13 @@ EOF
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -982,17 +981,6 @@ EOF
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
@@ -1058,7 +1046,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1102,8 +1090,11 @@ EOF
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@@ -1141,6 +1132,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1153,7 +1154,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1216,6 +1217,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1324,6 +1328,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/config.sub b/config.sub
index 6759825..eb0389a 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2008-01-16'
+timestamp='2009-06-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -122,6 +122,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -152,6 +153,9 @@ case $os in
os=
basic_machine=$1
;;
+ -bluegene*)
+ os=-cnk
+ ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -249,13 +253,16 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep \
+ | maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
- | mips64vr | mips64vrel \
+ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@@ -268,6 +275,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | moxie \
| mt \
| msp430 \
| nios | nios2 \
@@ -277,7 +285,7 @@ case $basic_machine in
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| score \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -286,7 +294,7 @@ case $basic_machine in
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
+ | z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
@@ -329,14 +337,17 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
+ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@@ -358,20 +369,20 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
- | z8k-*)
+ | z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
@@ -439,6 +450,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -455,10 +470,18 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -526,6 +549,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -1128,6 +1155,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
none)
basic_machine=none-none
os=-none
@@ -1166,7 +1197,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1236,10 +1267,11 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
+ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1248,7 +1280,7 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1388,6 +1420,9 @@ case $os in
-zvmoe)
os=-zvmoe
;;
+ -dicos*)
+ os=-dicos
+ ;;
-none)
;;
*)
@@ -1585,7 +1620,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -aix*)
+ -cnk*|-aix*)
vendor=ibm
;;
-beos*)
diff --git a/depcomp b/depcomp
index e5f9736..df8eea7 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2007-03-29.01
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u="sed s,\\\\\\\\,/,g"
+ depmode=msvisualcpp
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
-' ' ' >> $depfile
- echo >> $depfile
+' ' ' >> "$depfile"
+ echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> $depfile
+ >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -328,7 +335,12 @@ hp2)
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
- sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -404,7 +416,7 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -455,32 +467,39 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
- cleared=no
- for arg in "$@"; do
+ cleared=no eat=no
+ for arg
+ do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
@@ -500,7 +519,7 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -538,13 +557,27 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o,
- # because we must use -o when running libtool.
+ # always write the preprocessed file to stdout.
"$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
IFS=" "
for arg
do
case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@@ -557,16 +590,23 @@ msvisualcpp)
;;
esac
done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
none)
exec "$@"
;;
@@ -585,5 +625,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/install-sh b/install-sh
index a5897de..6781b98 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2006-12-25.00
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,5 +515,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/ltmain.sh b/ltmain.sh
index b612e9a..7ed280b 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,6 +1,6 @@
# Generated from ltmain.m4sh.
-# ltmain.sh (GNU libtool) 2.2.6
+# ltmain.sh (GNU libtool) 2.2.6b
# Written by Gordon Matzigkeit <gord(a)gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.2.6 Debian-2.2.6a-1ubuntu1
+# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -73,9 +73,9 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION="2.2.6 Debian-2.2.6a-1ubuntu1"
+VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
TIMESTAMP=""
-package_revision=1.3012
+package_revision=1.3017
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -5347,19 +5347,19 @@ func_mode_link ()
# It is a libtool convenience library, so add in its objects.
convenience="$convenience $ladir/$objdir/$old_library"
old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_duplicate_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if $opt_duplicate_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
continue
fi # $pass = conv
@@ -5896,6 +5896,7 @@ func_mode_link ()
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
+ path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
diff --git a/missing b/missing
index 1c8ff70..28055d2 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard(a)iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
Send bug reports to <bug-automake(a)gnu.org>."
exit $?
;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake(a)gnu.org>."
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
-# the program).
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
case $1 in
- lex|yacc)
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
+ tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
@@ -138,7 +146,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
- bison|yacc)
+ bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg. You should only need it if
fi
;;
- lex|flex)
+ lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg. You should only need it if
fi
;;
- help2man)
+ help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg. You should only need it if
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar)
+ tar*)
shift
# We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/mkinstalldirs b/mkinstalldirs
index ef7e16f..4191a45 100755
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-scriptversion=2006-05-11.19
+scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman(a)prep.ai.mit.edu>
# Created: 1993-05-16
@@ -157,5 +157,6 @@ exit $errstatus
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
1
0
[torsocks/osx] Do our best to ensure tsocks_init is called only once.
by hoganrobert@torproject.org 23 Oct '11
by hoganrobert@torproject.org 23 Oct '11
23 Oct '11
commit 8829590838478cd68b7893ec5e67f350fc081cab
Author: Robert Hogan <robert(a)webkit.org>
Date: Sun Jun 20 13:11:53 2010 +0100
Do our best to ensure tsocks_init is called only once.
---
src/tsocks.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/tsocks.c b/src/tsocks.c
index d76808c..dbda0f9 100644
--- a/src/tsocks.c
+++ b/src/tsocks.c
@@ -176,6 +176,10 @@ void tsocks_init(void) {
return;
}
+ /* Not strictly true yet, but prevents us getting called while still in progress.*/
+ /* This has been observed on Snow Leopard for instance. */
+ tsocks_init_complete = 1;
+
#ifdef USE_OLD_DLSYM
void *lib;
#endif
@@ -260,7 +264,6 @@ void tsocks_init(void) {
area won't be shared across fork()s. */
deadpool_init();
#endif
- tsocks_init_complete=1;
}
static int get_environment() {
1
0
commit fe7bc53fbc81f012343f38271582fea76cafe4f0
Author: Robert Hogan <robert(a)roberthogan.net>
Date: Sat Sep 18 12:11:29 2010 +0100
Major refactor of symbol hooking
Patch by alex(a)ohmantics.net
Make torsocks fully compatible with Snow Leopard OSX.
Slim down the symbol hooking code considerably.
Alex's notes:
"http://developer.apple.com/mac/library/releasenotes/Darwin/SymbolVariantsRe… explains the one of the problems that people have run into. 64-bit applications
don't have the $UNIX2003 variants. For working 10.6 support, we'll need to
conditionalize the UNIX2003 variants off when compiling for 64-bit."
---
configure.in | 42 +++++-
src/Makefile.am | 2 +-
src/darwin_warts.c | 47 ++++++
src/patch_table.h | 114 ++++++++++++++
src/tsocks.c | 443 ++++++++++++++--------------------------------------
5 files changed, 313 insertions(+), 335 deletions(-)
diff --git a/configure.in b/configure.in
index 04703e4..06461ff 100644
--- a/configure.in
+++ b/configure.in
@@ -292,6 +292,7 @@ fi
dnl Find the correct select prototype on this machine
AC_MSG_CHECKING(for correct select prototype)
PROTO=
+NAMES='n, readfds, writefds, exceptfds, timeout'
for testproto in 'int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout'
do
if test "${PROTO}" = ""; then
@@ -308,11 +309,13 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([select(${PROTO})])
AC_DEFINE_UNQUOTED([SELECT_SIGNATURE],[${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([SELECT_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct connect prototype on this machine
AC_MSG_CHECKING(for correct connect prototype)
PROTO=
-PROTO1='int __fd, const struct sockaddr * __addr, int len'
+NAMES='__fd, __addr, __len'
+PROTO1='int __fd, const struct sockaddr * __addr, int __len'
PROTO2='int __fd, const struct sockaddr_in * __addr, socklen_t __len'
PROTO3='int __fd, struct sockaddr * __addr, int __len'
PROTO4='int __fd, const struct sockaddr * __addr, socklen_t __len'
@@ -334,6 +337,7 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([connect(${PROTO})])
AC_DEFINE_UNQUOTED([CONNECT_SIGNATURE],[${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([CONNECT_ARGNAMES],[${NAMES}],[Argument names])
dnl Pick which of the sockaddr type arguments we need for
dnl connect(), we need to cast one of ours to it later
@@ -348,6 +352,7 @@ AC_DEFINE_UNQUOTED([CONNECT_SOCKARG],[${SOCKETARG}],[Description])
dnl Find the correct close prototype on this machine
AC_MSG_CHECKING(for correct close prototype)
PROTO=
+NAMES='fd'
PROTO1='int fd'
for testproto in "${PROTO1}"
do
@@ -363,11 +368,13 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([close(${PROTO})])
AC_DEFINE_UNQUOTED([CLOSE_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([CLOSE_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct res_querydomain prototype on this machine
AC_MSG_CHECKING(for correct res_querydomain prototype)
PROTO=
+NAMES='name, domain, class, type, answer, anslen'
PROTO1='const char *name, const char *domain, int class, int type, unsigned char *answer, int anslen'
for testproto in "${PROTO1}"
do
@@ -385,10 +392,12 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([res_querydomain(${PROTO})])
AC_DEFINE_UNQUOTED([RES_QUERYDOMAIN_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([RES_QUERYDOMAIN_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct res_send prototype on this machine
AC_MSG_CHECKING(for correct res_send prototype)
PROTO=
+NAMES='msg, msglen, answer, anslen'
PROTO1='const char *msg, int msglen, char *answer, int anslen'
PROTO2='const unsigned char *msg, int msglen, unsigned char *answer, int anslen'
for testproto in "${PROTO1}" \
@@ -408,13 +417,15 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([res_send(${PROTO})])
AC_DEFINE_UNQUOTED([RES_SEND_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([RES_SEND_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct res_search prototype on this machine
AC_MSG_CHECKING(for correct res_search prototype)
PROTO=
-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
-for testproto in "${PROTO1}"
+NAMES='dname, class, type, answer, anslen'
+PROTO1='const char *dname, int class, int type, unsigned char *answer, int anslen'
+for testproto in "${PROTO1}"
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -430,13 +441,15 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([res_search(${PROTO})])
AC_DEFINE_UNQUOTED([RES_SEARCH_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([RES_SEARCH_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct res_query prototype on this machine
AC_MSG_CHECKING(for correct res_query prototype)
PROTO=
-PROTO1='const char *dname, int class, int type,unsigned char *answer, int anslen'
-for testproto in "${PROTO1}"
+NAMES='dname, class, type, answer, anslen'
+PROTO1='const char *dname, int class, int type, unsigned char *answer, int anslen'
+for testproto in "${PROTO1}"
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -452,10 +465,12 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([res_query(${PROTO})])
AC_DEFINE_UNQUOTED([RES_QUERY_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([RES_QUERY_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct getpeername prototype on this machine
AC_MSG_CHECKING(for correct getpeername prototype)
PROTO=
+NAMES='__fd, __name, __namelen'
PROTO1='int __fd, const struct sockaddr * __name, int *__namelen'
PROTO2='int __fd, const struct sockaddr_in * __name, socklen_t *__namelen'
PROTO3='int __fd, struct sockaddr * __name, socklen_t *__namelen'
@@ -478,14 +493,16 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([getpeername(${PROTO})])
AC_DEFINE_UNQUOTED(GETPEERNAME_SIGNATURE, [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([GETPEERNAME_ARGNAMES],[${NAMES}],[Argument names])
dnl Find the correct poll prototype on this machine
AC_MSG_CHECKING(for correct poll prototype)
PROTO=
+NAMES='ufds, nfds, timeout'
for testproto in 'struct pollfd *ufds, unsigned long nfds, int timeout' \
'struct pollfd *ufds, nfds_t nfds, int timeout' \
- 'struct pollfd *pfd, unsigned int nfds, int timeout'
+ 'struct pollfd *ufds, unsigned int nfds, int timeout'
do
if test "${PROTO}" = ""; then
AC_TRY_COMPILE([
@@ -499,30 +516,43 @@ if test "${PROTO}" = ""; then
fi
AC_MSG_RESULT([poll(${PROTO})])
AC_DEFINE_UNQUOTED([POLL_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([POLL_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for gethostbyname
PROTO="const char *name"
+NAMES='name'
AC_DEFINE_UNQUOTED([GETHOSTBYNAME_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([GETHOSTBYNAME_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for getaddrinfo
PROTO="const char *node, const char *service, void *hints, void *res"
+NAMES='node, service, hints, res'
AC_DEFINE_UNQUOTED([GETADDRINFO_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([GETADDRINFO_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for getipnodebyname
PROTO="const char *name, int af, int flags, int *error_num"
+NAMES='name, af, flags, error_num'
AC_DEFINE_UNQUOTED([GETIPNODEBYNAME_SIGNATURE], [${PROTO}],[Description])
+AC_DEFINE_UNQUOTED([GETIPNODEBYNAME_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for gethostbyaddr
PROTO="const void *addr, socklen_t len, int type"
+NAMES='addr, len, type'
AC_DEFINE_UNQUOTED(GETHOSTBYADDR_SIGNATURE, [${PROTO}], [Description])
+AC_DEFINE_UNQUOTED([GETHOSTBYADDR_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for sendto
PROTO="int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen"
+NAMES='s, buf, len, flags, to, tolen'
AC_DEFINE_UNQUOTED(SENDTO_SIGNATURE, [${PROTO}], [Description])
+AC_DEFINE_UNQUOTED([SENDTO_ARGNAMES],[${NAMES}],[Argument names])
dnl Emit signature for sendmsg
PROTO="int s, const struct msghdr *msg, int flags"
+NAMES='s, msg, flags'
AC_DEFINE_UNQUOTED(SENDMSG_SIGNATURE, [${PROTO}], [Description])
+AC_DEFINE_UNQUOTED([SENDMSG_ARGNAMES],[${NAMES}],[Argument names])
dnl Output the special librarys (libdl etc needed for tsocks)
SPECIALLIBS=${LIBS}
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e7bb96..d5d1239 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,7 @@ torsocksconfmanpage_DATA = torsocks.conf.5
# Install main library to $(prefix)/lib/tor (must match torsocks.in)
lib_LTLIBRARIES = libtorsocks.la
-libtorsocks_la_SOURCES = tsocks.c common.c parser.c dead_pool.c
+libtorsocks_la_SOURCES = tsocks.c common.c parser.c dead_pool.c darwin_warts.c
libtorsocks_la_LDFLAGS = -version-info 1:0:0
#libtorsocks_la_CFLAGS = -nostartfiles
diff --git a/src/darwin_warts.c b/src/darwin_warts.c
new file mode 100644
index 0000000..c35ed8b
--- /dev/null
+++ b/src/darwin_warts.c
@@ -0,0 +1,47 @@
+/* Mac OS X 10.6 forces any function named "select" to be named "_select$1050"
+ * in the output to the assembler. We need to patch select as well, so this
+ * isolated code exists without tripping over the Darwin header that causes the
+ * probkem.
+ */
+
+#if defined(__APPLE__) || defined(__darwin__)
+
+#include <AvailabilityMacros.h>
+
+#if defined(MAC_OS_X_VERSION_10_6)
+
+#include <stddef.h>
+#include <stdint.h>
+#include <dlfcn.h>
+#include "common.h"
+
+#define LOAD_ERROR(s,l) { \
+ char *error; \
+ error = dlerror(); \
+ show_msg(l, "The symbol %s() was not found in any shared " \
+ "library. The error reported was: %s!\n", s, \
+ (error)?error:"not found"); \
+ dlerror(); \
+ }
+
+#define SELECT_SIGNATURE int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout
+#define SELECT_ARGNAMES n, readfds, writefds, exceptfds, timeout
+
+/* forward declare opaque structures instead of bringing in real Darwin decls. */
+typedef struct fd_set fd_set;
+struct timeval;
+
+int (*realselect)(SELECT_SIGNATURE);
+int tsocks_select_guts(SELECT_SIGNATURE, int (*original_select)(SELECT_SIGNATURE));
+
+int select(SELECT_SIGNATURE) {
+ if (!realselect) {
+ dlerror();
+ if ((realselect = dlsym(RTLD_NEXT, "select")) == NULL)
+ LOAD_ERROR("select", MSGERR);
+ }
+ return tsocks_select_guts(SELECT_ARGNAMES, realselect);
+}
+
+#endif /* 10.6 */
+#endif /* darwin */
diff --git a/src/patch_table.h b/src/patch_table.h
new file mode 100644
index 0000000..9ebde08
--- /dev/null
+++ b/src/patch_table.h
@@ -0,0 +1,114 @@
+#undef FUNC
+#undef FUNCD
+#undef FUND32
+#undef FUNCD64
+
+#ifdef SUPPORT_RES_API
+ #define RES_FUNC FUNC
+ #define RES_FUNCD FUNCD
+ #define RES_FUNCD32 FUNCD32
+ #define RES_FUNCD64 FUNCD64
+#else
+ #define RES_FUNC EMPTY_FUNC
+ #define RES_FUNCD EMPTY_FUNC
+ #define RES_FUNCD32 EMPTY_FUNC
+ #define RES_FUNCD64 EMPTY_FUNC
+#endif
+
+#ifdef USE_TOR_DNS
+ #define DNS_FUNC FUNC
+ #define DNS_FUNCD FUNCD
+ #define DNS_FUNCD32 FUNCD32
+ #define DNS_FUNCD64 FUNCD64
+#else
+ #define DNS_FUNC EMPTY_FUNC
+ #define DNS_FUNCD EMPTY_FUNC
+ #define DNS_FUNCD32 EMPTY_FUNC
+ #define DNS_FUNCD64 EMPTY_FUNC
+#endif
+
+#define EMPTY_FUNC(e,r,s,n,b,m)
+
+#if defined(__APPLE__) || defined(__darwin__)
+ #ifndef DARWIN_EXPANSION
+ #define DARWIN_EXPANSION PATCH_TABLE_EXPANSION
+ #endif
+
+ #define FUNCD(e,r,s,n,b,m) DARWIN_EXPANSION(e,r,s,n,b,m)
+ #if (__LP64__)
+ #define FUNCD32(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #define FUNCD64(e,r,s,n,b,m) DARWIN_EXPANSION(e,r,s,n,b,m)
+
+ /* This tests if we're building with 10.6 or later headers, not
+ if we're running on 10.6. We'd rather do the latter. */
+ #ifdef MAC_OS_X_VERSION_10_6
+ #define FUNCD64_106(e,r,s,n,b,m) DARWIN_EXPANSION(e,r,s,n,b,m)
+ #else
+ #define FUNCD64_106(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #endif
+ #else
+ #define FUNCD32(e,r,s,n,b,m) DARWIN_EXPANSION(e,r,s,n,b,m)
+ #define FUNCD64(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #define FUNCD64_106(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #endif
+#else
+ #define FUNCD(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #define FUNCD32(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #define FUNCD64(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+ #define FUNCD64_106(e,r,s,n,b,m) EMPTY_FUNC(e,r,s,n,b,m)
+#endif
+#define FUNC(e,r,s,n,b,m) PATCH_TABLE_EXPANSION(e,r,s,n,b,m)
+
+/* dlsym return type SIG/ARGS C name base name asm name */
+/*RES_FUNC (ERR, int, RES_INIT_, res_init, res_init, "res_init") */
+/* res_init takes void, so we do that one manually. */
+RES_FUNC (ERR, int, RES_QUERY_, res_query, res_query, "res_query")
+RES_FUNC (ERR, int, RES_SEARCH_, res_search, res_search, "res_search")
+RES_FUNC (ERR, int, RES_SEND_, res_send, res_send, "res_send")
+RES_FUNC (ERR, int, RES_QUERYDOMAIN_, res_querydomain, res_querydomain, "res_querydomain")
+
+DNS_FUNC (ERR, struct hostent *, GETHOSTBYNAME_, gethostbyname, gethostbyname, "gethostbyname")
+DNS_FUNC (ERR, struct hostent *, GETHOSTBYADDR_, gethostbyaddr, gethostbyaddr, "gethostbyaddr")
+DNS_FUNC (ERR, int, GETADDRINFO_, getaddrinfo, getaddrinfo, "getaddrinfo")
+/* getipnodebyname is deprecated so do not report an error if it is not
+ available.*/
+DNS_FUNC (WARN, struct hostent *, GETIPNODEBYNAME_, getipnodebyname, getipnodebyname, "getipnodebyname")
+
+DNS_FUNC (ERR, ssize_t, SENDTO_, sendto, sendto, "sendto")
+DNS_FUNCD32 (ERR, ssize_t, SENDTO_, sendto_unix2003, sendto, "sendto$UNIX2003")
+DNS_FUNCD32 (ERR, ssize_t, SENDTO_, sendto_nocancel_unix2003, sendto, "sendto$NOCANCEL$UNIX2003")
+DNS_FUNCD64 (ERR, ssize_t, SENDTO_, sendto_nocancel, sendto, "sendto$NOCANCEL")
+
+DNS_FUNC (ERR, ssize_t, SENDMSG_, sendmsg, sendmsg, "sendmsg")
+DNS_FUNCD32 (ERR, ssize_t, SENDMSG_, sendmsg_unix2003, sendmsg, "sendmsg$UNIX2003")
+DNS_FUNCD32 (ERR, ssize_t, SENDMSG_, sendmsg_nocancel_unix2003, sendmsg, "sendmsg$NOCANCEL$UNIX2003")
+DNS_FUNCD64 (ERR, ssize_t, SENDMSG_, sendmsg_nocancel, sendmsg, "sendmsg$NOCANCEL")
+
+FUNC (ERR, int, CONNECT_, connect, connect, "connect")
+FUNCD32 (ERR, int, CONNECT_, connect_unix2003, connect, "connect$UNIX2003")
+FUNCD32 (ERR, int, CONNECT_, connect_nocancel_unix2003, connect, "connect$NOCANCEL$UNIX2003")
+FUNCD64 (ERR, int, CONNECT_, connect_nocancel, connect, "connect$NOCANCEL")
+
+#if !(defined(__APPLE__) || defined(__darwin__) && defined(MAX_OS_X_VERSION_10_6))
+/* see darwin_warts.c */
+FUNC (ERR, int, SELECT_, select, select, "select")
+#endif
+FUNCD (ERR, int, SELECT_, select_darwinextsn, select, "select$DARWIN_EXTSN")
+FUNCD (ERR, int, SELECT_, select_darwinextsn_nocancel, select, "select$DARWIN_EXTSN$NOCANCEL")
+FUNCD32 (ERR, int, SELECT_, select_unix2003, select, "select$UNIX2003")
+FUNCD32 (ERR, int, SELECT_, select_nocancel_unix2003, select, "select$NOCANCEL$UNIX2003")
+FUNCD64 (ERR, int, SELECT_, select_nocancel, select, "select$NOCANCEL")
+FUNCD64_106 (ERR, int, SELECT_, select_1050, select, "select$1050")
+
+FUNC (ERR, int, POLL_, poll, poll, "poll")
+FUNCD32 (ERR, int, POLL_, poll_unix2003, poll, "poll$UNIX2003")
+FUNCD32 (ERR, int, POLL_, poll_nocancel_unix2003, poll, "poll$NOCANCEL$UNIX2003")
+FUNCD64 (ERR, int, POLL_, poll_nocancel, poll, "poll$NOCANCEL")
+
+FUNC (ERR, int, CLOSE_, close, close, "close")
+FUNCD32 (ERR, int, CLOSE_, close_unix2003, close, "close$UNIX2003")
+FUNCD32 (ERR, int, CLOSE_, close_nocancel_unix2003, close, "close$NOCANCEL$UNIX2003")
+FUNCD64 (ERR, int, CLOSE_, close_nocancel, close, "close$NOCANCEL")
+
+FUNC (ERR, int, GETPEERNAME_, getpeername, getpeername, "getpeername")
+FUNCD32 (ERR, int, GETPEERNAME_, getpeername_unix2003, getpeername, "getpeername$UNIX2003")
diff --git a/src/tsocks.c b/src/tsocks.c
index 92bca5b..2545e42 100644
--- a/src/tsocks.c
+++ b/src/tsocks.c
@@ -90,6 +90,7 @@ const char *progname = "libtorsocks"; /* Name used in err msgs */
#include <errno.h>
#include <fcntl.h>
#include <common.h>
+#include <pthread.h>
#include <stdarg.h>
#if !defined(__APPLE__) && !defined(__darwin__)
#include <sys/socket.h>
@@ -101,105 +102,51 @@ const char *progname = "libtorsocks"; /* Name used in err msgs */
#include <tsocks.h>
#include "dead_pool.h"
+/* Some function names are macroized on Darwin. Allow those names
+ to expand accordingly. */
+#define EXPAND_GUTS(x) tsocks_##x##_guts
+#define EXPAND_GUTS_NAME(x) EXPAND_GUTS(x)
+
/* Global Declarations */
-#ifdef SUPPORT_RES_API
-static int (*realresinit)(void);
-static int (*realresquery)(RES_QUERY_SIGNATURE);
-static int (*realressearch)(RES_SEARCH_SIGNATURE);
-static int (*realressend)(RES_SEND_SIGNATURE);
-static int (*realresquerydomain)(RES_QUERYDOMAIN_SIGNATURE);
-#endif /*SUPPORT_RES_API*/
#ifdef USE_TOR_DNS
static dead_pool *pool = NULL;
-static struct hostent *(*realgethostbyname)(GETHOSTBYNAME_SIGNATURE);
-static struct hostent *(*realgethostbyaddr)(GETHOSTBYADDR_SIGNATURE);
-int (*realgetaddrinfo)(GETADDRINFO_SIGNATURE);
-static struct hostent *(*realgetipnodebyname)(GETIPNODEBYNAME_SIGNATURE);
-static ssize_t (*realsendto)(SENDTO_SIGNATURE);
-static ssize_t (*realsendmsg)(SENDMSG_SIGNATURE);
-#if defined(__APPLE__) || defined(__darwin__)
-static ssize_t (*realsendto_unix2003)(SENDTO_SIGNATURE);
-static ssize_t (*realsendto_nocancel)(SENDTO_SIGNATURE);
-static ssize_t (*realsendmsg_unix2003)(SENDMSG_SIGNATURE);
-static ssize_t (*realsendmsg_nocancel)(SENDMSG_SIGNATURE);
-#endif
#endif /*USE_TOR_DNS*/
-int (*realconnect)(CONNECT_SIGNATURE);
-static int (*realselect)(SELECT_SIGNATURE);
-static int (*realpoll)(POLL_SIGNATURE);
-int (*realclose)(CLOSE_SIGNATURE);
-static int (*realgetpeername)(GETPEERNAME_SIGNATURE);
-#if defined(__APPLE__) || defined(__darwin__)
-static int (*realconnect_unix2003)(CONNECT_SIGNATURE);
-static int (*realconnect_nocancel)(CONNECT_SIGNATURE);
-static int (*realselect_darwinextsn)(SELECT_SIGNATURE);
-static int (*realselect_darwinextsn_nocancel)(SELECT_SIGNATURE);
-static int (*realselect_unix2003)(SELECT_SIGNATURE);
-static int (*realselect_nocancel)(SELECT_SIGNATURE);
-static int (*realpoll_unix2003)(POLL_SIGNATURE);
-static int (*realpoll_nocancel)(POLL_SIGNATURE);
-static int (*realclose_unix2003)(CLOSE_SIGNATURE);
-static int (*realclose_nocancel)(CLOSE_SIGNATURE);
-static int (*realgetpeername_unix2003)(GETPEERNAME_SIGNATURE);
+
+/* Function prototypes for original functions that we patch */
+#ifdef SUPPORT_RES_API
+int (*realres_init)(void);
#endif
+#define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) r (*real##n)(s##SIGNATURE);
+#include "patch_table.h"
+#undef PATCH_TABLE_EXPANSION
+#undef DARWIN_EXPANSION
-static struct parsedfile *config;
+static struct parsedfile config;
static struct connreq *requests = NULL;
static int suid = 0;
static char *conffile = NULL;
-static int tsocks_init_complete = 0;
+static volatile int tsocks_init_complete = 0;
/* Exported Function Prototypes */
void __attribute__ ((constructor)) tsocks_init(void);
-int connect(CONNECT_SIGNATURE);
-int select(SELECT_SIGNATURE);
-int poll(POLL_SIGNATURE);
-int close(CLOSE_SIGNATURE);
-int getpeername(GETPEERNAME_SIGNATURE);
-#if defined(__APPLE__) || defined(__darwin__)
-int connect_unix2003(CONNECT_SIGNATURE) __asm("_connect$UNIX2003");
-int connect_nocancel(CONNECT_SIGNATURE) __asm("_connect$NOCANCEL$UNIX2003");
-int select_darwinextsn(SELECT_SIGNATURE) __asm("_select$DARWIN_EXTSN");
-int select_darwinextsn_nocancel(SELECT_SIGNATURE) __asm("_select$DARWIN_EXTSN$NOCANCEL");
-int select_unix2003(SELECT_SIGNATURE) __asm("_select$UNIX2003");
-int select_nocancel(SELECT_SIGNATURE) __asm("_select$NOCANCEL$UNIX2003");
-int poll_unix2003(POLL_SIGNATURE) __asm("_poll$UNIX2003");
-int poll_nocancel(POLL_SIGNATURE) __asm("_poll$NOCANCEL$UNIX2003");
-int close_unix2003(CLOSE_SIGNATURE) __asm("_close$UNIX2003");
-int close_nocancel(CLOSE_SIGNATURE) __asm("_close$NOCANCEL$UNIX2003");
-int getpeername_unxi2003(GETPEERNAME_SIGNATURE) __asm("_getpeername$UNIX2003");
-#endif
+/* Function prototypes for our patches */
#ifdef SUPPORT_RES_API
int res_init(void);
-int res_query(RES_QUERY_SIGNATURE);
-int res_search(RES_SEARCH_SIGNATURE);
-int res_querydomain(RES_QUERYDOMAIN_SIGNATURE);
-int res_send(RES_SEND_SIGNATURE);
-#endif
-#ifdef USE_TOR_DNS
-struct hostent *gethostbyname(GETHOSTBYNAME_SIGNATURE);
-struct hostent *gethostbyaddr(GETHOSTBYADDR_SIGNATURE);
-int getaddrinfo(GETADDRINFO_SIGNATURE);
-struct hostent *getipnodebyname(GETIPNODEBYNAME_SIGNATURE);
-ssize_t sendto(SENDTO_SIGNATURE);
-ssize_t sendmsg(SENDMSG_SIGNATURE);
-#if defined(__APPLE__) || defined(__darwin__)
-ssize_t sendto_unix2003(SENDTO_SIGNATURE) __asm("_sendto$UNIX2003");
-ssize_t sendto_nocancel(SENDTO_SIGNATURE) __asm("_sendto$NOCANCEL$UNIX2003");
-ssize_t sendmsg_unix2003(SENDMSG_SIGNATURE) __asm("_sendmsg$UNIX2003");
-ssize_t sendmsg_nocancel(SENDMSG_SIGNATURE) __asm("_sendmsg$NOCANCEL$UNIX2003");
-#endif
#endif /*USE_TOR_DNS*/
+#define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) r n(s##SIGNATURE);
+#define DARWIN_EXPANSION(e,r,s,n,b,m) r n(s##SIGNATURE) __asm("_" m);
+#include "patch_table.h"
+#undef PATCH_TABLE_EXPANSION
+#undef DARWIN_EXPANSION
+
/* Private Function Prototypes */
-static int tsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIGNATURE));
-static int tsocks_select_guts(SELECT_SIGNATURE, int (*original_select)(SELECT_SIGNATURE));
-static int tsocks_poll_guts(POLL_SIGNATURE, int (*original_poll)(POLL_SIGNATURE));
-static int tsocks_close_guts(CLOSE_SIGNATURE, int (*original_close)(CLOSE_SIGNATURE));
-static int tsocks_getpeername_guts(GETPEERNAME_SIGNATURE, int (*original_getpeername)(GETPEERNAME_SIGNATURE));
-static ssize_t tsocks_sendto_guts(SENDTO_SIGNATURE, ssize_t (*original_sendto)(SENDTO_SIGNATURE));
-static ssize_t tsocks_sendmsg_guts(SENDMSG_SIGNATURE, ssize_t (*original_sendmsg)(SENDMSG_SIGNATURE));
+/* no tsocks_res_init_guts */
+#define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) r tsocks_##b##_guts(s##SIGNATURE, r (*original_##b)(s##SIGNATURE));
+#include "patch_table.h"
+#undef PATCH_TABLE_EXPANSION
+
static int get_config();
static int get_environment();
@@ -227,6 +174,8 @@ static int deadpool_init(void);
static int send_socksv4a_request(struct connreq *conn, const char *onion_host);
#endif
+static pthread_mutex_t tsocks_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+
void tsocks_init(void) {
#define LOAD_ERROR(s,l) { \
@@ -238,6 +187,8 @@ void tsocks_init(void) {
dlerror(); \
}
+ pthread_mutex_lock(&tsocks_init_mutex);
+
/* We only need to be called once */
if (tsocks_init_complete) {
return;
@@ -249,10 +200,10 @@ void tsocks_init(void) {
show_msg(MSGWARN, "In tsocks_init \n");
-// get_environment();
-// get_config();
-//
-// show_msg(MSGWARN, "In tsocks_init after env/config\n");
+ get_environment();
+ get_config();
+
+ show_msg(MSGWARN, "In tsocks_init after env/config\n");
#ifdef USE_OLD_DLSYM
void *lib;
@@ -267,95 +218,13 @@ void tsocks_init(void) {
dlerror();
#ifndef USE_OLD_DLSYM
- if ((realconnect = dlsym(RTLD_NEXT, "connect")) == NULL)
- LOAD_ERROR("connect", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realconnect_unix2003 = dlsym(RTLD_NEXT, "connect$UNIX2003")) == NULL)
- LOAD_ERROR("connect$UNIX2003", MSGERR);
- if ((realconnect_nocancel = dlsym(RTLD_NEXT, "connect$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("connect$NOCANCEL$UNIX2003", MSGERR);
-#endif
-
- if ((realselect = dlsym(RTLD_NEXT, "select")) == NULL)
- LOAD_ERROR("select", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realselect_darwinextsn = dlsym(RTLD_NEXT, "select$DARWIN_EXTSN")) == NULL)
- LOAD_ERROR("select$DARWIN_EXTSN", MSGERR);
- if ((realselect_darwinextsn_nocancel = dlsym(RTLD_NEXT, "select$DARWIN_EXTSN$NOCANCEL")) == NULL)
- LOAD_ERROR("select$DARWIN_EXTSN$NOCANCEL", MSGERR);
- if ((realselect_unix2003 = dlsym(RTLD_NEXT, "select$UNIX2003")) == NULL)
- LOAD_ERROR("select$UNIX2003", MSGERR);
- if ((realselect_nocancel = dlsym(RTLD_NEXT, "select$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("select$NOCANCEL$UNIX2003", MSGERR);
-#endif
-
- if ((realpoll = dlsym(RTLD_NEXT, "poll")) == NULL)
- LOAD_ERROR("poll", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realpoll_unix2003 = dlsym(RTLD_NEXT, "poll$UNIX2003")) == NULL)
- LOAD_ERROR("poll$UNIX2003", MSGERR);
- if ((realpoll_nocancel = dlsym(RTLD_NEXT, "poll$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("poll$NOCANCEL$UNIX2003", MSGERR);
-#endif
-
- if ((realclose = dlsym(RTLD_NEXT, "close")) == NULL)
- LOAD_ERROR("close", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realclose_unix2003 = dlsym(RTLD_NEXT, "close$UNIX2003")) == NULL)
- LOAD_ERROR("close$UNIX2003", MSGERR);
- if ((realclose_nocancel = dlsym(RTLD_NEXT, "close$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("close$NOCANCEL$UNIX2003", MSGERR);
-#endif
-
- if ((realgetpeername = dlsym(RTLD_NEXT, "getpeername")) == NULL)
- LOAD_ERROR("getpeername", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realgetpeername_unix2003 = dlsym(RTLD_NEXT, "getpeername$UNIX2003")) == NULL)
- LOAD_ERROR("getpeername$UNIX2003", MSGERR);
-#endif
-
- #ifdef SUPPORT_RES_API
- if ((realresinit = dlsym(RTLD_NEXT, "res_init")) == NULL)
- LOAD_ERROR("res_init", MSGERR);
- if ((realresquery = dlsym(RTLD_NEXT, "res_query")) == NULL)
- LOAD_ERROR("res_query", MSGERR);
- if ((realressearch = dlsym(RTLD_NEXT, "res_search")) == NULL)
- LOAD_ERROR("res_search", MSGERR);
- if ((realresquerydomain = dlsym(RTLD_NEXT, "res_querydomain")) == NULL)
- LOAD_ERROR("res_querydomain", MSGERR);
- if ((realressend = dlsym(RTLD_NEXT, "res_send")) == NULL)
- LOAD_ERROR("res_send", MSGERR);
- #endif
- #ifdef USE_TOR_DNS
- if ((realgethostbyname = dlsym(RTLD_NEXT, "gethostbyname")) == NULL)
- LOAD_ERROR("gethostbyname", MSGERR);
- if ((realgethostbyaddr = dlsym(RTLD_NEXT, "gethostbyaddr")) == NULL)
- LOAD_ERROR("gethostbyaddr", MSGERR);
- if ((realgetaddrinfo = dlsym(RTLD_NEXT, "getaddrinfo")) == NULL)
- LOAD_ERROR("getaddrinfo", MSGERR);
- /* getipnodebyname is deprecated so do not report an error if it is not
- available.*/
- if ((realgetipnodebyname = dlsym(RTLD_NEXT, "getipnodebyname")) == NULL)
- LOAD_ERROR("getipnodebyname", MSGWARN);
-
- if ((realsendto = dlsym(RTLD_NEXT, "sendto")) == NULL)
- LOAD_ERROR("sendto", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realsendto_unix2003 = dlsym(RTLD_NEXT, "sendto$UNIX2003")) == NULL)
- LOAD_ERROR("sendto$UNIX2003", MSGERR);
- if ((realsendto_nocancel = dlsym(RTLD_NEXT, "sendto$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("sendto$NOCANCEL$UNIX2003", MSGERR);
-#endif
-
- if ((realsendmsg = dlsym(RTLD_NEXT, "sendmsg")) == NULL)
- LOAD_ERROR("sendmsg", MSGERR);
-#if defined(__APPLE__) || defined(__darwin__)
- if ((realsendmsg_unix2003 = dlsym(RTLD_NEXT, "sendmsg$UNIX2003")) == NULL)
- LOAD_ERROR("sendmsg$UNIX2003", MSGERR);
- if ((realsendmsg_nocancel = dlsym(RTLD_NEXT, "sendmsg$NOCANCEL$UNIX2003")) == NULL)
- LOAD_ERROR("sendmsg$NOCANCEL$UNIX2003", MSGERR);
-#endif
- #endif /*USE_TOR_DNS*/
+ #ifdef SUPPORT_RES_API
+ if ((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL)
+ LOAD_ERROR("res_init", MSGERR);
+ #endif
+ #define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) if ((real##n = dlsym(RTLD_NEXT, m)) == NULL) LOAD_ERROR(m, MSG##e);
+ #include "patch_table.h"
+ #undef PATCH_TABLE_EXPANSION
#else
lib = dlopen(LIBCONNECT, RTLD_LAZY);
realconnect = dlsym(lib, "connect");
@@ -375,7 +244,7 @@ void tsocks_init(void) {
dlclose(lib);
#ifdef SUPPORT_RES_API
lib = dlopen(LIBRESOLV, RTLD_LAZY);
- realresinit = dlsym(lib, "res_init");
+ realres_init = dlsym(lib, "res_init");
realresquery = dlsym(lib, "res_query");
realressend = dlsym(lib, "res_send");
realresquerydomain = dlsym(lib, "res_querydomain");
@@ -388,7 +257,10 @@ void tsocks_init(void) {
area won't be shared across fork()s. */
deadpool_init();
#endif
+ tsocks_init_complete=1;
+ pthread_mutex_unlock(&tsocks_init_mutex);
+ show_msg(MSGWARN, "Exit tsocks_init \n");
}
static int get_environment() {
@@ -431,123 +303,31 @@ static int get_config () {
#endif
/* Read in the config file */
- config = malloc(sizeof(*config));
+/* config = malloc(sizeof(*config));
if (!config)
- return(0);
- read_config(conffile, config);
- if (config->paths)
- show_msg(MSGDEBUG, "First lineno for first path is %d\n", config->paths->lineno);
+ return(0);*/
+ read_config(conffile, &config);
+ if (config.paths)
+ show_msg(MSGDEBUG, "First lineno for first path is %d\n", config.paths->lineno);
done = 1;
return(0);
}
-#define PATCH_CONNECT(funcname, symbolname) \
- int funcname(CONNECT_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_connect_guts(__fd, __addr, __len, real ## funcname); \
- }
-PATCH_CONNECT(connect, "connect")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_CONNECT(connect_unix2003, "conncect$UNIX2003")
-PATCH_CONNECT(connect_nocancel, "conncect$NOCANCEL$UNIX2003")
-#endif
-
-#define PATCH_CLOSE(funcname, symbolname) \
- int funcname(CLOSE_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_close_guts(fd, real ## funcname); \
- }
-PATCH_CLOSE(close, "close")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_CLOSE(close_unix2003, "close$UNIX2003")
-PATCH_CLOSE(close_nocancel, "close$NOCANCEL$UNIX2003")
-#endif
-
-#define PATCH_SELECT(funcname, symbolname) \
- int funcname(SELECT_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_select_guts(n, readfds, writefds, exceptfds, timeout, real ## funcname); \
- }
-PATCH_SELECT(select, "select")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_SELECT(select_darwinextsn, "select$DARWIN_EXTSN")
-PATCH_SELECT(select_darwinextsn_nocancel, "select$DARWIN_EXTSN$NOCANCEL")
-PATCH_SELECT(select_unix2003, "select$UNIX2003")
-PATCH_SELECT(select_nocancel, "select$NOCANCEL$UNIX2003")
-#endif
-
-#define PATCH_POLL(funcname, symbolname) \
- int funcname(POLL_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_poll_guts(ufds, nfds, timeout, real ## funcname); \
- }
-PATCH_POLL(poll, "poll")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_POLL(poll_unix2003, "poll$UNIX2003")
-PATCH_POLL(poll_nocancel, "poll$NOCANCEL$UNIX2003")
-#endif
-
-#define PATCH_GETPEERNAME(funcname, symbolname) \
- int funcname(GETPEERNAME_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_getpeername_guts(__fd, __name, __namelen, real ## funcname); \
- }
-PATCH_GETPEERNAME(getpeername, "getpeername")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_GETPEERNAME(getpeername_unix2003, "getpeername$UNIX2003")
-#endif
-
-#define PATCH_SENDTO(funcname, symbolname) \
- ssize_t funcname(SENDTO_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_sendto_guts(s, buf, len, flags, to, tolen, real ## funcname); \
- }
-PATCH_SENDTO(sendto, "sendto")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_SENDTO(sendto_unix2003, "sendto$UNIX2003")
-PATCH_SENDTO(sendto_nocancel, "sendto$NOCANCEL$UNIX2003")
-#endif
-
-#define PATCH_SENDMSG(funcname, symbolname) \
- ssize_t funcname(SENDMSG_SIGNATURE) { \
- if (!real ## funcname) { \
- dlerror(); \
- if ((real ## funcname = dlsym(RTLD_NEXT, symbolname)) == NULL) \
- LOAD_ERROR(symbolname, MSGERR); \
- } \
- return tsocks_sendmsg_guts(s, msg, flags, real ## funcname); \
- }
-PATCH_SENDMSG(sendmsg, "sendmsg")
-#if defined(__APPLE__) || defined(__darwin__)
-PATCH_SENDMSG(sendmsg_unix2003, "sendmsg$UNIX2003")
-PATCH_SENDMSG(sendmsg_nocancel, "sendmsg$NOCANCEL$UNIX2003")
-#endif
+/* Patch trampoline functions */
+/* no tsocks_res_init_guts */
+#define PATCH_TABLE_EXPANSION(e,r,s,n,b,m) \
+ r n(s##SIGNATURE) { \
+ if (!real##n) { \
+ dlerror(); \
+ if ((real##n = dlsym(RTLD_NEXT, m)) == NULL) \
+ LOAD_ERROR(m, MSG##e); \
+ } \
+ return tsocks_##b##_guts(s##ARGNAMES, real##n); \
+ }
+#include "patch_table.h"
+#undef PATCH_TABLE_EXPANSION
int tsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIGNATURE)) {
struct sockaddr_in *connaddr;
@@ -662,22 +442,22 @@ int tsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIGNA
/* If the address is local call original_connect */
#ifdef USE_TOR_DNS
- if (!(is_local(config, &(connaddr->sin_addr))) &&
+ if (!(is_local(&config, &(connaddr->sin_addr))) &&
!is_dead_address(pool, connaddr->sin_addr.s_addr)) {
#else
- if (!(is_local(config, &(connaddr->sin_addr)))) {
+ if (!(is_local(&config, &(connaddr->sin_addr)))) {
#endif
show_msg(MSGDEBUG, "Connection for socket %d is local\n", __fd);
return(original_connect(__fd, __addr, __len));
}
/* Ok, so its not local, we need a path to the net */
- pick_server(config, &path, &(connaddr->sin_addr), ntohs(connaddr->sin_port));
+ pick_server(&config, &path, &(connaddr->sin_addr), ntohs(connaddr->sin_port));
show_msg(MSGDEBUG, "Picked server %s for connection\n",
(path->address ? path->address : "(Not Provided)"));
if (path->address == NULL) {
- if (path == &(config->defaultserver))
+ if (path == &(config.defaultserver))
show_msg(MSGERR, "Connection needs to be made "
"via default server but "
"the default server has not "
@@ -701,7 +481,7 @@ int tsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIGNA
bzero(&(server_address.sin_zero), 8);
/* Complain if this server isn't on a localnet */
- if (is_local(config, &server_address.sin_addr)) {
+ if (is_local(&config, &server_address.sin_addr)) {
show_msg(MSGERR, "SOCKS server %s (%s) is not on a local subnet!\n",
path->address, inet_ntoa(server_address.sin_addr));
} else
@@ -1078,6 +858,13 @@ int tsocks_close_guts(CLOSE_SIGNATURE, int (*original_close)(CLOSE_SIGNATURE)) {
int rc;
struct connreq *conn;
+ /* If we're not currently managing any requests we can just
+ * leave here */
+ if (!requests) {
+ show_msg(MSGDEBUG, "No requests waiting, calling real close\n");
+ return(original_close(fd));
+ }
+
/* If we are called before this symbol has been dlopened then try
loading symbols now. This is a workaround for a problem I don't
really understand and have only encountered when using torsocks
@@ -1712,8 +1499,8 @@ static int read_socksv4_req(struct connreq *conn) {
int res_init(void) {
int rc;
- if (!realresinit) {
- if ((realresinit = dlsym(RTLD_NEXT, "res_init")) == NULL)
+ if (!realres_init) {
+ if ((realres_init = dlsym(RTLD_NEXT, "res_init")) == NULL)
LOAD_ERROR("res_init", MSGERR);
}
@@ -1724,23 +1511,23 @@ int res_init(void) {
tsocks_init();
}
- if (realresinit == NULL) {
+ if (realres_init == NULL) {
show_msg(MSGERR, "Unresolved symbol: res_init\n");
return(-1);
}
/* Call normal res_init */
- rc = realresinit();
+ rc = realres_init();
/* Force using TCP protocol for DNS queries */
_res.options |= RES_USEVC;
return(rc);
}
-int res_query(RES_QUERY_SIGNATURE) {
+int EXPAND_GUTS_NAME(res_query)(RES_QUERY_SIGNATURE, int (*original_res_query)(RES_QUERY_SIGNATURE)) {
int rc;
- if (!realresquery) {
- if ((realresquery = dlsym(RTLD_NEXT, "res_query")) == NULL)
+ if (!original_res_query) {
+ if ((original_res_query = dlsym(RTLD_NEXT, "res_query")) == NULL)
LOAD_ERROR("res_query", MSGERR);
}
@@ -1751,7 +1538,7 @@ int res_query(RES_QUERY_SIGNATURE) {
tsocks_init();
}
- if (realresquery == NULL) {
+ if (original_res_query == NULL) {
show_msg(MSGERR, "Unresolved symbol: res_query\n");
return(-1);
}
@@ -1762,16 +1549,16 @@ int res_query(RES_QUERY_SIGNATURE) {
res_init();
/* Call normal res_query */
- rc = realresquery(dname, class, type, answer, anslen);
+ rc = original_res_query(dname, class, type, answer, anslen);
return(rc);
}
-int res_querydomain(RES_QUERYDOMAIN_SIGNATURE) {
+int EXPAND_GUTS_NAME(res_querydomain)(RES_QUERYDOMAIN_SIGNATURE, int (*original_res_querydomain)(RES_QUERYDOMAIN_SIGNATURE)) {
int rc;
- if (!realresquerydomain) {
- if ((realresquerydomain = dlsym(RTLD_NEXT, "res_querydomain")) == NULL)
+ if (!original_res_querydomain) {
+ if ((original_res_querydomain = dlsym(RTLD_NEXT, "res_querydomain")) == NULL)
LOAD_ERROR("res_querydoimain", MSGERR);
}
@@ -1782,7 +1569,7 @@ int res_querydomain(RES_QUERYDOMAIN_SIGNATURE) {
tsocks_init();
}
- if (realresquerydomain == NULL) {
+ if (original_res_querydomain == NULL) {
show_msg(MSGERR, "Unresolved symbol: res_querydomain\n");
return(-1);
}
@@ -1793,16 +1580,16 @@ int res_querydomain(RES_QUERYDOMAIN_SIGNATURE) {
res_init();
/* Call normal res_querydomain */
- rc = realresquerydomain(name, domain, class, type, answer, anslen);
+ rc = original_res_querydomain(name, domain, class, type, answer, anslen);
return(rc);
}
-int res_search(RES_SEARCH_SIGNATURE) {
+int EXPAND_GUTS_NAME(res_search)(RES_SEARCH_SIGNATURE, int (*original_res_search)(RES_SEARCH_SIGNATURE)) {
int rc;
- if (!realressearch) {
- if ((realressearch = dlsym(RTLD_NEXT, "res_search")) == NULL)
+ if (!original_res_search) {
+ if ((original_res_search = dlsym(RTLD_NEXT, "res_search")) == NULL)
LOAD_ERROR("res_search", MSGERR);
}
@@ -1813,7 +1600,7 @@ int res_search(RES_SEARCH_SIGNATURE) {
tsocks_init();
}
- if (realressearch == NULL) {
+ if (original_res_search == NULL) {
show_msg(MSGERR, "Unresolved symbol: res_search\n");
return(-1);
}
@@ -1824,16 +1611,16 @@ int res_search(RES_SEARCH_SIGNATURE) {
res_init();
/* Call normal res_search */
- rc = realressearch(dname, class, type, answer, anslen);
+ rc = original_res_search(dname, class, type, answer, anslen);
return(rc);
}
-int res_send(RES_SEND_SIGNATURE) {
+int EXPAND_GUTS_NAME(res_send)(RES_SEND_SIGNATURE, int (*original_res_send)(RES_SEND_SIGNATURE)) {
int rc;
- if (!realressend) {
- if ((realressend = dlsym(RTLD_NEXT, "res_send")) == NULL)
+ if (!original_res_send) {
+ if ((original_res_send = dlsym(RTLD_NEXT, "res_send")) == NULL)
LOAD_ERROR("res_send", MSGERR);
}
@@ -1844,7 +1631,7 @@ int res_send(RES_SEND_SIGNATURE) {
tsocks_init();
}
- if (realressend == NULL) {
+ if (original_res_send == NULL) {
show_msg(MSGERR, "Unresolved symbol: res_send\n");
return(-1);
}
@@ -1855,7 +1642,7 @@ int res_send(RES_SEND_SIGNATURE) {
res_init();
/* Call normal res_send */
- rc = realressend(msg, msglen, answer, anslen);
+ rc = original_res_send(msg, msglen, answer, anslen);
return(rc);
}
@@ -1866,13 +1653,13 @@ static int deadpool_init(void)
if(!pool) {
get_environment();
get_config();
- if(config->tordns_enabled) {
+ if(config.tordns_enabled) {
pool = init_pool(
- config->tordns_cache_size,
- config->tordns_deadpool_range->localip,
- config->tordns_deadpool_range->localnet,
- config->defaultserver.address,
- config->defaultserver.port
+ config.tordns_cache_size,
+ config.tordns_deadpool_range->localip,
+ config.tordns_deadpool_range->localnet,
+ config.defaultserver.address,
+ config.defaultserver.port
);
if(!pool) {
show_msg(MSGERR, "failed to initialize deadpool: tordns disabled\n");
@@ -1882,39 +1669,39 @@ static int deadpool_init(void)
return 0;
}
-struct hostent *gethostbyname(GETHOSTBYNAME_SIGNATURE)
+struct hostent *tsocks_gethostbyname_guts(GETHOSTBYNAME_SIGNATURE, struct hostent *(*original_gethostbyname)(GETHOSTBYNAME_SIGNATURE))
{
if(pool) {
return our_gethostbyname(pool, name);
} else {
- return realgethostbyname(name);
+ return original_gethostbyname(name);
}
}
-struct hostent *gethostbyaddr(GETHOSTBYADDR_SIGNATURE)
+struct hostent *tsocks_gethostbyaddr_guts(GETHOSTBYADDR_SIGNATURE, struct hostent *(*original_gethostbyaddr)(GETHOSTBYADDR_SIGNATURE))
{
if(pool) {
return our_gethostbyaddr(pool, addr, len, type);
} else {
- return realgethostbyaddr(addr, len, type);
+ return original_gethostbyaddr(addr, len, type);
}
}
-int getaddrinfo(GETADDRINFO_SIGNATURE)
+int tsocks_getaddrinfo_guts(GETADDRINFO_SIGNATURE, int (*original_getaddrinfo)(GETADDRINFO_SIGNATURE))
{
if(pool) {
return our_getaddrinfo(pool, node, service, hints, res);
} else {
- return realgetaddrinfo(node, service, hints, res);
+ return original_getaddrinfo(node, service, hints, res);
}
}
-struct hostent *getipnodebyname(GETIPNODEBYNAME_SIGNATURE)
+struct hostent *tsocks_getipnodebyname_guts(GETIPNODEBYNAME_SIGNATURE, struct hostent *(*original_getipnodebyname)(GETIPNODEBYNAME_SIGNATURE))
{
if(pool) {
return our_getipnodebyname(pool, name, af, flags, error_num);
} else {
- return realgetipnodebyname(name, af, flags, error_num);
+ return original_getipnodebyname(name, af, flags, error_num);
}
}
1
0
commit 92151a43a5d9f99d8ea8c58852e275fdeb4a55a2
Merge: 8829590 7af1fc5
Author: Robert Hogan <robert(a)webkit.org>
Date: Sun Jun 20 13:19:47 2010 +0100
Merge branch 'osx'
configure.in | 49 ++++
src/parser.c | 862 +++++++++++++++++++++++++++----------------------------
src/torsocks.in | 45 ++-
src/tsocks.c | 348 ++++++++++++++++++++---
4 files changed, 813 insertions(+), 491 deletions(-)
diff --cc src/parser.c
index f0d3387,a77b262..5619ed2
--- a/src/parser.c
+++ b/src/parser.c
@@@ -82,23 -82,21 +82,23 @@@ int read_config (char *filename, struc
config->tordns_enabled = 1;
- /* If a filename wasn't provided, use the default */
- if (filename == NULL) {
- strncpy(line, CONF_FILE, sizeof(line) - 1);
- /* Insure null termination */
- line[sizeof(line) - 1] = (char) 0;
- filename = line;
- show_msg(MSGWARN, "Configuration file not provided by TORSOCKS_CONF_FILE "
- "environment variable, attempting to use defaults in %s.\n", filename);
- }
-
- /* If there is no configuration file use reasonable defaults for Tor */
- if ((conf = fopen(filename, "r")) == NULL) {
- show_msg(MSGERR, "Could not open socks configuration file "
- "(%s), assuming sensible defaults for Tor.\n", filename);
+ /* If a filename wasn't provided, use the default */
+ if (filename == NULL) {
+ strncpy(line, CONF_FILE, sizeof(line) - 1);
+ /* Insure null termination */
+ line[sizeof(line) - 1] = (char) 0;
+ filename = line;
++ show_msg(MSGWARN, "Configuration file not provided by TORSOCKS_CONF_FILE "
++ "environment variable, attempting to use defaults in %s.\n", filename);
+ }
+
+ /* If there is no configuration file use reasonable defaults for Tor */
+ if ((conf = fopen(filename, "r")) == NULL) {
+ show_msg(MSGERR, "Could not open socks configuration file "
+ "(%s) errno (%d), assuming sensible defaults for Tor.\n", filename, errno);
memset(&(config->defaultserver), 0x0, sizeof(config->defaultserver));
- check_server(&(config->defaultserver));
- handle_local(config, 0, "127.0.0.0/255.0.0.0");
+ check_server(&(config->defaultserver));
+ handle_local(config, 0, "127.0.0.0/255.0.0.0");
handle_local(config, 0, "10.0.0.0/255.0.0.0");
handle_local(config, 0, "192.168.0.0/255.255.0.0");
handle_local(config, 0, "172.16.0.0/255.240.0.0");
diff --cc src/tsocks.c
index dbda0f9,4f84fed..92bca5b
--- a/src/tsocks.c
+++ b/src/tsocks.c
@@@ -176,10 -243,13 +243,17 @@@ void tsocks_init(void)
return;
}
- show_msg(MSGWARN, "In tsocks_init \n");
+ /* Not strictly true yet, but prevents us getting called while still in progress.*/
+ /* This has been observed on Snow Leopard for instance. */
+ tsocks_init_complete = 1;
- get_environment();
- get_config();
++ show_msg(MSGWARN, "In tsocks_init \n");
+
- show_msg(MSGWARN, "In tsocks_init after env/config\n");
++// get_environment();
++// get_config();
++//
++// show_msg(MSGWARN, "In tsocks_init after env/config\n");
+
#ifdef USE_OLD_DLSYM
void *lib;
#endif
@@@ -264,6 -384,8 +388,7 @@@
area won't be shared across fork()s. */
deadpool_init();
#endif
- tsocks_init_complete=1;
- show_msg(MSGWARN, "Exit tsocks_init \n");
++
}
static int get_environment() {
1
0