Nick Mathewson
d3aabf4db1
Fix various small leaks on error cases
...
Spotted by coverity, bug 7816, bugfix on various versions.
2012-12-28 22:49:32 -05:00
Nick Mathewson
99669c69b3
Note limitation of parse_rfc_1123_time
...
RFC1123 suggests that we should handle two-year times, and a full
range of time zones, and other stuff too. We don't.
2012-11-23 10:06:16 -05:00
Nick Mathewson
864e15cd1c
In comments and logs, say "UTC" not "GMT"
...
Fix for #6113 .
Note that the RFC1123 times we generate still all say 'GMT'. I'm
going to suggest this is not worth changing.
2012-11-23 10:05:16 -05:00
Nick Mathewson
08436b27ff
Merge remote-tracking branch 'origin/maint-0.2.3'
2012-11-08 20:00:54 -05:00
Nick Mathewson
e567b4482a
Turn a memwipe in tor_process_handle_destroy() back to memset
...
It broke linking on tor-resolve.c, and it's not actually sanitizing
anything sensitive. Fix for bug 7420; bug not on ony released Tor.
2012-11-08 19:59:54 -05:00
Nick Mathewson
81deddb08c
Merge remote-tracking branch 'origin/maint-0.2.3'
...
Conflicts:
src/common/crypto.c
src/or/rendservice.c
2012-11-08 16:48:04 -05:00
Nick Mathewson
49dd5ef3a3
Add and use and unlikely-to-be-eliminated memwipe()
...
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.
2012-11-08 16:44:50 -05:00
George Kadianakis
a9f786758d
Add warning message when a managed proxy dies during configuration.
2012-11-06 17:53:09 -05:00
Nick Mathewson
56c0baa523
Rename all reserved C identifiers we defined
...
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;
==============================
2012-10-12 12:22:13 -04:00
Nick Mathewson
c3f526ed64
Merge branch '6044_nm_squashed'
2012-09-17 10:03:11 -04:00
meejah
d64bf286a1
Handle FIFOs in read_file_to_str
...
add read_file_to_str_until_eof which is used by read_file_to_str
if the file happens to be a FIFO.
change file_status() to return FN_FILE if st_mode matches S_IFIFO
(on not-windows) so that init_key_from_file() will read from a FIFO.
2012-09-17 10:02:24 -04:00
Nick Mathewson
523b0ec288
Merge remote-tracking branch 'origin/maint-0.2.3'
2012-09-14 12:40:23 -04:00
Nick Mathewson
b1447a4312
Use file-size-fixup code on cygwin too.
...
We already had code on windows to fix our file sizes when we're
reading a file in text mode and its size doesn't match the size from
fstat. But that code was only enabled when _WIN32 was defined, and
Cygwin defines __CYGWIN__ instead.
Fixes bug 6844; bugfix on 0.1.2.7-alpha.
2012-09-14 12:39:18 -04:00
Nick Mathewson
e4ce8cd969
Fix compilation with older gccs
...
They don't like to have #preprocessor directives inside macro arguments.
Fixes #6842 ; fix on 0.2.4.2-alpha.
Found by grarpamp.
2012-09-14 10:06:00 -04:00
Nick Mathewson
37953497d8
Don't compute ((uint64_t)1)<<64 in round_to_power_of_2
...
This would be undefined behavior if it happened. (It can't actually
happen as we're using round_to_power_of_2, since we would have to
be trying to allocate exabytes of data.)
While we're at it, fix the behavior of round_to_power_of_2(0),
and document the function better.
Fix for bug 6831.
2012-09-14 09:51:24 -04:00
Roger Dingledine
5977da6c60
hot: we fixed incancations to be intancations.
2012-09-12 02:51:33 -04:00
Nick Mathewson
75c9ccd4f8
Merge remote-tracking branch 'public/bug6538'
...
Conflicts:
configure.ac
2012-09-11 17:51:36 -04:00
Nick Mathewson
f8a665c87d
Merge remote-tracking branch 'origin/maint-0.2.3'
2012-09-11 13:21:20 -04:00
Nick Mathewson
5833861f62
Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3
...
Conflicts:
src/test/test_util.c
2012-09-11 13:20:15 -04:00
Nick Mathewson
973c18bf0e
Fix assertion failure in tor_timegm.
...
Fixes bug 6811.
2012-09-11 13:13:07 -04:00
Nick Mathewson
e9684405ac
Merge remote-tracking branch 'asn/bug4567_rebased'
2012-09-06 10:12:28 -04:00
George Kadianakis
93c38b679f
Log more information when we fail to terminate a process.
2012-09-06 17:03:11 +03:00
George Kadianakis
b9551fd074
Fix some bugs that did not allow compilation on Windows.
2012-09-05 18:23:29 +03:00
George Kadianakis
44fe717524
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
2012-09-05 18:23:28 +03:00
George Kadianakis
cd05f35d2c
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
2012-09-05 18:04:34 +03:00
George Kadianakis
03e89f0b72
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.
2012-09-05 18:02:27 +03:00
Nick Mathewson
ef628649c8
Spelling fix in util.c comments
2012-08-27 16:44:54 -04:00
Nick Mathewson
f45cde05f9
Remove tor_malloc_roundup().
...
This function never actually did us any good, and it added a little
complexity. See the changes file for more info.
2012-08-13 13:27:32 -04:00
Nick Mathewson
e106812a77
Change smartlist_choose_node_by_bandwidth to avoid double
...
This should make our preferred solution to #6538 easier to
implement, avoid a bunch of potential nastiness with excessive
int-vs-double math, and generally make the code there a little less
scary.
"But wait!" you say. "Is it really safe to do this? Won't the
results come out differently?"
Yes, but not much. We now round every weighted bandwidth to the
nearest byte before computing on it. This will make every node that
had a fractional part of its weighted bandwidth before either
slighty more likely or slightly less likely. Further, the rand_bw
value was only ever set with integer precision, so it can't
accurately sample routers with tiny fractional bandwidth values
anyway. Finally, doing repeated double-vs-uint64 comparisons is
just plain sad; it will involve an implicit cast to double, which is
never a fun thing.
2012-08-09 12:21:37 -04:00
Nick Mathewson
da3edc4df0
Fix clang warning on d4285f03df
. Not in any released tor.
2012-06-29 00:22:57 -04:00
Nick Mathewson
19a81ef020
Merge commit '81cd3d7ad641a8dbf'
2012-06-28 15:52:57 -04:00
Roger Dingledine
81cd3d7ad6
add a blurb for 0.2.3.18-rc, other minor cleanups
2012-06-28 15:32:36 -04:00
Nick Mathewson
d4285f03df
Extend tor_sscanf so it can replace sscanf in rephist.c
...
Fixes bug 4195 and Coverity CID 448
2012-06-28 09:54:05 -04:00
Nick Mathewson
05dd0a9cd9
Merge remote-tracking branch 'origin/maint-0.2.3'
2012-06-26 11:03:32 -04:00
Nick Mathewson
5fad3dc36b
Fix a warning when using glibc's strcspn with clang.
...
With glibc 2.15 and clang 3.0, I get warnings from where we use the
strcpsn implementation in the header as strcspn(string, "="). This
is apparently because clang sees that part of the strcspn macro
expands to "="[2], and doesn't realize that that part of the macro
is only evaluated when "="[1] != 0.
2012-06-26 11:02:44 -04:00
Nick Mathewson
201b852c27
Fix a compilation warning with clang 3.0
...
In b1ad1a1d02
we introduced an implicit (but safe)
long-to-int shortening that clang didn't like.
Warning not in any released version of Tor.
2012-06-26 10:48:31 -04:00
Nick Mathewson
888d5d08fe
Merge remote-tracking branch 'public/bug2385'
2012-06-25 12:05:36 -04:00
Nick Mathewson
ffd7189b3f
Don't assert in get_string_from_pipe() on len==0
...
We can treat this case as an EAGAIN (probably because of an
unexpected internal NUL) rather than a crash-worthy problem.
Fixes bug 6225, again. Bug not in any released version of Tor.
2012-06-23 15:35:43 -04:00
Nick Mathewson
b1ad1a1d02
Resolve crash caused by format_helper_exit_status changes in #5557
...
Because the string output was no longer equal in length to
HEX_ERRNO_SIZE, the write() call would add some extra spaces and
maybe a NUL, and the NUL would trigger an assert in
get_string_from_pipe.
Fixes bug 6225; bug not in any released version of Tor.
2012-06-23 15:32:04 -04:00
Nick Mathewson
4a7e4129af
Style tweaks and add a warning about NUL-termination
2012-06-22 22:21:20 -04:00
Andrea Shepard
c21af69f29
Refactor unsigned int hex formatting out of format_helper_exit_status() in util.c
2012-06-22 22:21:20 -04:00
Andrea Shepard
4c62cc6f99
Make format_helper_exit_status() avoid unnecessary spaces
2012-06-22 22:21:19 -04:00
Nick Mathewson
4a8eaad7ef
Clear a couple more fields in rend_service_load_auth_keys
2012-06-18 13:13:53 -04:00
Nick Mathewson
bf9252587b
Fix mingw build with -DUNICODE -D_UNICODE
...
This is a very blunt fix, and mostly just turns some func() calls
into FuncA() to make things build again. Fixes bug 6097.
2012-06-07 11:59:32 -04:00
Nick Mathewson
1e5683b167
Be more careful calling wcstombs
...
The function is not guaranteed to NUL-terminate its output. It
*is*, however, guaranteed not to generate more than two bytes per
multibyte character (plus terminating nul), so the general approach
I'm taking is to try to allocate enough space, AND to manually add a
NUL at the end of each buffer just in case I screwed up the "enough
space" thing.
Fixes bug 5909.
2012-06-07 11:09:38 -04:00
Nick Mathewson
b482c870ca
Fix some mingw build warnings
...
These include:
- Having a weird in_addr that can't be initialized with {0}
- Needing INVALID_HANDLE_VALUE instead of -1 for file handles.
- Having a weird dependent definition for struct stat.
- pid is signed, not unsigned.
2012-06-05 11:06:26 -04:00
Nick Mathewson
7f45ea5c41
Merge remote-tracking branch 'public/bug3894'
2012-06-05 10:31:00 -04:00
Nick Mathewson
0fa107a6aa
Update copyright dates to 2012; add a few missing copyright statements
2012-06-04 20:58:17 -04:00
Nick Mathewson
173b18c79b
Add about 60 more DOCDOC comments to 0.2.3
...
Also, try to resolve some doxygen issues. First, define a magic
"This is doxygen!" macro so that we take the correct branch in
various #if/#else/#endifs in order to get the right documentation.
Second, add in a few grouping @{ and @} entries in order to get some
variables and fields to get grouped together.
2012-06-04 19:59:08 -04:00
Nick Mathewson
f68c042637
Resolve all currently pending DOCDOC items in master
2012-06-04 19:05:51 -04:00
Nick Mathewson
f35271bf3e
Fix some more FreeBSD4 issues (based on a patch from grarpamp)
...
Apparently, freebsd 4 doesn't like malloc.h, needs sys/param.h for
MIN/MAX, and doesn't have a SIZE_MAX.
For bug 3894.
2012-05-16 14:34:17 -04:00
Nick Mathewson
d732b87e60
Merge remote-tracking branch 'origin/maint-0.2.2'
2012-05-16 12:20:56 -04:00
Sebastian Hahn
679aa93e23
Fix month check in parse_http_time, add test
2012-05-16 12:15:13 -04:00
Nick Mathewson
801923ac21
Remove more dubiosity in struct tm handling. related to bug5346
2012-05-16 12:15:08 -04:00
Nick Mathewson
1abe533b33
Reject an additional type of bad date in parse_http_time
2012-05-16 12:14:48 -04:00
Esteban Manchado Velázquez
d0d9c3d71e
Fix parse_http_time and add tests
...
* It seems parse_http_time wasn't parsing correctly any date with commas (RFCs
1123 and 850). Fix that.
* It seems parse_http_time was reporting the wrong month (they start at 0, not
1). Fix that.
* Add some tests for parse_http_time, covering all three formats.
2012-05-16 12:14:48 -04:00
Nick Mathewson
c78a42685f
Merge remote-tracking branch 'origin/maint-0.2.2'
...
Conflicts:
src/common/util.c
src/test/test_util.c
2012-05-10 15:41:04 -04:00
Nick Mathewson
9b344628ed
Handle out-of-range values in tor_parse_* integer functions
...
The underlying strtoX functions handle overflow by saturating and
setting errno to ERANGE. If the min/max arguments to the
tor_parse_* functions are equal to the minimum/maximum of the
underlying type, then with the old approach, we wouldn't treat a
too-large value as genuinely broken.
Found this while looking at bug 5786; bugfix on 19da1f36
(in Tor
0.0.9), which introduced these functions.
2012-05-07 12:25:59 -04:00
Nick Mathewson
9dddfe83f3
Several mingw/msvc/cross-compilation fixes
...
They boil down to:
- MS_WINDOWS is dead and replaced with _WIN32, but we let a few
instances creep in when we merged Esteban's tests.
- Capitalizing windows header names confuses mingw.
- #ifdef 0 ain't C.
- One unit test wasn't compiled on windows, but was being listed
anyway.
- One unit test was checking for the wrong value.
Gisle Vanem found and fixed the latter 3 issues.
2012-04-26 18:36:25 -04:00
George Kadianakis
b80728a115
tor_vsscanf(): Don't return -1 if '%%' doesn't match.
...
tor_vsscanf() is supposed to return the current number of matches on
match failure.
2012-04-03 16:20:24 +02:00
Nick Mathewson
56e0959d2a
Have tor_parse_*long functions check for negative bases
...
One of our unit tests checks that they behave correctly (giving an
error) when the base is negative. But there isn't a guarantee that
strtol and friends actually handle negative bases correctly.
Found by Coverity Scan; fix for CID 504.
2012-03-30 10:34:05 -04:00
George Kadianakis
aae570b493
Close fds on pipe() error in tor_spawn_background().
2012-03-12 12:41:29 -04:00
Nick Mathewson
c13dc5170f
Merge remote-tracking branch 'origin/maint-0.2.2'
2012-03-09 11:54:45 -05:00
Nick Mathewson
be0535f00b
Correctly handle broken escape sequences in torrc values
...
Previously, malformatted torrc values could crash us.
Patch by Esteban Manchado. Fixes bug 5090; fix on 0.2.0.16-alpha.
2012-03-09 11:50:22 -05:00
Esteban Manchado Velázquez
8a633a3ebd
Small fix in tor_sscanf documentation
2012-03-08 20:49:23 -05:00
Esteban Manchado Velázquez
a753ef8517
Fix typo in config parser documentation
2012-03-08 20:49:17 -05:00
Nick Mathewson
77a7a980d0
Don't leak the env_vars_sorted smartlist in process_environment_make
...
Found by Coverity.
No changes/ file, because this bug has not been in a release yet.
2012-02-29 19:49:26 -05:00
Nick Mathewson
1d36693570
Use get_environment(), not environ.
2012-02-17 11:50:19 -05:00
Robert Ransom
33552c16ca
Heap-allocate strings returned by get_current_process_environment_variables
2012-02-17 11:42:21 -05:00
Robert Ransom
c0808b795f
Pass process_environment_t * to tor_spawn_background
...
Now tor_spawn_background's prototype is OS-independent.
2012-02-17 11:42:20 -05:00
Robert Ransom
ee3a49d6ed
Remove (void)envp from tor_spawn_background
...
The envp argument is used on Windows.
2012-02-17 11:42:20 -05:00
Robert Ransom
d37a1ec8c6
Add set_environment_variable_in_smartlist
2012-02-17 11:42:20 -05:00
Robert Ransom
0ba93e184a
Add get_current_process_environment_variables
2012-02-17 11:42:19 -05:00
Robert Ransom
98cec14982
Add process_environment_make and related utilities
2012-02-17 11:42:19 -05:00
Robert Ransom
806e0f7e19
Add tor_calloc
2012-02-17 11:42:19 -05:00
Nick Mathewson
79a80c88ee
Fix straggling MS_WINDOWS issues; add a changes file
...
There was one MS_WINDOWS that remained because it wasn't on a macro
line; a few remaining uses (and the definition!) in configure.in;
and a now-nonsensical stanza of eventdns_tor.h that previously
defined 'WIN32' if it didn't exist.
2012-01-31 15:48:47 -05:00
Nick Mathewson
5cf9167f91
Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32
...
This commit is completely mechanical; I used this perl script to make it:
#!/usr/bin/perl -w -i.bak -p
if (/^\s*\#/) {
s/MS_WINDOWS/_WIN32/g;
s/\bWIN32\b/_WIN32/g;
}
2012-01-31 15:48:47 -05:00
Nick Mathewson
26e789fbfd
Rename nonconformant identifiers.
...
Fixes bug 4893.
These changes are pure mechanical, and were generated with this
perl script:
/usr/bin/perl -w -i.bak -p
s/crypto_pk_env_t/crypto_pk_t/g;
s/crypto_dh_env_t/crypto_dh_t/g;
s/crypto_cipher_env_t/crypto_cipher_t/g;
s/crypto_digest_env_t/crypto_digest_t/g;
s/aes_free_cipher/aes_cipher_free/g;
s/crypto_free_cipher_env/crypto_cipher_free/g;
s/crypto_free_digest_env/crypto_digest_free/g;
s/crypto_free_pk_env/crypto_pk_free/g;
s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g;
s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g;
s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g;
s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g;
s/crypto_new_cipher_env/crypto_cipher_new/g;
s/crypto_new_digest_env/crypto_digest_new/g;
s/crypto_new_digest256_env/crypto_digest256_new/g;
s/crypto_new_pk_env/crypto_pk_new/g;
s/crypto_create_crypto_env/crypto_cipher_new/g;
s/connection_create_listener/connection_listener_new/g;
s/smartlist_create/smartlist_new/g;
s/transport_create/transport_new/g;
2012-01-18 15:53:30 -05:00
Nick Mathewson
9c29369a04
Convert instances of tor_malloc+tor_snprintf into tor_asprintf
...
These were found by looking for tor_snprintf() instances that were
preceeded closely by tor_malloc(), though I probably converted some
more snprintfs as well.
(In every case, make sure that the length variable (if any) is
removed, renamed, or lowered, so that anything else that might have
assumed a longer buffer doesn't exist.)
2012-01-16 15:03:44 -05:00
Nick Mathewson
9c6d913b9e
Rename smartlist_{v,}asprintf_add to smartlist_add_{v,}asprintf
2012-01-16 15:01:54 -05:00
Nick Mathewson
f729e1e984
Merge branch 'feature3457-v4-nm-squashed'
...
Conflicts:
src/or/rendclient.c
2012-01-11 12:10:14 -05:00
Nick Mathewson
b5af456685
Use spaceless ISO8601 time format, not sec,usec.
2012-01-11 12:08:01 -05:00
Sebastian Hahn
0f8026ec23
Some more check-spaces stuff
...
This re-applies a check-spaces fix that was part of
7920ea55b8
and got reverted along with the
rest of that commit in df1f72329a
.
2011-12-08 08:47:09 +01:00
Nick Mathewson
df1f72329a
Revert "Refactor tor_event_base_once to do what we actually want"
...
This reverts commit 7920ea55b8
.
2011-12-06 19:49:20 -05:00
Nick Mathewson
da6c136817
Merge remote-tracking branch 'asn-mytor/bug4548_take2'
2011-11-29 18:30:41 -05:00
George Kadianakis
f28014bf1a
Introduce write_bytes_to_new_file().
...
Introduce write_bytes_to_new_file(), a function which writes bytes to
a file only if that file did not exist.
2011-11-26 18:56:49 +01:00
Nick Mathewson
7920ea55b8
Refactor tor_event_base_once to do what we actually want
...
This version avoids the timeout system entirely, gives a nicer
interface, and lets us manage allocation explicitly.
2011-11-25 17:18:54 -05:00
Nick Mathewson
d6c18c5804
Make process_handle_t private and fix some unit tests
...
Let's *not* expose more cross-platform-compatibility structures, or
expect code to use them right.
Also, don't fclose() stdout_handle and stdin_handle until we do
tor_process_handle_destroy, or we risk a double-fclose.
2011-11-25 16:47:25 -05:00
Nick Mathewson
093e6724c7
Merge remote-tracking branch 'asn/bug3472_act2'
2011-11-25 16:00:31 -05:00
Sebastian Hahn
3dc2a1c62c
Get rid of an unused parameter warning on win
...
This is a backport of bed79c47f4
which
accidentally only went into master
2011-11-20 03:02:28 +01:00
Sebastian Hahn
4b8d2ad6f5
Fix compile warnings on windows
2011-11-15 13:34:04 +01:00
George Kadianakis
6b3c3b968f
Rename tor_process_destroy() to tor_process_handle_destroy().
2011-10-24 16:04:31 +02:00
George Kadianakis
47a5b8009b
Improve general code quality.
...
- Add a tor_process_get_pid() function that returns the PID of a
process_handle_t.
- Conform to make check-spaces.
- Add some more documentation.
- Improve some log messages.
2011-10-24 16:01:24 +02:00
George Kadianakis
f12a40d860
Prepare util.[ch] to use the new process_handle_t API.
...
Also, create tor_process_destroy() which destroys a process_handle_t.
2011-10-24 15:55:53 +02:00
Sebastian Hahn
cce85c819b
Fix a compile warning on OS X 10.6 and up
2011-10-11 02:25:00 +02:00
Nick Mathewson
6a673ad313
Add a missing comma in tor_check_port_forwarding
...
My fault; fix for bug 4213.
2011-10-10 11:42:05 -04:00
Nick Mathewson
ed39621a9d
Merge remote-tracking branch 'asn2/bug3656'
...
Conflicts:
src/common/util.c
src/common/util.h
src/or/config.h
src/or/main.c
src/test/test_util.c
2011-10-07 16:05:13 -04:00
George Kadianakis
3be9d76fa2
Make it compile on Windows™.
2011-10-07 15:44:44 +02:00
George Kadianakis
2e73f9b3ee
Put some sense into our logging.
...
Transform our logging severities to something more sensible.
Remove sneaky printf()s.
2011-09-12 00:10:07 +02:00
George Kadianakis
de7565f87f
Make check-spaces happy.
2011-09-11 23:34:36 +02:00
George Kadianakis
c6811c57cb
Enforce transport names being C identifiers.
...
Introduce string_is_C_identifier() and use it to enforce transport
names according to the 180 spec.
2011-09-11 23:34:11 +02:00
George Kadianakis
782810a8bf
Introduce tor_terminate_process() function.
2011-09-11 20:26:01 +02:00
Nick Mathewson
a41f1fc612
Merge remote-tracking branch 'origin/maint-0.2.2'
...
Conflicts:
configure.in
src/or/circuitbuild.c
2011-09-09 12:58:12 -04:00
Steven Murdoch
cfa9ee5fe7
Fix double-closing a stdio stream
...
After a stream reached eof, we fclose it, but then
test_util_spawn_background_partial_read() reads from it again, which causes
an error and thus another fclose(). Some platforms are fine with this, others
(e.g. debian-sid-i386) trigger a double-free() error. The actual code used by
Tor (log_from_pipe() and tor_check_port_forwarding()) handle this case
correctly.
2011-09-01 14:15:54 +01:00
Nick Mathewson
6a3e4a89a2
Tweaks on last process-launch patches
2011-08-31 22:14:38 -04:00
Steven Murdoch
5b8a20ed44
Make a version of tor_read_all_handle() for non-Windows platforms
...
Mainly used for testing reading from subprocesses. To be more generic
we now pass in a pointer to a process_handle_t rather than a Windows-
specific HANDLE.
2011-09-01 01:43:44 +01:00
Nick Mathewson
a7c07605d0
Add a missing include to util.c to get waitpid() on Linux
2011-08-31 00:36:43 -04:00
Nick Mathewson
0ac4b0f99d
Check for lround with autoconf; fall back to rint.
2011-08-30 22:22:15 -04:00
Nick Mathewson
2778cdd671
Rename tor_join_cmdline to tor_join_win_cmdline; tweak doxygen
2011-08-30 16:00:08 -04:00
Nick Mathewson
4f585b9ee2
Merge remote-tracking branch 'sjmurdoch/bug2046'
2011-08-30 15:51:45 -04:00
Steven Murdoch
d1dd9991cd
Document limitation of log_from_handle with partial reads
2011-08-30 15:02:28 +01:00
Steven Murdoch
da34360952
Factor out and re-write code for splitting lines from a handle
...
Now handles non-printable characters and will not output a spurious
new-line if given a partial line.
2011-08-30 14:55:51 +01:00
Steven Murdoch
bc97f41080
Refactor out command line formatting
...
Now correctly handles whitespace, quotes and backslashes. Passes all unit tests.
2011-08-29 14:37:38 +01:00
Steven Murdoch
93792b5aa6
Add a sanity check
2011-08-29 00:36:41 +01:00
Steven Murdoch
f1ff65dfad
Replace two magic tristates with #define'd names
...
- process_handle_t.status
- return value of tor_get_exit_code()
2011-08-29 00:30:18 +01:00
Steven Murdoch
3f0a197aad
Make signature of tor_spawn_background more conventional
...
Conventionally in Tor, structs are returned as pointers, so change
tor_spawn_background() to return the process handle in a pointer rather
than as return value.
2011-08-28 23:35:02 +01:00
Steven Murdoch
1da5081ae0
Appease "make check-spaces"
2011-08-24 21:34:13 +01:00
Steven Murdoch
50b48c3ea7
Improve comments and fix one bug
2011-08-24 21:33:53 +01:00
Steven Murdoch
476807211c
We don't need to find our own path, just tell Windows to search
2011-08-24 20:50:58 +01:00
Nick Mathewson
ede9cd4f99
Merge remote-tracking branch 'origin/maint-0.2.2'
2011-08-24 13:53:17 -04:00
Gisle Vanem
5939c09d35
lround() missing in MSVC
...
lround() is missing in MS Visual-C's <math.h>. Not available anywhere.
Here is an easy patch.
2011-08-24 13:52:44 -04:00
Steven Murdoch
2efafdfe14
Fix compilation errors under *nix
2011-08-23 01:09:24 +01:00
Steven Murdoch
1ad986335a
Tidy up subprocess code
...
- Better error handling
- Write description of functions
- Don't assume non-negative process return values
2011-08-22 19:43:38 +01:00
Steven Murdoch
f46f6aabb4
Fix some compiler warnings
2011-08-22 18:13:58 +01:00
Steven Murdoch
cc5b6d6cee
Merge remote branch 'origin/master' into bug2046
2011-08-18 18:42:02 +01:00
Steven Murdoch
7d015c886a
Complete logging of output from port forwarding helper
2011-08-18 18:41:23 +01:00
George Kadianakis
db4cde3810
Improve the code a tad.
...
* Use strcmpstart() instead of strcmp(x,y,strlen(y)).
* Warn the user if the managed proxy failed to launch.
* Improve function documentation.
* Use smartlist_len() instead of n_unconfigured_proxies.
* Split managed_proxy_destroy() to managed_proxy_destroy()
and managed_proxy_destroy_with_transports().
* Constification.
2011-08-15 17:26:03 +02:00
Nick Mathewson
b76f46c6d8
Merge branch 'bug1692-squashed'
2011-08-10 15:04:36 -04:00
Robert Ransom
e42a74e563
Add smartlist_[v]asprintf_add
...
I should have added this before implementing #2411 .
2011-08-10 15:03:24 -04:00
Sebastian Hahn
bed79c47f4
Get rid of an unused parameter warning on win
2011-08-09 11:03:17 +02:00
Nick Mathewson
e802199cb3
Initial patch to build Tor with msvc and nmake
...
We'll still need to tweak it so that it looks for includes and
libraries somewhere more sensible than "where we happened to find
them on Erinn's system"; so that tests and tools get built too;
so that it's a bit documented; and so that we actually try running
the output.
Work done with Erinn Clark.
2011-08-01 12:36:59 -04:00
Steven Murdoch
5bf9890b3b
Test case for reading the partial output of a background process
2011-07-25 04:08:08 +01:00
Steven Murdoch
99baa7e45c
Fix compilation on non-Windows platforms
2011-07-23 23:49:30 +01:00
Steven Murdoch
c5796a8fb2
If hProcess is NULL, read_all_handle returns if it would block
2011-07-23 21:35:50 +01:00
Steven Murdoch
2d5059e08e
Use PeekNamedPipe to avoid blocking ReadFile when there is nothing to read
2011-07-22 21:12:00 +01:00
Steven Murdoch
55a1cb53d6
Add code to read all from a handle, but this block forever
...
See http://stackoverflow.com/questions/3722409/windows-child-process-with-redirected-input-and-output
for a potential solution
2011-07-22 15:57:56 +01:00
Steven Murdoch
fec902dd60
Add Windows version of tor_spawn_background and ancillary functions
2011-07-21 19:26:19 +01:00
Steven Murdoch
35c89be02b
Generalize process spawning so its test compiles (but fails) in Windows
...
- pid, stdout/stderr_pipe now encapsulated in process_handle
- read_all replaced by tor_read_all_from_process_stdin/stderr
- waitpid replaced by tor_get_exit_code
Untested on *nix
2011-07-21 16:34:48 +01:00
Nick Mathewson
94f85f216a
Turn streq_opt into a generic strcmp_opt.
2011-07-19 02:36:11 -04:00
Nick Mathewson
773bfaf91e
Implement stream isolation
...
This is the meat of proposal 171: we change circuit_is_acceptable()
to require that the connection is compatible with every connection
that has been linked to the circuit; we update circuit_is_better to
prefer attaching streams to circuits in the way that decreases the
circuits' usefulness the least; and we update link_apconn_to_circ()
to do the appropriate bookkeeping.
2011-07-19 01:58:45 -04:00
George Kadianakis
69271b2a38
Reuse get_string_from_pipe() in log_from_pipe().
2011-07-18 17:06:16 +02:00
George Kadianakis
14c5a24fe7
Replaced ST_* enum prefix for stream status with IO_STREAM_*.
2011-07-18 02:35:29 +02:00
George Kadianakis
810a7a5fa0
Make some utility functions.
...
* Create a function that will get input from a stream, so that we can
communicate with the managed proxy.
* Hackish change to tor_spawn_background() so that we can specify an
environ for our spawn.
2011-07-13 18:59:52 +02:00
Nick Mathewson
997499369e
Merge remote-tracking branch 'origin/maint-0.2.2'
2011-06-20 15:28:16 -04:00
Nick Mathewson
1040ccafb2
Fix overwide lines in util.c
2011-06-20 15:28:06 -04:00
Nick Mathewson
8839b86085
Merge remote-tracking branch 'origin/maint-0.2.2'
2011-06-14 12:25:33 -04:00
Jérémy Bobbio
54d7d31cba
Make ControlSocketsGroupWritable work with User.
...
Original message from bug3393:
check_private_dir() to ensure that ControlSocketsGroupWritable is
safe to use. Unfortunately, check_private_dir() only checks against
the currently running user… which can be root until privileges are
dropped to the user and group configured by the User config option.
The attached patch fixes the issue by adding a new effective_user
argument to check_private_dir() and updating the callers. It might
not be the best way to fix the issue, but it did in my tests.
(Code by lunar; changelog by nickm)
2011-06-14 12:18:32 -04:00
Nick Mathewson
21de9d46e2
Merge remote-tracking branch 'origin/maint-0.2.2'
...
Conflicts:
src/common/compat.c
src/or/main.c
2011-05-30 14:58:26 -04:00
Nick Mathewson
da7c60dcf3
Merge remote-tracking branch 'public/bug3270' into maint-0.2.2
2011-05-30 14:49:49 -04:00
Nick Mathewson
8e09f7cf10
Fix a -Wunused-but-set-variable instance in master
2011-05-28 01:57:38 -04:00
Nick Mathewson
2527acb2dc
Merge remote-tracking branch 'origin/maint-0.2.2'
...
Conflicts:
src/common/Makefile.am
src/or/control.c
2011-05-23 01:23:53 -04:00
Nick Mathewson
b80a8bba19
Merge branch 'feature3049-v2' into maint-0.2.2
...
Conflicts:
src/common/Makefile.am
2011-05-23 01:19:04 -04:00
Nick Mathewson
cfeafe5e77
Use a 64-bit type to hold sockets on win64.
...
On win64, sockets are of type UINT_PTR; on win32 they're u_int;
elsewhere they're int. The correct windows way to check a socket for
being set is to compare it with INVALID_SOCKET; elsewhere you see if
it is negative.
On Libevent 2, all callbacks take sockets as evutil_socket_t; we've
been passing them int.
This patch should fix compilation and correctness when built for
64-bit windows. Fixes bug 3270.
2011-05-23 00:17:48 -04:00
Roger Dingledine
cb7fff193e
Merge branch 'maint-0.2.2'
2011-05-21 18:14:16 -04:00
Roger Dingledine
a2851d3034
what's up with this trailing whitespace
2011-05-20 23:30:37 -04:00
Nick Mathewson
4ac8ff9c9f
Merge remote-tracking branch 'origin/maint-0.2.2'
2011-05-15 20:22:44 -04:00
Nick Mathewson
f72e792be5
Make check_private_dir check for group ownership as appropriate
2011-05-15 20:20:30 -04:00
Nick Mathewson
287f6cb128
Fix up some comment issues spotted by rransom
2011-05-15 20:20:30 -04:00
Nick Mathewson
5d147d8527
Add a new flag to check_private_dir to make it _not_ change permissions
...
We'll need this for checking permissions on the directories that hold
control sockets: if somebody says "ControlSocket ~/foo", it would be
pretty rude to do a chmod 700 on their homedir.
2011-05-15 20:20:29 -04:00
Nick Mathewson
b147c01295
Make check_private_dir accept g+rx dirs if told to do so.
2011-05-15 20:20:29 -04:00
Robert Ransom
c714a098ea
Improve a documentation comment
2011-05-12 02:57:09 -07:00
Nick Mathewson
9fba014e3f
Merge remote-tracking branch 'public/bug3122_memcmp_022' into bug3122_memcmp_023
...
Conflicts in various places, mainly node-related. Resolved them in
favor of HEAD, with copying of tor_mem* operations from bug3122_memcmp_022.
src/common/Makefile.am
src/or/circuitlist.c
src/or/connection_edge.c
src/or/directory.c
src/or/microdesc.c
src/or/networkstatus.c
src/or/router.c
src/or/routerlist.c
src/test/test_util.c
2011-05-11 16:39:45 -04:00
Nick Mathewson
44ad734573
Merge remote-tracking branch 'public/3122_memcmp_squashed' into bug3122_memcmp_022
...
Conflicts throughout. All resolved in favor of taking HEAD and
adding tor_mem* or fast_mem* ops as appropriate.
src/common/Makefile.am
src/or/circuitbuild.c
src/or/directory.c
src/or/dirserv.c
src/or/dirvote.c
src/or/networkstatus.c
src/or/rendclient.c
src/or/rendservice.c
src/or/router.c
src/or/routerlist.c
src/or/routerparse.c
src/or/test.c
2011-05-11 16:24:29 -04:00
Nick Mathewson
59f9097d5c
Hand-conversion and audit phase of memcmp transition
...
Here I looked at the results of the automated conversion and cleaned
them up as follows:
If there was a tor_memcmp or tor_memeq that was in fact "safe"[*] I
changed it to a fast_memcmp or fast_memeq.
Otherwise if there was a tor_memcmp that could turn into a
tor_memneq or tor_memeq, I converted it.
This wants close attention.
[*] I'm erring on the side of caution here, and leaving some things
as tor_memcmp that could in my opinion use the data-dependent
fast_memcmp variant.
2011-05-11 16:12:51 -04:00
Nick Mathewson
db7b2a33ee
Automated conversion of memcmp to tor_memcmp/tor_mem[n]eq
...
This commit is _exactly_ the result of
perl -i -pe 's/\bmemcmp\(/tor_memcmp\(/g' src/*/*.[ch]
perl -i -pe 's/\!\s*tor_memcmp\(/tor_memeq\(/g' src/*/*.[ch]
perl -i -pe 's/0\s*==\s*tor_memcmp\(/tor_memeq\(/g' src/*/*.[ch]
perl -i -pe 's/0\s*!=\s*tor_memcmp\(/tor_memneq\(/g' src/*/*.[ch]
git checkout src/common/di_ops.[ch]
git checkout src/or/test.c
git checkout src/common/test.h
2011-05-11 16:12:51 -04:00
Nick Mathewson
444e46d96d
Remove the "fuzzy time" code
...
It was the start of a neat idea, but it only got used in 3 places,
none of which really needed it.
2011-03-25 16:28:37 -04:00
Nick Mathewson
a87a55a9b6
Merge remote branch 'origin/maint-0.2.2'
2011-01-03 15:55:41 -05:00
Nick Mathewson
f089804332
Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
2011-01-03 15:31:19 -05:00
Nick Mathewson
e365aee971
Avoid assertion on read_file_to_str() with size==SIZE_T_CEILING-1
...
Spotted by doors, fixes bug 2326.
2011-01-03 15:30:11 -05:00
Nick Mathewson
a96b46570f
Merge remote branch 'origin/maint-0.2.2'
2011-01-03 15:16:36 -05:00
Nick Mathewson
cee433d751
Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
2011-01-03 15:15:54 -05:00
Nick Mathewson
e09ab69703
Check size against SIZE_T_CEILING in realloc too.
...
Fixes bug 2324.
2011-01-03 15:15:27 -05:00
Nick Mathewson
8730884ebe
Merge remote branch 'origin/maint-0.2.2'
2011-01-03 11:53:28 -05:00
Nick Mathewson
f1de329e78
Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
...
Conflicts:
src/common/test.h
src/or/test.c
2011-01-03 11:51:17 -05:00
Nick Mathewson
1a07348a50
Bump copyright statements to 2011
2011-01-03 11:50:39 -05:00
Roger Dingledine
c79427a992
Merge branch 'maint-0.2.2'
2010-12-19 22:08:42 -05:00
Nick Mathewson
b5e293afe6
Merge remote branch fix_security_bug_021 into fix_security_bug_022
...
Conflicts:
src/common/memarea.c
src/or/or.h
src/or/rendclient.c
2010-12-15 22:48:23 -05:00
Nick Mathewson
785086cfba
Have all of our allocation functions and a few others check for underflow
...
It's all too easy in C to convert an unsigned value to a signed one,
which will (on all modern computers) give you a huge signed value. If
you have a size_t value of size greater than SSIZE_T_MAX, that is way
likelier to be an underflow than it is to be an actual request for
more than 2gb of memory in one go. (There's nothing in Tor that
should be trying to allocate >2gb chunks.)
2010-12-13 18:40:21 -05:00
Steven Murdoch
d5127ebdd8
Fix connecting the stdin of tor-fw-helper to /dev/null
...
This wasn't working due to the parameters of dup2 being in the wrong order.
As a result, tor-fw-helper was inheriting the stdin of Tor.
2010-12-01 12:22:21 -05:00
Nick Mathewson
b4f56dd4c6
Obviate need for doing a CLOEXEC on pipes: just close them before exec
2010-11-20 01:24:30 -05:00
Nick Mathewson
5a66de7015
Initial work to set CLOEXEC on all possible fds
...
Still to go: some pipes, all stdio files.
2010-11-20 00:58:40 -05:00
Nick Mathewson
a5289fa794
Remove the unused old fuzzy-time code
2010-10-15 11:16:42 -04:00
Nick Mathewson
8c837db38f
Merge branch 'nodes'
2010-10-13 16:04:25 -04:00
Nick Mathewson
544a8afe5a
Merge remote branch 'sjmurdoch/bug1903'
2010-10-11 11:01:15 -04:00
Nick Mathewson
8f76f31761
Make tor_sscanf handle %x
2010-10-11 10:50:47 -04:00
Steven Murdoch
8a12ce2cf9
Add a unit test for tor_spawn_background
...
- Test sucessfully starting a process
- Test failing to find the executable
2010-10-10 19:08:44 +01:00
Steven Murdoch
68e576e9f9
Update documentation for tor_spawn_background
...
- Include description of stdout_read, stderr_read, and argv
2010-10-10 19:08:44 +01:00
Steven Murdoch
23e9f362a2
Fix issues in nickm's review of log_from_pipe for bug #1903
...
- Replace sscanf with tor_sscanf
- Replace use of strstr with equivalent call to strcmpstart
2010-10-10 19:08:44 +01:00
Steven Murdoch
4d694c7890
Fix nickm's comments on logging for bug #1903
...
- Use log_warn rather than log_err for bad but survivable events
2010-10-10 19:08:44 +01:00
Steven Murdoch
708ba8899f
Note icky constructs mentioned in bug #1903
...
- To be dealt with as part of bug #2029
2010-10-10 19:07:40 +01:00
Steven Murdoch
5a77c64834
Fix issues in nickm's review of format_helper_exit_status for bug #1903
...
- Responsibility of clearing hex_errno is no longer with caller
- More conservative bounds checking
- Length requirement of hex_errno documented
- Output format documented
2010-10-04 14:31:27 +01:00
Nick Mathewson
b5341314c1
Implement a few more node-based functions
...
Some of these functions only work for routerinfo-based nodes, and as
such are only usable for advisory purposes. Fortunately, our uses
of them are compatible with this limitation.
2010-10-01 18:14:27 -04:00
Nick Mathewson
80b515b85f
Initialize fd values in tor_port_check_forwarding to -1
2010-10-01 18:14:17 -04:00
Nick Mathewson
495e630a49
Merge branch 'tor-fw-squashed2'
...
Conflicts:
src/common/util.c
2010-09-30 16:22:39 -04:00
Nick Mathewson
0e9d969bb2
Fix space and formatting issues
2010-09-30 15:55:42 -04:00
Nick Mathewson
2835dcf69f
#if-out the fw-helper code in util.c when building on windows
2010-09-30 12:58:48 -04:00
Steven Murdoch
a6dc00fa75
Start tor-fw-helper in the background, and log whatever it outputs
2010-09-30 11:40:37 -04:00
Sebastian Hahn
45c51e3238
Fix check-spaces
2010-09-30 06:17:32 +02:00
Nick Mathewson
e385961542
Merge remote branch 'public/bug1954' into maint-0.2.2
2010-09-27 15:39:40 -04:00
Nick Mathewson
d073d7d4eb
Consistency issues in load_windows_system_library patch. Thanks Sebastian
2010-09-24 14:16:55 -04:00
Sebastian Hahn
851255170a
Note that the torrc format doesn't need nl at end
2010-09-24 13:32:27 +02:00
Nick Mathewson
0a0cc4599f
Tweak continuation-and-comment logic
...
I think there was a read-off-the-end-of-the-buffer bug that I fixed.
At least I added some good comments, I hope.
2010-09-23 22:58:04 -04:00
Nick Mathewson
418e6caeeb
New function to load windows system libraries
...
This function uses GetSystemDirectory() to make sure we load the version
of the library from c:\windows\system32 (or local equivalent) rather than
whatever version lives in the cwd.
2010-09-21 14:39:23 -04:00
Sebastian Hahn
a05ef55b66
Allow comments for multi-line torrc options
2010-09-11 01:41:23 +02:00
Nick Mathewson
07049b3d25
Support mutli-line torrc options via the usual backslash syntax
2010-09-10 09:19:10 -04:00
Nick Mathewson
edc9256e95
Merge remote branch 'public/win_unicode_fixes'
2010-09-06 10:06:07 -04:00
Nick Mathewson
285addbd94
Fix some issues in rate-limiting noticed by Sebastian
2010-08-31 12:52:11 -04:00
Nick Mathewson
c0c7868250
Make the windows build succeed with or without -DUNICODE enabled.
...
This should keep WinCE working (unicode always-on) and get Win98
working again (unicode never-on).
There are two places where we explicitly use ASCII-only APIs, still:
in ntmain.c and in the unit tests.
This patch also fixes a bug in windoes tor_listdir that would cause
the first file to be listed an arbitrary number of times that was
also introduced with WinCE support.
Should fix bug 1797.
2010-08-20 13:40:01 -04:00
Nick Mathewson
ba9c1275c4
Add a generic rate-limited log mechanism, and use it in a few places
...
Incidentally fixes bug 1042.
2010-08-18 15:55:49 -04:00
Nick Mathewson
14bc4dcc22
Rename log.h to torlog.h
...
This should make us conflict less with system files named "log.h".
Yes, we shouldn't have been conflicting with those anyway, but some
people's compilers act very oddly.
The actual change was done with one "git mv", by editing
Makefile.am, and running
find . -name '*.[ch]' | xargs perl -i -pe 'if (/^#include.*\Wlog.h/) {s/log.h/torlog.h/; }'
2010-07-09 22:05:38 -04:00
Florian Zumbiehl
426116113f
Save a couple characters' allocation in esc_for_log
2010-06-14 14:05:18 -04:00
Nick Mathewson
03ea5f930e
Reinstate warning when HOME isn't set.
...
Having ~/.tor expand into /.tor is, after all, almost certainly not
what the user wanted, and it deserves a warning message.
Also, convert a guess-and-malloc-and-sprintf triple into an asprintf.
2010-06-07 11:20:39 -04:00
Sebastian Hahn
0882e1e839
Treat unset $HOME like empty $HOME
...
This means Tor no longer dies when it doesn't have a $HOME.
2010-06-07 02:18:01 +02:00
valerino
8d31141ccb
Port Tor to work on Windows CE
...
Most of the changes here are switches to use APIs available on Windows
CE. The most pervasive change is that Windows CE only provides the
wide-character ("FooW") variants of most of the windows function, and
doesn't support the older ASCII verions at all.
This patch will require use of the wcecompat library to get working
versions of the posix-style fd-based file IO functions.
[commit message by nickm]
2010-05-24 11:46:45 -04:00
Nick Mathewson
b006e3279f
Merge remote branch 'origin/maint-0.2.1'
...
Conflicts:
src/common/test.h
src/or/test.c
2010-02-27 17:16:31 -05:00
Nick Mathewson
c3e63483b2
Update Tor Project copyright years
2010-02-27 17:14:21 -05:00
Nick Mathewson
d35b8dc582
Make expand_filename into a tor_strdup() alias on windows.
...
On Windows, we don't have a notion of ~ meaning "our homedir", so we
were deliberately using an #ifdef to avoid calling expand_filename()
in multiple places. This is silly: The right place to turn a function
into a no-op on a single platform is in the function itself, not in
every single call-site.
2010-02-22 12:42:31 -05:00
Karsten Loesing
f80672d747
Remove duplicate words and a duplicate newline.
2009-12-18 12:55:05 +01:00
Nick Mathewson
235f1e1a96
Refactor out the 'find string at start of any line' logic.
...
We do this in too many places throughout the code; it's time to start
clamping down.
Also, refactor Karsten's patch to use strchr-then-strndup, rather than
malloc-then-strlcpy-then-strchr-then-clear.
2009-12-17 18:29:37 -05:00
Nick Mathewson
e56747f9cf
Refactor a bit so that it is safe to include math.h, and mostly not needed.
2009-12-15 14:40:49 -05:00
Nick Mathewson
d086c9a7f7
Merge commit 'sebastian/fixes'
2009-12-12 02:10:57 -05:00
Nick Mathewson
0c1b3070cf
Now that FOO_free(NULL) always works, remove checks before calling it.
2009-12-12 02:07:59 -05:00
Sebastian Hahn
28b29e0fd7
Fix typo in a comment
2009-12-12 02:53:27 +01:00
Nick Mathewson
f629687053
Merge branch 'microdesc'
2009-10-19 00:45:47 -04:00
Nick Mathewson
465d4e1cd1
Document some formerly undocumented functions.
2009-10-19 00:30:52 -04:00
Nick Mathewson
e26a79ca8a
Make start_writing_to_stdio_file() respect O_BINARY.
2009-10-15 15:17:13 -04:00
Nick Mathewson
e1ddee8bbe
Code to generate, store, and parse microdescriptors and consensuses.
...
The consensus documents are not signed properly, not served, and not
exchanged yet.
2009-10-15 15:17:13 -04:00
Sebastian Hahn
772ce9d085
Fix compile on Snow Leopard
2009-09-20 23:17:00 -04:00
Mike Perry
e2cc4e353a
Add a couple of time helper functions.
...
Also add rounding support to tv_mdiff().
2009-09-20 18:03:39 -07:00
Sebastian Hahn
0a71d1c6a7
Fix compile warnings on Snow Leopard
...
Big thanks to nickm and arma for helping me with this!
2009-09-01 22:16:46 +02:00
Nick Mathewson
1cda6f3e75
Merge commit 'origin/maint-0.2.1'
2009-09-01 15:59:40 -04:00
Sebastian Hahn
742788b737
typo
2009-09-01 21:58:06 +02:00
Sebastian Hahn
aea9cf1011
Fix compile warnings on Snow Leopard
...
Big thanks to nickm and arma for helping me with this!
2009-09-01 18:36:27 +02:00
Nick Mathewson
00b37f071d
Revise parsing of time and memory units to handle spaces.
...
When we added support for fractional units (like 1.5 MB) I broke
support for giving units with no space (like 2MB). This patch should
fix that. It also adds a propoer tor_parse_double().
Fix for bug 1076. Bugfix on 0.2.2.1-alpha.
2009-08-31 00:18:55 -04:00
Karsten Loesing
7b716878cb
Fix dirreq and cell stats on 32-bit architectures.
...
When determining how long directory requests take or how long cells spend
in queues, we were comparing timestamps on microsecond detail only to
convert results to second or millisecond detail later on. But on 32-bit
architectures this means that 2^31 microseconds only cover time
differences of up to 36 minutes. Instead, compare timestamps on
millisecond detail.
2009-07-27 16:23:53 +02:00
Karsten Loesing
8f1a973669
Two tweaks to exit-port statistics.
...
Add two functions for round_to_next_multiple_of() for uint32_t and
uint64_t.
Avoid division in every step of the loop over all ports.
2009-07-13 22:43:06 +02:00
Nick Mathewson
fd992deeea
Don't attempt to log messages to a controller from a worker thread.
...
This patch adds a function to determine whether we're in the main
thread, and changes control_event_logmsg() to return immediately if
we're in a subthread. This is necessary because otherwise we will
call connection_write_to_buf, which modifies non-locked data
structures.
Bugfix on 0.2.0.x; fix for at least one of the things currently
called "bug 977".
2009-05-30 18:16:24 -04:00
Nick Mathewson
f0453c45c8
Spelling fixes in comments and strings
2009-05-27 16:36:13 -04:00
Nick Mathewson
11b9c839f0
Stop using malloc_usable_size(): valgrind hates it.
2009-05-17 01:55:02 -04:00
Karsten Loesing
9b32e8c141
Update copyright to 2009.
2009-05-04 11:28:27 -04:00
Nick Mathewson
cbbc0c9c86
Actually use tor_sscanf() to parse untrusted input.
...
svn:r18761
2009-03-03 18:02:36 +00:00
Nick Mathewson
26d83fc04c
Add a simple locale-independent no-surprises sscanf replacement.
...
tor_sscanf() only handles %u and %s for now, which will make it
adequate to replace sscanf() for date/time/IP parsing. We want this
to prevent attackers from constructing weirdly formed descriptors,
cells, addresses, HTTP responses, etc, that validate under some
locales but not others.
svn:r18760
2009-03-03 18:02:31 +00:00
Nick Mathewson
25c6ff6f55
Support 64-bit time_t. Patch from Matthias Drochner. Partial backport candidate.
...
svn:r18234
2009-01-22 16:28:12 +00:00
Nick Mathewson
a87980c2eb
Add a better (non-locale-having) ctypes implementation to avoid protocol and parsing mismatches on different platforms.
...
svn:r18189
2009-01-20 21:33:56 +00:00
Nick Mathewson
743c6c8277
OpenBSD malloc.h believes that you should be able to detect headers with autoconf, or build without warnings, but not both. So never include malloc.h on OpenBSD. Backport candidate.
...
svn:r17891
2009-01-04 22:47:42 +00:00
Nick Mathewson
c4b8fef362
Remove svn $Id$s from our source, and remove tor --version --version.
...
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed. They were not actually useful for
telling the version of Tor files in the wild.
svn:r17867
2009-01-04 00:35:51 +00:00
Nick Mathewson
558e9899e4
Document most undocumented variables.
...
svn:r17754
2008-12-23 17:56:31 +00:00
Nick Mathewson
b4d387c28b
Make freelist_len in memarea.c static; document a few variables.
...
svn:r17741
2008-12-22 19:14:08 +00:00
Nick Mathewson
b68379b13b
Add DOCDOC entries for undocumented static and global variables.
...
svn:r17739
2008-12-22 19:00:05 +00:00
Nick Mathewson
1e5f457461
Fix most DOCDOCs remaining and/or added by redox.
...
svn:r17734
2008-12-22 17:53:04 +00:00