svn:r1456
This commit is contained in:
Roger Dingledine 2004-04-03 02:14:20 +00:00
parent 8c19d6e3d7
commit 4e996a4ce8
4 changed files with 28 additions and 28 deletions

View File

@ -282,8 +282,8 @@ void directory_has_arrived(void) {
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 */

View File

@ -62,7 +62,7 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc,
}
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;
@ -95,9 +95,9 @@ rend_service_descriptor_t *rend_parse_service_descriptor(
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;
}

View File

@ -89,7 +89,7 @@ static void add_service(rend_service_t *service)
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);
}
}
}
@ -126,13 +126,13 @@ static rend_service_port_config_t *parse_port_config(const char *string)
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. */
@ -141,8 +141,8 @@ static rend_service_port_config_t *parse_port_config(const char *string)
/* 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 */
}
@ -173,7 +173,7 @@ int rend_config_services(or_options_t *options)
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();
@ -188,8 +188,8 @@ int rend_config_services(or_options_t *options)
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")) {
@ -257,7 +257,7 @@ int rend_service_init_keys(void)
/* 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;
}
@ -275,7 +275,7 @@ int rend_service_init_keys(void)
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;
}

View File

@ -42,7 +42,7 @@ static or_history_t *get_or_history(const char* nickname)
* 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;
@ -152,7 +152,7 @@ void rep_hist_note_connection_died(const char* nickname, time_t when)
* 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); */
@ -204,23 +204,23 @@ void rep_hist_dump_stats(time_t now, int severity)
}
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);