Loading src/common/compat.c +2 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,8 @@ tor_open_cloexec(const char *path, int flags, unsigned mode) return fd; } /** DOCDOC */ /** As fpoen(path,mode), but ensures that the O_CLOEXEC bit is set on the * underlying file handle. */ FILE * tor_fopen_cloexec(const char *path, const char *mode) { Loading src/common/util.c +10 −2 Original line number Diff line number Diff line Loading @@ -3323,7 +3323,15 @@ process_handle_new(void) return out; } /*DOCDOC*/ /** * @name child-process states * * Each of these values represents a possible state that a child process can * be in. They're used to determine what to say when telling the parent how * far along we were before failure. * * @{ */ #define CHILD_STATE_INIT 0 #define CHILD_STATE_PIPE 1 #define CHILD_STATE_MAXFD 2 Loading @@ -3334,7 +3342,7 @@ process_handle_new(void) #define CHILD_STATE_CLOSEFD 7 #define CHILD_STATE_EXEC 8 #define CHILD_STATE_FAILEXEC 9 /** @} */ /** Start a program in the background. If <b>filename</b> contains a '/', then * it will be treated as an absolute or relative path. Otherwise, on * non-Windows systems, the system path will be searched for <b>filename</b>. Loading src/common/util.h +3 −1 Original line number Diff line number Diff line Loading @@ -409,8 +409,10 @@ void set_environment_variable_in_smartlist(struct smartlist_t *env_vars, #define PROCESS_STATUS_ERROR -1 #ifdef UTIL_PRIVATE /*DOCDOC*/ /** Structure to represent the state of a process with which Tor is * communicating. The contents of this structure are private to util.c */ struct process_handle_t { /** One of the PROCESS_STATUS_* values */ int status; #ifdef _WIN32 HANDLE stdout_pipe; Loading src/or/config.c +40 −19 Original line number Diff line number Diff line Loading @@ -675,11 +675,12 @@ static const config_format_t state_format = { /** Command-line and config-file options. */ static or_options_t *global_options = NULL; /** DOCDOC */ /** The fallback options_t object; this is where we look for options not * in torrc before we fall back to Tor's defaults. */ static or_options_t *global_default_options = NULL; /** Name of most recently read torrc file. */ static char *torrc_fname = NULL; /** DOCDOC */ /** Name of the most recently read torrc-defaults file.*/ static char *torrc_defaults_fname; /** Persistent serialized state. */ static or_state_t *global_state = NULL; Loading Loading @@ -4345,8 +4346,8 @@ get_windows_conf_root(void) } #endif /** Return the default location for our torrc file. * DOCDOC defaults_file */ /** Return the default location for our torrc file (if <b>defaults_file</b> is * false), or for the torrc-defaults file (if <b>defaults_file</b> is true). */ static const char * get_default_conf_file(int defaults_file) { Loading Loading @@ -4396,12 +4397,21 @@ check_nickname_list(const char *lst, const char *name, char **msg) return r; } /** Learn config file name from command line arguments, or use the default, * DOCDOC defaults_file */ /** Learn config file name from command line arguments, or use the default. * * If <b>defaults_file</b> is true, we're looking for torrc-defaults; * otherwise, we're looking for the regular torrc_file. * * Set *<b>using_default_fname</b> to true if we're using the default * configuration file name; or false if we've set it from the command line. * * Set *<b>ignore_missing_torrc</b> to true if we should ignore the resulting * filename if it doesn't exist. */ static char * find_torrc_filename(int argc, char **argv, int defaults_file, int *using_default_torrc, int *ignore_missing_torrc) int *using_default_fname, int *ignore_missing_torrc) { char *fname=NULL; int i; Loading @@ -4427,14 +4437,14 @@ find_torrc_filename(int argc, char **argv, fname = absfname; } *using_default_torrc = 0; *using_default_fname = 0; ++i; } else if (ignore_opt && !strcmp(argv[i],ignore_opt)) { *ignore_missing_torrc = 1; } } if (*using_default_torrc) { if (*using_default_fname) { /* didn't find one, try CONFDIR */ const char *dflt = get_default_conf_file(defaults_file); if (dflt && file_status(dflt) == FN_FILE) { Loading @@ -4458,8 +4468,13 @@ find_torrc_filename(int argc, char **argv, return fname; } /** Load torrc from disk, setting torrc_fname if successful. * DOCDOC defaults_file */ /** Load a configuration file from disk, setting torrc_fname or * torrc_defaults_fname if successful. * * If <b>defaults_file</b> is true, load torrc-defaults; otherwise load torrc. * * Return the contents of the file on success, and NULL on failure. */ static char * load_torrc_from_disk(int argc, char **argv, int defaults_file) { Loading Loading @@ -5455,7 +5470,10 @@ warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname) } SMARTLIST_FOREACH_END(port); } /** DOCDOC */ /** Given a list of port_cfg_t in <b>ports</b>, warn any controller port there * is listening on any non-loopback address. If <b>forbid</b> is true, * then emit a stronger warning and remove the port from the list. */ static void warn_nonlocal_controller_ports(smartlist_t *ports, unsigned forbid) { Loading Loading @@ -5839,9 +5857,11 @@ parse_port_config(smartlist_t *out, return retval; } /** DOCDOC */ /** Parse a list of config_line_t for an AF_UNIX unix socket listener option * from <b>cfg</b> and add them to <b>out</b>. No fancy options are * supported: the line contains nothing but the path to the AF_UNIX socket. */ static int parse_socket_config(smartlist_t *out, const config_line_t *cfg, parse_unix_socket_config(smartlist_t *out, const config_line_t *cfg, int listener_type) { Loading Loading @@ -5928,7 +5948,7 @@ parse_ports(const or_options_t *options, int validate_only, "configuration"); goto err; } if (parse_socket_config(ports, if (parse_unix_socket_config(ports, options->ControlSocket, CONN_TYPE_CONTROL_LISTENER) < 0) { *msg = tor_strdup("Invalid ControlSocket configuration"); Loading Loading @@ -5980,7 +6000,8 @@ parse_ports(const or_options_t *options, int validate_only, return retval; } /** DOCDOC */ /** Given a list of <b>port_cfg_t</b> in <b>ports</b>, check them for internal * consistency and warn as appropriate. */ static int check_server_ports(const smartlist_t *ports, const or_options_t *options) Loading src/or/connection.c +9 −4 Original line number Diff line number Diff line Loading @@ -1659,7 +1659,8 @@ connection_send_socks5_connect(connection_t *conn) conn->proxy_state = PROXY_SOCKS5_WANT_CONNECT_OK; } /** DOCDOC */ /** Wrapper around fetch_from_(buf/evbuffer)_socks_client: see those functions * for documentation of its behavior. */ static int connection_fetch_from_buf_socks_client(connection_t *conn, int state, char **reason) Loading Loading @@ -2239,7 +2240,9 @@ global_write_bucket_low(connection_t *conn, size_t attempt, int priority) return 0; } /** DOCDOC */ /** Helper: adjusts our bandwidth history and informs the controller as * appropriate, given that we have just read <b>num_read</b> bytes and written * <b>num_written</b> bytes on <b>conn</b>. */ static void record_num_bytes_transferred_impl(connection_t *conn, time_t now, size_t num_read, size_t num_written) Loading Loading @@ -2270,7 +2273,8 @@ record_num_bytes_transferred_impl(connection_t *conn, } #ifdef USE_BUFFEREVENTS /** DOCDOC */ /** Wrapper around fetch_from_(buf/evbuffer)_socks_client: see those functions * for documentation of its behavior. */ static void record_num_bytes_transferred(connection_t *conn, time_t now, size_t num_read, size_t num_written) Loading Loading @@ -2592,7 +2596,8 @@ connection_get_rate_limit_totals(uint64_t *read_out, uint64_t *written_out) } } /** DOCDOC */ /** Perform whatever operations are needed on <b>conn</b> to enable * rate-limiting. */ void connection_enable_rate_limiting(connection_t *conn) { Loading Loading
src/common/compat.c +2 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,8 @@ tor_open_cloexec(const char *path, int flags, unsigned mode) return fd; } /** DOCDOC */ /** As fpoen(path,mode), but ensures that the O_CLOEXEC bit is set on the * underlying file handle. */ FILE * tor_fopen_cloexec(const char *path, const char *mode) { Loading
src/common/util.c +10 −2 Original line number Diff line number Diff line Loading @@ -3323,7 +3323,15 @@ process_handle_new(void) return out; } /*DOCDOC*/ /** * @name child-process states * * Each of these values represents a possible state that a child process can * be in. They're used to determine what to say when telling the parent how * far along we were before failure. * * @{ */ #define CHILD_STATE_INIT 0 #define CHILD_STATE_PIPE 1 #define CHILD_STATE_MAXFD 2 Loading @@ -3334,7 +3342,7 @@ process_handle_new(void) #define CHILD_STATE_CLOSEFD 7 #define CHILD_STATE_EXEC 8 #define CHILD_STATE_FAILEXEC 9 /** @} */ /** Start a program in the background. If <b>filename</b> contains a '/', then * it will be treated as an absolute or relative path. Otherwise, on * non-Windows systems, the system path will be searched for <b>filename</b>. Loading
src/common/util.h +3 −1 Original line number Diff line number Diff line Loading @@ -409,8 +409,10 @@ void set_environment_variable_in_smartlist(struct smartlist_t *env_vars, #define PROCESS_STATUS_ERROR -1 #ifdef UTIL_PRIVATE /*DOCDOC*/ /** Structure to represent the state of a process with which Tor is * communicating. The contents of this structure are private to util.c */ struct process_handle_t { /** One of the PROCESS_STATUS_* values */ int status; #ifdef _WIN32 HANDLE stdout_pipe; Loading
src/or/config.c +40 −19 Original line number Diff line number Diff line Loading @@ -675,11 +675,12 @@ static const config_format_t state_format = { /** Command-line and config-file options. */ static or_options_t *global_options = NULL; /** DOCDOC */ /** The fallback options_t object; this is where we look for options not * in torrc before we fall back to Tor's defaults. */ static or_options_t *global_default_options = NULL; /** Name of most recently read torrc file. */ static char *torrc_fname = NULL; /** DOCDOC */ /** Name of the most recently read torrc-defaults file.*/ static char *torrc_defaults_fname; /** Persistent serialized state. */ static or_state_t *global_state = NULL; Loading Loading @@ -4345,8 +4346,8 @@ get_windows_conf_root(void) } #endif /** Return the default location for our torrc file. * DOCDOC defaults_file */ /** Return the default location for our torrc file (if <b>defaults_file</b> is * false), or for the torrc-defaults file (if <b>defaults_file</b> is true). */ static const char * get_default_conf_file(int defaults_file) { Loading Loading @@ -4396,12 +4397,21 @@ check_nickname_list(const char *lst, const char *name, char **msg) return r; } /** Learn config file name from command line arguments, or use the default, * DOCDOC defaults_file */ /** Learn config file name from command line arguments, or use the default. * * If <b>defaults_file</b> is true, we're looking for torrc-defaults; * otherwise, we're looking for the regular torrc_file. * * Set *<b>using_default_fname</b> to true if we're using the default * configuration file name; or false if we've set it from the command line. * * Set *<b>ignore_missing_torrc</b> to true if we should ignore the resulting * filename if it doesn't exist. */ static char * find_torrc_filename(int argc, char **argv, int defaults_file, int *using_default_torrc, int *ignore_missing_torrc) int *using_default_fname, int *ignore_missing_torrc) { char *fname=NULL; int i; Loading @@ -4427,14 +4437,14 @@ find_torrc_filename(int argc, char **argv, fname = absfname; } *using_default_torrc = 0; *using_default_fname = 0; ++i; } else if (ignore_opt && !strcmp(argv[i],ignore_opt)) { *ignore_missing_torrc = 1; } } if (*using_default_torrc) { if (*using_default_fname) { /* didn't find one, try CONFDIR */ const char *dflt = get_default_conf_file(defaults_file); if (dflt && file_status(dflt) == FN_FILE) { Loading @@ -4458,8 +4468,13 @@ find_torrc_filename(int argc, char **argv, return fname; } /** Load torrc from disk, setting torrc_fname if successful. * DOCDOC defaults_file */ /** Load a configuration file from disk, setting torrc_fname or * torrc_defaults_fname if successful. * * If <b>defaults_file</b> is true, load torrc-defaults; otherwise load torrc. * * Return the contents of the file on success, and NULL on failure. */ static char * load_torrc_from_disk(int argc, char **argv, int defaults_file) { Loading Loading @@ -5455,7 +5470,10 @@ warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname) } SMARTLIST_FOREACH_END(port); } /** DOCDOC */ /** Given a list of port_cfg_t in <b>ports</b>, warn any controller port there * is listening on any non-loopback address. If <b>forbid</b> is true, * then emit a stronger warning and remove the port from the list. */ static void warn_nonlocal_controller_ports(smartlist_t *ports, unsigned forbid) { Loading Loading @@ -5839,9 +5857,11 @@ parse_port_config(smartlist_t *out, return retval; } /** DOCDOC */ /** Parse a list of config_line_t for an AF_UNIX unix socket listener option * from <b>cfg</b> and add them to <b>out</b>. No fancy options are * supported: the line contains nothing but the path to the AF_UNIX socket. */ static int parse_socket_config(smartlist_t *out, const config_line_t *cfg, parse_unix_socket_config(smartlist_t *out, const config_line_t *cfg, int listener_type) { Loading Loading @@ -5928,7 +5948,7 @@ parse_ports(const or_options_t *options, int validate_only, "configuration"); goto err; } if (parse_socket_config(ports, if (parse_unix_socket_config(ports, options->ControlSocket, CONN_TYPE_CONTROL_LISTENER) < 0) { *msg = tor_strdup("Invalid ControlSocket configuration"); Loading Loading @@ -5980,7 +6000,8 @@ parse_ports(const or_options_t *options, int validate_only, return retval; } /** DOCDOC */ /** Given a list of <b>port_cfg_t</b> in <b>ports</b>, check them for internal * consistency and warn as appropriate. */ static int check_server_ports(const smartlist_t *ports, const or_options_t *options) Loading
src/or/connection.c +9 −4 Original line number Diff line number Diff line Loading @@ -1659,7 +1659,8 @@ connection_send_socks5_connect(connection_t *conn) conn->proxy_state = PROXY_SOCKS5_WANT_CONNECT_OK; } /** DOCDOC */ /** Wrapper around fetch_from_(buf/evbuffer)_socks_client: see those functions * for documentation of its behavior. */ static int connection_fetch_from_buf_socks_client(connection_t *conn, int state, char **reason) Loading Loading @@ -2239,7 +2240,9 @@ global_write_bucket_low(connection_t *conn, size_t attempt, int priority) return 0; } /** DOCDOC */ /** Helper: adjusts our bandwidth history and informs the controller as * appropriate, given that we have just read <b>num_read</b> bytes and written * <b>num_written</b> bytes on <b>conn</b>. */ static void record_num_bytes_transferred_impl(connection_t *conn, time_t now, size_t num_read, size_t num_written) Loading Loading @@ -2270,7 +2273,8 @@ record_num_bytes_transferred_impl(connection_t *conn, } #ifdef USE_BUFFEREVENTS /** DOCDOC */ /** Wrapper around fetch_from_(buf/evbuffer)_socks_client: see those functions * for documentation of its behavior. */ static void record_num_bytes_transferred(connection_t *conn, time_t now, size_t num_read, size_t num_written) Loading Loading @@ -2592,7 +2596,8 @@ connection_get_rate_limit_totals(uint64_t *read_out, uint64_t *written_out) } } /** DOCDOC */ /** Perform whatever operations are needed on <b>conn</b> to enable * rate-limiting. */ void connection_enable_rate_limiting(connection_t *conn) { Loading