[or-cvs] r16382: Limit number of authorized clients depending on authorizatio (tor/branches/121-hs-authorization/src/or)

kloesing at seul.org kloesing at seul.org
Mon Aug 4 15:46:46 UTC 2008


Author: kloesing
Date: 2008-08-04 11:46:46 -0400 (Mon, 04 Aug 2008)
New Revision: 16382

Modified:
   tor/branches/121-hs-authorization/src/or/rendservice.c
Log:
Limit number of authorized clients depending on authorization protocol.

Modified: tor/branches/121-hs-authorization/src/or/rendservice.c
===================================================================
--- tor/branches/121-hs-authorization/src/or/rendservice.c	2008-08-04 12:44:14 UTC (rev 16381)
+++ tor/branches/121-hs-authorization/src/or/rendservice.c	2008-08-04 15:46:46 UTC (rev 16382)
@@ -383,6 +383,20 @@
       smartlist_split_string(clients, client_names, ",",
                                    SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
       tor_free(client_names);
+      if ((service->auth_type == 1 && smartlist_len(clients) > 512) ||
+          (service->auth_type == 2 && smartlist_len(clients) > 16)) {
+        log_warn(LD_CONFIG, "HiddenServiceAuthorizeClient contains %d "
+                            "client authorization entries, but only a "
+                            "maximum of %d entries is allowed for "
+                            "authorization type %d.",
+                 smartlist_len(clients),
+                 service->auth_type == 1 ? 512 : 16,
+                 service->auth_type);
+        SMARTLIST_FOREACH(clients, char *, cp, tor_free(cp));
+        smartlist_free(clients);
+        rend_service_free(service);
+        return -1;
+      }
       SMARTLIST_FOREACH(clients, char *, client_name, {
         rend_authorized_client_t *client;
         size_t len = strlen(client_name);



More information about the tor-commits mailing list