summaryrefslogtreecommitdiff
path: root/src/feature/dirparse/microdesc_parse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-23 19:55:12 -0400
committerNick Mathewson <nickm@torproject.org>2018-11-19 08:26:10 -0500
commit426c9561c5f5bc5f38a42f3e46437db59fcdc7c0 (patch)
treed2e05ca6dbe3e35486e4e5d4d50d23d9daa9cddb /src/feature/dirparse/microdesc_parse.c
parent83be4d2bbd7a4ed584f42d043558a4026c4a449d (diff)
downloadtor-426c9561c5f5bc5f38a42f3e46437db59fcdc7c0.tar.gz
tor-426c9561c5f5bc5f38a42f3e46437db59fcdc7c0.zip
Use nodefamily_t in microdescriptors.
Closes ticket 27359.
Diffstat (limited to 'src/feature/dirparse/microdesc_parse.c')
-rw-r--r--src/feature/dirparse/microdesc_parse.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/feature/dirparse/microdesc_parse.c b/src/feature/dirparse/microdesc_parse.c
index aebff5a35f..8ad9626377 100644
--- a/src/feature/dirparse/microdesc_parse.c
+++ b/src/feature/dirparse/microdesc_parse.c
@@ -18,6 +18,7 @@
#include "feature/dirparse/routerparse.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/nickname.h"
+#include "feature/nodelist/nodefamily.h"
#include "feature/relay/router.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_ed25519.h"
@@ -32,7 +33,7 @@ static token_rule_t microdesc_token_table[] = {
T01("ntor-onion-key", K_ONION_KEY_NTOR, GE(1), NO_OBJ ),
T0N("id", K_ID, GE(2), NO_OBJ ),
T0N("a", K_A, GE(1), NO_OBJ ),
- T01("family", K_FAMILY, ARGS, NO_OBJ ),
+ T01("family", K_FAMILY, CONCAT_ARGS, NO_OBJ ),
T01("p", K_P, CONCAT_ARGS, NO_OBJ ),
T01("p6", K_P6, CONCAT_ARGS, NO_OBJ ),
A01("@last-listed", A_LAST_LISTED, CONCAT_ARGS, NO_OBJ ),
@@ -222,16 +223,9 @@ microdescs_parse_from_string(const char *s, const char *eos,
}
if ((tok = find_opt_by_keyword(tokens, K_FAMILY))) {
- int i;
- md->family = smartlist_new();
- for (i=0;i<tok->n_args;++i) {
- if (!is_legal_nickname_or_hexdigest(tok->args[i])) {
- log_warn(LD_DIR, "Illegal nickname %s in family line",
- escaped(tok->args[i]));
- goto next;
- }
- smartlist_add_strdup(md->family, tok->args[i]);
- }
+ md->family = nodefamily_parse(tok->args[0],
+ NULL,
+ NF_WARN_MALFORMED);
}
if ((tok = find_opt_by_keyword(tokens, K_P))) {