commit 92151a43a5d9f99d8ea8c58852e275fdeb4a55a2 Merge: 8829590 7af1fc5 Author: Robert Hogan robert@webkit.org Date: Sun Jun 20 13:19:47 2010 +0100
Merge branch 'osx'
configure.in | 49 ++++ src/parser.c | 862 +++++++++++++++++++++++++++---------------------------- src/torsocks.in | 45 ++- src/tsocks.c | 348 ++++++++++++++++++++--- 4 files changed, 813 insertions(+), 491 deletions(-)
diff --cc src/parser.c index f0d3387,a77b262..5619ed2 --- a/src/parser.c +++ b/src/parser.c @@@ -82,23 -82,21 +82,23 @@@ int read_config (char *filename, struc config->tordns_enabled = 1;
- /* If a filename wasn't provided, use the default */ - if (filename == NULL) { - strncpy(line, CONF_FILE, sizeof(line) - 1); - /* Insure null termination */ - line[sizeof(line) - 1] = (char) 0; - filename = line; - show_msg(MSGWARN, "Configuration file not provided by TORSOCKS_CONF_FILE " - "environment variable, attempting to use defaults in %s.\n", filename); - } - - /* If there is no configuration file use reasonable defaults for Tor */ - if ((conf = fopen(filename, "r")) == NULL) { - show_msg(MSGERR, "Could not open socks configuration file " - "(%s), assuming sensible defaults for Tor.\n", filename); + /* If a filename wasn't provided, use the default */ + if (filename == NULL) { + strncpy(line, CONF_FILE, sizeof(line) - 1); + /* Insure null termination */ + line[sizeof(line) - 1] = (char) 0; + filename = line; ++ show_msg(MSGWARN, "Configuration file not provided by TORSOCKS_CONF_FILE " ++ "environment variable, attempting to use defaults in %s.\n", filename); + } + + /* If there is no configuration file use reasonable defaults for Tor */ + if ((conf = fopen(filename, "r")) == NULL) { + show_msg(MSGERR, "Could not open socks configuration file " + "(%s) errno (%d), assuming sensible defaults for Tor.\n", filename, errno); memset(&(config->defaultserver), 0x0, sizeof(config->defaultserver)); - check_server(&(config->defaultserver)); - handle_local(config, 0, "127.0.0.0/255.0.0.0"); + check_server(&(config->defaultserver)); + handle_local(config, 0, "127.0.0.0/255.0.0.0"); handle_local(config, 0, "10.0.0.0/255.0.0.0"); handle_local(config, 0, "192.168.0.0/255.255.0.0"); handle_local(config, 0, "172.16.0.0/255.240.0.0"); diff --cc src/tsocks.c index dbda0f9,4f84fed..92bca5b --- a/src/tsocks.c +++ b/src/tsocks.c @@@ -176,10 -243,13 +243,17 @@@ void tsocks_init(void) return; }
- show_msg(MSGWARN, "In tsocks_init \n"); + /* Not strictly true yet, but prevents us getting called while still in progress.*/ + /* This has been observed on Snow Leopard for instance. */ + tsocks_init_complete = 1;
- get_environment(); - get_config(); ++ show_msg(MSGWARN, "In tsocks_init \n"); + - show_msg(MSGWARN, "In tsocks_init after env/config\n"); ++// get_environment(); ++// get_config(); ++// ++// show_msg(MSGWARN, "In tsocks_init after env/config\n"); + #ifdef USE_OLD_DLSYM void *lib; #endif @@@ -264,6 -384,8 +388,7 @@@ area won't be shared across fork()s. */ deadpool_init(); #endif - tsocks_init_complete=1; - show_msg(MSGWARN, "Exit tsocks_init \n"); ++ }
static int get_environment() {