tor-commits
Threads by month
- ----- 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
April 2014
- 22 participants
- 2021 discussions
commit aeea98a337d763490fc0f7b8868efffd4b9454b8
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 18:42:38 2013 -0400
Remove useless files
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
Doxyfile | 283 ---------------------------------------------------------
README.TORDNS | 187 --------------------------------------
2 files changed, 470 deletions(-)
diff --git a/Doxyfile b/Doxyfile
deleted file mode 100644
index 220991e..0000000
--- a/Doxyfile
+++ /dev/null
@@ -1,283 +0,0 @@
-# Doxyfile 1.5.1-KDevelop
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = torsocks
-PROJECT_NUMBER = 0.1
-OUTPUT_DIRECTORY =
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH = /home/robert/
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = /backup/robert/Development/torsocks
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.py \
- *.C \
- *.CC \
- *.C++ \
- *.II \
- *.I++ \
- *.H \
- *.HH \
- *.H++ \
- *.CS \
- *.PHP \
- *.PHP3 \
- *.M \
- *.MM \
- *.PY \
- *.C \
- *.H \
- *.tlh \
- *.diff \
- *.patch \
- *.moc \
- *.xpm \
- *.dox
-RECURSIVE = yes
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS = *
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = YES
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = yes
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = torsocks.tag
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-CALLER_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/README.TORDNS b/README.TORDNS
deleted file mode 100644
index 0b7dafd..0000000
--- a/README.TORDNS
+++ /dev/null
@@ -1,187 +0,0 @@
-
-TORDNS
-======
-
-What is it?
------------
-
-This patch modifies the tsocks library to use SOCKS for name resolution.
-
-
-Why should I use it?
---------------------
-
-* It's easier.
-
-When using this patch you don't (always..) need to run 'tor-resolve' when
-using 'torify' anymore. Also, 'torify' now works directly with SSH without
-the need for connect scripts or other fiddling. [As long as SSH is not
-installed suid root].
-
-* It allows you to use programs which are not SOCKS aware to connect to
-.onion sites.
-
-For example, you can ssh directly to a .onion site, or use telnet / netcat
-without hassle.
-
-
-QUICK: what do I need to do to make it work?
---------------------------------------------
-
-Configuration instructions:
-
-1) Get the sources
-
-wget http://ftp1.sourceforge.net/tsocks/tsocks-1.8beta5.tar.gz
-wget http://www.totalinfosecurity.com/patches/tor-tsocks/tordns-1.8b5.patch
-
-2) Unpack and apply the tsocks patch
-
-tar xzvf tsocks-1.8beta5.tar.gz
-cd tsocks-1.8
-patch -p1 < ../tordns-1.8b5.patch
-
-3) Configure, compile and install
-
-NOTE: The default 'configure' settings for tsocks have been changed by
-this patch. The --disable-hostnames option (don't try to use DNS to look
-up SOCKS servers) is now enabled by default. Also, tordns is enabled
-by default.
-
-./configure
-make
-make install
-
-All the tordns config options have sane default values which you should
-not need to change.
-
-
-Why did I need to use 'tor-resolve' with 'torify' in the first place?
----------------------------------------------------------------------
-
-Because if you run "torify telnet bar.foo.com 31337", for example, then
-you're leaking information about what sites you're visiting to DNS servers.
-
-The tor-resolve utility resolves names through tor using SOCKS, in a way
-that shouldn't compromise your privacy.
-
-
-What won't work with this?
---------------------------
-
-The 'tordns' feature for tsocks only works with applications using the
-standard c library name lookup mechanisms.
-
-Some programs roll their own name lookup functions, for example, 'curl'
-uses the 'adns' library, not the standard c library name lookup calls.
-In this case, you'll still be leaking DNS requests.
-
-However, it seems that most programs which go to the trouble of implementing
-asynchronous DNS requests or doing other tricky things have native SOCKS or
-HTTP proxy support.
-
-Requests for reverse name lookups are not intercepted.
-
-Finally, the tsocks library is NOT thread-safe, with or without this patch.
-You should not 'torify' multithreaded applications.
-
-
-How does it work?
------------------
-
-This patch adds interceptors for common name resolution calls to tsocks.
-Specifically, the 'gethostbyname', 'getaddrinfo' and 'getipnodebyname' library
-functions. (gethostbyname_r is not supported).
-
-When a call to one of these functions is intercepted, a SOCKS4A resolve
-request is used to retrieve the relevant information, and the results are
-cached.
-
-When the application calls 'connect', the cache is consulted and instead
-of making a SOCKS5 request and supplying the IP address, we connect using
-the name. This prevents those messages in the tor logs which look like:
-
- Sep 23 10:12:20.901 [warn] fetch_from_buf_socks(): Your application (using s
- ocks5 on port 80) is giving Tor only an IP address. Applications that do DNS
- resolves themselves may leak information. Consider using Socks4A (e.g. via
- privoxy or socat) instead.
-
-There are special provisions for handling .onion sites. When a program asks
-to resolve a name ending in '.onion', no name lookup is performed. A bogus IP
-address is returned. The range of unused IP addresses to hand out is called the
-"deadpool". This IP address doesn't mean anything in particular, and could be
-considered a cookie associated with the name. When the application eventually
-calls 'connect' with this bogus IP, the cache is consulted and the result is a
-SOCKS5 request which includes the name of the .onion site.
-
-The default deadpool range is '127.0.69.0/255.255.255.0'. NOTE: if a resolve
-request results in an IP from the deadpool range then the response is rejected,
-and it appears to the application that the lookup failed.
-
-The lookup cache is kept in mmap'd memory and shared across fork() calls.
-This is because some programs perform name lookups in a child process and
-then invoke 'connect' in the parent as a kind of "poor man's async DNS".
-
-
-Advanced configuration options
-------------------------------
-
-The following options have been added to the tsocks configuration file:
-
-tordns_enable
-
- The default value is 'true'. If you set it to 'false', tsocks should work
- just like it did without the tordns patch.
-
-
-tordns_deadpool_range
-
- The default value is '127.0.69.0/255.255.255.0'. This specifies what range
- of IP addresses will be handed to the application as "cookies" for .onion
- names. Of course, you should pick a block of addresses which you aren't
- going to ever need to actually connect to.
-
-
-tordns_cache_size
-
- This specifies the number of IP addresses looked up through socks to cache.
- The default value is 256. The default value is 256. Each entry consumes 260
- bytes of memory, so the default adds 66,560 bytes of overhead to each
- 'torified' process. NOTE: if the number of IP addresses in
- tordns_deadpool_range is less than the value specified for tordns_cache_size,
- then the cache will be shrunk to fit the deadpool range. This is to prevent
- duplicate deadpool addresses from ever appearing in the cache.
-
-
-TODO
-----
-
-* Think about how local names get resolved. Is it important? For example,
- if I 'telnet localhost' which using tordns, what should happen? Should
- we search through /etc/hosts ourselves or what?
-
-* What about the isc library calls like res_init and so on? How widely are
- they use? Does this present a more elegant way to implement this stuff?
-
-* Perhaps intercept res_query etc and try to do something appropriate.
-
-* It should be possible to make this thread-safe with --enable-threads.
-
-* validateconf needs to be updated to understand (and show information about)
- the tordns configuration options.
-
-* Perhaps intercept reverse name lookups?
-
-* In fact, one could modify tsocks further to play nicely with tor. For
- example, you could prevent nonlocal UDP traffic from being sent at all,
- and so on.
-
-
-******************************************************
-Questions or comments, please contact:
-Blair Strang (bls(a)totalinfosecurity.com)
-Caleb Anderson (caleb.anderson(a)totalinfosecurity.com)
-Carl Purvis (carl.purvis(a)totalinfosecurity.com)
-
-Total Information Security Ltd.
-http://www.totalinfosecurity.com/
1
0
05 Apr '14
commit 357b465b42691d845de2b6ceceb847c2db85ffb8
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 19:08:05 2013 -0400
Deny unsupported syscall() number for safety
Until we support all possible syscall() number, relevant to network
communication, we deny them for now just to be safe.
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
src/lib/syscall.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/lib/syscall.c b/src/lib/syscall.c
index 5cb9e8f..c2cd114 100644
--- a/src/lib/syscall.c
+++ b/src/lib/syscall.c
@@ -84,7 +84,14 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int __number, va_list args)
ret = handle_close(args);
break;
default:
- ret = tsocks_libc_syscall(__number, args);
+ /*
+ * Deny call since we have no idea if this call can leak or not data
+ * off the Tor network.
+ */
+ WARN("[syscall] Unsupported syscall number %ld. Denying the call",
+ __number);
+ ret = -1;
+ errno = ENOSYS;
break;
}
1
0
commit 68bfd65a236cbc39413b6235db49eb24223b8f7b
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 18:43:25 2013 -0400
Add gpl v2 license file
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
COPYING | 339 -----------------------------------------------------------
gpl-2.0.txt | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 339 insertions(+), 339 deletions(-)
diff --git a/COPYING b/COPYING
deleted file mode 100644
index d159169..0000000
--- a/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/gpl-2.0.txt b/gpl-2.0.txt
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/gpl-2.0.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
1
0
commit 7793cdb63d9f73a5ae155ae801604407a7c5c954
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 21:34:50 2013 -0400
Update TODO list
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
TODO | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/TODO b/TODO
index 66ae105..ab593f4 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,8 @@ Version 2.0
* Support res_* API
* Check recvmmsg() FD passing on Unix socket and for TCP socket, clean exit
* Support the complete list of dangerous syscall numbers with syscall()
-* Clean configure.ac
-* Create new updated torsocks shell script
+* Clean configure.ac - DONE
+* Create new updated torsocks shell script - DONE
* Rename torsocks to something more meaningful
* Add tests and a bunch load of them!
1
0
05 Apr '14
commit a87cd2e5800490f2f5123d8b3087db763a1405c8
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 21:35:18 2013 -0400
Set hidden visibility to most function calls
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
src/common/compat.c | 4 ++--
src/common/compat.h | 6 +-----
src/common/config-file.c | 2 ++
src/common/connection.c | 11 +++++++++++
src/common/ht.h | 5 +++++
src/common/onion.c | 5 +++++
src/common/socks5.c | 9 +++++++++
src/common/utils.c | 1 +
8 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/common/compat.c b/src/common/compat.c
index 03f70a8..5e3cf77 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -19,7 +19,7 @@
#include "compat.h"
-#ifdef __linux__
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__darwin__))
/*
* Initialize a pthread mutex. This never fails.
@@ -71,4 +71,4 @@ void tsocks_mutex_unlock(tsocks_mutex_t *m)
assert(!ret);
}
-#endif /* __linux__ */
+#endif /* __linux__, __darwin__, __FreeBSD__ */
diff --git a/src/common/compat.h b/src/common/compat.h
index 020fe8e..a433339 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -22,10 +22,6 @@
#define RTLD_NEXT ((void *) -1)
-#endif /* __linux__, __FreeBSD__, __darwin__ */
-
-#ifdef __linux__
-
#include <pthread.h>
typedef struct tsocks_mutex_t {
@@ -41,6 +37,6 @@ void tsocks_mutex_destroy(tsocks_mutex_t *m);
void tsocks_mutex_lock(tsocks_mutex_t *m);
void tsocks_mutex_unlock(tsocks_mutex_t *m);
-#endif /* __linux__ */
+#endif /* __linux__, __darwin__, __FreeBSD__ */
#endif /* TORSOCKS_COMPAT_H */
diff --git a/src/common/config-file.c b/src/common/config-file.c
index 32c93ea..39ca792 100644
--- a/src/common/config-file.c
+++ b/src/common/config-file.c
@@ -250,6 +250,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int config_file_read(const char *filename, struct configuration *config)
{
int ret;
@@ -305,6 +306,7 @@ error:
* Free everything inside a configuration file object. It is the caller
* responsability to free the object if needed.
*/
+ATTR_HIDDEN
void config_file_destroy(struct config_file *conf)
{
assert(conf);
diff --git a/src/common/connection.c b/src/common/connection.c
index 52d7acb..ab065b1 100644
--- a/src/common/connection.c
+++ b/src/common/connection.c
@@ -84,6 +84,7 @@ HT_GENERATE(connection_registry, connection, node, conn_hash_fct,
/*
* Acquire connection registry mutex.
*/
+ATTR_HIDDEN
void connection_registry_lock(void)
{
tsocks_mutex_lock(&connection_registry_mutex);
@@ -92,6 +93,7 @@ void connection_registry_lock(void)
/*
* Release connection registry mutex.
*/
+ATTR_HIDDEN
void connection_registry_unlock(void)
{
tsocks_mutex_unlock(&connection_registry_mutex);
@@ -100,6 +102,7 @@ void connection_registry_unlock(void)
/*
* Initialize connection registry.
*/
+ATTR_HIDDEN
void connection_registry_init(void)
{
HT_INIT(connection_registry, &connection_registry_root);
@@ -111,6 +114,7 @@ void connection_registry_init(void)
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int connection_addr_set(enum connection_domain domain, const char *ip,
in_port_t port, struct connection_addr *addr)
{
@@ -170,6 +174,7 @@ error:
*
* Return a newly allocated connection object or else NULL.
*/
+ATTR_HIDDEN
struct connection *connection_create(int fd, const struct sockaddr *dest)
{
struct connection *conn = NULL;
@@ -211,6 +216,7 @@ error:
/*
* Return the matching element with the given key or NULL if not found.
*/
+ATTR_HIDDEN
struct connection *connection_find(int key)
{
struct connection c_tmp;
@@ -222,6 +228,7 @@ struct connection *connection_find(int key)
/*
* Insert a connection object into the hash table.
*/
+ATTR_HIDDEN
void connection_insert(struct connection *conn)
{
struct connection *c_tmp;
@@ -238,6 +245,7 @@ void connection_insert(struct connection *conn)
/*
* Remove a given connection object from the registry.
*/
+ATTR_HIDDEN
void connection_remove(struct connection *conn)
{
assert(conn);
@@ -247,6 +255,7 @@ void connection_remove(struct connection *conn)
/*
* Destroy a connection by freeing its memory.
*/
+ATTR_HIDDEN
void connection_destroy(struct connection *conn)
{
if (!conn) {
@@ -260,6 +269,7 @@ void connection_destroy(struct connection *conn)
/*
* Get a reference of the given connection object.
*/
+ATTR_HIDDEN
void connection_get_ref(struct connection *c)
{
ref_get(&c->refcount);
@@ -269,6 +279,7 @@ void connection_get_ref(struct connection *c)
* Put back a reference of the given connection object. If the refcount drops
* to 0, the release connection function is called which frees the object.
*/
+ATTR_HIDDEN
void connection_put_ref(struct connection *c)
{
ref_put(&c->refcount, release_conn);
diff --git a/src/common/ht.h b/src/common/ht.h
index 9883ea5..e2fb809 100644
--- a/src/common/ht.h
+++ b/src/common/ht.h
@@ -8,6 +8,8 @@
#ifndef HT_H_INCLUDED_
#define HT_H_INCLUDED_
+#include "macros.h"
+
#define HT_HEAD(name, type) \
struct name { \
/* The hash table itself. */ \
@@ -315,6 +317,7 @@ ht_string_hash(const char *s)
/* Expand the internal table of 'head' until it is large enough to \
* hold 'size' elements. Return 0 on success, -1 on allocation \
* failure. */ \
+ ATTR_HIDDEN \
int \
name##_HT_GROW(struct name *head, unsigned size) \
{ \
@@ -377,6 +380,7 @@ ht_string_hash(const char *s)
} \
/* Free all storage held by 'head'. Does not free 'head' itself, or \
* individual elements. */ \
+ ATTR_HIDDEN \
void \
name##_HT_CLEAR(struct name *head) \
{ \
@@ -387,6 +391,7 @@ ht_string_hash(const char *s)
} \
/* Debugging helper: return false iff the representation of 'head' is \
* internally consistent. */ \
+ ATTR_HIDDEN \
int \
name##_HT_REP_IS_BAD_(const struct name *head) \
{ \
diff --git a/src/common/onion.c b/src/common/onion.c
index 8255c89..c34121a 100644
--- a/src/common/onion.c
+++ b/src/common/onion.c
@@ -88,6 +88,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int onion_pool_init(struct onion_pool *pool, in_addr_t addr, uint8_t mask)
{
int ret = 0;
@@ -139,6 +140,7 @@ error:
/*
* Destroy onion pool by freeing every entry.
*/
+ATTR_HIDDEN
void onion_pool_destroy(struct onion_pool *pool)
{
int i;
@@ -160,6 +162,7 @@ void onion_pool_destroy(struct onion_pool *pool)
*
* Return a newly allocated onion entry or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_create(struct onion_pool *pool,
const char *onion_name)
{
@@ -215,6 +218,7 @@ error:
*
* Return entry on success or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_find_by_name(const char *onion_name,
struct onion_pool *pool)
{
@@ -245,6 +249,7 @@ end:
*
* Return entry on success or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_find_by_ip(in_addr_t ip,
struct onion_pool *pool)
{
diff --git a/src/common/socks5.c b/src/common/socks5.c
index f1683c9..fcd48b6 100644
--- a/src/common/socks5.c
+++ b/src/common/socks5.c
@@ -119,6 +119,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_connect(struct connection *conn)
{
int ret;
@@ -160,6 +161,7 @@ error:
*
* Return 0 on success or else a negative errno value.
*/
+ATTR_HIDDEN
int socks5_send_method(struct connection *conn)
{
int ret = 0;
@@ -191,6 +193,7 @@ error:
*
* Return 0 on success or else a negative errno value.
*/
+ATTR_HIDDEN
int socks5_recv_method(struct connection *conn)
{
int ret;
@@ -228,6 +231,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_connect_request(struct connection *conn)
{
int ret;
@@ -332,6 +336,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_connect_reply(struct connection *conn)
{
int ret;
@@ -426,6 +431,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_resolve_request(const char *hostname, struct connection *conn)
{
int ret, ret_send;
@@ -487,6 +493,7 @@ error:
*
* Return 0 on success else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_resolve_reply(struct connection *conn, void *addr,
size_t addrlen)
{
@@ -563,6 +570,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_resolve_ptr_request(const void *ip, struct connection *conn)
{
int ret, ret_send;
@@ -623,6 +631,7 @@ error:
*
* Return 0 on success else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_resolve_ptr_reply(struct connection *conn, char **_hostname)
{
int ret;
diff --git a/src/common/utils.c b/src/common/utils.c
index 11a3652..59aa16f 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -163,6 +163,7 @@ char *utils_strsplit(char *separator, char **text, const char *search)
*
* Returns as for strcasecmp.
*/
+ATTR_HIDDEN
int utils_strcasecmpend(const char *s1, const char *s2)
{
size_t n1 = strlen(s1), n2 = strlen(s2);
1
0
commit 5d93644fbcdebd9fb58cc7f690e2d69dfb550508
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Sat Aug 24 12:24:08 2013 -0400
Cleanup old test system
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
test/Makefile.am | 5 --
test/README | 3 --
test/expectedresults.txt | 120 ----------------------------------------------
test/run_tests.sh | 44 -----------------
4 files changed, 172 deletions(-)
diff --git a/test/Makefile.am b/test/Makefile.am
index 263fea0..d42f10e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,8 +2,3 @@ noinst_PROGRAMS= test_torsocks
test_torsocks_SOURCES= test_torsocks.c
test_torsocks_LDFLAGS= $(TESTLDFLAGS)
-
-dist_data_DATA = run_tests.sh expectedresults.txt
-
-check-am:
- ./run_tests.sh
diff --git a/test/README b/test/README
deleted file mode 100644
index 4d65948..0000000
--- a/test/README
+++ /dev/null
@@ -1,3 +0,0 @@
-To run the tests:
-$./run_tests.sh
-
diff --git a/test/expectedresults.txt b/test/expectedresults.txt
deleted file mode 100644
index 53f1105..0000000
--- a/test/expectedresults.txt
+++ /dev/null
@@ -1,120 +0,0 @@
-libtorsocks: The symbol getipnodebyname() was not found in any shared library. The error reported was: not found!
-libtorsocks: The symbol getipnodebyname() was not found in any shared library. The error reported was: not found!
-libtorsocks: The symbol getipnodebyname() was not found in any shared library. The error reported was: not found!
-libtorsocks: our_getaddrinfo: 'www.torproject.org' requested
-libtorsocks: Got sendmsg request
-libtorsocks: sendmsg: Connection is a UDP or ICMP stream, may be a DNS request or other form of leak: rejecting.
-libtorsocks: Got sendto request
-libtorsocks: sendto: Connection is a UDP or ICMP stream, may be a DNS request or other form of leak: rejecting.
-libtorsocks: Got sendto request
-libtorsocks: sendto: Connection is a UDP or ICMP stream, may be a DNS request or other form of leak: rejecting.
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is a UDP or ICMP stream, may be a DNS request or other form of leak: rejecting.
-libtorsocks: our_gethostbyaddr: resolved '38.229.70.16' to: 'vescum.torproject.org'
-libtorsocks: our_gethostbyname: 'www.torproject.org' requested
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-libtorsocks: Got connection request
-libtorsocks: Intercepted call to getpeername
-libtorsocks: Got res_init request
-libtorsocks: Got connection request
-libtorsocks: Intercepted call to getpeername
-libtorsocks: Got connection request
-libtorsocks: Intercepted call to getpeername
-libtorsocks: Got connection request
-libtorsocks: Intercepted call to getpeername
-libtorsocks: Got connection request
-libtorsocks: Intercepted call to getpeername
-libtorsocks: Got res_init request
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-libtorsocks: Got connection request
-libtorsocks: connect: Connection is to a local address (192.168.1.1), may be a TCP DNS request to a local DNS server so have to reject to be safe. Please report a bug to http://code.google.com/p/torsocks/issues/entry if this is preventing a program from working properly with torsocks.
-socket: Operation not permitted
-
-----------------------getaddrinfo() TEST-----------------
-
-getaddrinfo: Servname not supported for ai_socktype
-
-----------------------UDP TEST----------------------
-
-
-----------------------udp sendmsg() TEST-------------------
-
-sendmsg() returned ret=-1 wb=0
-
-----------------------udp sendto() TEST--------------------
-
-sendto() returned ret=-1 wb=0
-
-----------------------udp connect() TEST-------------------
-
-Connect returned ret=-1
-
-----------------------udp send() TEST----------------------
-
-Note: no interception by torsocks expected as send() requires a socket in a connected state.
-send() returned ret=-1 wb=0
-
-----------------------gethostbyaddr() TEST-----------------
-
-vescum.torproject.org -> 38.229.70.16
-
-----------------------gethostbyname() TEST-----------------
-
-www.torproject.org -> 38.229.70.16
-
----------------------- local connect() TEST----------------------
-
-
----------------------- internet connect() TEST----------------------
-
-
----------------------- internet res_init() TEST----------------------
-
-nameserver for test: 8.8.8.8
-
----------------------- internet res_query() TEST----------------------
-
-return code: 102
-
----------------------- internet res_search() TEST----------------------
-
-return code: 102
-
---------------- internet res_querydomain() TEST----------------------
-
-return code: -1
-
----------------------- internet res_send() TEST----------------------
-
-return code: -1
-
----------------------- local res_init() TEST----------------------
-
-nameserver for test: 192.168.1.1
-
----------------------- local res_query() TEST----------------------
-
-return code: -1
-
----------------------- local res_search() TEST----------------------
-
-return code: -1
-
---------------- local res_querydomain() TEST----------------------
-
-return code: -1
-
----------------------- local res_send() TEST----------------------
-
-return code: -1
-
-----------------icmp() TEST----------------------------
-
diff --git a/test/run_tests.sh b/test/run_tests.sh
deleted file mode 100755
index 5582102..0000000
--- a/test/run_tests.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /bin/sh
-# ***************************************************************************
-# * *
-# * Copyright (C) 2011 Robert Hogan <robert(a)roberthogan.net> *
-# * *
-# * 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 *
-# * the Free Software Foundation; either version 2 of the License, or *
-# * (at your option) any later version. *
-# * *
-# * This program is distributed in the hope that it will be useful, *
-# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
-# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-# * 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., *
-#* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
-# ***************************************************************************
-export TORSOCKS_DEBUG=2
-TORSOCKS="`which torsocks`"
-
-if [ ! -x "$TORSOCKS" ]; then
- echo "torsocks doesn't exist." >&2
- echo "Perhaps you haven't installed torsocks yet?" >&2
- exit 1
-fi
-
-if [ ! -f ./test_torsocks ]; then
- echo "test_torsocks binary doesn't exist in this directory." >&2
- echo "Perhaps you haven't compiled torsocks yet?" >&2
- exit 1
-fi
-
-torsocks ./test_torsocks > /tmp/newresults.txt 2>&1
-output=`diff expectedresults.txt /tmp/newresults.txt`
-if ["$output" = ""]; then
- echo "Tests passed"
-else
- echo "Tests failed. Please post this output to http://code.google.com/p/torsocks/issues/entry"
-fi
-rm -f /tmp/newresults.txt
-export TORSOCKS_DEBUG=
\ No newline at end of file
1
0
commit 3f0e24d841c80ff92c6d6f339045df2ec4f5ba42
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Sat Aug 24 13:50:09 2013 -0400
Add DNS resolution test
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
.gitignore | 2 +-
tests/Makefile.am | 11 +++++
tests/test_dns.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 150 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 7f13a81..6e728a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,4 +41,4 @@ doc/usewithtor.1
src/bin/torsocks
-test/test_torsocks
+tests/test_dns
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 97b7b2b..e0a3fba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1 +1,12 @@
SUBDIRS = utils
+
+AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils/ -I$(srcdir)
+
+LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
+
+LIBTORSOCKS=$(top_builddir)/src/lib/libtorsocks.la
+
+noinst_PROGRAMS = test_dns
+
+test_dns_SOURCES = test_dns.c
+test_dns_LDADD = $(LIBTAP) $(LIBTORSOCKS)
diff --git a/tests/test_dns.c b/tests/test_dns.c
new file mode 100644
index 0000000..01bb5d9
--- /dev/null
+++ b/tests/test_dns.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2013 - David Goulet <dgoulet(a)ev0ke.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the 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.
+ */
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <sys/socket.h>
+
+#include <lib/torsocks.h>
+
+#include <tap/tap.h>
+
+#define NUM_TESTS 3
+
+struct test_host {
+ const char *name;
+ const char *ip;
+};
+
+/* Tor check hostname/ip. */
+static const struct test_host tor_check = {
+ .name = "sergii.torproject.org",
+ .ip = "38.229.72.22",
+};
+
+/* moria1 directory authority. */
+static const struct test_host tor_dir_auth1 = {
+ .name = "belegost.csail.mit.edu",
+ .ip = "128.31.0.39",
+};
+
+/* maatuska directory authority. */
+static const struct test_host tor_dir_auth2 = {
+ .name = "ehlo.4711.se",
+ .ip = "171.25.193.9",
+};
+
+static void test_gethostbyname(const struct test_host *host)
+{
+ struct hostent *he;
+
+ assert(host);
+
+ diag("gethostbyname test");
+
+ he = gethostbyname(host->name);
+ if (he) {
+ char *addr = inet_ntoa(*((struct in_addr *) he->h_addr_list[0]));
+ ok(strcmp(addr, host->ip) == 0, "Resolving %s", host->name);
+ } else {
+ fail("Resolving %s", host->name);
+ }
+
+ return;
+}
+
+static void test_gethostbyaddr(const struct test_host *host)
+{
+ struct hostent *he;
+ in_addr_t addr;
+
+ assert(host);
+
+ diag("gethostbyaddr test");
+
+ addr = inet_addr(host->ip);
+
+ he = gethostbyaddr(&addr, INET_ADDRSTRLEN, AF_INET);
+ if (he) {
+ ok(strcmp(host->name, he->h_name) == 0,
+ "Resolving address %s", host->ip);
+ } else {
+ fail("Resolving address %s", host->ip);
+ }
+
+ return;
+}
+
+static void test_getaddrinfo(const struct test_host *host)
+{
+ int ret;
+ struct addrinfo hints;
+ struct addrinfo *result;
+
+ diag("getaddrinfo test");
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
+ hints.ai_protocol = 0; /* Any protocol */
+ hints.ai_canonname = NULL;
+ hints.ai_addr = NULL;
+ hints.ai_next = NULL;
+
+ ret = getaddrinfo(host->name, NULL, &hints, &result);
+ if (ret == 0) {
+ struct in_addr addr;
+ char *ip;
+
+ addr.s_addr = ((struct sockaddr_in *)(result->ai_addr))->sin_addr.s_addr;
+ ip = inet_ntoa(addr);
+
+ ok(strcmp(host->ip, ip) == 0,
+ "Resolving address %s with getaddrinfo", host->name);
+ } else {
+ printf("%s\n", gai_strerror(ret));
+ fail("Resolving address %s with getaddrinfo", host->name);
+ }
+
+ return;
+}
+
+int main(int argc, char **argv)
+{
+ /* Libtap call for the number of tests planned. */
+ plan_tests(NUM_TESTS);
+
+ test_getaddrinfo(&tor_check);
+ test_gethostbyname(&tor_dir_auth1);
+ test_gethostbyaddr(&tor_dir_auth2);
+
+ return 0;
+}
1
0
commit a4dbb2dceb96b81ed0eefd49b219231e93ef1cd6
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 21:42:43 2013 -0400
Fix: change ERR message to WARN
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
src/lib/connect.c | 2 +-
src/lib/socket.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lib/connect.c b/src/lib/connect.c
index 6d84cc8..357a313 100644
--- a/src/lib/connect.c
+++ b/src/lib/connect.c
@@ -57,7 +57,7 @@ LIBC_CONNECT_RET_TYPE tsocks_connect(LIBC_CONNECT_SIG)
* request that we can't pass through Tor using raw UDP packet.
*/
if (sock_type != SOCK_STREAM) {
- ERR("[connect] UDP or ICMP stream can't be handled. Rejecting.");
+ WARN("[connect] UDP or ICMP stream can't be handled. Rejecting.");
errno = EBADF;
goto error;
}
diff --git a/src/lib/socket.c b/src/lib/socket.c
index 1f543e5..ce28576 100644
--- a/src/lib/socket.c
+++ b/src/lib/socket.c
@@ -34,8 +34,7 @@ LIBC_SOCKET_RET_TYPE tsocks_socket(LIBC_SOCKET_SIG)
break;
default:
if (__domain == AF_INET || __domain == AF_INET6) {
- ERR("Non TCP socket denied. Tor network can't handle it. "
- "Stopping everything!");
+ WARN("Non TCP inet socket denied. Tor network can't handle it.");
errno = EINVAL;
return -1;
}
1
0
commit 24cd794912b0be8a54979d94e6e94ae83ba7f55b
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Sat Aug 24 15:18:57 2013 -0400
Update torsocks.1 man page
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
doc/torsocks.1 | 113 ++++++++++++++++++++++++++++++++------------------------
1 file changed, 65 insertions(+), 48 deletions(-)
diff --git a/doc/torsocks.1 b/doc/torsocks.1
index 555e661..885ff52 100644
--- a/doc/torsocks.1
+++ b/doc/torsocks.1
@@ -1,63 +1,80 @@
-.TH TORSOCKS 1 "" "TORSOCKS"
+.TH "TORSOCKS" "1" "August 24th, 2013" "" ""
.SH NAME
-.BR torsocks
-\- Shell wrapper to simplify the use of the torsocks(8) library to
-transparently allow an application to use a SOCKS proxy. Basically a renamed, patched tsocks.
+torsocks \(em Shell wrapper to simplify the use of the torsocks(8) library to
+transparently torify an application.
+
.SH SYNOPSIS
-.B torsocks
-.RB [application\ [application's\ arguments]]
-.br
-or
-.B torsocks
-.RB [on|off|--shell]
-.br
-or
-.B torsocks
+
+.PP
+torsocks [OPTIONS] [COMMAND [ARG ...]]
+
.SH DESCRIPTION
-.B torsocks
-is a wrapper between the torsocks library and the application what you
-would like to run socksified.
-.SH SUMMARY
-By default, torsocks will assume that it should connect to the SOCKS proxy
-running at 127.0.0.1 on port 9050. This is the default address and port for
-Tor's socks server on most installations.
+\fBtorsocks\fP is a wrapper between the torsocks library and the application in
+order to make every Internet communication go through the Tor network.
-In order to use a configuration file, you must set the environment variable
-TORSOCKS_CONF_FILE with the location of the file.
+By default, torsocks will assume that it should connect to the Tor SOCKS proxy
+running at 127.0.0.1 on port 9050 being the defaults of the Tor daemon.
-If TORSOCKS_CONF_FILE is not set, torsocks will attempt to read the configuration
-file at @CONFDIR@/torsocks.conf. If that file cannot be read, torsocks will
-use sensible defaults for most Tor installations, i.e. it will assume that
-you want to use a SOCKS proxy running at 127.0.0.1 (localhost) on port 9050.
+In order to use a configuration file, torsocks tries to read the
+\fB@CONFDIR@/tor/torsocks.conf\fP file or look for the environment variable
+TORSOCKS_CONF_FILE with the location of the file. If that file cannot be read,
+torsocks will use sensible defaults for most Tor installations.
For further information on configuration, see
-.B torsocks.conf(5).
+.BR torsocks.conf(5).
.SH OPTIONS
-.IP \fB[application\ \fB[application's\ arguments]]
-run the application as specified with the environment (LD_PRELOAD) set
-such that torsocks(8) will transparently proxy SOCKS connections in
-that program
-.IP \fB[on|off]
-this option adds or removes torsocks(8) from the LD_PRELOAD environment
-variable. When torsocks(8) is in this variable all executed
-applications are automatically socksified. If you want to
-use this function, you HAVE to source the shell script from yours,
-like this: "source /usr/bin/torsocks" or ". /usr/bin/torsocks"
-.br
-Example:
+
+.TP
+.BR "\-h, \-\-help, \-?"
+Show summary of possible options and commands.
+.TP
+.BR "\-\-shell"
+Create a new shell with @LDPRELOAD@ including \fBtorsocks(8)\fP.
+.TP
+.BR "on | off"
+This option adds or removes \fBtorsocks(8)\fP from the @LDPRELOAD@ environment
+variable for the current shell. If you want to use this option, you HAVE to
+source torsocks from yours.
.br
-". torsocks on" -- add the torsocks lib to LD_PRELOAD
+
+.nf
+Add the torsocks library to @LDPRELOAD@
+$ . torsocks on
.br
-". torsocks off" -- remove the torsocks lib from LD_PRELOAD
-.IP \fB[show|sh]
-show the current value of the LD_PRELOAD variable
-.IP \fB[--shell]
-create a new shell with LD_PRELOAD including torsocks(8).
+Remove the torsocks library from @LDPRELOAD@
+$ . torsocks off
+.fi
+.TP
+.BR "show | sh"
+Show the current value of the @LDPRELOAD@ environment variable.
+
+.SH "ENVIRONMENT VARIABLES"
+.PP
+Please see \fBtorsocks(8)\fP for more detail on possible environment variables.
.PP
+
+.SH "SEE ALSO"
+.BR torsocks(8),
+.BR torsocks.conf(5)
+
+.SH "CREDITS"
+
+.PP
+torsocks is distributed under the GNU General Public License version 2.
+.PP
+A Web site is available at https://www.torproject.org for more information.
+.PP
+You can also find the source code at https://git.torproject.org.
+.PP
+Mailing list for help is <tor-talk(a)lists.torproject.org> and for development
+use <tor-dev(a)lists.torproject.org>. You can find the project also on IRC server
+irc.oftc.net (OFTC) in #tor and #tor-dev.
+.PP
+
.SH AUTHOR
-This script was created by Tamas SZERB <toma(a)rulez.org> for the debian
-package of tsocks. It (along with this manual page) have since been
-adapted into the torsocks project and modified.
+torsocks was originally written by Robert Hogan and has been rewritten by David
+Goulet <dgoulet(a)ev0ke.net> in 2013.
+.PP
1
0
05 Apr '14
commit 826007d5a3110dac36d8c6ff8b88f060c80994ea
Author: David Goulet <dgoulet(a)ev0ke.net>
Date: Fri Aug 23 20:55:49 2013 -0400
Optimize onion pool search by IP addr
Signed-off-by: David Goulet <dgoulet(a)ev0ke.net>
---
src/common/onion.c | 30 +++++++++++-------------------
src/common/onion.h | 1 +
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/src/common/onion.c b/src/common/onion.c
index 85585e3..8255c89 100644
--- a/src/common/onion.c
+++ b/src/common/onion.c
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <inttypes.h>
#include "defaults.h"
#include "log.h"
@@ -110,6 +111,7 @@ int onion_pool_init(struct onion_pool *pool, in_addr_t addr, uint8_t mask)
pool->max_pos = pool->base + ((1UL << (32 - mask)) - 1);
pool->next_entry_pos = 0;
pool->count = 0;
+ pool->mask = mask;
tsocks_mutex_init(&pool->lock);
/*
@@ -127,8 +129,8 @@ int onion_pool_init(struct onion_pool *pool, in_addr_t addr, uint8_t mask)
goto error;
}
- DBG("[onion] Pool initialized with base %lu, max_pos %lu and size %lu",
- pool->base, pool->max_pos, pool->size);
+ DBG("[onion] Pool initialized with mask %" PRIu8 ", base %lu, max_pos %lu "
+ "and size %lu", pool->mask, pool->base, pool->max_pos, pool->size);
error:
return ret;
@@ -222,7 +224,7 @@ struct onion_entry *onion_entry_find_by_name(const char *onion_name,
assert(onion_name);
assert(pool);
- DBG("[onion] Finding onion entry for name %s", onion_name);
+ DBG("[onion] Finding onion entry by name %s", onion_name);
for (i = 0; i < pool->count; i++) {
if (strcmp(onion_name, pool->entries[i]->hostname) == 0) {
@@ -246,27 +248,17 @@ end:
struct onion_entry *onion_entry_find_by_ip(in_addr_t ip,
struct onion_pool *pool)
{
- int i;
+ uint32_t index;
struct onion_entry *entry = NULL;
DBG("[onion] Finding onion entry for IP %s",
inet_ntoa(*((struct in_addr *) &ip)));
- /*
- * XXX: This can be improved by simply getting the offset of the IP with
- * the pool subnet which gives the index in the pool entries. For instance,
- * 127.0.0.45 with a ip_subnet set to 127.0.0.0/24, the index in the pool
- * entries is 45.
- */
- for (i = 0; i < pool->count; i++) {
- if (pool->entries[i]->ip == ip) {
- entry = pool->entries[i];
- DBG("[onion] Onion entry name %s found in pool.",
- entry->hostname);
- goto end;
- }
- }
+ index = ip >> pool->mask;
+ entry = pool->entries[index];
+
+ DBG("[onion] Onion entry name %s found in pool at index %" PRIu32,
+ entry->hostname, index);
-end:
return entry;
}
diff --git a/src/common/onion.h b/src/common/onion.h
index 90b4d5b..e866ba6 100644
--- a/src/common/onion.h
+++ b/src/common/onion.h
@@ -77,6 +77,7 @@ struct onion_pool {
*/
uint32_t base;
uint32_t max_pos;
+ uint8_t mask;
/*
* Current size of the array. This is the number of allocated entry in the
1
0