mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Clean up formatting after Coccinelle
Clean up some minor formatting quirks after the Coccinelle run.
This commit is contained in:
parent
983452e221
commit
68caca58a8
@ -142,7 +142,8 @@ handle_control_authchallenge(control_connection_t *conn,
|
||||
|
||||
if (strcasecmp(smartlist_get(args->args, 0), "SAFECOOKIE")) {
|
||||
control_write_endreply(conn, 513,
|
||||
"AUTHCHALLENGE only supports SAFECOOKIE " "authentication");
|
||||
"AUTHCHALLENGE only supports SAFECOOKIE "
|
||||
"authentication");
|
||||
goto fail;
|
||||
}
|
||||
if (!authentication_cookie_is_set) {
|
||||
@ -154,13 +155,14 @@ handle_control_authchallenge(control_connection_t *conn,
|
||||
"2 arguments.\r\n", conn);
|
||||
*/
|
||||
control_printf_endreply(conn, 512,
|
||||
"AUTHCHALLENGE dislikes argument list %s",
|
||||
escaped(args->raw_body));
|
||||
"AUTHCHALLENGE dislikes argument list %s",
|
||||
escaped(args->raw_body));
|
||||
goto fail;
|
||||
}
|
||||
if (strcmp(args->kwargs->key, "")) {
|
||||
control_write_endreply(conn, 512,
|
||||
"AUTHCHALLENGE does not accept keyword " "arguments.");
|
||||
"AUTHCHALLENGE does not accept keyword "
|
||||
"arguments.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -222,9 +224,9 @@ handle_control_authchallenge(control_connection_t *conn,
|
||||
server_nonce, sizeof(server_nonce));
|
||||
|
||||
control_printf_endreply(conn, 250,
|
||||
"AUTHCHALLENGE SERVERHASH=%s " "SERVERNONCE=%s",
|
||||
server_hash_encoded,
|
||||
server_nonce_encoded);
|
||||
"AUTHCHALLENGE SERVERHASH=%s SERVERNONCE=%s",
|
||||
server_hash_encoded,
|
||||
server_nonce_encoded);
|
||||
|
||||
tor_free(client_nonce);
|
||||
return 0;
|
||||
@ -279,7 +281,9 @@ handle_control_authenticate(control_connection_t *conn,
|
||||
if (base16_decode(password, password_len+1, hex_passwd, strlen(hex_passwd))
|
||||
!= (int) password_len) {
|
||||
control_write_endreply(conn, 551,
|
||||
"Invalid hexadecimal encoding. Maybe you tried a plain text " "password? If so, the standard requires that you put it in " "double quotes.");
|
||||
"Invalid hexadecimal encoding. Maybe you tried a plain text "
|
||||
"password? If so, the standard requires that you put it in "
|
||||
"double quotes.");
|
||||
connection_mark_for_close(TO_CONN(conn));
|
||||
tor_free(password);
|
||||
return 0;
|
||||
|
@ -320,11 +320,11 @@ handle_control_getconf(control_connection_t *conn,
|
||||
if ((len = smartlist_len(unrecognized))) {
|
||||
for (i=0; i < len-1; ++i)
|
||||
control_printf_midreply(conn, 552,
|
||||
"Unrecognized configuration key \"%s\"",
|
||||
(char*)smartlist_get(unrecognized, i));
|
||||
"Unrecognized configuration key \"%s\"",
|
||||
(char*)smartlist_get(unrecognized, i));
|
||||
control_printf_endreply(conn, 552,
|
||||
"Unrecognized configuration key \"%s\"",
|
||||
(char*)smartlist_get(unrecognized, len-1));
|
||||
"Unrecognized configuration key \"%s\"",
|
||||
(char*)smartlist_get(unrecognized, len-1));
|
||||
} else if ((len = smartlist_len(answers))) {
|
||||
char *tmp = smartlist_get(answers, len-1);
|
||||
tor_assert(strlen(tmp)>4);
|
||||
@ -424,8 +424,7 @@ handle_control_setevents(control_connection_t *conn,
|
||||
}
|
||||
|
||||
if (event_code == -1) {
|
||||
control_printf_endreply(conn, 552, "Unrecognized event \"%s\"",
|
||||
ev);
|
||||
control_printf_endreply(conn, 552, "Unrecognized event \"%s\"", ev);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -489,8 +488,7 @@ handle_control_signal(control_connection_t *conn,
|
||||
}
|
||||
|
||||
if (sig < 0)
|
||||
control_printf_endreply(conn, 552, "Unrecognized signal code \"%s\"",
|
||||
s);
|
||||
control_printf_endreply(conn, 552, "Unrecognized signal code \"%s\"", s);
|
||||
if (sig < 0)
|
||||
return 0;
|
||||
|
||||
@ -777,7 +775,7 @@ handle_control_extendcircuit(control_connection_t *conn,
|
||||
intended_purpose = circuit_purpose_from_string(purpose_line->value);
|
||||
if (intended_purpose == CIRCUIT_PURPOSE_UNKNOWN) {
|
||||
control_printf_endreply(conn, 552, "Unknown purpose \"%s\"",
|
||||
purpose_line->value);
|
||||
purpose_line->value);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@ -882,7 +880,7 @@ handle_control_extendcircuit(control_connection_t *conn,
|
||||
}
|
||||
|
||||
control_printf_endreply(conn, 250, "EXTENDED %lu",
|
||||
(unsigned long)circ->global_identifier);
|
||||
(unsigned long)circ->global_identifier);
|
||||
if (zero_circ) /* send a 'launched' event, for completeness */
|
||||
circuit_event_status(circ, CIRC_EVENT_LAUNCHED, 0);
|
||||
done:
|
||||
@ -922,7 +920,7 @@ handle_control_setcircuitpurpose(control_connection_t *conn,
|
||||
new_purpose = circuit_purpose_from_string(purp->value);
|
||||
if (new_purpose == CIRCUIT_PURPOSE_UNKNOWN) {
|
||||
control_printf_endreply(conn, 552, "Unknown purpose \"%s\"",
|
||||
purp->value);
|
||||
purp->value);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@ -970,7 +968,7 @@ handle_control_attachstream(control_connection_t *conn,
|
||||
&hop_line_ok, NULL);
|
||||
if (!hop_line_ok) { /* broken hop line */
|
||||
control_printf_endreply(conn, 552, "Bad value hop=%s",
|
||||
hoparg->value);
|
||||
hoparg->value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1052,7 +1050,7 @@ handle_control_postdescriptor(control_connection_t *conn,
|
||||
if (line) {
|
||||
purpose = router_purpose_from_string(line->value);
|
||||
control_printf_endreply(conn, 552, "Unknown purpose \"%s\"",
|
||||
line->value);
|
||||
line->value);
|
||||
goto done;
|
||||
}
|
||||
line = config_line_find_case(args->kwargs, "cache");
|
||||
@ -1063,7 +1061,7 @@ handle_control_postdescriptor(control_connection_t *conn,
|
||||
cache = 1;
|
||||
else {
|
||||
control_printf_endreply(conn, 552, "Unknown cache request \"%s\"",
|
||||
line->value);
|
||||
line->value);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@ -1105,7 +1103,7 @@ handle_control_redirectstream(control_connection_t *conn,
|
||||
if (!(ap_conn = get_stream(smartlist_get(args, 0)))
|
||||
|| !ap_conn->socks_request) {
|
||||
control_printf_endreply(conn, 552, "Unknown stream \"%s\"",
|
||||
(char*)smartlist_get(args, 0));
|
||||
(char*)smartlist_get(args, 0));
|
||||
} else {
|
||||
int ok = 1;
|
||||
if (smartlist_len(args) > 2) { /* they included a port too */
|
||||
@ -1114,7 +1112,7 @@ handle_control_redirectstream(control_connection_t *conn,
|
||||
}
|
||||
if (!ok) {
|
||||
control_printf_endreply(conn, 512, "Cannot parse port \"%s\"",
|
||||
(char*)smartlist_get(args, 2));
|
||||
(char*)smartlist_get(args, 2));
|
||||
} else {
|
||||
new_addr = tor_strdup(smartlist_get(args, 1));
|
||||
}
|
||||
@ -1153,13 +1151,13 @@ handle_control_closestream(control_connection_t *conn,
|
||||
|
||||
if (!(ap_conn = get_stream(smartlist_get(args, 0))))
|
||||
control_printf_endreply(conn, 552, "Unknown stream \"%s\"",
|
||||
(char*)smartlist_get(args, 0));
|
||||
(char*)smartlist_get(args, 0));
|
||||
else {
|
||||
reason = (uint8_t) tor_parse_ulong(smartlist_get(args,1), 10, 0, 255,
|
||||
&ok, NULL);
|
||||
if (!ok) {
|
||||
control_printf_endreply(conn, 552, "Unrecognized reason \"%s\"",
|
||||
(char*)smartlist_get(args, 1));
|
||||
(char*)smartlist_get(args, 1));
|
||||
ap_conn = NULL;
|
||||
}
|
||||
}
|
||||
@ -1275,7 +1273,7 @@ handle_control_protocolinfo(control_connection_t *conn,
|
||||
});
|
||||
if (bad_arg) {
|
||||
control_printf_endreply(conn, 513, "No such version %s",
|
||||
escaped(bad_arg));
|
||||
escaped(bad_arg));
|
||||
/* Don't tolerate bad arguments when not authenticated. */
|
||||
if (!STATE_IS_OPEN(TO_CONN(conn)->state))
|
||||
connection_mark_for_close(TO_CONN(conn));
|
||||
@ -1340,7 +1338,7 @@ handle_control_usefeature(control_connection_t *conn,
|
||||
;
|
||||
else {
|
||||
control_printf_endreply(conn, 552, "Unrecognized feature \"%s\"",
|
||||
arg);
|
||||
arg);
|
||||
bad = 1;
|
||||
break;
|
||||
}
|
||||
@ -1423,8 +1421,7 @@ handle_control_hsfetch(control_connection_t *conn,
|
||||
version = HS_VERSION_THREE;
|
||||
hs_parse_address(hsaddress, &v3_pk, NULL, NULL);
|
||||
} else {
|
||||
control_printf_endreply(conn, 513, "Invalid argument \"%s\"",
|
||||
arg1);
|
||||
control_printf_endreply(conn, 513, "Invalid argument \"%s\"", arg1);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1434,8 +1431,7 @@ handle_control_hsfetch(control_connection_t *conn,
|
||||
|
||||
const node_t *node = node_get_by_hex_id(server, 0);
|
||||
if (!node) {
|
||||
control_printf_endreply(conn, 552, "Server \"%s\" not found",
|
||||
server);
|
||||
control_printf_endreply(conn, 552, "Server \"%s\" not found", server);
|
||||
goto done;
|
||||
}
|
||||
if (!hsdirs) {
|
||||
@ -1514,7 +1510,7 @@ handle_control_hspost(control_connection_t *conn,
|
||||
|
||||
if (!node || !node->rs) {
|
||||
control_printf_endreply(conn, 552, "Server \"%s\" not found",
|
||||
server);
|
||||
server);
|
||||
goto done;
|
||||
}
|
||||
/* Valid server, add it to our local list. */
|
||||
@ -1736,7 +1732,7 @@ handle_control_add_onion(control_connection_t *conn,
|
||||
non_anonymous = 1;
|
||||
} else {
|
||||
control_printf_endreply(conn, 512, "Invalid 'Flags' argument: %s",
|
||||
escaped(flag));
|
||||
escaped(flag));
|
||||
bad = 1;
|
||||
break;
|
||||
}
|
||||
@ -1811,8 +1807,8 @@ handle_control_add_onion(control_connection_t *conn,
|
||||
* (I've deliberately written them out in full here to aid searchability.)
|
||||
*/
|
||||
control_printf_endreply(conn, 512,
|
||||
"Tor is in %sanonymous hidden service " "mode",
|
||||
non_anonymous ? "" : "non-");
|
||||
"Tor is in %sanonymous hidden service " "mode",
|
||||
non_anonymous ? "" : "non-");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1872,7 +1868,7 @@ handle_control_add_onion(control_connection_t *conn,
|
||||
if (key_new_alg) {
|
||||
tor_assert(key_new_blob);
|
||||
control_printf_midreply(conn, 250, "PrivateKey=%s:%s",
|
||||
key_new_alg, key_new_blob);
|
||||
key_new_alg, key_new_blob);
|
||||
}
|
||||
if (auth_created_clients) {
|
||||
SMARTLIST_FOREACH(auth_created_clients, rend_authorized_client_t *, ac, {
|
||||
@ -2355,7 +2351,7 @@ handle_single_control_command(const control_cmd_def_t *def,
|
||||
&err);
|
||||
if (!parsed_args) {
|
||||
control_printf_endreply(conn, 512, "Bad arguments to %s: %s",
|
||||
conn->current_cmd, err?err:"");
|
||||
conn->current_cmd, err?err:"");
|
||||
tor_free(err);
|
||||
} else {
|
||||
if (BUG(err))
|
||||
@ -2396,7 +2392,7 @@ handle_control_command(control_connection_t *conn,
|
||||
}
|
||||
|
||||
control_printf_endreply(conn, 510, "Unrecognized command \"%s\"",
|
||||
conn->current_cmd);
|
||||
conn->current_cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user