diff options
author | Taylor Yu <catalyst@torproject.org> | 2019-04-10 17:04:09 -0500 |
---|---|---|
committer | Taylor Yu <catalyst@torproject.org> | 2019-04-30 13:18:46 -0500 |
commit | 983452e2215d27033ed91012a53c1b9ad3dd4a34 (patch) | |
tree | 77e4b6036c9bc8103853976472a7c25ef6686813 /src/feature/control/control.c | |
parent | 58ec88e8060508a253bbe8ba5c19b020a2629ea0 (diff) | |
download | tor-983452e2215d27033ed91012a53c1b9ad3dd4a34.tar.gz tor-983452e2215d27033ed91012a53c1b9ad3dd4a34.zip |
Run Coccinelle for control.c refactor
Diffstat (limited to 'src/feature/control/control.c')
-rw-r--r-- | src/feature/control/control.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/feature/control/control.c b/src/feature/control/control.c index 1f85bd3fc0..436bf423cf 100644 --- a/src/feature/control/control.c +++ b/src/feature/control/control.c @@ -401,7 +401,7 @@ connection_control_process_inbuf(control_connection_t *conn) return 0; else if (r == -1) { if (data_len + conn->incoming_cmd_cur_len > MAX_COMMAND_LINE_LENGTH) { - connection_write_str_to_buf("500 Line too long.\r\n", conn); + control_write_endreply(conn, 500, "Line too long."); connection_stop_reading(TO_CONN(conn)); connection_mark_and_flush(TO_CONN(conn)); } @@ -455,20 +455,20 @@ connection_control_process_inbuf(control_connection_t *conn) /* Otherwise, Quit is always valid. */ if (!strcasecmp(conn->current_cmd, "QUIT")) { - connection_write_str_to_buf("250 closing connection\r\n", conn); + control_write_endreply(conn, 250, "closing connection"); connection_mark_and_flush(TO_CONN(conn)); return 0; } if (conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH && !is_valid_initial_command(conn, conn->current_cmd)) { - connection_write_str_to_buf("514 Authentication required.\r\n", conn); + control_write_endreply(conn, 514, "Authentication required."); connection_mark_for_close(TO_CONN(conn)); return 0; } if (data_len >= UINT32_MAX) { - connection_write_str_to_buf("500 A 4GB command? Nice try.\r\n", conn); + control_write_endreply(conn, 500, "A 4GB command? Nice try."); connection_mark_for_close(TO_CONN(conn)); return 0; } |