summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-09 06:40:32 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-09 06:40:32 +0000
commit48a0b6c476dee067685a66a955cdffc8a37ea9d3 (patch)
treebe7cf99ec4d744cfd5448926e761ad556ee44985 /src/or/control.c
parent005b02fd57136b2deb53185458cbedd9c2d7c1a6 (diff)
downloadtor-48a0b6c476dee067685a66a955cdffc8a37ea9d3.tar.gz
tor-48a0b6c476dee067685a66a955cdffc8a37ea9d3.zip
Separate is-recognized-option from get-option-value, since NULL is ambiguous and returning "" misrepresents.
svn:r2731
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index bc5cfeea82..57ef6f484e 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -146,7 +146,7 @@ send_control_message(connection_t *conn, uint16_t type, uint16_t len,
{
char buf[4];
tor_assert(conn);
- tor_assert(len || !body);
+ tor_assert(len || !body || !strlen(body));
tor_assert(type <= _CONTROL_CMD_MAX_RECOGNIZED);
set_uint32(buf, htons(len));
set_uint32(buf+2, htons(type));
@@ -249,11 +249,13 @@ handle_control_getconf(connection_t *conn, uint16_t body_len, const char *body)
answers = smartlist_create();
SMARTLIST_FOREACH(questions, const char *, q,
{
- struct config_line_t *answer = config_get_assigned_option(options,q);
- if (!answer) {
+ int recognized = config_option_is_recognized(q);
+ if (!recognized) {
send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, body);
goto done;
} else {
+ struct config_line_t *answer = config_get_assigned_option(options,q);
+
while (answer) {
struct config_line_t *next;
size_t alen = strlen(answer->key)+strlen(answer->value)+2;