[tor-commits] [tor/master] Use tor_malloc_zero() in var_cell_new().
commit 8284c2bcba4d8daecf5416fa88324212c5fc17ea Author: George Kadianakis desnac...@riseup.net Date: Thu Sep 6 01:22:32 2012 +0300 Use tor_malloc_zero() in var_cell_new(). This is just a precaution; we seem to be using var_cell_t.payload and var_cell_t.payload_len correctly at the moment. --- src/or/connection_or.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/or/connection_or.c b/src/or/connection_or.c index da27cba..5a3b620 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -327,7 +327,7 @@ var_cell_t * var_cell_new(uint16_t payload_len) { size_t size = STRUCT_OFFSET(var_cell_t, payload) + payload_len; - var_cell_t *cell = tor_malloc(size); + var_cell_t *cell = tor_malloc_zero(size); cell-payload_len = payload_len; cell-command = 0; cell-circ_id = 0; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Log more information when we fail to terminate a process.
commit 93c38b679f01bba7d85ddf5eeac51c462e782a62 Author: George Kadianakis desnac...@riseup.net Date: Thu Sep 6 17:03:11 2012 +0300 Log more information when we fail to terminate a process. --- src/common/util.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index ce67252..4b1bce8 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3897,10 +3897,15 @@ tor_process_handle_destroy(process_handle_t *process_handle, if (also_terminate_process) { if (tor_terminate_process(process_handle) 0) { - log_notice(LD_GENERAL, Failed to terminate process with PID '%d', - tor_process_get_pid(process_handle)); + log_notice(LD_GENERAL, Failed to terminate process with + PID '%d' ('%s')., tor_process_get_pid(process_handle), +#ifdef _WIN32 + format_win32_error(GetLastError())); +#else + strerror(errno)); +#endif } else { - log_info(LD_GENERAL, Terminated process with PID '%d', + log_info(LD_GENERAL, Terminated process with PID '%d'., tor_process_get_pid(process_handle)); } } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge remote-tracking branch 'asn/bug6765'
commit deee0b67c3171cf4a6c7cf9c64c642d882b39880 Merge: 0012054 8284c2b Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 10:12:11 2012 -0400 Merge remote-tracking branch 'asn/bug6765' src/or/connection_or.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge remote-tracking branch 'asn/bug6779'
commit d2d7cab5b83e49aba4ae8ecf0aabb9dfcda8d31e Merge: deee0b6 93c38b6 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 10:12:15 2012 -0400 Merge remote-tracking branch 'asn/bug6779' src/common/util.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [torspec/master] Make tor-fw-helper port-purpose-agnostic.
commit 43c37b1113cd42b9818236a75660b896e16e6324 Author: George Kadianakis desnac...@riseup.net Date: Mon Jun 11 19:51:54 2012 +0300 Make tor-fw-helper port-purpose-agnostic. --- tor-fw-helper-spec.txt | 38 +- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/tor-fw-helper-spec.txt b/tor-fw-helper-spec.txt index 0068b26..fdc34b1 100644 --- a/tor-fw-helper-spec.txt +++ b/tor-fw-helper-spec.txt @@ -22,25 +22,37 @@ 2.1 Output format - When tor-fw-helper has completed the requested action successfully, it will - report the following message to standard output: +2.1.1. Motivation -tor-fw-helper: SUCCESS + tor-fw-helper should be able to signal to tor whether its actions + succeeded so that tor can act accordingly. For this reason it's + important to standarize the output format of tor-fw-helper. - If tor-fw-helper was unable to complete the requested action successfully, it - will report the following message to standard error: + tor-fw-helper outputs signalling commands to stdout, and debugging + messages to stderr. This means that a program that launches + tor-fw-helper only needs to monitor stdout to learn its status. -tor-fw-helper: FAILURE +2.1.2. TCP forwarding output - All informational messages are printed to standard output; all error messages - are printed to standard error. Messages other than SUCCESS and FAILURE - may be printed by any compliant tor-fw-helper. + When tor-fw-helper completes a TCP forwarding action, it prints the + following message to standard output: -2.2 Output format stability +tor-fw-helper tcp-forwarding external port internal port status [message] - The above SUCCESS and FAILURE messages are the only stable output formats - provided by this specification. tor-fw-helper-spec compliant implementations - must return SUCCESS or FAILURE as defined above. + where, + + external port, is the TCP port in the external side of the NAT + device that was forwarded. + internal port, is the TCP port in the internal side of the NAT + device that accepts forwarded traffic. + status, is either SUCCESS or FAIL. + message, is an optional supplementary message that can include +multiple words. + + For example, upon successfully using NAT-PMP to forward connections from + port '4200' to port '4333', tor-fw-helper would output in stdout: + +tor-fw-helper tcp-forwarding 4200 4333 SUCCESS NAT-PMP succeded 3. Security Concerns ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [torspec/master] Merge remote-tracking branch 'asn-gitorious/bug6059'
commit e5e36e4acabc2914799f96de70bd649f8b80667d Merge: 5cb 43c37b1 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 10:14:09 2012 -0400 Merge remote-tracking branch 'asn-gitorious/bug6059' tor-fw-helper-spec.txt | 38 +- 1 files changed, 25 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Implement the new TCP port parsing logic in tor-fw-helper.
commit d7261fb7f1ac6892b034ea47cdf59577188af93f Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 00:43:20 2012 +0300 Implement the new TCP port parsing logic in tor-fw-helper. --- src/tools/tor-fw-helper/tor-fw-helper.c | 56 +++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c index d23f9ba..9e5fbca 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.c +++ b/src/tools/tor-fw-helper/tor-fw-helper.c @@ -21,6 +21,8 @@ #include time.h #include string.h +#include container.h + #ifdef _WIN32 #include winsock2.h #endif @@ -244,6 +246,50 @@ network_init(void) return 0; } +/** Parse the '-p' argument of tor-fw-helper. Its format is + * [external port]:internal port, and external port is optional. + * Return NULL if barg/b was c0rrupted. */ +static port_to_forward_t * +parse_port(const char *arg) +{ + smartlist_t *sl = smartlist_new(); + port_to_forward_t *port_to_forward = NULL; + char *port_str = NULL; + int ok; + int port; + + smartlist_split_string(sl, arg, :, 0, 0); + if (smartlist_len(sl) != 2) +goto err; + + port_to_forward = tor_malloc(sizeof(port_to_forward_t)); + if (!port_to_forward) +goto err; + + port_str = smartlist_get(sl, 0); /* macroify ? */ + port = (int)tor_parse_long(port_str, 10, 1, 65536, ok, NULL); + if (!ok strlen(port_str)) /* :1555 is valid */ +goto err; + port_to_forward-external_port = port; + + port_str = smartlist_get(sl, 1); + port = (int)tor_parse_long(port_str, 10, 1, 65536, ok, NULL); + if (!ok) +goto err; + port_to_forward-internal_port = port; + + goto done; + + err: + tor_free(port_to_forward); + + done: + SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp)); + smartlist_free(sl); + + return port_to_forward; +} + int main(int argc, char **argv) { @@ -285,6 +331,16 @@ main(int argc, char **argv) exit(1); } +/* If no external port was given (it's optional), set it to be + * equal with the internal port. */ +if (!port_to_forward-external_port) { + assert(port_to_forward-internal_port); + if (tor_fw_options.verbose) +fprintf(stderr, V: No external port was given. Setting to %u.\n, +port_to_forward-internal_port); + port_to_forward-external_port = port_to_forward-internal_port; +} + if (!tor_fw_options.ports_to_forward) tor_fw_options.ports_to_forward = smartlist_new(); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Refactor tor-fw-helper port forwarding logic.
commit d19a78744e287d48df36e9946b021dbf1987bbce Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 18:26:27 2012 +0300 Refactor tor-fw-helper port forwarding logic. Make it port-purpose-agnostic; that is it should treat each port as equal, and not expect to get a DirPort and an ORPort. --- src/tools/tor-fw-helper/tor-fw-helper.c | 149 -- src/tools/tor-fw-helper/tor-fw-helper.h | 14 ++-- 2 files changed, 68 insertions(+), 95 deletions(-) diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c index 0510e65..d23f9ba 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.c +++ b/src/tools/tor-fw-helper/tor-fw-helper.c @@ -45,7 +45,7 @@ typedef struct backends_t { void *backend_state[MAX_BACKENDS]; } backends_t; -/** Initalize each backend helper with the user input stored in boptions/b +/** Initialize each backend helper with the user input stored in boptions/b * and put the results in the bbackends/b struct. */ static int init_backends(tor_fw_options_t *options, backends_t *backends) @@ -97,10 +97,7 @@ usage(void) [-T|--Test]\n [-v|--verbose]\n [-g|--fetch-public-ip]\n - -i|--internal-or-port [TCP port]\n - [-e|--external-or-port [TCP port]]\n - [-d|--internal-dir-port [TCP port]\n - [-p|--external-dir-port [TCP port]]]\n); + [-p|--forward-port ([external port]:internal port])\n); } /** Log commandline options to a hardcoded file btor-fw-helper.log/b in the @@ -259,22 +256,20 @@ main(int argc, char **argv) memset(tor_fw_options, 0, sizeof(tor_fw_options)); memset(backend_state, 0, sizeof(backend_state)); + // Parse CLI arguments. while (1) { int option_index = 0; static struct option long_options[] = { {verbose, 0, 0, 'v'}, {help, 0, 0, 'h'}, -{internal-or-port, 1, 0, 'i'}, -{external-or-port, 1, 0, 'e'}, -{internal-dir-port, 1, 0, 'd'}, -{external-dir-port, 1, 0, 'p'}, +{port, 1, 0, 'p'}, {fetch-public-ip, 0, 0, 'g'}, {test-commandline, 0, 0, 'T'}, {0, 0, 0, 0} }; -c = getopt_long(argc, argv, vhi:e:d:p:gT, +c = getopt_long(argc, argv, vhp:gT, long_options, option_index); if (c == -1) break; @@ -282,14 +277,21 @@ main(int argc, char **argv) switch (c) { case 'v': tor_fw_options.verbose = 1; break; case 'h': tor_fw_options.help = 1; usage(); exit(1); break; - case 'i': sscanf(optarg, %hu, tor_fw_options.private_or_port); -break; - case 'e': sscanf(optarg, %hu, tor_fw_options.public_or_port); -break; - case 'd': sscanf(optarg, %hu, tor_fw_options.private_dir_port); -break; - case 'p': sscanf(optarg, %hu, tor_fw_options.public_dir_port); + case 'p': { +port_to_forward_t *port_to_forward = parse_port(optarg); +if (!port_to_forward) { + fprintf(stderr, E: Failed to parse '%s'.\n, optarg); + usage(); + exit(1); +} + +if (!tor_fw_options.ports_to_forward) + tor_fw_options.ports_to_forward = smartlist_new(); + +smartlist_add(tor_fw_options.ports_to_forward, port_to_forward); + break; + } case 'g': tor_fw_options.fetch_public_ip = 1; break; case 'T': tor_fw_options.test_commandline = 1; break; case '?': break; @@ -297,100 +299,69 @@ main(int argc, char **argv) } } - if (tor_fw_options.verbose) { -fprintf(stderr, V: tor-fw-helper version %s\n -V: We were called with the following arguments:\n -V: verbose = %d, help = %d, pub or port = %u, -priv or port = %u\n -V: pub dir port = %u, priv dir port = %u\n -V: fetch_public_ip = %u\n, -tor_fw_version, tor_fw_options.verbose, tor_fw_options.help, -tor_fw_options.private_or_port, tor_fw_options.public_or_port, -tor_fw_options.private_dir_port, tor_fw_options.public_dir_port, -tor_fw_options.fetch_public_ip); + { // Verbose output + +if (tor_fw_options.verbose) + fprintf(stderr, V: tor-fw-helper version %s\n + V: We were called with the following arguments:\n + V: verbose = %d, help = %d, fetch_public_ip = %u\n, + tor_fw_version, tor_fw_options.verbose, tor_fw_options.help, + tor_fw_options.fetch_public_ip); + +if (tor_fw_options.verbose tor_fw_options.ports_to_forward) { + fprintf(stderr, V: TCP forwarding:\n); + SMARTLIST_FOREACH(tor_fw_options.ports_to_forward, +const port_to_forward_t *, port_to_forward, +fprintf(stderr, V: External: %u, Internal: %u\n, +port_to_forward-external_port, +port_to_forward-internal_port)); +}
[tor-commits] [tor/master] Further implement tor-fw-helper's TCP port forwarding system.
commit c5778553dc5a5c2f61dc6689a1041364a94e0eca Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 00:48:08 2012 +0300 Further implement tor-fw-helper's TCP port forwarding system. --- src/tools/tor-fw-helper/tor-fw-helper.c | 160 --- 1 files changed, 123 insertions(+), 37 deletions(-) diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c index 9e5fbca..00d2c4e 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.c +++ b/src/tools/tor-fw-helper/tor-fw-helper.c @@ -20,6 +20,7 @@ #include getopt.h #include time.h #include string.h +#include assert.h #include container.h @@ -168,65 +169,123 @@ tor_fw_fetch_public_ip(tor_fw_options_t *tor_fw_options, } } -/** Iterate over each of the supported bbackends/b and attempt to add a - * port forward for the OR port stored in btor_fw_options/b. */ +/** Print a spec-conformant string to stdout describing the results of + * the TCP port forwarding operation from bexternal_port/b to + * binternal_port/b. */ static void -tor_fw_add_or_port(tor_fw_options_t *tor_fw_options, - backends_t *backends) +tor_fw_helper_report_port_fw_results(uint16_t internal_port, + uint16_t external_port, + int succeded, + const char *message) { + char *report_string = NULL; + + tor_asprintf(report_string, %s %s %u %u %s %s\n, + tor-fw-helper, + tcp-forward, + external_port, internal_port, + succeded ? SUCCESS : FAIL, + message); + fprintf(stdout, %s, report_string); + fflush(stdout); + tor_free(report_string); +} + +#define tor_fw_helper_report_port_fw_fail(i, e, m) \ + tor_fw_helper_report_port_fw_results((i), (e), 0, (m)) + +#define tor_fw_helper_report_port_fw_success(i, e, m) \ + tor_fw_helper_report_port_fw_results((i), (e), 1, (m)) + +/** Return a heap-allocated string containing the list of our + * backends. It can be used in log messages. Be sure to free it + * afterwards! */ +static char * +get_list_of_backends_string(backends_t *backends) +{ + char *backend_names = NULL; int i; - int r = 0; + smartlist_t *backend_names_sl = smartlist_new(); - if (tor_fw_options-verbose) -fprintf(stdout, V: tor_fw_add_or_port\n); + assert(backends-n_backends); - for (i=0; ibackends-n_backends; ++i) { -if (tor_fw_options-verbose) { - fprintf(stdout, V: running backend_state now: %i\n, i); - fprintf(stdout, V: size of backend state: %u\n, - (int)(backends-backend_ops)[i].state_len); - fprintf(stdout, V: backend state name: %s\n, - (const char *) backends-backend_ops[i].name); -} -r = backends-backend_ops[i].add_tcp_mapping(tor_fw_options, - backends-backend_state[i]); -fprintf(stdout, tor-fw-helper: tor_fw_add_or_port backend %s -returned: %i\n, (const char *) backends-backend_ops[i].name, r); - } + for (i=0; ibackends-n_backends; ++i) +smartlist_add(backend_names_sl, (char *) backends-backend_ops[i].name); + + backend_names = smartlist_join_strings(backend_names_sl, , , 0, NULL); + smartlist_free(backend_names_sl); + + return backend_names; } /** Iterate over each of the supported bbackends/b and attempt to add a - * port forward for the Dir port stored in btor_fw_options/b. */ + * port forward for the port stored in btor_fw_options/b. */ static void -tor_fw_add_dir_port(tor_fw_options_t *tor_fw_options, - backends_t *backends) +tor_fw_add_ports(tor_fw_options_t *tor_fw_options, + backends_t *backends) { int i; int r = 0; + int succeeded = 0; if (tor_fw_options-verbose) -fprintf(stdout, V: tor_fw_add_dir_port\n); +fprintf(stderr, V: %s\n, __func__); - for (i=0; ibackends-n_backends; ++i) { -if (tor_fw_options-verbose) { - fprintf(stdout, V: running backend_state now: %i\n, i); - fprintf(stdout, V: size of backend state: %u\n, - (int)(backends-backend_ops)[i].state_len); - fprintf(stdout, V: backend state name: %s\n, - (char *)(backends-backend_ops)[i].name); + /** Loop all ports that need to be forwarded, and try to use our + * backends for each port. If a backend succeeds, break the loop, + * report success and get to the next port. If all backends fail, + * report failure for that port. */ + SMARTLIST_FOREACH_BEGIN(tor_fw_options-ports_to_forward, + port_to_forward_t *, port_to_forward) { + +succeeded = 0; + +for (i=0; ibackends-n_backends; ++i) { + if (tor_fw_options-verbose) { +fprintf(stderr, V: running backend_state now: %i\n, i); +fprintf(stderr, V: size of backend state: %u\n, +(int)(backends-backend_ops)[i].state_len); +fprintf(stderr, V:
[tor-commits] [tor/master] Refactor our backends' interface.
commit b9e160446a9fcc5c840694ea6eee3c23217bcd19 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 00:56:23 2012 +0300 Refactor our backends' interface. --- src/tools/tor-fw-helper/tor-fw-helper-natpmp.c | 30 -- src/tools/tor-fw-helper/tor-fw-helper-natpmp.h |4 +- src/tools/tor-fw-helper/tor-fw-helper-upnp.c | 40 +++- src/tools/tor-fw-helper/tor-fw-helper-upnp.h |3 +- src/tools/tor-fw-helper/tor-fw-helper.h|4 +- 5 files changed, 37 insertions(+), 44 deletions(-) diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c index 0e0b385..257ef0d 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c @@ -110,27 +110,25 @@ wait_until_fd_readable(tor_socket_t fd, struct timeval *timeout) return 0; } -/** Add a TCP port mapping for a single port stored in btor_fw_options/b - * using the bnatpmp_t/b stored in bbackend_state/b. */ int -tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options, - void *backend_state) +tor_natpmp_add_tcp_mapping(uint16_t internal_port, uint16_t external_port, + int is_verbose, void *backend_state) { - natpmp_state_t *state = (natpmp_state_t *) backend_state; int r = 0; int x = 0; int sav_errno; + natpmp_state_t *state = (natpmp_state_t *) backend_state; struct timeval timeout; - if (tor_fw_options-verbose) -fprintf(stdout, V: sending natpmp portmapping request...\n); + if (is_verbose) +fprintf(stderr, V: sending natpmp portmapping request...\n); r = sendnewportmappingrequest((state-natpmp), state-protocol, -tor_fw_options-internal_port, -tor_fw_options-external_port, +internal_port, +external_port, state-lease); - if (tor_fw_options-verbose) -fprintf(stdout, tor-fw-helper: NAT-PMP sendnewportmappingrequest + if (is_verbose) +fprintf(stderr, tor-fw-helper: NAT-PMP sendnewportmappingrequest returned %d (%s)\n, r, r==12?SUCCESS:FAILED); do { @@ -139,8 +137,8 @@ tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options, if (x == -1) return -1; -if (tor_fw_options-verbose) - fprintf(stdout, V: attempting to readnatpmpreponseorretry...\n); +if (is_verbose) + fprintf(stderr, V: attempting to readnatpmpreponseorretry...\n); r = readnatpmpresponseorretry((state-natpmp), (state-response)); sav_errno = errno; @@ -163,16 +161,14 @@ tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options, } if (r == NATPMP_SUCCESS) { -fprintf(stdout, tor-fw-helper: NAT-PMP mapped public port %hu to +fprintf(stderr, tor-fw-helper: NAT-PMP mapped public port %hu to localport %hu liftime %u\n, (state-response).pnu.newportmapping.mappedpublicport, (state-response).pnu.newportmapping.privateport, (state-response).pnu.newportmapping.lifetime); } - tor_fw_options-nat_pmp_status = 1; - - return r; + return (r == NATPMP_SUCCESS) ? 0 : -1; } /** Fetch our likely public IP from our upstream NAT-PMP enabled NAT device. diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h index 54f541b..0f97236 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h +++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h @@ -36,8 +36,8 @@ int tor_natpmp_init(tor_fw_options_t *tor_fw_options, void *backend_state); int tor_natpmp_cleanup(tor_fw_options_t *tor_fw_options, void *backend_state); -int tor_natpmp_add_tcp_mapping(tor_fw_options_t *tor_fw_options, - void *backend_state); +int tor_natpmp_add_tcp_mapping(uint16_t internal_port, uint16_t external_port, + int is_verbose, void *backend_state); int tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options, void *backend_state); diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c index 7c104f1..0977e0d 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c @@ -154,44 +154,40 @@ tor_upnp_fetch_public_ip(tor_fw_options_t *options, void *backend_state) return UPNP_ERR_GETEXTERNALIP; } -/** Add a TCP port mapping for a single port stored in btor_fw_options/b - * and store the results in bbackend_state/b. */ int -tor_upnp_add_tcp_mapping(tor_fw_options_t *options, void *backend_state) +tor_upnp_add_tcp_mapping(uint16_t internal_port, uint16_t external_port, + int is_verbose, void *backend_state) { - miniupnpc_state_t *state = (miniupnpc_state_t *) backend_state; - int r; + int retval; char
[tor-commits] [tor/master] All loging messages are now sent to stderr.
commit e8be040016a279d5cbef38fa5328cc2eb0de2c46 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 00:59:20 2012 +0300 All loging messages are now sent to stderr. stdout should be clean for control messages. --- src/tools/tor-fw-helper/tor-fw-helper-natpmp.c | 28 src/tools/tor-fw-helper/tor-fw-helper-upnp.c |4 +- src/tools/tor-fw-helper/tor-fw-helper.c| 12 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c index 257ef0d..ee6d5f3 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c @@ -60,15 +60,15 @@ tor_natpmp_init(tor_fw_options_t *tor_fw_options, void *backend_state) state-lease = NATPMP_DEFAULT_LEASE; if (tor_fw_options-verbose) -fprintf(stdout, V: natpmp init...\n); +fprintf(stderr, V: natpmp init...\n); r = initnatpmp((state-natpmp), 0, 0); if (r == 0) { state-init = 1; -fprintf(stdout, tor-fw-helper: natpmp initialized...\n); +fprintf(stderr, V: natpmp initialized...\n); return r; } else { -fprintf(stderr, tor-fw-helper: natpmp failed to initialize...\n); +fprintf(stderr, V: natpmp failed to initialize...\n); return r; } } @@ -80,10 +80,10 @@ tor_natpmp_cleanup(tor_fw_options_t *tor_fw_options, void *backend_state) natpmp_state_t *state = (natpmp_state_t *) backend_state; int r = 0; if (tor_fw_options-verbose) -fprintf(stdout, V: natpmp cleanup...\n); +fprintf(stderr, V: natpmp cleanup...\n); r = closenatpmp((state-natpmp)); if (tor_fw_options-verbose) -fprintf(stdout, V: closing natpmp socket: %d\n, r); +fprintf(stderr, V: closing natpmp socket: %d\n, r); return r; } @@ -101,7 +101,7 @@ wait_until_fd_readable(tor_socket_t fd, struct timeval *timeout) FD_SET(fd, fds); r = select(fd+1, fds, NULL, NULL, timeout); if (r == -1) { -fprintf(stdout, V: select failed in wait_until_fd_readable: %s\n, +fprintf(stderr, V: select failed in wait_until_fd_readable: %s\n, strerror(errno)); return -1; } @@ -185,7 +185,7 @@ tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options, struct timeval timeout; r = sendpublicaddressrequest((state-natpmp)); - fprintf(stdout, tor-fw-helper: NAT-PMP sendpublicaddressrequest returned + fprintf(stderr, tor-fw-helper: NAT-PMP sendpublicaddressrequest returned %d (%s)\n, r, r==2?SUCCESS:FAILED); do { @@ -196,12 +196,12 @@ tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options, return -1; if (tor_fw_options-verbose) - fprintf(stdout, V: NAT-PMP attempting to read reponse...\n); + fprintf(stderr, V: NAT-PMP attempting to read reponse...\n); r = readnatpmpresponseorretry((state-natpmp), (state-response)); sav_errno = errno; if (tor_fw_options-verbose) - fprintf(stdout, V: NAT-PMP readnatpmpresponseorretry returned + fprintf(stderr, V: NAT-PMP readnatpmpresponseorretry returned %d\n, r); if ( r 0 r != NATPMP_TRYAGAIN) { @@ -219,15 +219,15 @@ tor_natpmp_fetch_public_ip(tor_fw_options_t *tor_fw_options, return r; } - fprintf(stdout, tor-fw-helper: ExternalIPAddress = %s\n, + fprintf(stderr, tor-fw-helper: ExternalIPAddress = %s\n, inet_ntoa((state-response).pnu.publicaddress.addr)); tor_fw_options-public_ip_status = 1; if (tor_fw_options-verbose) { -fprintf(stdout, V: result = %u\n, r); -fprintf(stdout, V: type = %u\n, (state-response).type); -fprintf(stdout, V: resultcode = %u\n, (state-response).resultcode); -fprintf(stdout, V: epoch = %u\n, (state-response).epoch); +fprintf(stderr, V: result = %u\n, r); +fprintf(stderr, V: type = %u\n, (state-response).type); +fprintf(stderr, V: resultcode = %u\n, (state-response).resultcode); +fprintf(stderr, V: epoch = %u\n, (state-response).epoch); } return r; diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c index 0977e0d..e5c33db 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c @@ -91,7 +91,7 @@ tor_upnp_init(tor_fw_options_t *options, void *backend_state) assert(options); r = UPNP_GetValidIGD(devlist, (state-urls), (state-data), state-lanaddr, UPNP_LANADDR_SZ); - fprintf(stdout, tor-fw-helper: UPnP GetValidIGD returned: %d (%s)\n, r, + fprintf(stderr, tor-fw-helper: UPnP GetValidIGD returned: %d (%s)\n, r, r==UPNP_SUCCESS?SUCCESS:FAILED); freeUPNPDevlist(devlist); @@ -141,7 +141,7 @@ tor_upnp_fetch_public_ip(tor_fw_options_t *options, void *backend_state) goto err; if (externalIPAddress[0]) { -fprintf(stdout, tor-fw-helper: ExternalIPAddress = %s\n, +fprintf(stderr, tor-fw-helper:
[tor-commits] [tor/master] Introduce get_lines_from_handle().
commit 03e89f0b72ede5ec37c76de840f04579b8d118c3 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 19:07:13 2012 +0300 Introduce get_lines_from_handle(). get_lines_from_handle() is a multiplatform function which drains lines from a stream and stuffs it into a smartlist. It's useful for line-based protocols, like the one managed proxy and the tor-fw-helper protocols. --- src/common/util.c | 71 + src/common/util.h | 10 +++ 2 files changed, 81 insertions(+), 0 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index ce67252..6e23c96 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -4369,6 +4369,50 @@ tor_split_lines(smartlist_t *sl, char *buf, int len) } #ifdef _WIN32 + +/** Return a smartlist containing lines outputted from + * bhandle/b. Return NULL on error, and set + * bstream_status_out/b appropriately. */ +smartlist_t * +tor_get_lines_from_handle(HANDLE *handle, + enum stream_status *stream_status_out) +{ + int pos; + char stdout_buf[600] = {0}; + smartlist_t *lines = NULL; + + tor_assert(stream_status); + + *stream_status = IO_STREAM_TERM; + + pos = tor_read_all_handle(handle, stdout_buf, sizeof(stdout_buf) - 1, NULL); + if (pos 0) { +*stream_status = IO_STREAM_TERM; +return NULL; + } + if (pos == 0) { +*stream_status = IO_STREAM_EAGAIN; +return NULL; + } + + /* End with a null even if there isn't a \r\n at the end */ + /* TODO: What if this is a partial line? */ + stdout_buf[pos] = '\0'; + + /* Split up the buffer */ + lines = smartlist_new(); + tor_split_lines(lines, stdout_buf, pos); + + /* Currently 'lines' is populated with strings residing on the + stack. Replace them with their exact copies on the heap: */ + SMARTLIST_FOREACH(lines, char *, line, +SMARTLIST_REPLACE_CURRENT(lines, line, tor_strdup(line))); + + *stream_status = IO_STREAM_OKAY; + + return lines; +} + /** Read from stream, and send lines to log at the specified log level. * Returns -1 if there is a error reading, and 0 otherwise. * If the generated stream is flushed more often than on new lines, or @@ -4416,6 +4460,33 @@ log_from_handle(HANDLE *pipe, int severity) #else +/** Return a smartlist containing lines outputted from + * bhandle/b. Return NULL on error, and set bstream_status/b + * appropriately. */ +smartlist_t * +tor_get_lines_from_handle(FILE *handle, enum stream_status *stream_status_out) +{ + enum stream_status stream_status; + char stdout_buf[400]; + smartlist_t *lines = NULL; + + while (1) { +memset(stdout_buf, 0, sizeof(stdout_buf)); + +stream_status = get_string_from_pipe(handle, + stdout_buf, sizeof(stdout_buf) - 1); +if (stream_status != IO_STREAM_OKAY) + goto done; + +if (!lines) lines = smartlist_new(); +smartlist_add(lines, tor_strdup(stdout_buf)); + } + + done: + *stream_status_out = stream_status; + return lines; +} + /** Read from stream, and send lines to log at the specified log level. * Returns 1 if stream is closed normally, -1 if there is a error reading, and * 0 otherwise. Handles lines from tor-fw-helper and diff --git a/src/common/util.h b/src/common/util.h index c059730..69335ed 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -464,6 +464,16 @@ HANDLE tor_process_get_stdout_pipe(process_handle_t *process_handle); FILE *tor_process_get_stdout_pipe(process_handle_t *process_handle); #endif +#ifdef _WIN32 +struct smartlist_t * +tor_get_lines_from_handle(HANDLE *handle, + enum stream_status *stream_status); +#else +struct smartlist_t * +tor_get_lines_from_handle(FILE *handle, + enum stream_status *stream_status); +#endif + int tor_terminate_process(process_handle_t *process_handle); void tor_process_handle_destroy(process_handle_t *process_handle, int also_terminate_process); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Use get_lines_from_handle() in configure_proxy().
commit 64b2a64310a66a3e22403917ecdef38263ba0483 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 19:09:31 2012 +0300 Use get_lines_from_handle() in configure_proxy(). --- src/or/transports.c | 86 --- 1 files changed, 13 insertions(+), 73 deletions(-) diff --git a/src/or/transports.c b/src/or/transports.c index dd07a91..9edeebd 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -585,15 +585,12 @@ pt_configure_remaining_proxies(void) mark_my_descriptor_dirty(configured managed proxies); } -#ifdef _WIN32 - /** Attempt to continue configuring managed proxy bmp/b. */ static void configure_proxy(managed_proxy_t *mp) { - int pos; - char stdout_buf[200]; - smartlist_t *lines = NULL; + smartlist_t *proxy_output = NULL; + enum stream_status stream_status = 0; /* if we haven't launched the proxy yet, do it now */ if (mp-conf_state == PT_PROTO_INFANT) { @@ -607,28 +604,18 @@ configure_proxy(managed_proxy_t *mp) tor_assert(mp-conf_state != PT_PROTO_INFANT); tor_assert(mp-process_handle); - pos = tor_read_all_handle(tor_process_get_stdout_pipe(mp-process_handle), -stdout_buf, sizeof(stdout_buf) - 1, NULL); - if (pos 0) { -log_notice(LD_GENERAL, Failed to read data from managed proxy '%s'., - mp-argv[0]); -mp-conf_state = PT_PROTO_BROKEN; + proxy_output = +tor_get_lines_from_handle(tor_process_get_stdout_pipe(mp-process_handle), + stream_status); + if (!proxy_output) { /* failed to get input from proxy */ +if (stream_status != IO_STREAM_EAGAIN) + mp-conf_state = PT_PROTO_BROKEN; + goto done; } - if (pos == 0) /* proxy has nothing interesting to say. */ -return; - - /* End with a null even if there isn't a \r\n at the end */ - /* TODO: What if this is a partial line? */ - stdout_buf[pos] = '\0'; - - /* Split up the buffer */ - lines = smartlist_new(); - tor_split_lines(lines, stdout_buf, pos); - /* Handle lines. */ - SMARTLIST_FOREACH_BEGIN(lines, const char *, line) { + SMARTLIST_FOREACH_BEGIN(proxy_output, const char *, line) { handle_proxy_line(line, mp); if (proxy_configuration_finished(mp)) goto done; @@ -639,59 +626,12 @@ configure_proxy(managed_proxy_t *mp) if (proxy_configuration_finished(mp)) handle_finished_proxy(mp); - if (lines) -smartlist_free(lines); -} - -#else /* _WIN32 */ - -/** Attempt to continue configuring managed proxy bmp/b. */ -static void -configure_proxy(managed_proxy_t *mp) -{ - enum stream_status r; - char stdout_buf[200]; - - /* if we haven't launched the proxy yet, do it now */ - if (mp-conf_state == PT_PROTO_INFANT) { -if (launch_managed_proxy(mp) 0) { /* launch fail */ - mp-conf_state = PT_PROTO_FAILED_LAUNCH; - handle_finished_proxy(mp); -} -return; - } - - tor_assert(mp-conf_state != PT_PROTO_INFANT); - tor_assert(mp-process_handle); - - while (1) { -r = get_string_from_pipe(tor_process_get_stdout_pipe(mp-process_handle), - stdout_buf, sizeof(stdout_buf) - 1); - -if (r == IO_STREAM_OKAY) { /* got a line; handle it! */ - handle_proxy_line((const char *)stdout_buf, mp); -} else if (r == IO_STREAM_EAGAIN) { /* check back later */ - return; -} else if (r == IO_STREAM_CLOSED || r == IO_STREAM_TERM) { /* snap! */ - log_warn(LD_GENERAL, Our communication channel with the managed proxy - '%s' closed. Most probably application stopped running., - mp-argv[0]); - mp-conf_state = PT_PROTO_BROKEN; -} else { /* unknown stream status */ - log_warn(LD_BUG, Unknown stream status '%d' while configuring managed - proxy '%s'., (int)r, mp-argv[0]); -} - -/* if the proxy finished configuring, exit the loop. */ -if (proxy_configuration_finished(mp)) { - handle_finished_proxy(mp); - return; -} + if (proxy_output) { +SMARTLIST_FOREACH(proxy_output, char *, cp, tor_free(cp)); +smartlist_free(proxy_output); } } -#endif /* _WIN32 */ - /** Register server managed proxy bmp/b transports to state */ static void register_server_proxy(const managed_proxy_t *mp) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Tweak code and pump the tor-fw-helper version.
commit 443260ffd8370c0fddefad42479b957132e8d275 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 19:24:31 2012 +0300 Tweak code and pump the tor-fw-helper version. Conflicts: src/or/circuitbuild.h --- src/or/circuitbuild.h |4 src/tools/tor-fw-helper/tor-fw-helper.h |4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index b3ebf09..7083db1 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -137,6 +137,10 @@ const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr, struct transport_t; int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, const struct transport_t **transport); +const char *find_transport_name_by_bridge_addrport(const tor_addr_t *addr, + uint16_t port); + +int validate_pluggable_transports_config(void); #endif diff --git a/src/tools/tor-fw-helper/tor-fw-helper.h b/src/tools/tor-fw-helper/tor-fw-helper.h index 0981501..08f94d0 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.h +++ b/src/tools/tor-fw-helper/tor-fw-helper.h @@ -17,7 +17,7 @@ #include time.h /** The current version of tor-fw-helper. */ -#define tor_fw_version 0.1 +#define tor_fw_version 0.2 /** This is an arbitrary hard limit - We currently have two (NAT-PMP and UPnP). We're likely going to add the Intel UPnP library but nothing else comes to @@ -36,7 +36,7 @@ typedef struct { int verbose; int help; int test_commandline; - smartlist_t *ports_to_forward; + struct smartlist_t *ports_to_forward; int fetch_public_ip; int nat_pmp_status; int upnp_status; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Refactor tor to support the new tor-fw-helper protocol.
commit cd05f35d2cdf50d31108428cf5c19549d468dbc0 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 19:16:18 2012 +0300 Refactor tor to support the new tor-fw-helper protocol. Add handle_fw_helper_output(), a function responsible for parsing the output of tor-fw-helper. Refactor tor_check_port_forwarding() and run_scheduled_events() accordingly too. We now issue warnings when we get control output from tor-fw-helper, and we log the verbose output of tor-fw-helper in LOG_INFO. Conflicts: src/common/util.c --- src/common/util.c | 179 src/common/util.h |3 +- src/or/main.c | 14 +++-- 3 files changed, 162 insertions(+), 34 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index 6e23c96..b1a05b5 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -4605,9 +4605,128 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count) return IO_STREAM_TERM; } -/* DOCDOC tor_check_port_forwarding */ +/** Parse a bline/b from tor-fw-helper and issue an appropriate + * log message to our user. */ +static void +handle_fw_helper_line(const char *line) +{ + smartlist_t *tokens = smartlist_new(); + char *message = NULL; + char *message_for_log = NULL; + const char *external_port = NULL; + const char *internal_port = NULL; + const char *result = NULL; + int port = 0; + int success = 0; + + smartlist_split_string(tokens, line, NULL, + SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, -1); + + if (smartlist_len(tokens) 5) +goto err; + + if (strcmp(smartlist_get(tokens, 0), tor-fw-helper) || + strcmp(smartlist_get(tokens, 1), tcp-forward)) +goto err; + + external_port = smartlist_get(tokens, 2); + internal_port = smartlist_get(tokens, 3); + result = smartlist_get(tokens, 4); + + if (smartlist_len(tokens) 5) { +/* If there are more than 5 tokens, they are part of [message]. + Let's use a second smartlist to form the whole message; + strncat loops suck. */ +int i; +int message_words_n = smartlist_len(tokens) - 5; +smartlist_t *message_sl = smartlist_new(); +for (i = 0; i message_words_n; i++) + smartlist_add(message_sl, smartlist_get(tokens, 5+i)); + +tor_assert(smartlist_len(message_sl) 0); +message = smartlist_join_strings(message_sl, , 0, NULL); + +/* wrap the message in log-friendly wrapping */ +tor_asprintf(message_for_log, ('%s'), message); + +smartlist_free(message_sl); + } + + port = atoi(external_port); + if (port 1 || port 65535) +goto err; + + port = atoi(internal_port); + if (port 1 || port 65535) +goto err; + + if (!strcmp(result, SUCCESS)) +success = 1; + else if (!strcmp(result, FAIL)) +success = 0; + else +goto err; + + if (!success) { +log_warn(LD_GENERAL, Tor was unable to forward TCP port '%s' to '%s'%s. + Please make sure that your router supports port + forwarding protocols (like NAT-PMP). Note that if '%s' is + your ORPort, your relay will be unable to receive inbound + traffic., external_port, internal_port, + message_for_log ? message_for_log : , + internal_port); + } else { +log_notice(LD_GENERAL, + Tor successfully forwarded TCP port '%s' to '%s'%s., + external_port, internal_port, + message_for_log ? message_for_log : ); + } + + goto done; + + err: + log_warn(LD_GENERAL, tor-fw-helper sent us a string we could not + parse (%s)., line); + + done: + SMARTLIST_FOREACH(tokens, char *, cp, tor_free(cp)); + smartlist_free(tokens); + tor_free(message); + tor_free(message_for_log); +} + +/** Read what tor-fw-helper has to say in its stdout and handle it + * appropriately */ +static int +handle_fw_helper_output(process_handle_t *process_handle) +{ + smartlist_t *fw_helper_output = NULL; + enum stream_status stream_status = 0; + + fw_helper_output = +tor_get_lines_from_handle(tor_process_get_stdout_pipe(process_handle), + stream_status); + if (!fw_helper_output) { /* didn't get any output from tor-fw-helper */ +/* if EAGAIN we should retry in the future */ +return (stream_status == IO_STREAM_EAGAIN) ? 0 : -1; + } + + /* Handle the lines we got: */ + SMARTLIST_FOREACH_BEGIN(fw_helper_output, char *, line) { +handle_fw_helper_line(line); +tor_free(line); + } SMARTLIST_FOREACH_END(line); + + smartlist_free(fw_helper_output); + + return 0; +} + +/** Spawn tor-fw-helper and ask it to forward the ports in + * bports_to_forward/b. */ void -tor_check_port_forwarding(const char *filename, int dir_port, int or_port, +tor_check_port_forwarding(const char *filename, + smartlist_t *ports_to_forward, time_t now) { /* When fw-helper succeeds, how long do we wait until running it
[tor-commits] [tor/master] Start passing ports to tor_check_port_forwarding().
commit da16c425ef8c17a753ae0abc3fdb26a328004062 Author: George Kadianakis desnac...@riseup.net Date: Thu Jun 7 19:20:36 2012 +0300 Start passing ports to tor_check_port_forwarding(). Conflicts: src/or/transports.c --- src/or/config.c | 35 +++ src/or/main.c |2 +- src/or/transports.c | 27 +++ src/or/transports.h |2 ++ 4 files changed, 65 insertions(+), 1 deletions(-) diff --git a/src/or/config.c b/src/or/config.c index f21016d..ad422ef 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -7254,6 +7254,41 @@ remove_file_if_very_old(const char *fname, time_t now) } } +/** Return a smartlist of ports that must be forwarded by + * tor-fw-helper. The smartlist contains the ports in a string format + * that is understandable by tor-fw-helper. */ +smartlist_t * +get_list_of_ports_to_forward(void) +{ + smartlist_t *ports_to_forward = smartlist_new(); + int port = 0; + + /** XXX TODO tor-fw-helper does not support forwarding ports to + other hosts than the local one. If the user is binding to a + different IP address, tor-fw-helper won't work. */ + port = get_primary_or_port(); /* Get ORPort */ + if (port) +smartlist_add_asprintf(ports_to_forward, %d:%d, port, port); + + port = get_primary_dir_port(); /* Get DirPort */ + if (port) +smartlist_add_asprintf(ports_to_forward, %d:%d, port, port); + + /* Get ports of transport proxies */ + smartlist_t *transport_ports = get_transport_proxy_ports(); + if (transport_ports) { +smartlist_add_all(ports_to_forward, transport_ports); +smartlist_free(transport_ports); + } + + if (!smartlist_len(ports_to_forward)) { +smartlist_free(ports_to_forward); +ports_to_forward = NULL; + } + + return ports_to_forward; +} + /** Helper to implement GETINFO functions about configuration variables (not * their values). Given a config/names question, set *banswer/b to a * new string describing the supported configuration variables and their diff --git a/src/or/main.c b/src/or/main.c index 7b750ba..75a6d65 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1547,7 +1547,7 @@ run_scheduled_events(time_t now) options-PortForwarding is_server) { #define PORT_FORWARDING_CHECK_INTERVAL 5 -smartlist_t *ports_to_forward = NULL;//get_list_of_ports_to_forward(); +smartlist_t *ports_to_forward = get_list_of_ports_to_forward(); if (ports_to_forward) { tor_check_port_forwarding(options-PortForwardingHelper, ports_to_forward, diff --git a/src/or/transports.c b/src/or/transports.c index 9edeebd..f2c604c 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1324,6 +1324,33 @@ pt_prepare_proxy_list_for_config_read(void) tor_assert(unconfigured_proxies_n == 0); } +/** Return a smartlist containing the ports where our pluggable + * transports are listening. */ +smartlist_t * +get_transport_proxy_ports(void) +{ + smartlist_t *sl = NULL; + + if (!managed_proxy_list) +return NULL; + + /** XXX assume that external proxy ports have been forwarded + manually */ + SMARTLIST_FOREACH_BEGIN(managed_proxy_list, const managed_proxy_t *, mp) { +if (!mp-is_server || mp-conf_state != PT_PROTO_COMPLETED) + continue; + +if (!sl) sl = smartlist_new(); + +tor_assert(mp-transports); +SMARTLIST_FOREACH(mp-transports, const transport_t *, t, + smartlist_add_asprintf(sl, %u:%u, t-port, t-port)); + + } SMARTLIST_FOREACH_END(mp); + + return sl; +} + /** Return the pluggable transport string that we should display in * our extra-info descriptor. If we shouldn't display such a string, * or we have nothing to display, return NULL. The string is diff --git a/src/or/transports.h b/src/or/transports.h index 3fd97f8..86a2530 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -54,6 +54,8 @@ void pt_free_all(void); void pt_prepare_proxy_list_for_config_read(void); void sweep_proxy_list(void); +smartlist_t *get_transport_proxy_ports(void); + #ifdef PT_PRIVATE /** State of the managed proxy configuration protocol. */ enum pt_proto_state { ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Fix some bugs that did not allow compilation on Windows.
commit b9551fd0741434e9d0917355d67164775eb25fbe Author: George Kadianakis desnac...@riseup.net Date: Tue Aug 21 20:56:30 2012 +0300 Fix some bugs that did not allow compilation on Windows. --- src/common/util.c | 14 +++--- src/tools/tor-fw-helper/tor-fw-helper.c | 20 +--- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index 25ddcc1..fa8fb53 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -4381,17 +4381,17 @@ tor_get_lines_from_handle(HANDLE *handle, char stdout_buf[600] = {0}; smartlist_t *lines = NULL; - tor_assert(stream_status); + tor_assert(stream_status_out); - *stream_status = IO_STREAM_TERM; + *stream_status_out = IO_STREAM_TERM; pos = tor_read_all_handle(handle, stdout_buf, sizeof(stdout_buf) - 1, NULL); if (pos 0) { -*stream_status = IO_STREAM_TERM; +*stream_status_out = IO_STREAM_TERM; return NULL; } if (pos == 0) { -*stream_status = IO_STREAM_EAGAIN; +*stream_status_out = IO_STREAM_EAGAIN; return NULL; } @@ -4408,7 +4408,7 @@ tor_get_lines_from_handle(HANDLE *handle, SMARTLIST_FOREACH(lines, char *, line, SMARTLIST_REPLACE_CURRENT(lines, line, tor_strdup(line))); - *stream_status = IO_STREAM_OKAY; + *stream_status_out = IO_STREAM_OKAY; return lines; } @@ -4461,8 +4461,8 @@ log_from_handle(HANDLE *pipe, int severity) #else /** Return a smartlist containing lines outputted from - * bhandle/b. Return NULL on error, and set bstream_status/b - * appropriately. */ + * bhandle/b. Return NULL on error, and set + * bstream_status_out/b appropriately. */ smartlist_t * tor_get_lines_from_handle(FILE *handle, enum stream_status *stream_status_out) { diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c index d02b757..4efe515 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.c +++ b/src/tools/tor-fw-helper/tor-fw-helper.c @@ -353,28 +353,18 @@ parse_port(const char *arg) /** Report a failure of epic proportions: We didn't manage to * initialize any port forwarding backends. */ static void -report_full_fail(const smartlist_t *ports_to_forward, backends_t *backends) +report_full_fail(const smartlist_t *ports_to_forward) { - char *list_of_backends_str = NULL; - char *fail_msg = NULL; - if (!ports_to_forward) return; - list_of_backends_str = get_list_of_backends_string(backends); - tor_asprintf(fail_msg, - Port forwarding backends (%s) could not be initialized., - list_of_backends_str); - SMARTLIST_FOREACH_BEGIN(ports_to_forward, const port_to_forward_t *, port_to_forward) { tor_fw_helper_report_port_fw_fail(port_to_forward-internal_port, port_to_forward-external_port, - fail_msg); + All backends (NAT-PMP, UPnP) failed + to initialize!); /* XXX hardcoded */ } SMARTLIST_FOREACH_END(port_to_forward); - - tor_free(list_of_backends_str); - tor_free(fail_msg); } int @@ -481,8 +471,8 @@ main(int argc, char **argv) r = init_backends(tor_fw_options, backend_state); if (!r) { // all backends failed: // report our failure -report_full_fail(tor_fw_options.ports_to_forward, backend_state); -fprintf(stderr, V: tor-fw-helper: All backends failed.\n); +report_full_fail(tor_fw_options.ports_to_forward); +fprintf(stderr, tor-fw-helper: All backends failed.\n); exit(1); } else { // some backends succeeded: fprintf(stderr, tor-fw-helper: %i NAT traversal helper(s) loaded\n, r); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge remote-tracking branch 'asn/bug4567_rebased'
commit e9684405acf5d3bbfa3c2d4f70332cef3c66d553 Merge: d2d7cab 4edc57c Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 10:12:28 2012 -0400 Merge remote-tracking branch 'asn/bug4567_rebased' changes/bug4567|3 + changes/bug4567_2 |4 + doc/tor-fw-helper.1.txt| 14 +- src/common/util.c | 272 -- src/common/util.h | 13 +- src/or/circuitbuild.h |4 + src/or/config.c| 37 +++ src/or/config.h|2 + src/or/main.c | 14 +- src/or/transports.c| 113 +++- src/or/transports.h|2 + src/tools/tor-fw-helper/tor-fw-helper-natpmp.c | 58 ++-- src/tools/tor-fw-helper/tor-fw-helper-natpmp.h |4 +- src/tools/tor-fw-helper/tor-fw-helper-upnp.c | 44 ++-- src/tools/tor-fw-helper/tor-fw-helper-upnp.h |3 +- src/tools/tor-fw-helper/tor-fw-helper.c| 367 +++- src/tools/tor-fw-helper/tor-fw-helper.h| 20 +- 17 files changed, 656 insertions(+), 318 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Figure out ORPort and DirPort even when 'auto' is used.
commit 4edc57caa5c4a7d4d46d30bf0150a7f70e8dcccb Author: George Kadianakis desnac...@riseup.net Date: Wed Sep 5 20:17:25 2012 +0300 Figure out ORPort and DirPort even when 'auto' is used. Use router_get_advertised_{dir,or}_port() functions instead of get_primary_{dir,or}_port(). --- src/or/config.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/config.c b/src/or/config.c index a4af22a..02afa1e 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -7266,11 +7266,11 @@ get_list_of_ports_to_forward(void) /** XXX TODO tor-fw-helper does not support forwarding ports to other hosts than the local one. If the user is binding to a different IP address, tor-fw-helper won't work. */ - port = get_primary_or_port(); /* Get ORPort */ + port = router_get_advertised_or_port(get_options()); /* Get ORPort */ if (port) smartlist_add_asprintf(ports_to_forward, %d:%d, port, port); - port = get_primary_dir_port(); /* Get DirPort */ + port = router_get_advertised_dir_port(get_options(), 0); /* Get DirPort */ if (port) smartlist_add_asprintf(ports_to_forward, %d:%d, port, port); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] General tweaks and fixes for Nick's comments.
commit 44fe717524408d247ab10e3794438232d81d66dc Author: George Kadianakis desnac...@riseup.net Date: Fri Jun 29 19:32:34 2012 +0300 General tweaks and fixes for Nick's comments. * Add changes/ files. * Edit the tor-fw-helper manpage. * Fix check-spaces. * Add prototype for get_list_of_ports_to_forward(). * Fix tor_parse_long() TCP port range. * Improve doc. of tor_check_port_forwarding(). * Check for overflows in tor_check_port_forwarding(). * Demote successful port forwarding to LOG_INFO. Conflicts: src/common/address.c src/or/circuitbuild.c --- changes/bug4567 |3 ++ changes/bug4567_2 |4 +++ doc/tor-fw-helper.1.txt | 14 +- src/common/address.c|1 - src/common/util.c | 42 ++ src/or/config.c | 10 --- src/or/config.h |2 + src/tools/tor-fw-helper/tor-fw-helper.c | 14 ++ 8 files changed, 56 insertions(+), 34 deletions(-) diff --git a/changes/bug4567 b/changes/bug4567 new file mode 100644 index 000..d57a33d --- /dev/null +++ b/changes/bug4567 @@ -0,0 +1,3 @@ + o Major features: +- Automatically forward the TCP ports of pluggable transport + proxies using tor-fw-helper if PortForwarding is enabled. diff --git a/changes/bug4567_2 b/changes/bug4567_2 new file mode 100644 index 000..5387593 --- /dev/null +++ b/changes/bug4567_2 @@ -0,0 +1,4 @@ + o Code refactoring: +- Tweak tor-fw-helper to accept an arbitrary amount of arbitrary + TCP ports to forward. In the past it only accepted two ports: + the ORPort and the DirPort. diff --git a/doc/tor-fw-helper.1.txt b/doc/tor-fw-helper.1.txt index 4caf16c..cf769d9 100644 --- a/doc/tor-fw-helper.1.txt +++ b/doc/tor-fw-helper.1.txt @@ -41,18 +41,8 @@ OPTIONS **-g** or **--fetch-public-ip**:: Fetch the the public ip address for each supported NAT helper method. -**-i** or **--internal-or-port** __port__:: -Inform **tor-fw-helper** of your internal OR port. This is the only -required argument. - -**-e** or **--external-or-port** __port__:: -Inform **tor-fw-helper** of your external OR port. - -**-d** or **--internal-dir-port** __port__:: -Inform **tor-fw-helper** of your internal Dir port. - -**-p** or **--external-dir-port** __port__:: -Inform **tor-fw-helper** of your external Dir port. +**-p** or **--forward-port** __external_port__:__internal_port__:: +Forward external_port to internal_port. BUGS diff --git a/src/common/address.c b/src/common/address.c index e5862be..ac45cba 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1697,7 +1697,6 @@ tor_addr_hostname_is_local(const char *name) !strcasecmpend(name, .local); } - /** Return a newly allocated tor_addr_port_t with baddr/b and bport/b filled in. */ tor_addr_port_t * diff --git a/src/common/util.c b/src/common/util.c index b1a05b5..25ddcc1 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -4676,10 +4676,10 @@ handle_fw_helper_line(const char *line) message_for_log ? message_for_log : , internal_port); } else { -log_notice(LD_GENERAL, - Tor successfully forwarded TCP port '%s' to '%s'%s., - external_port, internal_port, - message_for_log ? message_for_log : ); +log_info(LD_GENERAL, + Tor successfully forwarded TCP port '%s' to '%s'%s., + external_port, internal_port, + message_for_log ? message_for_log : ); } goto done; @@ -4723,7 +4723,9 @@ handle_fw_helper_output(process_handle_t *process_handle) } /** Spawn tor-fw-helper and ask it to forward the ports in - * bports_to_forward/b. */ + * bports_to_forward/b. bports_to_forward/b contains strings + * of the form external port:internal port, which is the format + * that tor-fw-helper expects. */ void tor_check_port_forwarding(const char *filename, smartlist_t *ports_to_forward, @@ -4748,17 +4750,35 @@ tor_check_port_forwarding(const char *filename, /* Start the child, if it is not already running */ if ((!child_handle || child_handle-status != PROCESS_STATUS_RUNNING) time_to_run_helper now) { -/* tor-fw-helper cli looks like this: tor_fw_helper -p : -p 4555: */ +/*tor-fw-helper cli looks like this: tor_fw_helper -p : -p 4555: */ const char **argv; /* cli arguments */ -/* Number of cli arguments: one for the filename, two for each - smartlist element (one for -p and one for the ports), and one - for the final NULL. */ -int args_n = 1 + 2*smartlist_len(ports_to_forward) + 1; +int args_n, status; int argv_index = 0; /* index inside 'argv' */ -int status; tor_assert(smartlist_len(ports_to_forward) 0); +/* check for
[tor-commits] [tor/master] Fix a dependency: sha256.c influences crypto.o, not crypto.c
commit 5d162d5a7b6b8ce9075cd6987cc6cda119b433ff Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 10:03:06 2012 -0400 Fix a dependency: sha256.c influences crypto.o, not crypto.c --- changes/bug6778 |1 + src/common/include.am |2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/changes/bug6778 b/changes/bug6778 index 3585140..4448d15 100644 --- a/changes/bug6778 +++ b/changes/bug6778 @@ -1,3 +1,4 @@ o Minor bugfixes: - Avoid a warning when building common_sha1.i out of tree. Fixes bug 6778; bugfix on 0.2.4.1-alpha. +- Fix a mis-declared dependency on src/common/crypto.c. diff --git a/src/common/include.am b/src/common/include.am index c6fde42..299c92e 100644 --- a/src/common/include.am +++ b/src/common/include.am @@ -72,4 +72,4 @@ src/common/common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(COMMONHEA fi src/common/util_codedigest.o: src/common/common_sha1.i -src/common/crypto.c: src/common/sha256.c +src/common/crypto.o: src/common/sha256.c ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Fix a dependency: micro-revision.i influences tor_main.o, not tor_main.c
commit 30fe9080e70aa2ebdf1c2bf86e98fe46b1ad27e1 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 11:00:32 2012 -0400 Fix a dependency: micro-revision.i influences tor_main.o, not tor_main.c --- changes/bug6778 |4 +++- src/or/include.am |2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changes/bug6778 b/changes/bug6778 index 4448d15..9149f70 100644 --- a/changes/bug6778 +++ b/changes/bug6778 @@ -1,4 +1,6 @@ o Minor bugfixes: - Avoid a warning when building common_sha1.i out of tree. Fixes bug 6778; bugfix on 0.2.4.1-alpha. -- Fix a mis-declared dependency on src/common/crypto.c. +- Fix mis-declared dependencies on src/common/crypto.c and + src/or/tor_main.c that could break out-of-tree builds under some + circumstances. Fixes bug 6778; bugfix on 0.2.4.1-alpha. diff --git a/src/or/include.am b/src/or/include.am index 34cd307..97072dc 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -64,7 +64,7 @@ src_or_libtor_a_SOURCES = \ src_or_tor_SOURCES = src/or/tor_main.c AM_CPPFLAGS += -I$(srcdir)/src/or -Isrc/or -src/or/tor_main.c: micro-revision.i +src/or/tor_main.o: micro-revision.i AM_CPPFLAGS += -DSHARE_DATADIR=\$(datadir)\ \ -DLOCALSTATEDIR=\$(localstatedir)\ \ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Fix a build-warning when building out-of-tree
commit 91fed2c7037acf3f154ab0a4a536bc1579c1ccfa Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 09:56:48 2012 -0400 Fix a build-warning when building out-of-tree We were trying to incorporate all headers in common_sha1.i, not just the src/common ones. This is part of bug 6778; fix on 0.2.4.1-alpha --- changes/bug6778 |3 +++ src/common/include.am | 10 ++ src/or/include.am | 13 +++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/changes/bug6778 b/changes/bug6778 new file mode 100644 index 000..3585140 --- /dev/null +++ b/changes/bug6778 @@ -0,0 +1,3 @@ + o Minor bugfixes: +- Avoid a warning when building common_sha1.i out of tree. Fixes bug + 6778; bugfix on 0.2.4.1-alpha. diff --git a/src/common/include.am b/src/common/include.am index 0ab4769..c6fde42 100644 --- a/src/common/include.am +++ b/src/common/include.am @@ -36,7 +36,7 @@ src_common_libor_crypto_a_SOURCES = \ src_common_libor_event_a_SOURCES = src/common/compat_libevent.c -noinst_HEADERS+= \ +COMMONHEADERS = \ src/common/address.h \ src/common/aes.h \ src/common/ciphers.inc \ @@ -57,13 +57,15 @@ noinst_HEADERS+=\ src/common/tortls.h \ src/common/util.h +noinst_HEADERS+= $(COMMONHEADERS) + DISTCLEANFILES+= src/common/common_sha1.i -src/common/common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS) +src/common/common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(COMMONHEADERS) $(AM_V_GEN)if test @SHA1SUM@ != none; then \ - (cd $(srcdir) @SHA1SUM@ $(src_common_libor_SOURCES) $(src_common_libor_crypto_a_SOURCES) $(noinst_HEADERS)) | @SED@ -n 's/^\(.*\)$$/\1\\n/p' $@; \ + (cd $(srcdir) @SHA1SUM@ $(src_common_libor_SOURCES) $(src_common_libor_crypto_a_SOURCES) $(COMMONHEADERS)) | @SED@ -n 's/^\(.*\)$$/\1\\n/p' $@; \ elif test @OPENSSL@ != none; then \ - (cd $(srcdir) @OPENSSL@ sha1 $(src_common_libor_SOURCES) $(src_Common_libor_crypto_a_SOURCES) $(noinst_HEADERS)) | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/\2 \1\\n/p' $@; \ + (cd $(srcdir) @OPENSSL@ sha1 $(src_common_libor_SOURCES) $(src_Common_libor_crypto_a_SOURCES) $(COMMONHEADERS)) | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/\2 \1\\n/p' $@; \ else \ rm $@; \ touch $@; \ diff --git a/src/or/include.am b/src/or/include.am index 65ff684..34cd307 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -81,7 +81,7 @@ src_or_tor_LDADD = src/or/libtor.a src/common/libor.a src/common/libor-crypto.a @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \ @TOR_LIB_WS32@ @TOR_LIB_GDI@ -noinst_HEADERS+= \ +ORHEADERS = \ src/or/buffers.h\ src/or/circuitbuild.h \ src/or/circuitlist.h\ @@ -122,8 +122,9 @@ noinst_HEADERS+= \ src/or/router.h \ src/or/routerlist.h \ src/or/routerparse.h\ - src/or/status.h \ - micro-revision.i + src/or/status.h + +noinst_HEADERS+= $(ORHEADERS) micro-revision.i src/or/config_codedigest.o: src/or/or_sha1.i @@ -143,12 +144,12 @@ micro-revision.i: FORCE mv micro-revision.tmp micro-revision.i; \ fi; true -src/or/or_sha1.i: $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES) +src/or/or_sha1.i: $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES) $(ORHEADERS) $(AM_V_GEN)if test @SHA1SUM@ != none; then \ - (cd $(srcdir) @SHA1SUM@ $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES)) | \ + (cd $(srcdir) @SHA1SUM@ $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES) $(ORHEADERS) ) | \ @SED@ -n 's/^\(.*\)$$/\1\\n/p' src/or/or_sha1.i; \ elif test @OPENSSL@ != none; then \ - (cd $(srcdir) @OPENSSL@ sha1 $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES)) | \ + (cd $(srcdir) @OPENSSL@ sha1 $(src_or_tor_SOURCES) $(src_or_libtor_a_SOURCES) $(ORHEADERS)) | \ @SED@ -n 's/SHA1(\(.*\))= \(.*\)/\2 \1\\n/p' src/or/or_sha1.i; \ else \ rm src/or/or_sha1.i; \ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'bug6778'
commit ad1e8b45df3933e6f01098a5f9ba6238adafc9c2 Merge: e968440 30fe908 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 11:05:16 2012 -0400 Merge branch 'bug6778' changes/bug6778 |6 ++ src/common/include.am | 12 +++- src/or/include.am | 15 --- 3 files changed, 21 insertions(+), 12 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'quiet_lib_versions_squashed'
commit 1ca9e2685f6cea803ff1a36c7dbe05625e9c4b61 Merge: ad1e8b4 7607ad2 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 11:32:09 2012 -0400 Merge branch 'quiet_lib_versions_squashed' changes/detect_openssl_mismatch |4 changes/quiet_lib_init |3 +++ src/common/aes.c|8 src/common/compat_libevent.c|2 +- src/common/crypto.c | 38 ++ src/common/crypto.h |1 + src/common/tortls.c |6 +++--- src/or/main.c | 10 +++--- 8 files changed, 61 insertions(+), 11 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Rename config_alloc() -- _new().
commit 3327a0a61cfaca07c3c20533d23a2599735e094f Author: Linus Nordberg li...@torproject.org Date: Mon Sep 3 14:45:24 2012 +0200 Rename config_alloc() -- _new(). --- src/or/config.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/or/config.c b/src/or/config.c index c6a4fe4..2403db6 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -718,7 +718,7 @@ get_dirportfrontpage(void) /** Allocate an empty configuration object of a given format type. */ static void * -config_alloc(const config_format_t *fmt) +config_new(const config_format_t *fmt) { void *opts = tor_malloc_zero(fmt-size); *(uint32_t*)STRUCT_VAR_P(opts, fmt-magic_offset) = fmt-magic; @@ -3118,7 +3118,7 @@ options_dup(const config_format_t *fmt, const or_options_t *old) int i; config_line_t *line; - newopts = config_alloc(fmt); + newopts = config_new(fmt); for (i=0; fmt-vars[i].name; ++i) { if (fmt-vars[i].type == CONFIG_TYPE_LINELIST_S) continue; @@ -3143,7 +3143,7 @@ options_dup(const config_format_t *fmt, const or_options_t *old) or_options_t * options_new(void) { - return config_alloc(options_format); + return config_new(options_format); } /** Set boptions/b to hold reasonable defaults for most options. @@ -3189,7 +3189,7 @@ config_dump(const config_format_t *fmt, const void *default_options, char *msg = NULL; if (defaults == NULL) { -defaults = defaults_tmp = config_alloc(fmt); +defaults = defaults_tmp = config_new(fmt); config_init(fmt, defaults_tmp); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Rename packed_cell_alloc() -- _new().
commit 09c84b50e71a7c65f1b891e396bb9ad811588dad Author: Linus Nordberg li...@torproject.org Date: Mon Sep 3 14:49:31 2012 +0200 Rename packed_cell_alloc() -- _new(). --- src/or/relay.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/relay.c b/src/or/relay.c index 9012966..169286e 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -1835,7 +1835,7 @@ packed_cell_free_unchecked(packed_cell_t *cell) /** Allocate and return a new packed_cell_t. */ static INLINE packed_cell_t * -packed_cell_alloc(void) +packed_cell_new(void) { ++total_cells_allocated; return mp_pool_get(cell_pool); @@ -1864,7 +1864,7 @@ dump_cell_pool_usage(int severity) static INLINE packed_cell_t * packed_cell_copy(const cell_t *cell) { - packed_cell_t *c = packed_cell_alloc(); + packed_cell_t *c = packed_cell_new(); cell_pack(c, cell); c-next = NULL; return c; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Rename extend_info_alloc() -- _new()
commit f4cf279eb58f5d0a61f603bd961b58e51cd82bc3 Author: Nick Mathewson ni...@torproject.org Date: Thu Sep 6 11:38:32 2012 -0400 Rename extend_info_alloc() -- _new() Based on a patch from Linus, regenerated so as to not conflict with Linus's 5535/6363 patches. --- src/or/circuitbuild.c | 10 +- src/or/circuitbuild.h |2 +- src/or/circuituse.c |2 +- src/or/router.c |2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 87a3fa6..8aa80cd 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2470,7 +2470,7 @@ circuit_extend(cell_t *cell, circuit_t *circ) log_debug(LD_CIRC|LD_OR,Next router (%s:%d): %s, fmt_addr(n_addr), (int)n_port, msg?msg:); -circ-n_hop = extend_info_alloc(NULL /*nickname*/, +circ-n_hop = extend_info_new(NULL /*nickname*/, id_digest, NULL /*onion_key*/, n_addr, n_port); @@ -3846,7 +3846,7 @@ onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice) /** Allocate a new extend_info object based on the various arguments. */ extend_info_t * -extend_info_alloc(const char *nickname, const char *digest, +extend_info_new(const char *nickname, const char *digest, crypto_pk_t *onion_key, const tor_addr_t *addr, uint16_t port) { @@ -3887,13 +3887,13 @@ extend_info_from_node(const node_t *node, int for_direct_connect) node-ri ? node-ri-nickname : node-rs-nickname); if (node-ri) -return extend_info_alloc(node-ri-nickname, +return extend_info_new(node-ri-nickname, node-identity, node-ri-onion_pkey, ap.addr, ap.port); else if (node-rs node-md) -return extend_info_alloc(node-rs-nickname, +return extend_info_new(node-rs-nickname, node-identity, node-md-onion_pkey, ap.addr, @@ -5382,7 +5382,7 @@ routerset_contains_bridge(const routerset_t *routerset, if (!routerset) return 0; - extinfo = extend_info_alloc( + extinfo = extend_info_new( NULL, bridge-identity, NULL, bridge-addr, bridge-port); result = routerset_contains_extendinfo(routerset, extinfo); extend_info_free(extinfo); diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 7083db1..bc775c3 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -41,7 +41,7 @@ int circuit_all_predicted_ports_handled(time_t now, int *need_uptime, int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info); int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info); void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop); -extend_info_t *extend_info_alloc(const char *nickname, const char *digest, +extend_info_t *extend_info_new(const char *nickname, const char *digest, crypto_pk_t *onion_key, const tor_addr_t *addr, uint16_t port); extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect); diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 20f124e..11d5811 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1570,7 +1570,7 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, escaped_safe_str_client(conn-socks_request-address)); return -1; } -extend_info = extend_info_alloc(conn-chosen_exit_name+1, +extend_info = extend_info_new(conn-chosen_exit_name+1, digest, NULL, addr, conn-socks_request-port); } else { diff --git a/src/or/router.c b/src/or/router.c index 9a3ef9d..bb8a6e3 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -891,7 +891,7 @@ extend_info_from_router(const routerinfo_t *r) tor_assert(r); router_get_prim_orport(r, ap); - return extend_info_alloc(r-nickname, r-cache_info.identity_digest, + return extend_info_new(r-nickname, r-cache_info.identity_digest, r-onion_pkey, ap.addr, ap.port); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/vidalia_help] Update translations for vidalia_help
commit c5541be8c3b65f5a19c91ca437760aa31b7413e0 Author: Translation commit bot translat...@torproject.org Date: Thu Sep 6 20:15:20 2012 + Update translations for vidalia_help --- sk/running.po | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sk/running.po b/sk/running.po index ff983b2..3e51b06 100644 --- a/sk/running.po +++ b/sk/running.po @@ -1,23 +1,24 @@ # # Translators: +# koloman...@gmail.com, 2012. msgid msgstr Project-Id-Version: The Tor Project\n Report-Msgid-Bugs-To: https://trac.torproject.org/projects/tor\n; POT-Creation-Date: 2010-06-26 17:00+0200\n -PO-Revision-Date: 2010-11-30 05:03+\n -Last-Translator: FULL NAME EMAIL@ADDRESS\n +PO-Revision-Date: 2012-09-06 19:46+\n +Last-Translator: K0L0M4N koloman...@gmail.com\n Language-Team: LANGUAGE l...@li.org\n MIME-Version: 1.0\n Content-Type: text/plain; charset=UTF-8\n Content-Transfer-Encoding: 8bit\n Language: sk\n -Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n=2 n=4) ? 1 : 2\n +Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n=2 n=4) ? 1 : 2;\n #. type: Content of: htmlbodyh1 #: en/running.html:16 msgid Running Tor -msgstr +msgstr SpustiÃ…Â¥ Tor #. type: Content of: htmlbodyp #: en/running.html:20 @@ -30,7 +31,7 @@ msgstr #. type: Content of: htmlbody #: en/running.html:25 msgid a name=\starting\/ -msgstr +msgstr a name=\starting\/ #. type: Content of: htmlbodyh3 #: en/running.html:26 @@ -50,7 +51,7 @@ msgstr #. type: Content of: htmlbodypol #: en/running.html:30 en/running.html:45 msgid . -msgstr +msgstr . #. type: Content of: htmlbodypolli #: en/running.html:32 @@ -147,5 +148,3 @@ msgid You can also check the a href=\log.html\message log/a for details about any problems Tor encountered before it exited. msgstr - - ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] r25783: {website} update me0w and overall mirror status. (in website/trunk: . include)
Author: phobos Date: 2012-09-06 20:26:50 + (Thu, 06 Sep 2012) New Revision: 25783 Modified: website/trunk/include/mirrors-table.wmi website/trunk/update-mirrors.pl Log: update me0w and overall mirror status. Modified: website/trunk/include/mirrors-table.wmi === --- website/trunk/include/mirrors-table.wmi 2012-09-05 23:29:55 UTC (rev 25782) +++ website/trunk/include/mirrors-table.wmi 2012-09-06 20:26:50 UTC (rev 25783) @@ -35,23 +35,6 @@ tr - tdNL/td - - tdAmorphis/td - - tdUp to date/td - -td - /td -tda href=http://tor.amorphis.eu/dist/;http/a/td -tda href=http://tor.amorphis.eu/;http/a/td -td - /td -td - /td -td - /td -td - /td -/tr - -tr - tdUS/td tdQuintex/td @@ -324,9 +307,9 @@ tr - tdMY/td + tdRO/td - td/td + tdme0w.cc/td tdUp to date/td @@ -732,15 +715,15 @@ tr - tdSE/td + tdUS/td - tdhomosu/td + td/td tdUp to date/td td - /td -tda href=http://tor.homosu.net/dist/;http/a/td -tda href=http://tor.homosu.net/;http/a/td +tda href=http://torproject.umbrellacorporation.org.uk/dist/;http/a/td +tda href=http://torproject.umbrellacorporation.org.uk/;http/a/td td - /td td - /td td - /td @@ -749,15 +732,15 @@ tr - tdUS/td + tdINT/td - td/td + tdCoralCDN/td tdUp to date/td td - /td -tda href=http://torproject.umbrellacorporation.org.uk/dist/;http/a/td -tda href=http://torproject.umbrellacorporation.org.uk/;http/a/td +tda href=http://www.torproject.org.nyud.net/dist/;http/a/td +tda href=http://www.torproject.org.nyud.net/;http/a/td td - /td td - /td td - /td @@ -766,15 +749,15 @@ tr - tdINT/td + tdNL/td - tdCoralCDN/td + tdAmorphis/td tdUp to date/td td - /td -tda href=http://www.torproject.org.nyud.net/dist/;http/a/td -tda href=http://www.torproject.org.nyud.net/;http/a/td +tda href=http://tor.amorphis.eu/dist/;http/a/td +tda href=http://tor.amorphis.eu/;http/a/td td - /td td - /td td - /td @@ -783,6 +766,23 @@ tr + tdSE/td + + tdhomosu/td + + tdUp to date/td + +td - /td +tda href=http://tor.homosu.net/dist/;http/a/td +tda href=http://tor.homosu.net/;http/a/td +td - /td +td - /td +td - /td +td - /td +/tr + +tr + tdDE/td td[[:bbs:]]/td Modified: website/trunk/update-mirrors.pl === --- website/trunk/update-mirrors.pl 2012-09-05 23:29:55 UTC (rev 25782) +++ website/trunk/update-mirrors.pl 2012-09-06 20:26:50 UTC (rev 25783) @@ -1073,10 +1073,10 @@ }, mirror075 = { adminContact = , -orgName = , -isoCC = MY, +orgName = me0w.cc, +isoCC = RO, subRegion = , -region = MY, +region = RO, ipv4 = True, ipv6 = False, loadBalanced = No, ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [flashproxy/master] Add SSLCertificateChainFile to facilitator-howto.txt.
commit 074d8349e46128240de8cc09f420f7a145f6475f Author: David Fifield da...@bamsoftware.com Date: Thu Sep 6 16:17:36 2012 -0700 Add SSLCertificateChainFile to facilitator-howto.txt. --- doc/facilitator-howto.txt |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/doc/facilitator-howto.txt b/doc/facilitator-howto.txt index c46902b..560eeaf 100644 --- a/doc/facilitator-howto.txt +++ b/doc/facilitator-howto.txt @@ -117,7 +117,11 @@ these contents: LogLevel warn SSLEngine on SSLCertificateFile /etc/apache2/tor-facilitator.pem + SSLCertificateChainFile /etc/apache2/intermediate.pem /VirtualHost +intermediate.pem is a possible intermediate certificate file provided by +the CA; if you did not get one, then leave off the +SSLCertificateChainFile line. We purposely do not include a CustomLog directive so as to not to log client and proxy IP addresses. ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [torbrowser/maint-2.3] Remove the image cache patch from this branch.
commit e73d1f387758569e1b2d2031955ea53453c587c5 Author: Mike Perry mikeperry-...@fscked.org Date: Wed Aug 29 13:25:47 2012 -0700 Remove the image cache patch from this branch. --- ...solate-the-Image-Cache-per-url-bar-domain.patch | 910 1 files changed, 0 insertions(+), 910 deletions(-) diff --git a/src/current-patches/firefox/alpha/0020-Isolate-the-Image-Cache-per-url-bar-domain.patch b/src/current-patches/firefox/alpha/0020-Isolate-the-Image-Cache-per-url-bar-domain.patch deleted file mode 100644 index 4399ee7..000 --- a/src/current-patches/firefox/alpha/0020-Isolate-the-Image-Cache-per-url-bar-domain.patch +++ /dev/null @@ -1,910 +0,0 @@ -From 56be32e279b20c1dbb9af6524c3e06a8b3771e94 Mon Sep 17 00:00:00 2001 -From: Mike Perry mikeperry-...@torproject.org -Date: Tue, 28 Aug 2012 18:35:33 -0700 -Subject: [PATCH 20/20] Isolate the Image Cache per url bar domain. - -Also adds a new API to mozIThirdPartyUtil to allow you to get the url bar URI -for a channel or nsIDocument. - content/base/src/ThirdPartyUtil.cpp| 52 + - content/base/src/ThirdPartyUtil.h |2 + - content/base/src/nsContentUtils.cpp| 13 +- - embedding/browser/webBrowser/nsContextMenuInfo.cpp | 29 ++- - extensions/cookie/nsCookiePermission.cpp |3 + - image/public/imgILoader.idl|4 +- - image/src/imgLoader.cpp| 200 - image/src/imgLoader.h | 13 +- - image/src/imgRequest.cpp |9 +- - image/src/imgRequest.h |3 + - layout/generic/nsImageFrame.cpp| 11 +- - netwerk/base/public/mozIThirdPartyUtil.idl | 21 ++ - netwerk/cookie/nsICookiePermission.idl |1 + - toolkit/system/gnome/nsAlertsIconListener.cpp |3 +- - widget/cocoa/nsMenuItemIconX.mm|9 +- - 15 files changed, 272 insertions(+), 101 deletions(-) - -diff --git a/content/base/src/ThirdPartyUtil.cpp b/content/base/src/ThirdPartyUtil.cpp -index 97a000e..87ffc8a 100644 a/content/base/src/ThirdPartyUtil.cpp -+++ b/content/base/src/ThirdPartyUtil.cpp -@@ -7,6 +7,9 @@ - #include nsIServiceManager.h - #include nsIHttpChannelInternal.h - #include nsIDOMWindow.h -+#include nsICookiePermission.h -+#include nsIDOMDocument.h -+#include nsIDocument.h - #include nsILoadContext.h - #include nsIPrincipal.h - #include nsIScriptObjectPrincipal.h -@@ -21,6 +24,7 @@ ThirdPartyUtil::Init() - - nsresult rv; - mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, rv); -+ mCookiePermissions = do_GetService(NS_COOKIEPERMISSION_CONTRACTID); - return rv; - } - -@@ -282,3 +286,51 @@ ThirdPartyUtil::GetBaseDomain(nsIURI* aHostURI, - - return NS_OK; - } -+ -+NS_IMETHODIMP -+ThirdPartyUtil::GetFirstPartyURI(nsIChannel *aChannel, -+ nsIDocument *aDoc, -+ nsIURI **aOutput) -+{ -+ nsresult rv = NS_ERROR_NULL_POINTER; -+ -+ if (!aChannel aDoc) { -+aChannel = aDoc-GetChannel(); -+ } -+ -+ // If aChannel is specified or available, use the official route -+ // for sure -+ if (aChannel) { -+rv = mCookiePermissions-GetOriginatingURI(aChannel, aOutput); -+ } -+ -+ // If the channel was missing, closed or broken, try the -+ // window hierarchy directly. -+ // -+ // This might fail to work for first-party loads themselves, but -+ // we don't need this codepath for that case. -+ if (NS_FAILED(rv) aDoc) { -+nsCOMPtrnsIDOMWindow top; -+nsCOMPtrnsIDOMDocument topDDoc; -+ -+aDoc-GetWindow()-GetTop(getter_AddRefs(top)); -+top-GetDocument(getter_AddRefs(topDDoc)); -+ -+nsCOMPtrnsIDocument topDoc(do_QueryInterface(topDDoc)); -+*aOutput = topDoc-GetOriginalURI(); -+ -+if (*aOutput) -+ rv = NS_OK; -+ } -+ -+ // TODO: We could provide a route through the loadgroup + notification -+ // callbacks too, but either channel or document was always available -+ // in the cases where this function was originally needed (the image cache). -+ // The notification callbacks also appear to suffers from the same limitation -+ // as the document path. See nsICookiePermissions.GetOriginatingURI() for -+ // details. -+ -+ return rv; -+} -+ -+ -diff --git a/content/base/src/ThirdPartyUtil.h b/content/base/src/ThirdPartyUtil.h -index 269069b..37c30e8 100644 a/content/base/src/ThirdPartyUtil.h -+++ b/content/base/src/ThirdPartyUtil.h -@@ -9,6 +9,7 @@ - #include nsString.h - #include mozIThirdPartyUtil.h - #include nsIEffectiveTLDService.h -+#include nsICookiePermission.h - - class nsIURI; - class nsIChannel; -@@ -28,6 +29,7 @@ private: - static already_AddRefednsIURI GetURIFromWindow(nsIDOMWindow* aWin); - - nsCOMPtrnsIEffectiveTLDService mTLDService; -+ nsCOMPtrnsICookiePermission mCookiePermissions; - }; - - #endif -diff --git
[tor-commits] [torbrowser/maint-2.3] Merge remote-tracking branch 'mikeperry/firefox15-noisolate' into maint-2.3
commit 1542586f2326c48a0fa4a819e4bf4d631163b223 Merge: 196ebd2 e73d1f3 Author: Mike Perry mikeperry-...@fscked.org Date: Thu Sep 6 18:44:53 2012 -0700 Merge remote-tracking branch 'mikeperry/firefox15-noisolate' into maint-2.3 ...nents.interfaces-lookupMethod-from-conten.patch | 10 +- ...0002-Make-Permissions-Manager-memory-only.patch | 16 +- ...-Make-Intermediate-Cert-Store-memory-only.patch |8 +- .../alpha/0004-Add-a-string-based-cacheKey.patch | 26 +- .../0005-Block-all-plugins-except-flash.patch | 14 +- ...ontent-pref-service-memory-only-clearable.patch | 10 +- .../0007-Disable-SSL-Session-ID-tracking.patch |4 +- ...ice-and-system-specific-CSS-Media-Queries.patch | 116 +++ ...observer-event-to-close-persistent-connec.patch | 40 --- ...ice-and-system-specific-CSS-Media-Queries.patch | 116 --- .../0009-Make-Download-manager-memory-only.patch | 57 .../0010-Add-DDG-and-StartPage-to-Omnibox.patch| 84 + .../alpha/0010-Rebrand-Firefox-to-TorBrowser.patch | 50 --- .../0011-Make-Download-manager-memory-only.patch | 57 ...-nsICacheService.EvictEntries-synchronous.patch | 44 +++ .../0012-Add-DDG-and-StartPage-to-Omnibox.patch| 84 - ...owser-exit-when-not-launched-from-Vidalia.patch | 45 +++ ...13-Limit-the-number-of-fonts-per-document.patch | 225 + ...-nsICacheService.EvictEntries-synchronous.patch | 44 --- .../alpha/0014-Prevent-WebSocket-DNS-leak.patch| 132 ...observer-event-to-close-persistent-connec.patch | 40 +++ ...owser-exit-when-not-launched-from-Vidalia.patch | 45 --- .../alpha/0015-Rebrand-Firefox-to-TorBrowser.patch | 59 ...16-Limit-the-number-of-fonts-per-document.patch | 225 - .../alpha/0016-Prevent-WebSocket-DNS-leak.patch| 133 ...ize-HTTP-request-order-and-pipeline-depth.patch | 26 +- ...Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch | 139 ...9-Add-a-redirect-API-for-HTTPS-Everywhere.patch | 345 +++ .../alpha/0019-Fix-Firefox-build-process.patch | 267 --- ...0-Add-a-redirect-API-for-HTTPS-Everywhere.patch | 346 30 files changed, 1273 insertions(+), 1534 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [torbrowser/maint-2.3] Forgot to git add some files in the patches
commit 5ccf2e7f6b0f1924059a9fc69dc1dc41583ed13e Author: Mike Perry mikeperry-...@fscked.org Date: Wed Aug 29 13:20:11 2012 -0700 Forgot to git add some files in the patches --- ...Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch | 138 ++-- ...9-Add-a-redirect-API-for-HTTPS-Everywhere.patch |2 +- ...solate-the-Image-Cache-per-url-bar-domain.patch |2 +- 3 files changed, 126 insertions(+), 16 deletions(-) diff --git a/src/current-patches/firefox/alpha/0018-Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch b/src/current-patches/firefox/alpha/0018-Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch index e09a3bf..4bdffcc 100644 --- a/src/current-patches/firefox/alpha/0018-Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch +++ b/src/current-patches/firefox/alpha/0018-Adapt-Steven-Michaud-s-Mac-crashfix-patch.patch @@ -1,4 +1,4 @@ -From c60d40f3ead79d91128f28682dc94fc626c45110 Mon Sep 17 00:00:00 2001 +From 40ffe7af2a41166a91f95fe145d3cb97527e4165 Mon Sep 17 00:00:00 2001 From: Mike Perry mikeperry-...@torproject.org Date: Tue, 28 Aug 2012 18:22:32 -0700 Subject: [PATCH 18/20] Adapt Steven Michaud's Mac crashfix patch @@ -8,19 +8,23 @@ Source is: https://bugzilla.mozilla.org/show_bug.cgi?id=715885#c35 Some minor tweaks were needed to get it to apply and to compile on MacOS. --- - widget/Makefile.in |1 + - widget/cocoa/nsChildView.mm| 28 ++-- - widget/gtk2/nsDragService.cpp |9 + - widget/nsIDragService.idl |4 +--- - widget/qt/nsDragService.h |2 ++ - widget/windows/Makefile.in |4 - widget/windows/nsDragService.cpp | 13 - - widget/windows/nsDragService.h | 12 ++-- - widget/windows/nsNativeDragSource.cpp |7 --- - widget/windows/nsNativeDragTarget.cpp | 28 +--- - widget/xpwidgets/nsBaseDragService.cpp | 16 +++- - widget/xpwidgets/nsBaseDragService.h |9 - - 12 files changed, 85 insertions(+), 48 deletions(-) + widget/Makefile.in|1 + + widget/cocoa/nsChildView.mm | 28 +++-- + widget/gtk2/nsDragService.cpp |9 +++-- + widget/nsIDragService.idl |4 +-- + widget/nsPIDragService.idl| 48 + + widget/qt/nsDragService.h |2 + + widget/windows/Makefile.in|4 ++ + widget/windows/nsDragService.cpp | 13 +--- + widget/windows/nsDragService.h| 12 +++--- + widget/windows/nsNativeDragSource.cpp |7 ++-- + widget/windows/nsNativeDragTarget.cpp | 28 ++-- + widget/windows/nsPIDragServiceWindows.idl | 46 +++ + widget/xpwidgets/nsBaseDragService.cpp| 16 +- + widget/xpwidgets/nsBaseDragService.h |9 ++--- + 14 files changed, 179 insertions(+), 48 deletions(-) + create mode 100644 widget/nsPIDragService.idl + create mode 100644 widget/windows/nsPIDragServiceWindows.idl diff --git a/widget/Makefile.in b/widget/Makefile.in index f1df966..eb6eec2 100644 @@ -148,6 +152,60 @@ index 196761e..c0565bb 100644 }; +diff --git a/widget/nsPIDragService.idl b/widget/nsPIDragService.idl +new file mode 100644 +index 000..93a144d +--- /dev/null b/widget/nsPIDragService.idl +@@ -0,0 +1,48 @@ ++/* * BEGIN LICENSE BLOCK * ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the License); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an AS IS basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is mozilla.org code. ++ * ++ * The Initial Developer of the Original Code is ++ * The Mozilla Foundation. ++ * Portions created by the Initial Developer are Copyright (C) 2012 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Steven Michaud smich...@pobox.com ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the GPL), or ++ * the GNU Lesser General Public License Version 2.1 or later (the LGPL), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ *