[or-cvs] r16418: Stop advertising hidden service that performs client authori (tor/branches/121-hs-authorization/src/or)

kloesing at seul.org kloesing at seul.org
Tue Aug 5 10:44:19 UTC 2008


Author: kloesing
Date: 2008-08-05 06:44:19 -0400 (Tue, 05 Aug 2008)
New Revision: 16418

Modified:
   tor/branches/121-hs-authorization/src/or/rendservice.c
Log:
Stop advertising hidden service that performs client authorization as version 0 hidden service.

Modified: tor/branches/121-hs-authorization/src/or/rendservice.c
===================================================================
--- tor/branches/121-hs-authorization/src/or/rendservice.c	2008-08-05 09:50:37 UTC (rev 16417)
+++ tor/branches/121-hs-authorization/src/or/rendservice.c	2008-08-05 10:44:19 UTC (rev 16418)
@@ -163,27 +163,40 @@
   service->intro_nodes = smartlist_create();
 
   /* If the service is configured to publish unversioned (v0) and versioned
-   * descriptors (v2 or higher), split it up into two separate services. */
+   * descriptors (v2 or higher), split it up into two separate services
+   * (unless it is configured to perform client authorization in which case
+   * ). */
   if (service->descriptor_version == -1) {
-    rend_service_t *v0_service = tor_malloc_zero(sizeof(rend_service_t));
-    v0_service->directory = tor_strdup(service->directory);
-    v0_service->ports = smartlist_create();
-    SMARTLIST_FOREACH(service->ports, rend_service_port_config_t *, p, {
-      rend_service_port_config_t *copy =
-        tor_malloc_zero(sizeof(rend_service_port_config_t));
-      memcpy(copy, p, sizeof(rend_service_port_config_t));
-      smartlist_add(v0_service->ports, copy);
-    });
-    v0_service->intro_prefer_nodes = tor_strdup(service->intro_prefer_nodes);
-    v0_service->intro_exclude_nodes = tor_strdup(service->intro_exclude_nodes);
-    v0_service->intro_period_started = service->intro_period_started;
-    v0_service->descriptor_version = 0; /* Unversioned descriptor. */
-    v0_service->auth_type = 0;
-    rend_add_service(v0_service);
+    if (!service->auth_type) {
+      rend_service_t *v0_service = tor_malloc_zero(sizeof(rend_service_t));
+      v0_service->directory = tor_strdup(service->directory);
+      v0_service->ports = smartlist_create();
+      SMARTLIST_FOREACH(service->ports, rend_service_port_config_t *, p, {
+        rend_service_port_config_t *copy =
+          tor_malloc_zero(sizeof(rend_service_port_config_t));
+        memcpy(copy, p, sizeof(rend_service_port_config_t));
+        smartlist_add(v0_service->ports, copy);
+      });
+      v0_service->intro_prefer_nodes =
+          tor_strdup(service->intro_prefer_nodes);
+      v0_service->intro_exclude_nodes =
+          tor_strdup(service->intro_exclude_nodes);
+      v0_service->intro_period_started = service->intro_period_started;
+      v0_service->descriptor_version = 0; /* Unversioned descriptor. */
+      v0_service->auth_type = 0;
+      rend_add_service(v0_service);
+    }
 
     service->descriptor_version = 2; /* Versioned descriptor. */
   }
 
+  if (service->auth_type && !service->descriptor_version) {
+    log_warn(LD_CONFIG, "Hidden service with client authorization and "
+                        "version 0 descriptors configured; ignoring.");
+    rend_service_free(service);
+    return;
+  }
+
   if (!smartlist_len(service->ports)) {
     log_warn(LD_CONFIG, "Hidden service with no ports configured; ignoring.");
     rend_service_free(service);



More information about the tor-commits mailing list