aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-28 23:57:59 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-28 23:57:59 +0000
commit907fc6c73ec7797361e53286e91c1bf21efa11d2 (patch)
tree77388f8888bff7b5b795beeddc14330fce3819fc /src/or/config.c
parent1a444e089a9bbe840c9b14ddabe515461cb56575 (diff)
downloadtor-907fc6c73ec7797361e53286e91c1bf21efa11d2.tar.gz
tor-907fc6c73ec7797361e53286e91c1bf21efa11d2.zip
r8977@Kushana: nickm | 2006-09-28 19:56:41 -0400
Make "is a v1 authority", "is a v2 authority", and "is a hidden service authority" into separate flags so we can eventually migrate more trust away from moria. svn:r8523
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/or/config.c b/src/or/config.c
index b77e733379..d785cae9aa 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3244,7 +3244,8 @@ parse_dir_server_line(const char *line, int validate_only)
char *addrport=NULL, *address=NULL, *nickname=NULL, *fingerprint=NULL;
uint16_t port;
char digest[DIGEST_LEN];
- int is_v1_authority = 0;
+ int is_v1_authority = 0, is_hidserv_authority = 0,
+ is_not_hidserv_authority = 0, is_v2_authority = 1;
items = smartlist_create();
smartlist_split_string(items, line, NULL,
@@ -3260,13 +3261,29 @@ parse_dir_server_line(const char *line, int validate_only)
smartlist_del_keeporder(items, 0);
}
- if (!strcmp(smartlist_get(items, 0), "v1")) {
- char *v1 = smartlist_get(items, 0);
- tor_free(v1);
- is_v1_authority = 1;
+ while (smartlist_len(items)) {
+ char *flag = smartlist_get(items, 0);
+ if (TOR_ISDIGIT(flag[0]))
+ break;
+ if (!strcasecmp(flag, "v1")) {
+ is_v1_authority = is_hidserv_authority = 1;
+ } else if (!strcasecmp(flag, "hs")) {
+ is_hidserv_authority = 1;
+ } else if (!strcasecmp(flag, "no-hs")) {
+ is_not_hidserv_authority = 1;
+ } else if (!strcasecmp(flag, "no-v2")) {
+ is_v2_authority = 0;
+ } else {
+ log_warn(LD_CONFIG, "Unrecognized flag '%s' on DirServer line",
+ flag);
+ }
+ tor_free(flag);
smartlist_del_keeporder(items, 0);
}
+ if (is_not_hidserv_authority)
+ is_hidserv_authority = 0;
+
if (smartlist_len(items) < 2) {
log_warn(LD_CONFIG, "Too few arguments to DirServer line.");
goto err;
@@ -3295,7 +3312,9 @@ parse_dir_server_line(const char *line, int validate_only)
if (!validate_only) {
log_debug(LD_DIR, "Trusted dirserver at %s:%d (%s)", address, (int)port,
(char*)smartlist_get(items,1));
- add_trusted_dir_server(nickname, address, port, digest, is_v1_authority);
+ add_trusted_dir_server(nickname, address, port, digest, is_v1_authority,
+ is_v2_authority, is_hidserv_authority);
+
}
r = 0;