commit 2207525a69702a13ad0b3c0346b8c3fdb90824c0 Author: George Kadianakis desnacked@riseup.net Date: Wed Dec 5 19:16:04 2012 +0200
Satisfy check-spaces. --- src/or/config.c | 2 +- src/or/connection_or.c | 41 ++++++++++++++++++++++++++--------------- src/or/control.c | 2 +- src/or/control.h | 2 +- src/or/transports.c | 3 ++- 5 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/src/or/config.c b/src/or/config.c index 6dad019..19da45a 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1474,7 +1474,7 @@ options_act(const or_options_t *old_options) return -1; }
- if (init_control_auth_cookie_authentication(options->CookieAuthentication) < 0) { + if (init_control_cookie_authentication(options->CookieAuthentication) < 0) { log_warn(LD_CONFIG,"Error creating control cookie authentication file."); return -1; } diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 089bb06..d6d74a7 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -2498,7 +2498,8 @@ connection_ext_or_transition(or_connection_t *conn) /** Length of the header of the cookie file. */ #define EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN 32 /** Total length of the cookie file. */ -#define EXT_OR_PORT_AUTH_COOKIE_FILE_LEN EXT_OR_PORT_AUTH_COOKIE_LEN+EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN +#define EXT_OR_PORT_AUTH_COOKIE_FILE_LEN \ + EXT_OR_PORT_AUTH_COOKIE_LEN+EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN /** Static cookie file header. */ #define EXT_OR_PORT_AUTH_COOKIE_HEADER "! Extended ORPort Auth Cookie !\x0a" /** Length of safe-cookie protocol hashes. */ @@ -2506,8 +2507,10 @@ connection_ext_or_transition(or_connection_t *conn) /** Length of safe-cookie protocol nonces. */ #define EXT_OR_PORT_AUTH_NONCE_LEN 32 /** Safe-cookie protocol constants. */ -#define EXT_OR_PORT_AUTH_SERVER_TO_CLIENT_CONST "ExtORPort authentication server-to-client hash" -#define EXT_OR_PORT_AUTH_CLIENT_TO_SERVER_CONST "ExtORPort authentication client-to-server hash" +#define EXT_OR_PORT_AUTH_SERVER_TO_CLIENT_CONST \ + "ExtORPort authentication server-to-client hash" +#define EXT_OR_PORT_AUTH_CLIENT_TO_SERVER_CONST \ + "ExtORPort authentication client-to-server hash"
/** If true, we've set ext_or_auth_cookie to a secret code and stored * it to disk. */ @@ -2523,7 +2526,8 @@ char * get_ext_or_auth_cookie_file(void) { const or_options_t *options = get_options(); - if (options->ExtORPortCookieAuthFile && strlen(options->ExtORPortCookieAuthFile)) { + if (options->ExtORPortCookieAuthFile && + strlen(options->ExtORPortCookieAuthFile)) { return tor_strdup(options->ExtORPortCookieAuthFile); } else { return get_datadir_fname("extended_orport_auth_cookie"); @@ -2554,7 +2558,8 @@ init_ext_or_auth_cookie_authentication(int is_enabled) return -1; ext_or_auth_cookie_is_set = 1;
- memcpy(cookie_file_string, EXT_OR_PORT_AUTH_COOKIE_HEADER, EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN); + memcpy(cookie_file_string, EXT_OR_PORT_AUTH_COOKIE_HEADER, + EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN); memcpy(cookie_file_string+EXT_OR_PORT_AUTH_COOKIE_HEADER_LEN, ext_or_auth_cookie, EXT_OR_PORT_AUTH_COOKIE_LEN);
@@ -2624,7 +2629,8 @@ connection_ext_or_auth_handle_client_nonce(connection_t *conn) if (connection_get_inbuf_len(conn) < EXT_OR_PORT_AUTH_NONCE_LEN) return 0;
- if (connection_fetch_from_buf(client_nonce, EXT_OR_PORT_AUTH_NONCE_LEN, conn) < 0) /* XXX check-spaces */ + if (connection_fetch_from_buf(client_nonce, + EXT_OR_PORT_AUTH_NONCE_LEN, conn) < 0) /* XXX check-spaces */ return -1;
/* Get our nonce */ @@ -2679,7 +2685,7 @@ connection_ext_or_auth_handle_client_nonce(connection_t *conn) tor_free(hmac_c_msg); }
- { /* debug logging */ /* XXX disable this codepath if not logging on debug? */ + { /* debug logging */ /* XXX disable this codepath if not logging on debug?*/ char server_hash_encoded[(2*EXT_OR_PORT_AUTH_HASH_LEN) + 1]; char server_nonce_encoded[(2*EXT_OR_PORT_AUTH_NONCE_LEN) + 1]; char client_nonce_encoded[(2*EXT_OR_PORT_AUTH_NONCE_LEN) + 1]; @@ -2691,13 +2697,15 @@ connection_ext_or_auth_handle_client_nonce(connection_t *conn) base16_encode(client_nonce_encoded, sizeof(client_nonce_encoded), client_nonce, sizeof(client_nonce));
- log_warn(LD_GENERAL, "server_hash: '%s'\nserver_nonce: '%s'\nclient_nonce: '%s'", + log_warn(LD_GENERAL, + "server_hash: '%s'\nserver_nonce: '%s'\nclient_nonce: '%s'", server_hash_encoded, server_nonce_encoded, client_nonce_encoded); }
{ /* write reply: (server_hash, server_nonce) */ memcpy(reply, server_hash, EXT_OR_PORT_AUTH_HASH_LEN); - memcpy(reply + EXT_OR_PORT_AUTH_HASH_LEN, server_nonce, EXT_OR_PORT_AUTH_NONCE_LEN); + memcpy(reply + EXT_OR_PORT_AUTH_HASH_LEN, server_nonce, + EXT_OR_PORT_AUTH_NONCE_LEN); connection_write_to_buf(reply, sizeof(reply), conn); }
@@ -2738,7 +2746,8 @@ connection_ext_or_auth_handle_client_hash(connection_t *conn) if (connection_get_inbuf_len(conn) < EXT_OR_PORT_AUTH_HASH_LEN) return 0;
- if (connection_fetch_from_buf(provided_client_hash, EXT_OR_PORT_AUTH_HASH_LEN, conn) < 0) + if (connection_fetch_from_buf(provided_client_hash, + EXT_OR_PORT_AUTH_HASH_LEN, conn) < 0) return -1;
if (tor_memneq(TO_OR_CONN(conn)->ext_or_auth_correct_client_hash, @@ -2789,7 +2798,6 @@ connection_ext_or_auth_process_inbuf(or_connection_t *or_conn) #define EXT_OR_CMD_BT_DENY 0x1001 #define EXT_OR_CMD_BT_CONTROL 0x1002
- /** Process a USERADDR command from the Extended * ORPort. <b>payload</b> is a payload of size <b>len</b>. * @@ -2798,7 +2806,8 @@ connection_ext_or_auth_process_inbuf(or_connection_t *or_conn) * * Return 0 on success and -1 on error. */ static int -connection_ext_or_handle_useraddr(connection_t *conn, char *payload, uint16_t len) +connection_ext_or_handle_useraddr(connection_t *conn, + char *payload, uint16_t len) { /* Copy address string. */ tor_addr_t addr; @@ -2824,7 +2833,7 @@ connection_ext_or_handle_useraddr(connection_t *conn, char *payload, uint16_t le char *old_address = tor_dup_addr(&conn->addr); char *new_address = tor_dup_addr(&addr);
- log_warn(LD_NET, "Received USERADDR." /* XXX FIX ALL LOG SEVERITIES AND MESSAGES */ + log_warn(LD_NET, "Received USERADDR." /* XXX Fix log severities/messages */ "We rewrite our address from '%s:%u' to '%s:%u'.", safe_str(old_address), conn->port, safe_str(new_address), port);
@@ -2888,10 +2897,11 @@ connection_ext_or_process_inbuf(or_connection_t *or_conn) conn->state = EXT_OR_CONN_STATE_FLUSHING; connection_stop_reading(conn); } else if (command->cmd == EXT_OR_CMD_TB_USERADDR) { - if (connection_ext_or_handle_useraddr(conn, command->body, command->len) < 0) + if (connection_ext_or_handle_useraddr(conn, + command->body, command->len) < 0) goto err; } else { - log_notice(LD_NET, "Got an Extended ORPort command we don't understand (%u).", + log_notice(LD_NET,"Got Extended ORPort command we don't regognize (%u).", command->cmd); }
@@ -2935,3 +2945,4 @@ connection_ext_or_start_auth(or_connection_t *or_conn)
return 0; } + diff --git a/src/or/control.c b/src/or/control.c index e83a8e0..faf7942 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -4451,7 +4451,7 @@ get_cookie_file(void) * authorized to use the control connection. Return -1 if we can't * write the file, or 0 on success. */ int -init_control_auth_cookie_authentication(int enabled) +init_control_cookie_authentication(int enabled) { char *fname; if (!enabled) { diff --git a/src/or/control.h b/src/or/control.h index 663824c..288c286 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -77,7 +77,7 @@ int control_event_buildtimeout_set(const circuit_build_times_t *cbt, buildtimeout_set_event_t type); int control_event_signal(uintptr_t signal);
-int init_control_auth_cookie_authentication(int enabled); +int init_control_cookie_authentication(int enabled); smartlist_t *decode_hashed_passwords(config_line_t *passwords); void disable_control_logging(void); void enable_control_logging(void); diff --git a/src/or/transports.c b/src/or/transports.c index 474a9db..8beb9a5c 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1268,7 +1268,8 @@ create_managed_proxy_environment(const managed_proxy_t *mp)
smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s", ext_or_addrport_tmp); - smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s", cookie_file_loc); + smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s", + cookie_file_loc);
tor_free(ext_or_addrport_tmp); tor_free(cookie_file_loc);
tor-commits@lists.torproject.org