[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11120: Fix a segfault in cert retrieval (in tor/trunk: . src/or)
Author: nickm
Date: 2007-08-15 11:38:53 -0400 (Wed, 15 Aug 2007)
New Revision: 11120
Modified:
tor/trunk/
tor/trunk/src/or/directory.c
Log:
r14031@Kushana: nickm | 2007-08-15 11:34:26 -0400
Fix a segfault in cert retrieval
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r14031] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-08-15 15:36:34 UTC (rev 11119)
+++ tor/trunk/src/or/directory.c 2007-08-15 15:38:53 UTC (rev 11120)
@@ -2012,11 +2012,10 @@
smartlist_t *certs = smartlist_create();
int compressed;
ssize_t len = -1;
- url += strlen("/tor/keys/");
compressed = !strcmpend(url, ".z");
if (compressed)
url[strlen(url)-2] = '\0';
- if (!strcmp(url, "all")) {
+ if (!strcmp(url, "/tor/keys/all")) {
SMARTLIST_FOREACH(router_get_trusted_dir_servers(),
trusted_dir_server_t *, ds,
{
@@ -2026,22 +2025,24 @@
if (cert->cache_info.published_on >= if_modified_since)
smartlist_add(certs, cert));
});
- } else if (!strcmp(url, "authority")) {
+ } else if (!strcmp(url, "/tor/keys/authority")) {
authority_cert_t *cert = get_my_v3_authority_cert();
if (cert)
smartlist_add(certs, cert);
- } else if (!strcmpstart(url, "fp/")) {
+ } else if (!strcmpstart(url, "/tor/keys/fp/")) {
smartlist_t *fps = smartlist_create();
- dir_split_resource_into_fingerprints(url, fps, NULL, 1, 1);
+ dir_split_resource_into_fingerprints(url+strlen("/tor/keys/fp/"),
+ fps, NULL, 1, 1);
SMARTLIST_FOREACH(fps, char *, d, {
authority_cert_t *c = authority_cert_get_newest_by_id(d);
if (c) smartlist_add(certs, c);
tor_free(d);
});
smartlist_free(fps);
- } else if (!strcmpstart(url, "sk/")) {
+ } else if (!strcmpstart(url, "/tor/keys/sk/")) {
smartlist_t *fps = smartlist_create();
- dir_split_resource_into_fingerprints(url, fps, NULL, 1, 1);
+ dir_split_resource_into_fingerprints(url+strlen("/tor/keys/sk/"),
+ fps, NULL, 1, 1);
SMARTLIST_FOREACH(fps, char *, d, {
authority_cert_t *c = authority_cert_get_by_sk_digest(d);
if (c) smartlist_add(certs, c);