[or-cvs] Make preferred/excluded intro points configurable
Nick Mathewson
nickm at seul.org
Fri Apr 2 22:06:48 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv27884/src/or
Modified Files:
config.c rendservice.c
Log Message:
Make preferred/excluded intro points configurable
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- config.c 1 Apr 2004 20:33:28 -0000 1.104
+++ config.c 2 Apr 2004 22:06:46 -0000 1.105
@@ -215,8 +215,10 @@
config_compare(list, "User", CONFIG_TYPE_STRING, &options->User) ||
config_compare(list, "RunTesting", CONFIG_TYPE_BOOL, &options->RunTesting) ||
- config_compare(list, "HiddenServiceDir", CONFIG_TYPE_LINELIST, &options->RendConfigLines) ||
- config_compare(list, "HiddenServicePort", CONFIG_TYPE_LINELIST, &options->RendConfigLines)
+ config_compare(list, "HiddenServiceDir", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServicePort", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServiceNodes", CONFIG_TYPE_LINELIST, &options->RendConfigLines)||
+ config_compare(list, "HiddenServiceExcludeNodes", CONFIG_TYPE_LINELIST, &options->RendConfigLines)
) {
/* then we're ok. it matched something. */
} else {
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- rendservice.c 2 Apr 2004 21:56:52 -0000 1.8
+++ rendservice.c 2 Apr 2004 22:06:46 -0000 1.9
@@ -22,6 +22,8 @@
/* Fields specified in config file */
char *directory;
smartlist_t *ports;
+ char *intro_nodes;
+ char *intro_exclude_nodes;
/* Other fields */
crypto_pk_env_t *private_key;
char service_id[REND_SERVICE_ID_LEN+1];
@@ -165,19 +167,33 @@
service = tor_malloc_zero(sizeof(rend_service_t));
service->directory = tor_strdup(line->value);
service->ports = smartlist_create();
- } else {
- assert(!strcasecmp(line->key, "HiddenServicePort"));
- if (!service) {
- log_fn(LOG_WARN, "HiddenServicePort with no preceeding HiddenServiceDir directive");
- rend_service_free(service);
- return -1;
- }
+ continue;
+ }
+ if (!service) {
+ log_fn(LOG_WARN, "HiddenServicePort with no preceeding HiddenServiceDir directive");
+ rend_service_free(service);
+ return -1;
+ }
+ if (!strcasecmp(line->key, "HiddenServicePort")) {
portcfg = parse_port_config(line->value);
if (!portcfg) {
rend_service_free(service);
return -1;
}
smartlist_add(service->ports, portcfg);
+ } else if (!strcasecmp(line->key, "HiddenServiceNodes")) {
+ if (service->intro_nodes) {
+ log_fn(LOG_WARN, "Got multiple HiddenServiceNodes lines for a single service");
+ return -1;
+ }
+ service->intro_nodes = tor_strdup(line->value);
+ } else {
+ assert(!strcasecmp(line->key, "HiddenServiceExcludeNodes"));
+ if (service->intro_exclude_nodes) {
+ log_fn(LOG_WARN, "Got multiple HiddenServiceExcludedNodes lines for a single service");
+ return -1;
+ }
+ service->intro_exclude_nodes = tor_strdup(line->value);
}
}
if (service)
More information about the tor-commits
mailing list