Commit Graph

10502 Commits

Author SHA1 Message Date
Roger Dingledine
5fed1ccd90 put a _ before or_options_t elements that aren't configurable
it's fine with me if we change the current convention, but we should
actually decide to change it if we want to.
2012-04-01 15:59:38 -04:00
Nick Mathewson
341c6a59db Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/or/config.c

Conflict was in or_options_free, where two newly added fields had free
calls in the same place.
2012-04-01 00:46:52 -04:00
Nick Mathewson
9a69c24150 Do not use strcmp() to compare an http authenticator to its expected value
This fixes a side-channel attack on the (fortunately unused!)
BridgePassword option for bridge authorities.  Fix for bug 5543;
bugfix on 0.2.0.14-alpha.
2012-04-01 00:42:04 -04:00
George Kadianakis
10232dc042 Pass OR address to PT proxy, even with IPv6 or ORListenAddress.
Introduce get_first_listener_addrport_for_pt() which returns a string
containing the addrport of the first listener we could find. Use it to
form the TOR_PT_ORPORT managed proxy protocol line.
2012-03-31 14:04:58 +02:00
George Kadianakis
fedf76a2e6 Introduce and use router_get_active_listener_port_by_type().
router_get_active_listener_port_by_type() iterates all connections,
trying to find a listener of a specific type, and returns its TCP
port.
2012-03-31 13:54:09 +02:00
George Kadianakis
da6e0993dc Generalize fmt_addr() to support IPv6 decorations. 2012-03-31 13:48:20 +02:00
Nick Mathewson
548f2e32cd Remove the deprecated FooListenAddress options from torrc.sample.in
Bug 5438.
2012-03-30 16:53:02 -04:00
Nick Mathewson
a74905cea4 We allow IPv6 connections, don't use sockaddr_in with getsockname
This fixes client_check_address_changed to work better with IPv6 Tor
clients, and prevents them from spewing errors. Fix for ticket 5537.
2012-03-30 16:43:52 -04:00
Nick Mathewson
cc35157805 Twiddle ROUTER_{MAX_COSMETIC_TIME_DIFFERENCE,MAX_AGE_TO_PUBLISH}
This is ticket 2479. Roger's original explanation was:

   We have a series of bugs where relays publish a descriptor within
   12 hours of their last descriptor, but the authorities drop it
   because it's not different "enough" from the last one and it's
   too close to the last one.

   The original goal of this idea was to a) reduce the number of new
   descriptors authorities accept (and thus have to store) and b)
   reduce the total number of descriptors that clients and mirrors
   fetch. It's a defense against bugs where relays publish a new
   descriptor every minute.

   Now that we're putting out one consensus per hour, we're doing
   better at the total damage that can be caused by 'b'.

   There are broader-scale design changes that would help here, and
   we've had a trac entry open for years about how relays should
   recognize that they're not in the consensus, or recognize when
   their publish failed, and republish sooner.

   In the mean time, I think we should change some of the parameters
   to make the problem less painful.
2012-03-30 15:38:16 -04:00
Robert Ransom
458718d497 Fix comment typo 2012-03-30 11:04:03 -04:00
nils
efb8a09f41 Fix tor_strtok_r_impl and test cases per bug #5091
==

Nick here. I tweaked this patch a little to make it apply cleanly to
master, to extract some common code into a function, and to replace
snprintf with tor_snprintf.

-- nickm
2012-03-30 11:01:21 -04:00
Nick Mathewson
56e0959d2a Have tor_parse_*long functions check for negative bases
One of our unit tests checks that they behave correctly (giving an
error) when the base is negative.  But there isn't a guarantee that
strtol and friends actually handle negative bases correctly.

Found by Coverity Scan; fix for CID 504.
2012-03-30 10:34:05 -04:00
Nick Mathewson
88caa552cc Fix a couple of "unused assigned value" warnings in parse_config tests
Coverity doesn't like the fact that we were storing the value of
parse_config_line_from_str() but not checking it in a couple of
cases.

Fixes CID 505 and 506.
2012-03-30 10:26:34 -04:00
Nick Mathewson
affbcded5c Fix a memory leak in an error case of SAFECOOKIE authentication.
Found by Coverity Scan; fix for CID 507; bugfix on 0.2.3.13-alpha.
2012-03-30 10:20:48 -04:00
Nick Mathewson
ab3197c059 Remove a couple redundant NULL-checks before crypto_cipher_free
Calling crypto_cipher_free(NULL) is always safe, since (by
convention) all of our xyz_free() functions treat xyz_free(NULL) as
a no-op.

Flagged by coverity scan; fixes CID 508 and 509.
2012-03-30 10:16:58 -04:00
Nick Mathewson
1da5223e89 Merge branch 'bug5527' 2012-03-30 10:15:35 -04:00
Nick Mathewson
491ffa540f Move router lookup to _after_ we assert that its argument is set
A previous commit in the 5527 branch had moved
router_get_mutable_by_digest(digest_rcvd) to happen before we did
tor_assert(digest_rcvd), which would have defeated the purpose of
the assert.
2012-03-30 10:14:31 -04:00
Nick Mathewson
545cb5f34e Merge remote-tracking branch 'linus/empty_desc_stats' 2012-03-30 10:06:21 -04:00
Roger Dingledine
3031def726 checking "same addr/port but with nonmatching keys" is obsolete
Specifically, I believe it dates back to when extend cells had address:port
but no digest in them. The special edge case is certainly not worth the
complexity these days.
2012-03-29 16:45:25 -04:00
Roger Dingledine
5cb82e44d1 simplify further 2012-03-29 16:37:50 -04:00
Linus Nordberg
20eb38a588 Refactor dirserv_orconn_tls_done().
Look up the router using the digest instead of looping over all routers.
2012-03-29 22:01:06 +02:00
Nick Mathewson
f348daa6fb Merge remote-tracking branch 'linus/bug4875_2' 2012-03-29 10:53:09 -04:00
Nick Mathewson
04a1696095 Merge remote-tracking branch 'linus/bug5151' 2012-03-28 17:18:30 -04:00
Linus Nordberg
734fad4103 Make relays handle an address suggestion from a directory server giving an IPv6 address.
last_guessed_ip becomes a tor_addr_t.

Most parts of router_new_address_suggestion() learns
about IPv6 (resolve_my_address() is still IPv4 only).
2012-03-28 22:16:55 +02:00
Linus Nordberg
1b6f6bfda5 Don't try to generate stats from an empty served_descs. 2012-03-28 20:57:45 +02:00
Sebastian Hahn
77bc1b803e Fix a bunch of check-spaces complaints 2012-03-28 15:02:15 +02:00
Nick Mathewson
a9c0e9fec2 Write initial documentation for the contents of the state file
Fixes bug 2987.  There is still some information to go, but now we
have a place to put it.
2012-03-28 04:08:56 -04:00
Nick Mathewson
d20c6d2a37 Keep separate time-to-downloads for each consensus flavor
This is a fix for bug 4011, where if we have a recent ns consensus we
won't even try fetching a microdesc consensus.  Fix on 0.2.3.1-alpha,
I believe.
2012-03-28 02:55:33 -04:00
Nick Mathewson
01905a6ef9 Excise PK_NO_PADDING entirely: Unpadded RSA is silly.
We never use it, so having it around is pointless.

Suggested by Sebastian
2012-03-27 22:38:06 -04:00
Nick Mathewson
55c3e29669 Use OpenSSL 1.0.1's EVP aes_ctr implementation when available
This should be really fast on Intel chips.
2012-03-27 22:38:06 -04:00
Nick Mathewson
de0dca0de7 Refactor the API for setting up a block cipher.
It allows us more flexibility on the backend if the user needs to
specify the key and IV at setup time.
2012-03-27 22:37:56 -04:00
Nick Mathewson
00b4784575 Remove support for PK_NO_PADDING in crypto_pk_public_hybrid_encrypt
We never use it, and it would be a stupid thing if we started using it.
2012-03-27 22:37:55 -04:00
Nick Mathewson
80b2756b53 Log statement to help track down bug4091 2012-03-27 18:28:39 -04:00
Nick Mathewson
342e753d31 Merge remote-tracking branch 'karsten/bug5053' 2012-03-27 11:22:32 -04:00
Sebastian Hahn
582f747049 Provide large enough buffer in test_util_sscanf()
This was causing crashes during unit test runs, as stack smashing
protections got triggered. Issue spotted by weasel
2012-03-27 15:16:22 +02:00
Roger Dingledine
4121e7f861 bump to 0.2.3.13-alpha-dev 2012-03-27 01:26:01 -04:00
Nick Mathewson
5a2d0fbe64 Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/or/control.c
2012-03-26 18:51:37 -04:00
Nick Mathewson
6dcbfec82d Merge remote-tracking branch 'rransom-tor/safecookie-022-v3' into maint-0.2.2 2012-03-26 14:03:29 -04:00
Nick Mathewson
650e2aac46 Merge commit 'a5704b1c624c9a808f52f3a125339f00e2b9a378' into maint-0.2.2 2012-03-26 13:59:49 -04:00
Roger Dingledine
e103509f7a bump to 0.2.3.13-alpha 2012-03-26 00:01:46 -04:00
Sebastian Hahn
fe2b177cfb Never disable debugger attachment for the unit tests 2012-03-22 12:50:44 +01:00
Linus Nordberg
341e37e38c Move the logging of 'My line' to debug level (#5151). 2012-03-19 05:12:19 +01:00
Linus Nordberg
bb2135fea6 Reorder initialisation of port_cfg to match order of members in struct. 2012-03-19 04:57:19 +01:00
Linus Nordberg
ce5489eec0 Fix cut'n'paste bug (#5151). 2012-03-19 04:55:17 +01:00
Roger Dingledine
12594f27db Stop discarding command-line arguments when TestingTorNetwork is set
Discovered by Kevin Bauer. Fixes bug 5373; bugfix on 0.2.3.9-alpha,
where task 4552 added support for two layers of torrc files.
2012-03-14 02:40:04 -04:00
George Kadianakis
aae570b493 Close fds on pipe() error in tor_spawn_background(). 2012-03-12 12:41:29 -04:00
Nick Mathewson
9f88c1e14f Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/or/circuitbuild.c
2012-03-09 14:30:12 -05:00
Nick Mathewson
99bd5400e8 Never choose a bridge as an exit. Bug 5342. 2012-03-09 14:27:50 -05:00
Nick Mathewson
978cfcfbbb Merge remote-tracking branch 'origin/maint-0.2.2' 2012-03-09 14:25:18 -05:00
Nick Mathewson
8abfcc0804 Revise "sufficient exit nodes" check to work with restrictive ExitNodes
If you set ExitNodes so that only 1 exit node is accepted, the
previous patch would have made you unable to build circuits.
2012-03-09 14:23:23 -05:00
Nick Mathewson
d4526e1d4a Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/or/routerlist.c
2012-03-09 13:57:32 -05:00
Nick Mathewson
a574f7f3fe Merge branch 'bug5343' into maint-0.2.2 2012-03-09 13:54:04 -05:00
Nick Mathewson
c13dc5170f Merge remote-tracking branch 'origin/maint-0.2.2' 2012-03-09 11:54:45 -05:00
Nick Mathewson
be0535f00b Correctly handle broken escape sequences in torrc values
Previously, malformatted torrc values could crash us.

Patch by Esteban Manchado.  Fixes bug 5090; fix on 0.2.0.16-alpha.
2012-03-09 11:50:22 -05:00
Nick Mathewson
c4bfc7ca0e Disable some tor_sscanf tests that gcc says are illegal formats 2012-03-08 21:16:46 -05:00
Nick Mathewson
97b15e6fb0 Fix new strcmp_opt/len tests on OSs where strcmp() can return values >1 or <-1 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez
998891e734 Add unit tests for path_is_relative 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez
dbd170f752 Some more corner cases for tor_sscanf 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez
8e88377905 expand_filename tests for trailing slash in $HOME 2012-03-08 21:16:46 -05:00
Esteban Manchado Velázquez
043e154cdd Add some tests for expand_filename 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
6beec6a373 Add two small tests for tor_sscanf 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
fa4ca5ddc1 Add test for broken escapes in parse_config_... 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
8bb68011f0 Add some unit tests for parse_iso_time 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
c097401879 Add tests for string_is_C_identifier 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
1f6e3ec500 Improve coverage in string-related unit tests 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
03258529d8 Improve coverage in time-related unit tests 2012-03-08 21:16:45 -05:00
Esteban Manchado Velázquez
a3679d30c0 Remove unreliable assertion
* This assertion fails when executing the whole suite, but not when executing
  this test by itself
* Ideally I'd prefer starting with a guaranteed empty directory, but it's not
  very important in this case as non-existence of other paths is being checked
  explicitly
2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez
8d62e42fd3 Add extra tests for wrap_string 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez
9ae7d511f4 Add extra tests for get_parent_directory 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez
fa1d6f812c Tweak test case text so it's clearer 2012-03-08 20:49:26 -05:00
Esteban Manchado Velázquez
4beebea698 Improve eat_whitespace* unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
3e4a977781 Put expected first in n_bits_set_u8 unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
afb89b83f2 Improve tor_split_lines unit tests
* Add some more test cases
* Switch to test_assert et al
2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
699af29bae Use test_streq in join_win_cmdline unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
7b8a7556a8 Use test_eq et al in spawn_background unit tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
6b3854f8a3 Use test_streq in format_helper_exit_status tests 2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
22a915bcd2 Improve get_parent_directory unit tests
* Add more test cases to the get_parent_directory tests
* Switch the parameter order so that the expected value is the first one
2012-03-08 20:49:25 -05:00
Esteban Manchado Velázquez
275b81ec5d Improve listdir unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez
667f30e465 Improve a bit asprintf unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez
781c6676ca Rewrite the find_str_at_start_of_line unit tests 2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez
667f5ea409 Improve/extend strtok_r unit tests
* Add several failing tests (embedded in an "#if 0" block) for behaviour that
  doesn't match strtok_r
* Add another, passing, more interesting test
* Use test_eq_ptr(NULL, ...) instead of test_assert(NULL == ...)
2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez
ee317256bb Improve tor_sscanf tests
* Add many new test cases, tweak/improve existing ones, reorganize them a bit
* Switch the parameters in all test_eq calls so the expected value is the first
* Change all the "r = tor_sscanf(...);\ntest_eq(1, r)" to the more compact
  "test_eq(1, tor_sscanf(...))". It may be a tiny bit harder to find the
  tor_sscanf calls (it's the long lines anyway), but it saves a lot of lines,
  which should help readability.
2012-03-08 20:49:24 -05:00
Esteban Manchado Velázquez
8a633a3ebd Small fix in tor_sscanf documentation 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
4e44024ced Improve test case for read_escaped_data unit test 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
3c5a3b33e8 Trivial readability changes in mmap unit tests 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
f90406cb01 Clean up and improve gzip unit tests
* Switch some test_eq parameters so the expected is always the first parameter
* Drop some manual checks of compressed format magic numbers (they're pointless
  and they make the unit tests less readable and more fragile, considering
  we're already indirectly checking those magic numbers via the
  detect_compression_method function)
* Add a couple of extra assertions
2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
f4242d2e4a Add/improve the rest of the strmisc tests 2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
14177f03a9 Improve tor_snprintf tests 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez
314c851bc2 Add/improve tests for str{,case}cmp{start,end} 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez
f11be57860 Add more/better tests in test_util_strmisc 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez
73d9868232 Trivial cosmetic fix in test comments 2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez
ab39382cf8 Organize test_util_time in blocks
* Separate the tests for different functions with a comment
* Move some test init code further down, closer to where it was actually being
  used
2012-03-08 20:49:18 -05:00
Esteban Manchado Velázquez
f81af6d791 Add test for comments in the config parser 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
5a206dbb7a Remove duplicated macro definition 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
f9ad35c361 Add test for broken hex parsing
* The test currently fails, but it's commented out (with an "#if 0")
* As a broken octal actually gives a parse error, it seems fair that this
  fails, too
2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
a753ef8517 Fix typo in config parser documentation 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
72d455b5eb Improve config parser escaped content tests 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
4d9dda9bb9 Add tests for escaped content in config 2012-03-08 20:49:17 -05:00
Esteban Manchado Velázquez
57a4e07665 Add quoted content tests for the config parser 2012-03-08 20:49:16 -05:00
Esteban Manchado Velázquez
2a720847ad Fix documentation URLs in config file comments 2012-03-08 20:49:16 -05:00
Nick Mathewson
ec8a06c5a1 Require a threshold of exit nodes before building circuits
This mitigates an attack proposed by wanoskarnet, in which all of a
client's bridges collude to restrict the exit nodes that the client
knows about.  Fixes bug 5343.
2012-03-08 15:42:54 -05:00
Nick Mathewson
3fc3ed50a1 Merge remote-tracking branch 'public/bug4361'
Conflicts:
	src/or/command.c
2012-03-08 14:23:52 -05:00
Nick Mathewson
5daa765bd1 Merge remote-tracking branch 'origin/maint-0.2.2' 2012-03-08 14:15:18 -05:00
Sebastian Hahn
fe50b676bc Fix compile warnings in openbsd malloc 2012-03-08 19:28:59 +01:00
Nick Mathewson
57ed8fbbdd Merge remote-tracking branch 'origin/maint-0.2.2' 2012-03-08 10:50:33 -05:00
Nick Mathewson
9d5d3a7fd4 Merge remote-tracking branch 'karsten/geoip-march2012' into maint-0.2.2 2012-03-08 10:50:03 -05:00
Karsten Loesing
c5d7ee714f Update to the March 2012 GeoIP database. 2012-03-08 09:35:15 +01:00
Roger Dingledine
b5a8c3aa00 Remove misleading function comment (bug 5324)
In the distant past, connection_handle_read() could be called when there
are pending bytes in the TLS object during the main loop. The design
since then has been to always read all pending bytes immediately, so
read events only trigger when the socket actually has bytes to read.

Resolves bug 5324.
2012-03-07 21:07:30 -05:00
Nick Mathewson
298e08132f Merge remote-tracking branch 'public/bug4760' 2012-03-05 10:44:48 -05:00
Nick Mathewson
77a7a980d0 Don't leak the env_vars_sorted smartlist in process_environment_make
Found by Coverity.

No changes/ file, because this bug has not been in a release yet.
2012-02-29 19:49:26 -05:00
Nick Mathewson
6a0d809f44 Merge remote-tracking branch 'sebastian/bug5231' 2012-02-29 15:16:15 -05:00
Roger Dingledine
406bc95271 Merge branch 'maint-0.2.2' 2012-02-29 13:23:23 -05:00
Roger Dingledine
e21756908f new ip address for maatuska 2012-02-29 13:22:41 -05:00
Roger Dingledine
c26aaf9cba whitespace fix 2012-02-29 13:17:52 -05:00
Sebastian Hahn
2755b09c52 Don't cannibalize already cannibalized circuits
This ensures we don't build circuits that have 5 hops or more. Patch
contributed by wanoskarnet, thanks!
2012-02-25 17:59:21 +01:00
Daniel Bryg
f7e87f41f7 When not fetching v2 dir info, don't require it for cleaning descriptors
Bugfix on 0.2.2.26-beta, which introduced the idea of caches not
cacheing v2 info.  Fixes bug 4838.
2012-02-23 13:59:37 -05:00
Robert Ransom
e111e371b4 Implement 'safe cookie authentication' 2012-02-22 05:46:09 -08:00
Nick Mathewson
a5704b1c62 Add a sha256 hmac function, with tests
(cherry picked from commit fdbb9cdf74)
2012-02-22 05:46:08 -08:00
Nick Mathewson
81fe3e438b Merge remote-tracking branch 'sebastian/bug5161' 2012-02-20 13:00:17 -05:00
Nick Mathewson
73d2f335c5 Merge remote-tracking branch 'pmezard/armv5' 2012-02-20 12:53:49 -05:00
Patrick Mézard
857ae345c8 Fix off-by-one error in test_util_make_environment 2012-02-20 14:12:50 +01:00
Robert Ransom
cd029f0ca3 Fix crypto_hmac_sha256 documentation comment 2012-02-20 02:47:10 -08:00
Sebastian Hahn
bc66878bde Don't redeclare environ if std headers already did
This would cause a redundant redeclaration warning on some versions of
Linux otherwise.
2012-02-19 16:52:38 +01:00
Roger Dingledine
3a94530595 document a cool attack that we evaluated 2012-02-17 14:02:25 -05:00
Nick Mathewson
1d36693570 Use get_environment(), not environ. 2012-02-17 11:50:19 -05:00
Nick Mathewson
eaedcba493 Merge branch 'bug5105-v2-squashed'
Conflicts:
	src/or/transports.c
2012-02-17 11:50:10 -05:00
Robert Ransom
773290c09a Add unit tests for easily tested, non-trivial utility functions 2012-02-17 11:42:21 -05:00
Robert Ransom
33552c16ca Heap-allocate strings returned by get_current_process_environment_variables 2012-02-17 11:42:21 -05:00
Robert Ransom
c0808b795f Pass process_environment_t * to tor_spawn_background
Now tor_spawn_background's prototype is OS-independent.
2012-02-17 11:42:20 -05:00
Robert Ransom
ee3a49d6ed Remove (void)envp from tor_spawn_background
The envp argument is used on Windows.
2012-02-17 11:42:20 -05:00
Robert Ransom
bf1ce3f53d Rewrite managed proxy environment setup code
Now, the environment setup is entirely OS-independent, as well as less
hacky and brittle.
2012-02-17 11:42:20 -05:00
Robert Ransom
340d906419 Change type of unixoid_environment_block to match tor_spawn_background's arg 2012-02-17 11:42:20 -05:00
Robert Ransom
d37a1ec8c6 Add set_environment_variable_in_smartlist 2012-02-17 11:42:20 -05:00
Robert Ransom
0ba93e184a Add get_current_process_environment_variables 2012-02-17 11:42:19 -05:00
Robert Ransom
98cec14982 Add process_environment_make and related utilities 2012-02-17 11:42:19 -05:00
Robert Ransom
806e0f7e19 Add tor_calloc 2012-02-17 11:42:19 -05:00
Nick Mathewson
936b7b7b0b Downgrade "Registered server transport" msg to notice. Bug 5136 2012-02-15 12:58:36 -05:00
Sebastian Hahn
19b4df0d46 Include compat.h from natpmp-helper to fix build
This means tor_socket_t is declared.
2012-02-14 23:36:39 +01:00
Sebastian Hahn
efb7b9dec1 Use _NSGetEnviron() instead of environ where required
OS X would otherwise crash with a segfault when linked statically to
some libraries.
2012-02-14 11:18:39 -05:00
Nick Mathewson
077b9f19a4 If SOCK_CLOEXEC and friends fail, fall back to regular socket() calls
Since 0.2.3.1-alpha, we've supported the Linux extensions to socket(),
open(), socketpair(), and accept() that enable us to create an fd and
make it close-on-exec with a single syscall.  This not only saves us a
syscall (big deal), but makes us less vulnerable to race conditions
where we open a socket and then exec before we can make it
close-on-exec.

But these extensions are not supported on all Linuxes: They were added
between 2.6.23 or so and 2.6.28 or so.  If you were to build your Tor
against a recent Linux's kernel headers, and then run it with a older
kernel, you would find yourselve unable to open sockets.  Ouch!

The solution here is that, when one of these syscalls fails with
EINVAL, we should try again in the portable way.  This adds an extra
syscall in the case where we built with new headers and are running
with old ones, but it will at least allow Tor to work.

Fixes bug 5112; bugfix on 0.2.3.1-alpha.
2012-02-14 10:34:06 -05:00
Sebastian Hahn
efcdc930fb Make ht.h conform to Tor's code style again
When porting over changes from libevent, a bunch of tabs and a couple of
long lines got introduced.
2012-02-14 11:13:06 +01:00
Nick Mathewson
a31fb42d2e Port over the last ht.h changes from libevent: avoid _reserved identifiers 2012-02-13 18:40:30 -05:00
Nick Mathewson
107f604f31 Port over ht.h improvements from Libevent.
There is a facility (not used now in Tor) to avoid storing the hash
of a given type if it is a fast-to-calculate hash.

There are also a few ancient-openbsd compilation issues fixed here.

The fact that Tor says INLINE while Libevent says inline remains
unaddressed.
2012-02-13 18:06:40 -05:00
Nick Mathewson
1e9400d9c8 ht.h comment tweaks, upstreamed from libevent 2012-02-13 17:56:13 -05:00
Nick Mathewson
8cae9c53b7 Oops; there were a couple of typos in the upstream tinytest 2012-02-13 17:48:43 -05:00
Nick Mathewson
9efee31fae Synchronize with upstream tinytest again: remove _identifiers 2012-02-13 17:45:15 -05:00
Nick Mathewson
3b47a11654 Synchronize with upstream tinytest.
The big change here is a patch (first added to Libevent by Ed Day)
to make sure that the CreateProcess forked-test trick works even
when the main test program is invoked without its .exe suffix.
2012-02-13 17:29:31 -05:00
Roger Dingledine
184a455293 bump to 0.2.3.12-alpha-dev 2012-02-13 10:53:49 -05:00
Roger Dingledine
ff0059b924 bump to 0.2.3.12-alpha 2012-02-13 00:55:03 -05:00
Nick Mathewson
c08dde7e28 Reinstate TOR_PR_EXTENDED_SERVER_PORT, just a little 2012-02-13 00:13:58 -05:00