Commit Graph

65 Commits

Author SHA1 Message Date
Nick Mathewson
0fa107a6aa Update copyright dates to 2012; add a few missing copyright statements 2012-06-04 20:58:17 -04:00
George Kadianakis
a8a862c909 Ignore unknown lines from managed proxies. 2012-05-18 15:04:48 +03:00
Nick Mathewson
4bac223311 Fix a couple of wide lines 2012-05-11 13:01:07 -04:00
Nick Mathewson
e0655708a2 Merge remote-tracking branch 'asn/bug4865_take2' 2012-05-11 11:52:51 -04:00
Nick Mathewson
eefdb9eec2 Using %d to printf an enum may not be by-the-standard okay. 2012-05-07 11:02:17 -04:00
Nick Mathewson
74810f95ad Fix an overwide line 2012-05-07 10:59:23 -04:00
Nick Mathewson
9ceec869b5 Document some transports.c behaviors and assumptions 2012-05-07 09:55:14 -04:00
George Kadianakis
e603692adc Make transports.c logs a bit more helpful. 2012-05-03 04:40:36 +03:00
George Kadianakis
6d2898607b Fix issues found by nickm.
* Document fmt_addr_impl() and friends.
* Parenthesize macro arguments.
* Rename get_first_listener_addrport_for_pt() to
  get_first_listener_addrport_string().
* Handle port_cfg_t with no_listen.
* Handle failure of router_get_active_listener_port_by_type().
* Add an XXX to router_get_active_listener_port_by_type().
2012-04-12 22:42:37 +02: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
Nick Mathewson
eaedcba493 Merge branch 'bug5105-v2-squashed'
Conflicts:
	src/or/transports.c
2012-02-17 11:50:10 -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
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
Nick Mathewson
936b7b7b0b Downgrade "Registered server transport" msg to notice. Bug 5136 2012-02-15 12:58:36 -05: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
c08dde7e28 Reinstate TOR_PR_EXTENDED_SERVER_PORT, just a little 2012-02-13 00:13:58 -05:00
Sebastian Hahn
93414707ae set_managed_proxy_environment() can't fail anymore
It already couldn't fail on Windows, now it can't fail on non-Windows,
either.
2012-02-12 23:39:58 -05:00
Sebastian Hahn
9857ef0fb5 Properly set up environment for managed-mode obfsproxy 2012-02-12 23:39:58 -05:00
Nick Mathewson
60b42d68f3 Try to have (and maintain!) an invariant about unconfigured_proxies_n
The invariant is: unconfigured_proxies_n is exactly the number of
managed_proxy_t not in state PT_PROTO_COMPLETED.

To maintain this, we need to stop overloading unconfigured_proxies_n
to also count managed_proxy_t items that are in PT_PROTO_COMPLETED but
which might need relaunching.  To make it so we can detect those, we
introduce another variable.

This commit also adds a function to assert that we haven't broken the
invariant.

Fix for bug 5084; bugfix on 0.2.3.6-alpha, I think.
2012-02-12 23:30:19 -05:00
Nick Mathewson
fff511a5e7 Don't smartlist_remove a managed proxy from a list we're iterating over.
In some cases, we solve this by doing a SMARTLIST_DEL_CURRENT before
calling managed_proxy_destroy.  But for a trickier one, we just make a
copy of the list before iterating over it, so that changes to the
manage proxy list don't hurt our iteration.

This could be related to bug 5084.
2012-02-12 23:30:18 -05:00
Robert Ransom
93dbc17a1a Fix #5097 on Windows, too 2012-02-12 19:13:17 -05:00
Robert Ransom
0e9663d439 Fix bug #5097: remove bogus envvar from managed proxies' environment 2012-02-12 19:12:51 -05:00
Nick Mathewson
5cf9167f91 Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32
This commit is completely mechanical; I used this perl script to make it:

 #!/usr/bin/perl -w -i.bak -p

 if (/^\s*\#/) {
     s/MS_WINDOWS/_WIN32/g;
     s/\bWIN32\b/_WIN32/g;
 }
2012-01-31 15:48:47 -05:00
Nick Mathewson
26e789fbfd Rename nonconformant identifiers.
Fixes bug 4893.

These changes are pure mechanical, and were generated with this
perl script:

  /usr/bin/perl -w -i.bak -p

  s/crypto_pk_env_t/crypto_pk_t/g;
  s/crypto_dh_env_t/crypto_dh_t/g;
  s/crypto_cipher_env_t/crypto_cipher_t/g;
  s/crypto_digest_env_t/crypto_digest_t/g;

  s/aes_free_cipher/aes_cipher_free/g;
  s/crypto_free_cipher_env/crypto_cipher_free/g;
  s/crypto_free_digest_env/crypto_digest_free/g;
  s/crypto_free_pk_env/crypto_pk_free/g;

  s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g;
  s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g;
  s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g;
  s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g;

  s/crypto_new_cipher_env/crypto_cipher_new/g;
  s/crypto_new_digest_env/crypto_digest_new/g;
  s/crypto_new_digest256_env/crypto_digest256_new/g;
  s/crypto_new_pk_env/crypto_pk_new/g;

  s/crypto_create_crypto_env/crypto_cipher_new/g;

  s/connection_create_listener/connection_listener_new/g;
  s/smartlist_create/smartlist_new/g;
  s/transport_create/transport_new/g;
2012-01-18 15:53:30 -05:00
Nick Mathewson
47aa491f9f Merge remote-tracking branch 'asn-mytor/bug4751' 2012-01-16 15:16:41 -05:00
Nick Mathewson
edcc9981d8 Try to use smartlist_add_asprintf consistently
(To ensure correctness, in every case, make sure that the temporary
variable is deleted, renamed, or lowered in scope, so we can't have
any bugs related to accidentally relying on the no-longer-filled
variable.)
2012-01-16 15:02:51 -05:00
George Kadianakis
39850f03f6 Improve names of some pluggable transport-related functions. 2012-01-13 16:44:30 +02:00
Nick Mathewson
26053bd7c9 Merge remote-tracking branch 'asn-mytor/bug4725_take2' 2011-12-20 14:28:31 -05:00
George Kadianakis
539cb627f7 Server transports should be instructed to bind on INADDR_ANY by default. 2011-12-18 13:21:58 +01:00
George Kadianakis
6d35f08e01 Doxygenize the file-level documentation of transports.c. 2011-12-16 11:01:56 +01:00
Linus Nordberg
c06c80b7f7 Fix warnings.
Remove environ declaration.
Use ORPort->value.  And it's a string.
Make tmp a char *.
2011-12-01 09:40:47 +01:00
Nick Mathewson
5f0a8dcd2c Initial hacking for proposal 186.
This code handles the new ORPort options, and incidentally makes all
remaining port types use the new port configuration systems.

There are some rough edges!  It doesn't do well in the case where your
Address says one thing but you say to Advertise another ORPort.  It
doesn't handle AllAddrs.  It doesn't actually advertise anything besides
the first listed advertised IPv4 ORPort and DirPort.  It doesn't do
port forwarding to them either.

It's not tested either, it needs more documentation, and it probably
forgets to put the milk back in the refrigerator.
2011-11-30 11:55:44 -05:00
Nick Mathewson
b1bd30c24c Make the pt/transports test not crash. 2011-11-25 16:54:06 -05:00
Nick Mathewson
d6c18c5804 Make process_handle_t private and fix some unit tests
Let's *not* expose more cross-platform-compatibility structures, or
expect code to use them right.

Also, don't fclose() stdout_handle and stdin_handle until we do
tor_process_handle_destroy, or we risk a double-fclose.
2011-11-25 16:47:25 -05:00
Nick Mathewson
093e6724c7 Merge remote-tracking branch 'asn/bug3472_act2' 2011-11-25 16:00:31 -05:00
George Kadianakis
d4ba301f29 Tell the bridge operator on what ports his transports spawned.
- Add a LOG_WARN message when registering the transports of a server
  managed proxy, so that the bridge operator can see in what ports the
  transports spawned and notify his/her clients.
2011-11-02 14:23:41 +01:00
George Kadianakis
6b3c3b968f Rename tor_process_destroy() to tor_process_handle_destroy(). 2011-10-24 16:04:31 +02:00
George Kadianakis
47a5b8009b Improve general code quality.
- Add a tor_process_get_pid() function that returns the PID of a
  process_handle_t.
- Conform to make check-spaces.
- Add some more documentation.
- Improve some log messages.
2011-10-24 16:01:24 +02:00
George Kadianakis
572aa4ec44 Add PT_PROTO_FAILED_LAUNCH managed proxy state.
We used to try to terminate the managed proxy process even if it
failed while launching. We introduce a new managed proxy state, to
represent a *broken* and *not launched* proxy.
2011-10-24 15:59:11 +02:00
George Kadianakis
20be928fae Make set_managed_proxy_environment() work on Windows. 2011-10-24 15:56:28 +02:00
George Kadianakis
45307ff980 Port managed proxy launching code to the new subprocess API. 2011-10-17 22:46:44 +02:00
Nick Mathewson
00b2b69add Fix names of functions that convert strings to addrs
Now let's have "lookup" indicate that there can be a hostname
resolution, and "parse" indicate that there wasn't.  Previously, we
had one "lookup" function that did resolution; four "parse" functions,
half of which did resolution; and a "from_str()" function that didn't
do resolution.  That's confusing and error-prone!

The code changes in this commit are exactly the result of this perl
script, run under "perl -p -i.bak" :

  s/tor_addr_port_parse/tor_addr_port_lookup/g;
  s/parse_addr_port(?=[^_])/addr_port_lookup/g;
  s/tor_addr_from_str/tor_addr_parse/g;

This patch leaves aton and pton alone: their naming convention and
behavior is is determined by the sockets API.

More renaming may be needed.
2011-10-11 11:30:12 -04:00
Nick Mathewson
ed39621a9d Merge remote-tracking branch 'asn2/bug3656'
Conflicts:
	src/common/util.c
	src/common/util.h
	src/or/config.h
	src/or/main.c
	src/test/test_util.c
2011-10-07 16:05:13 -04:00
George Kadianakis
3be9d76fa2 Make it compile on Windows™. 2011-10-07 15:44:44 +02:00
George Kadianakis
105cc42e96 Support multiple transports in a single transport line.
Support multiple comma-separated transpotrs in a single
{Client,Server}TransportPlugin line.
2011-10-07 14:13:41 +02:00
George Kadianakis
e2703e3654 Improve wording in some comments and log messages. 2011-09-23 17:50:56 +02:00
George Kadianakis
2e73f9b3ee Put some sense into our logging.
Transform our logging severities to something more sensible.
Remove sneaky printf()s.
2011-09-12 00:10:07 +02:00
George Kadianakis
e8715b3041 Constification. 2011-09-11 23:35:00 +02:00
George Kadianakis
de7565f87f Make check-spaces happy. 2011-09-11 23:34:36 +02:00