log_fn(LOG_INFO, "We now have a directory.");
/* just for testing */
- directory_initiate_command(router_pick_directory_server(),
- DIR_PURPOSE_FETCH_RENDDESC, "foo", 3);
+// directory_initiate_command(router_pick_directory_server(),
+// DIR_PURPOSE_FETCH_RENDDESC, "foo", 3);
rend_services_init(); /* get bob to initialize all his hidden services */
}
rend_service_descriptor_t *rend_parse_service_descriptor(
- const char *str, int len)
+ const char *str, int len)
{
rend_service_descriptor_t *result = NULL;
int keylen, asn1len, i;
keylen = crypto_pk_keysize(result->pk);
if (end-cp != keylen) goto truncated;
if (crypto_pk_public_checksig_digest(result->pk,
- (char*)str,cp-str, /* data */
- (char*)cp,end-cp /* signature*/
- )<0) {
+ (char*)str,cp-str, /* data */
+ (char*)cp,end-cp /* signature*/
+ )<0) {
log_fn(LOG_WARN, "Bad signature on service descriptor");
goto error;
}
p = smartlist_get(service->ports, i);
addr.s_addr = htonl(p->real_address);
log_fn(LOG_INFO,"Service maps port %d to %s:%d",
- p->virtual_port, inet_ntoa(addr), p->real_port);
+ p->virtual_port, inet_ntoa(addr), p->real_port);
}
}
}
r = tor_inet_aton(addrstring, &addr);
tor_free(addrstring);
if (!r) {
- log_fn(LOG_WARN,"Unparseable address in hidden service port configuration");
- return NULL;
+ log_fn(LOG_WARN,"Unparseable address in hidden service port configuration");
+ return NULL;
}
realport = strtol(colon+1, &endptr, 10);
if (*endptr) {
- log_fn(LOG_WARN,"Unparseable or missing port in hidden service port configuration.");
- return NULL;
+ log_fn(LOG_WARN,"Unparseable or missing port in hidden service port configuration.");
+ return NULL;
}
} else if (strchr(string, '.') && tor_inet_aton(string, &addr)) {
/* We have addr; use deafult port. */
/* No addr:port, no addr -- must be port. */
realport = strtol(string, &endptr, 10);
if (*endptr) {
- log_fn(LOG_WARN, "Unparseable of missing port in hidden service port configuration.");
- return NULL;
+ log_fn(LOG_WARN, "Unparseable of missing port in hidden service port configuration.");
+ return NULL;
}
addr.s_addr = htonl(0x7F000001u); /* Default to 127.0.0.1 */
}
for (line = options->RendConfigLines; line; line = line->next) {
if (!strcasecmp(line->key, "HiddenServiceDir")) {
if (service)
- add_service(service);
+ add_service(service);
service = tor_malloc_zero(sizeof(rend_service_t));
service->directory = tor_strdup(line->value);
service->ports = smartlist_create();
if (!strcasecmp(line->key, "HiddenServicePort")) {
portcfg = parse_port_config(line->value);
if (!portcfg) {
- rend_service_free(service);
- return -1;
+ rend_service_free(service);
+ return -1;
}
smartlist_add(service->ports, portcfg);
} else if (!strcasecmp(line->key, "HiddenServiceNodes")) {
/* Load key */
if (strlcpy(fname,s->directory,512) >= 512 ||
- strlcat(fname,"/private_key",512) >= 512) {
+ strlcat(fname,"/private_key",512) >= 512) {
log_fn(LOG_WARN, "Directory name too long: '%s'", s->directory);
return -1;
}
return -1;
}
if (strlcpy(fname,s->directory,512) >= 512 ||
- strlcat(fname,"/hostname",512) >= 512) {
+ strlcat(fname,"/hostname",512) >= 512) {
log_fn(LOG_WARN, "Directory name too long: '%s'", s->directory);
return -1;
}
* the second, creating it if necessary.
*/
static link_history_t *get_link_history(const char *from_name,
- const char *to_name)
+ const char *to_name)
{
or_history_t *orhist;
link_history_t *lhist;
* the OR 'to_name'.
*/
void rep_hist_note_extend_succeeded(const char *from_name,
- const char *to_name)
+ const char *to_name)
{
link_history_t *hist;
/* log_fn(LOG_WARN, "EXTEND SUCCEEDED: %s->%s",from_name,to_name); */
}
log(severity,
"OR %s: %ld/%ld good connections; uptime %ld/%ld sec (%.2f%%)",
- name1,
- or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
+ name1,
+ or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
upt, upt+downt, uptime*100.0);
strcpy(buffer, " Good extend attempts: ");
len = strlen(buffer);
for (lhist_it = strmap_iter_init(or_history->link_history_map);
- !strmap_iter_done(lhist_it);
- lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) {
+ !strmap_iter_done(lhist_it);
+ lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) {
strmap_iter_get(lhist_it, &name2, &link_history_p);
link_history = (link_history_t*) link_history_p;
len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
- link_history->n_extend_ok,
- link_history->n_extend_ok+link_history->n_extend_fail);
+ link_history->n_extend_ok,
+ link_history->n_extend_ok+link_history->n_extend_fail);
if (len >= 2048) {
- buffer[2047]='\0';
- break;
+ buffer[2047]='\0';
+ break;
}
}
log(severity, buffer);