1. 15 Nov, 2012 5 commits
  2. 08 Nov, 2012 1 commit
    • Nick Mathewson's avatar
      Add and use and unlikely-to-be-eliminated memwipe() · 49dd5ef3
      Nick Mathewson authored
      Apparently some compilers like to eliminate memset() operations on
      data that's about to go out-of-scope.  I've gone with the safest
      possible replacement, which might be a bit slow.  I don't think this
      is critical path in any way that will affect performance, but if it
      is, we can work on that in 0.2.4.
      
      Fixes bug 7352.
      49dd5ef3
  3. 17 Oct, 2012 2 commits
    • Nick Mathewson's avatar
      Restore the 'address' value of tunneled connections · 26946c65
      Nick Mathewson authored
      When we merged the channel code, we made the 'address' field of linked
      directory connections created with begindir (and their associated edge
      connections) contain an address:port string, when they should only
      have contained the address part.
      
      This patch also tweaks the interface to the get_descr method of
      channels so that it takes a set of flags rather than a single flag.
      26946c65
    • Nick Mathewson's avatar
      Fix for bug 7112 (spewing complaints from tor_addr_is_internal) · 898bd1ae
      Nick Mathewson authored
      In 4768c0ef (not in any released
      version of Tor), we removed a little block of code that set the addr
      field of an exit connection used in making a tunneled directory
      request.  Turns out that wasn't right.
      898bd1ae
  4. 12 Oct, 2012 1 commit
    • Nick Mathewson's avatar
      Rename all reserved C identifiers we defined · 56c0baa5
      Nick Mathewson authored
      For everything we declare that starts with _, make it end with _ instead.
      
      This is a machine-generated patch.  To make it, start by getting the
      list of reserved identifiers using:
      
           git ls-tree -r --name-only HEAD | grep  '\.[ch]$' | \
             xargs ctags --c-kinds=defglmpstuvx -o - | grep '^_' | \
             cut -f 1 | sort| uniq
      
      You might need gnu ctags.
      
      Then pipe the output through this script:
      ==============================
      
      use strict;
      
      BEGIN { print "#!/usr/bin/perl -w -i -p\n\n"; }
      
      chomp;
      
      next if (
           /^__attribute__/ or
           /^__func__/ or
           /^_FILE_OFFSET_BITS/ or
           /^_FORTIFY_SOURCE/ or
           /^_GNU_SOURCE/ or
           /^_WIN32/ or
           /^_DARWIN_UNLIMITED/ or
           /^_FILE_OFFSET_BITS/ or
           /^_LARGEFILE64_SOURCE/ or
           /^_LFS64_LARGEFILE/ or
           /^__cdecl/ or
           /^__attribute__/ or
           /^__func__/ or
          /^_WIN32_WINNT/);
      
      my $ident = $_;
      
      my $better = $ident;
      $better =~ s/^_//;
      
      $better = "${better}_";
      
      print "s/(?<![A-Za-z0-9_])$ident(?![A-Za-z0-9_])/$better/g;\n";
      ==============================
      
      Then run the resulting script on all the files you want to change.
      (That is, all the C except that in src/ext.)  The resulting script was:
      
      ==============================
      
      s/(?<![A-Za-z0-9_])_address(?![A-Za-z0-9_])/address_/g;
      s/(?<![A-Za-z0-9_])_aes_fill_buf(?![A-Za-z0-9_])/aes_fill_buf_/g;
      s/(?<![A-Za-z0-9_])_AllowInvalid(?![A-Za-z0-9_])/AllowInvalid_/g;
      s/(?<![A-Za-z0-9_])_AP_CONN_STATE_MAX(?![A-Za-z0-9_])/AP_CONN_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_AP_CONN_STATE_MIN(?![A-Za-z0-9_])/AP_CONN_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_assert_cache_ok(?![A-Za-z0-9_])/assert_cache_ok_/g;
      s/(?<![A-Za-z0-9_])_A_UNKNOWN(?![A-Za-z0-9_])/A_UNKNOWN_/g;
      s/(?<![A-Za-z0-9_])_base(?![A-Za-z0-9_])/base_/g;
      s/(?<![A-Za-z0-9_])_BridgePassword_AuthDigest(?![A-Za-z0-9_])/BridgePassword_AuthDigest_/g;
      s/(?<![A-Za-z0-9_])_buffer_stats_compare_entries(?![A-Za-z0-9_])/buffer_stats_compare_entries_/g;
      s/(?<![A-Za-z0-9_])_chan_circid_entries_eq(?![A-Za-z0-9_])/chan_circid_entries_eq_/g;
      s/(?<![A-Za-z0-9_])_chan_circid_entry_hash(?![A-Za-z0-9_])/chan_circid_entry_hash_/g;
      s/(?<![A-Za-z0-9_])_check_no_tls_errors(?![A-Za-z0-9_])/check_no_tls_errors_/g;
      s/(?<![A-Za-z0-9_])_c_hist_compare(?![A-Za-z0-9_])/c_hist_compare_/g;
      s/(?<![A-Za-z0-9_])_circ(?![A-Za-z0-9_])/circ_/g;
      s/(?<![A-Za-z0-9_])_circuit_get_global_list(?![A-Za-z0-9_])/circuit_get_global_list_/g;
      s/(?<![A-Za-z0-9_])_circuit_mark_for_close(?![A-Za-z0-9_])/circuit_mark_for_close_/g;
      s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_C_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_C_MAX_/g;
      s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_MAX_/g;
      s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_MIN(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_MIN_/g;
      s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_OR_MAX(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_OR_MAX_/g;
      s/(?<![A-Za-z0-9_])_CIRCUIT_PURPOSE_OR_MIN(?![A-Za-z0-9_])/CIRCUIT_PURPOSE_OR_MIN_/g;
      s/(?<![A-Za-z0-9_])_cmp_int_strings(?![A-Za-z0-9_])/cmp_int_strings_/g;
      s/(?<![A-Za-z0-9_])_compare_cached_resolves_by_expiry(?![A-Za-z0-9_])/compare_cached_resolves_by_expiry_/g;
      s/(?<![A-Za-z0-9_])_compare_digests(?![A-Za-z0-9_])/compare_digests_/g;
      s/(?<![A-Za-z0-9_])_compare_digests256(?![A-Za-z0-9_])/compare_digests256_/g;
      s/(?<![A-Za-z0-9_])_compare_dir_src_ents_by_authority_id(?![A-Za-z0-9_])/compare_dir_src_ents_by_authority_id_/g;
      s/(?<![A-Za-z0-9_])_compare_duration_idx(?![A-Za-z0-9_])/compare_duration_idx_/g;
      s/(?<![A-Za-z0-9_])_compare_int(?![A-Za-z0-9_])/compare_int_/g;
      s/(?<![A-Za-z0-9_])_compare_networkstatus_v2_published_on(?![A-Za-z0-9_])/compare_networkstatus_v2_published_on_/g;
      s/(?<![A-Za-z0-9_])_compare_old_routers_by_identity(?![A-Za-z0-9_])/compare_old_routers_by_identity_/g;
      s/(?<![A-Za-z0-9_])_compare_orports(?![A-Za-z0-9_])/compare_orports_/g;
      s/(?<![A-Za-z0-9_])_compare_pairs(?![A-Za-z0-9_])/compare_pairs_/g;
      s/(?<![A-Za-z0-9_])_compare_routerinfo_by_id_digest(?![A-Za-z0-9_])/compare_routerinfo_by_id_digest_/g;
      s/(?<![A-Za-z0-9_])_compare_routerinfo_by_ip_and_bw(?![A-Za-z0-9_])/compare_routerinfo_by_ip_and_bw_/g;
      s/(?<![A-Za-z0-9_])_compare_signed_descriptors_by_age(?![A-Za-z0-9_])/compare_signed_descriptors_by_age_/g;
      s/(?<![A-Za-z0-9_])_compare_string_ptrs(?![A-Za-z0-9_])/compare_string_ptrs_/g;
      s/(?<![A-Za-z0-9_])_compare_strings_for_pqueue(?![A-Za-z0-9_])/compare_strings_for_pqueue_/g;
      s/(?<![A-Za-z0-9_])_compare_strs(?![A-Za-z0-9_])/compare_strs_/g;
      s/(?<![A-Za-z0-9_])_compare_tor_version_str_ptr(?![A-Za-z0-9_])/compare_tor_version_str_ptr_/g;
      s/(?<![A-Za-z0-9_])_compare_vote_rs(?![A-Za-z0-9_])/compare_vote_rs_/g;
      s/(?<![A-Za-z0-9_])_compare_votes_by_authority_id(?![A-Za-z0-9_])/compare_votes_by_authority_id_/g;
      s/(?<![A-Za-z0-9_])_compare_without_first_ch(?![A-Za-z0-9_])/compare_without_first_ch_/g;
      s/(?<![A-Za-z0-9_])_connection_free(?![A-Za-z0-9_])/connection_free_/g;
      s/(?<![A-Za-z0-9_])_connection_mark_and_flush(?![A-Za-z0-9_])/connection_mark_and_flush_/g;
      s/(?<![A-Za-z0-9_])_connection_mark_for_close(?![A-Za-z0-9_])/connection_mark_for_close_/g;
      s/(?<![A-Za-z0-9_])_connection_mark_unattached_ap(?![A-Za-z0-9_])/connection_mark_unattached_ap_/g;
      s/(?<![A-Za-z0-9_])_connection_write_to_buf_impl(?![A-Za-z0-9_])/connection_write_to_buf_impl_/g;
      s/(?<![A-Za-z0-9_])_ConnLimit(?![A-Za-z0-9_])/ConnLimit_/g;
      s/(?<![A-Za-z0-9_])_CONN_TYPE_MAX(?![A-Za-z0-9_])/CONN_TYPE_MAX_/g;
      s/(?<![A-Za-z0-9_])_CONN_TYPE_MIN(?![A-Za-z0-9_])/CONN_TYPE_MIN_/g;
      s/(?<![A-Za-z0-9_])_CONTROL_CONN_STATE_MAX(?![A-Za-z0-9_])/CONTROL_CONN_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_CONTROL_CONN_STATE_MIN(?![A-Za-z0-9_])/CONTROL_CONN_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_CPUWORKER_STATE_MAX(?![A-Za-z0-9_])/CPUWORKER_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_CPUWORKER_STATE_MIN(?![A-Za-z0-9_])/CPUWORKER_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_crypto_dh_get_dh(?![A-Za-z0-9_])/crypto_dh_get_dh_/g;
      s/(?<![A-Za-z0-9_])_crypto_global_initialized(?![A-Za-z0-9_])/crypto_global_initialized_/g;
      s/(?<![A-Za-z0-9_])_crypto_new_pk_from_rsa(?![A-Za-z0-9_])/crypto_new_pk_from_rsa_/g;
      s/(?<![A-Za-z0-9_])_crypto_pk_get_evp_pkey(?![A-Za-z0-9_])/crypto_pk_get_evp_pkey_/g;
      s/(?<![A-Za-z0-9_])_crypto_pk_get_rsa(?![A-Za-z0-9_])/crypto_pk_get_rsa_/g;
      s/(?<![A-Za-z0-9_])_DIR_CONN_STATE_MAX(?![A-Za-z0-9_])/DIR_CONN_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_DIR_CONN_STATE_MIN(?![A-Za-z0-9_])/DIR_CONN_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_DIR_PURPOSE_MAX(?![A-Za-z0-9_])/DIR_PURPOSE_MAX_/g;
      s/(?<![A-Za-z0-9_])_DIR_PURPOSE_MIN(?![A-Za-z0-9_])/DIR_PURPOSE_MIN_/g;
      s/(?<![A-Za-z0-9_])_dirreq_map_get(?![A-Za-z0-9_])/dirreq_map_get_/g;
      s/(?<![A-Za-z0-9_])_dirreq_map_put(?![A-Za-z0-9_])/dirreq_map_put_/g;
      s/(?<![A-Za-z0-9_])_dns_randfn(?![A-Za-z0-9_])/dns_randfn_/g;
      s/(?<![A-Za-z0-9_])_dummy(?![A-Za-z0-9_])/dummy_/g;
      s/(?<![A-Za-z0-9_])_edge(?![A-Za-z0-9_])/edge_/g;
      s/(?<![A-Za-z0-9_])_END_CIRC_REASON_MAX(?![A-Za-z0-9_])/END_CIRC_REASON_MAX_/g;
      s/(?<![A-Za-z0-9_])_END_CIRC_REASON_MIN(?![A-Za-z0-9_])/END_CIRC_REASON_MIN_/g;
      s/(?<![A-Za-z0-9_])_EOF(?![A-Za-z0-9_])/EOF_/g;
      s/(?<![A-Za-z0-9_])_ERR(?![A-Za-z0-9_])/ERR_/g;
      s/(?<![A-Za-z0-9_])_escaped_val(?![A-Za-z0-9_])/escaped_val_/g;
      s/(?<![A-Za-z0-9_])_evdns_log(?![A-Za-z0-9_])/evdns_log_/g;
      s/(?<![A-Za-z0-9_])_evdns_nameserver_add_impl(?![A-Za-z0-9_])/evdns_nameserver_add_impl_/g;
      s/(?<![A-Za-z0-9_])_EVENT_MAX(?![A-Za-z0-9_])/EVENT_MAX_/g;
      s/(?<![A-Za-z0-9_])_EVENT_MIN(?![A-Za-z0-9_])/EVENT_MIN_/g;
      s/(?<![A-Za-z0-9_])_ExcludeExitNodesUnion(?![A-Za-z0-9_])/ExcludeExitNodesUnion_/g;
      s/(?<![A-Za-z0-9_])_EXIT_CONN_STATE_MAX(?![A-Za-z0-9_])/EXIT_CONN_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_EXIT_CONN_STATE_MIN(?![A-Za-z0-9_])/EXIT_CONN_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_EXIT_PURPOSE_MAX(?![A-Za-z0-9_])/EXIT_PURPOSE_MAX_/g;
      s/(?<![A-Za-z0-9_])_EXIT_PURPOSE_MIN(?![A-Za-z0-9_])/EXIT_PURPOSE_MIN_/g;
      s/(?<![A-Za-z0-9_])_extrainfo_free(?![A-Za-z0-9_])/extrainfo_free_/g;
      s/(?<![A-Za-z0-9_])_find_by_keyword(?![A-Za-z0-9_])/find_by_keyword_/g;
      s/(?<![A-Za-z0-9_])_free_cached_dir(?![A-Za-z0-9_])/free_cached_dir_/g;
      s/(?<![A-Za-z0-9_])_free_cached_resolve(?![A-Za-z0-9_])/free_cached_resolve_/g;
      s/(?<![A-Za-z0-9_])_free_duplicate_routerstatus_entry(?![A-Za-z0-9_])/free_duplicate_routerstatus_entry_/g;
      s/(?<![A-Za-z0-9_])_free_link_history(?![A-Za-z0-9_])/free_link_history_/g;
      s/(?<![A-Za-z0-9_])_geoip_compare_entries(?![A-Za-z0-9_])/geoip_compare_entries_/g;
      s/(?<![A-Za-z0-9_])_geoip_compare_key_to_entry(?![A-Za-z0-9_])/geoip_compare_key_to_entry_/g;
      s/(?<![A-Za-z0-9_])_hex_decode_digit(?![A-Za-z0-9_])/hex_decode_digit_/g;
      s/(?<![A-Za-z0-9_])_idxplus1(?![A-Za-z0-9_])/idxplus1_/g;
      s/(?<![A-Za-z0-9_])__libc_enable_secure(?![A-Za-z0-9_])/_libc_enable_secure_/g;
      s/(?<![A-Za-z0-9_])_log_debug(?![A-Za-z0-9_])/log_debug_/g;
      s/(?<![A-Za-z0-9_])_log_err(?![A-Za-z0-9_])/log_err_/g;
      s/(?<![A-Za-z0-9_])_log_fn(?![A-Za-z0-9_])/log_fn_/g;
      s/(?<![A-Za-z0-9_])_log_fn_function_name(?![A-Za-z0-9_])/log_fn_function_name_/g;
      s/(?<![A-Za-z0-9_])_log_global_min_severity(?![A-Za-z0-9_])/log_global_min_severity_/g;
      s/(?<![A-Za-z0-9_])_log_info(?![A-Za-z0-9_])/log_info_/g;
      s/(?<![A-Za-z0-9_])_log_notice(?![A-Za-z0-9_])/log_notice_/g;
      s/(?<![A-Za-z0-9_])_log_prefix(?![A-Za-z0-9_])/log_prefix_/g;
      s/(?<![A-Za-z0-9_])_log_warn(?![A-Za-z0-9_])/log_warn_/g;
      s/(?<![A-Za-z0-9_])_magic(?![A-Za-z0-9_])/magic_/g;
      s/(?<![A-Za-z0-9_])_MALLOC_LOCK(?![A-Za-z0-9_])/MALLOC_LOCK_/g;
      s/(?<![A-Za-z0-9_])_MALLOC_LOCK_INIT(?![A-Za-z0-9_])/MALLOC_LOCK_INIT_/g;
      s/(?<![A-Za-z0-9_])_MALLOC_UNLOCK(?![A-Za-z0-9_])/MALLOC_UNLOCK_/g;
      s/(?<![A-Za-z0-9_])_microdesc_eq(?![A-Za-z0-9_])/microdesc_eq_/g;
      s/(?<![A-Za-z0-9_])_microdesc_hash(?![A-Za-z0-9_])/microdesc_hash_/g;
      s/(?<![A-Za-z0-9_])_MIN_TOR_TLS_ERROR_VAL(?![A-Za-z0-9_])/MIN_TOR_TLS_ERROR_VAL_/g;
      s/(?<![A-Za-z0-9_])_mm_free(?![A-Za-z0-9_])/mm_free_/g;
      s/(?<![A-Za-z0-9_])_NIL(?![A-Za-z0-9_])/NIL_/g;
      s/(?<![A-Za-z0-9_])_n_openssl_mutexes(?![A-Za-z0-9_])/n_openssl_mutexes_/g;
      s/(?<![A-Za-z0-9_])_openssl_dynlock_create_cb(?![A-Za-z0-9_])/openssl_dynlock_create_cb_/g;
      s/(?<![A-Za-z0-9_])_openssl_dynlock_destroy_cb(?![A-Za-z0-9_])/openssl_dynlock_destroy_cb_/g;
      s/(?<![A-Za-z0-9_])_openssl_dynlock_lock_cb(?![A-Za-z0-9_])/openssl_dynlock_lock_cb_/g;
      s/(?<![A-Za-z0-9_])_openssl_locking_cb(?![A-Za-z0-9_])/openssl_locking_cb_/g;
      s/(?<![A-Za-z0-9_])_openssl_mutexes(?![A-Za-z0-9_])/openssl_mutexes_/g;
      s/(?<![A-Za-z0-9_])_option_abbrevs(?![A-Za-z0-9_])/option_abbrevs_/g;
      s/(?<![A-Za-z0-9_])_option_vars(?![A-Za-z0-9_])/option_vars_/g;
      s/(?<![A-Za-z0-9_])_OR_CONN_STATE_MAX(?![A-Za-z0-9_])/OR_CONN_STATE_MAX_/g;
      s/(?<![A-Za-z0-9_])_OR_CONN_STATE_MIN(?![A-Za-z0-9_])/OR_CONN_STATE_MIN_/g;
      s/(?<![A-Za-z0-9_])_OutboundBindAddressIPv4(?![A-Za-z0-9_])/OutboundBindAddressIPv4_/g;
      s/(?<![A-Za-z0-9_])_OutboundBindAddressIPv6(?![A-Za-z0-9_])/OutboundBindAddressIPv6_/g;
      s/(?<![A-Za-z0-9_])_PDS_PREFER_TUNNELED_DIR_CONNS(?![A-Za-z0-9_])/PDS_PREFER_TUNNELED_DIR_CONNS_/g;
      s/(?<![A-Za-z0-9_])_port(?![A-Za-z0-9_])/port_/g;
      s/(?<![A-Za-z0-9_])__progname(?![A-Za-z0-9_])/_progname_/g;
      s/(?<![A-Za-z0-9_])_PublishServerDescriptor(?![A-Za-z0-9_])/PublishServerDescriptor_/g;
      s/(?<![A-Za-z0-9_])_remove_old_client_helper(?![A-Za-z0-9_])/remove_old_client_helper_/g;
      s/(?<![A-Za-z0-9_])_rend_cache_entry_free(?![A-Za-z0-9_])/rend_cache_entry_free_/g;
      s/(?<![A-Za-z0-9_])_routerlist_find_elt(?![A-Za-z0-9_])/routerlist_find_elt_/g;
      s/(?<![A-Za-z0-9_])_SafeLogging(?![A-Za-z0-9_])/SafeLogging_/g;
      s/(?<![A-Za-z0-9_])_SHORT_FILE_(?![A-Za-z0-9_])/SHORT_FILE__/g;
      s/(?<![A-Za-z0-9_])_state_abbrevs(?![A-Za-z0-9_])/state_abbrevs_/g;
      s/(?<![A-Za-z0-9_])_state_vars(?![A-Za-z0-9_])/state_vars_/g;
      s/(?<![A-Za-z0-9_])_t(?![A-Za-z0-9_])/t_/g;
      s/(?<![A-Za-z0-9_])_t32(?![A-Za-z0-9_])/t32_/g;
      s/(?<![A-Za-z0-9_])_test_op_ip6(?![A-Za-z0-9_])/test_op_ip6_/g;
      s/(?<![A-Za-z0-9_])_thread1_name(?![A-Za-z0-9_])/thread1_name_/g;
      s/(?<![A-Za-z0-9_])_thread2_name(?![A-Za-z0-9_])/thread2_name_/g;
      s/(?<![A-Za-z0-9_])_thread_test_func(?![A-Za-z0-9_])/thread_test_func_/g;
      s/(?<![A-Za-z0-9_])_thread_test_mutex(?![A-Za-z0-9_])/thread_test_mutex_/g;
      s/(?<![A-Za-z0-9_])_thread_test_start1(?![A-Za-z0-9_])/thread_test_start1_/g;
      s/(?<![A-Za-z0-9_])_thread_test_start2(?![A-Za-z0-9_])/thread_test_start2_/g;
      s/(?<![A-Za-z0-9_])_thread_test_strmap(?![A-Za-z0-9_])/thread_test_strmap_/g;
      s/(?<![A-Za-z0-9_])_tor_calloc(?![A-Za-z0-9_])/tor_calloc_/g;
      s/(?<![A-Za-z0-9_])_TOR_CHANNEL_INTERNAL(?![A-Za-z0-9_])/TOR_CHANNEL_INTERNAL_/g;
      s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_C(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_C_/g;
      s/(?<![A-Za-z0-9_])_tor_free(?![A-Za-z0-9_])/tor_free_/g;
      s/(?<![A-Za-z0-9_])_tor_malloc(?![A-Za-z0-9_])/tor_malloc_/g;
      s/(?<![A-Za-z0-9_])_tor_malloc_zero(?![A-Za-z0-9_])/tor_malloc_zero_/g;
      s/(?<![A-Za-z0-9_])_tor_memdup(?![A-Za-z0-9_])/tor_memdup_/g;
      s/(?<![A-Za-z0-9_])_tor_realloc(?![A-Za-z0-9_])/tor_realloc_/g;
      s/(?<![A-Za-z0-9_])_tor_strdup(?![A-Za-z0-9_])/tor_strdup_/g;
      s/(?<![A-Za-z0-9_])_tor_strndup(?![A-Za-z0-9_])/tor_strndup_/g;
      s/(?<![A-Za-z0-9_])_TOR_TLS_SYSCALL(?![A-Za-z0-9_])/TOR_TLS_SYSCALL_/g;
      s/(?<![A-Za-z0-9_])_TOR_TLS_ZERORETURN(?![A-Za-z0-9_])/TOR_TLS_ZERORETURN_/g;
      s/(?<![A-Za-z0-9_])__USE_ISOC99(?![A-Za-z0-9_])/_USE_ISOC99_/g;
      s/(?<![A-Za-z0-9_])_UsingTestNetworkDefaults(?![A-Za-z0-9_])/UsingTestNetworkDefaults_/g;
      s/(?<![A-Za-z0-9_])_val(?![A-Za-z0-9_])/val_/g;
      s/(?<![A-Za-z0-9_])_void_for_alignment(?![A-Za-z0-9_])/void_for_alignment_/g;
      
      ==============================
      56c0baa5
  5. 11 Oct, 2012 1 commit
  6. 10 Oct, 2012 1 commit
  7. 08 Oct, 2012 2 commits
  8. 14 Sep, 2012 1 commit
  9. 17 Jul, 2012 1 commit
    • Nick Mathewson's avatar
      Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/END · 7faf115d
      Nick Mathewson authored
      The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when
      you have a nice short loop body, but using it for long bodies makes
      your preprocessor tell the compiler that all the code is on the same
      line.  That causes grief, since compiler warnings and debugger lines
      will all refer to that one line.
      
      So, here's a new style rule: SMARTLIST_FOREACH blocks need to be
      short.
      7faf115d
  10. 28 Jun, 2012 1 commit
  11. 19 Jun, 2012 1 commit
    • Nick Mathewson's avatar
      Fix a regression bug in AllowDotExit · c239c57d
      Nick Mathewson authored
      The code that detected the source of a remapped address checked that
      an address mapping's source was a given rewrite rule if addr_orig had
      no .exit, and addr did have a .exit after processing that rule.  But
      addr_orig was formatted for logging: it was not the original address
      at all, but rather was the address escaped for logging and possibly
      replaced with "[scrubbed]".
      
      This new logic will correctly set ADDRMAPSRC_NONE in the case when the
      address starts life as a .exit address, so that AllowDotExit can work
      again.
      
      Fixes bug 6211; bugfix on 0.2.3.17-beta
      c239c57d
  12. 15 Jun, 2012 1 commit
  13. 12 Jun, 2012 1 commit
  14. 05 Jun, 2012 2 commits
  15. 04 Jun, 2012 3 commits
  16. 16 May, 2012 1 commit
    • Fabian Keil's avatar
      In connection_ap_handshake_process_socks(), mark the socks request as finished... · 2888644a
      Fabian Keil authored and Nick Mathewson's avatar Nick Mathewson committed
      In connection_ap_handshake_process_socks(), mark the socks request as finished if a reply is send after a parse error
      
      Silences the log message:
      [warn] {BUG} _connection_mark_unattached_ap(): Bug: stream (marked at connection_edge.c:2224) sending two socks replies?
      after the client triggered the "Tor is not an HTTP Proxy" response.
      
      No additional socks reply was sent, though.
      2888644a
  17. 11 May, 2012 1 commit
    • Nick Mathewson's avatar
      An attempt at bug3940 and making AllowDotExit 0 work with MapAddress · 35d08e30
      Nick Mathewson authored
      This time, I follow grarpamp's suggestion and move the check for
      .exit+AllowDotExit 0 to the top of connection_ap_rewrite_and_attach,
      before any rewriting occurs.  This way, .exit addresses are
      forbidden as they arrive from a socks connection or a DNSPort
      request, and not otherwise.
      
      It _is_ a little more complicated than that, though.  We need to
      treat any .exit addresses whose source is TrackHostExits as meaning
      that we can retry without that exit.  We also need to treat any
      .exit address that comes from an AutomapHostsOnResolve operation as
      user-provided (and thus forbidden if AllowDotExits==0), so that
      transitioning from AllowDotExits==1 to AllowDotExits==0 will
      actually turn off automapped .exit addresses.
      35d08e30
  18. 01 May, 2012 1 commit
  19. 24 Apr, 2012 1 commit
  20. 28 Mar, 2012 2 commits
  21. 16 Jan, 2012 2 commits
  22. 11 Jan, 2012 1 commit
  23. 30 Nov, 2011 7 commits
    • Robert Ransom's avatar
      Add ifdefs to disable assertion in connection_ap_handshake_send_begin · 328c9582
      Robert Ransom authored and Nick Mathewson's avatar Nick Mathewson committed
      328c9582
    • Robert Ransom's avatar
      Don't allow tor2web-mode Tors to connect to non-HS addresses · ebf524b4
      Robert Ransom authored and Nick Mathewson's avatar Nick Mathewson committed
      The client's anonymity when accessing a non-HS address in tor2web-mode
      would be easily nuked by inserting an inline image with a .onion URL, so
      don't even pretend to access non-HS addresses through Tor.
      ebf524b4
    • Nick Mathewson's avatar
      Tweak addressmap_rewrite a little more · e8d598c4
      Nick Mathewson authored
      This resolves a loop warning on "MapAddress *.example.com
      example.com", makes the rewrite log messages correct, and fixes the
      behavior of "MapAddress *.a *.b" when just given "a" as an input.
      e8d598c4
    • Nick Mathewson's avatar
      Fix an issue in my mapaddress domains code spotted by arma · 66859e2d
      Nick Mathewson authored
      MapAddress *.torproject.org torproject.org would have been interpreted
      as a map from a domain to itself, and would have cleared the mapping.
      Now we require not only a match of domains, but of wildcards.
      66859e2d
    • Nick Mathewson's avatar
      Refactor addressmap_match_superdomains and representation of wildcards · 69d16900
      Nick Mathewson authored
      In this new representation for wildcarded addresses, there are no
      longer any 'magic addresses': rather, "a.b c.d", "*.a.b c.d" and
      "*.a.b *.c.d" are all represented by a mapping from "a.b" to "c.d". we
      now distinguish them by setting bits in the addressmap_entry_t
      structure, where src_wildcard is set if the source address had a
      wildcard, and dst_wildcard is set if the target address had a
      wildcard.
      
      This lets the case where "*.a.b *.c.d" or "*.a.b c.d" remap the
      address "a.b" get handled trivially, and lets us simplify and improve
      the addressmap_match_superdomains implementation: we can now have it
      run in O(parts of address) rather than O(entries in addressmap).
      69d16900
    • Robert Hogan's avatar
      Address nickm's comments at https://trac.torproject.org/projects/tor/ticket/933#comment:8 · 53ce6bb5
      Robert Hogan authored and Nick Mathewson's avatar Nick Mathewson committed
          1. Only allow '*.' in MapAddress expressions. Ignore '*ample.com' and '.example.com'.
             This has resulted in a slight refactoring of config_register_addressmaps.
          2. Add some more detail to the man page entry for AddressMap.
          3. Fix initialization of a pointer to NULL rather than 0.
          4. Update the unit tests to cater for the changes in 1 and test more explicitly for
             recursive mapping.
      53ce6bb5
    • Robert Hogan's avatar
      Address nickm's comments at https://trac.torproject.org/projects/tor/ticket/933#comment:4 · 909e9769
      Robert Hogan authored and Nick Mathewson's avatar Nick Mathewson committed
      1. Implement the following mapping rules:
      
         MapAddress a.b.c d.e.f # This is what we have now
         MapAddress .a.b.c d.e.f # Replaces any address ending with .a.b.c with d.e.f
         MapAddress .a.b.c .d.e.f # Replaces the .a.b.c at the end of any addr with .d.e.f
      
         (Note that 'a.b.c .d.e.f' is invalid, and will be rejected.)
      
      2. Add tests for the new rules.
      
      3. Allow proper wildcard annotation, i.e. '*.d.e' '.d.e' will still work.
      
      4. Update addressmap_entry_t with an is_wildcard member.
      909e9769