aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control/control_cmd.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-09 10:09:38 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-25 14:13:03 -0400
commitddd33d39c7e115045d296dd88fd4d310b932a4e1 (patch)
treeb9b5bb1550b1e6f098a27c4d758446404b4221a2 /src/feature/control/control_cmd.c
parent8799b4e805ed5495409b6036b82d08e4624bacd3 (diff)
downloadtor-ddd33d39c7e115045d296dd88fd4d310b932a4e1.tar.gz
tor-ddd33d39c7e115045d296dd88fd4d310b932a4e1.zip
Port the authenticate and authchallenge commands to the new parser
These two presented their own challenge, because of their use of QString, and their distinguished handling of quoted versus non-quoted values.
Diffstat (limited to 'src/feature/control/control_cmd.c')
-rw-r--r--src/feature/control/control_cmd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c
index 0b4f3555ff..a29ab72ffa 100644
--- a/src/feature/control/control_cmd.c
+++ b/src/feature/control/control_cmd.c
@@ -116,6 +116,11 @@ control_cmd_parse_args(const char *command,
result->command = command;
+ if (syntax->store_raw_body) {
+ tor_assert(body[body_len] == 0);
+ result->raw_body = body;
+ }
+
const char *eol = memchr(body, '\n', body_len);
if (syntax->want_object) {
if (! eol || (eol+1) == body+body_len) {
@@ -2309,7 +2314,7 @@ static const control_cmd_def_t CONTROL_COMMANDS[] =
ONE_LINE_PARSED(getconf, 0),
MULTLINE_PARSED(loadconf, 0),
ONE_LINE_PARSED(setevents, 0),
- ONE_LINE(authenticate, legacy, CMD_FL_WIPE),
+ ONE_LINE_PARSED(authenticate, CMD_FL_WIPE),
ONE_LINE_PARSED(saveconf, 0),
ONE_LINE_PARSED(signal, 0),
ONE_LINE_PARSED(takeownership, 0),
@@ -2327,7 +2332,7 @@ static const control_cmd_def_t CONTROL_COMMANDS[] =
ONE_LINE_PARSED(usefeature, 0),
ONE_LINE_PARSED(resolve, 0),
ONE_LINE_PARSED(protocolinfo, 0),
- ONE_LINE(authchallenge, legacy, CMD_FL_WIPE),
+ ONE_LINE_PARSED(authchallenge, CMD_FL_WIPE),
ONE_LINE_PARSED(dropguards, 0),
ONE_LINE_PARSED(hsfetch, 0),
MULTLINE_PARSED(hspost, 0),