[or-cvs] r15597: Add client-specific onion address to client_keys file. (tor/branches/121-hs-authorization/src/or)

kloesing at seul.org kloesing at seul.org
Wed Jul 2 12:47:49 UTC 2008


Author: kloesing
Date: 2008-07-02 08:47:49 -0400 (Wed, 02 Jul 2008)
New Revision: 15597

Modified:
   tor/branches/121-hs-authorization/src/or/rendservice.c
Log:
Add client-specific onion address to client_keys file.

Modified: tor/branches/121-hs-authorization/src/or/rendservice.c
===================================================================
--- tor/branches/121-hs-authorization/src/or/rendservice.c	2008-07-02 11:17:25 UTC (rev 15596)
+++ tor/branches/121-hs-authorization/src/or/rendservice.c	2008-07-02 12:47:49 UTC (rev 15597)
@@ -595,15 +595,22 @@
             strmap_free(parsed_clients, rend_authorized_client_free);
             return -1;
           }
+          if (rend_get_service_id(client->client_key, service_id)<0) {
+            log_warn(LD_BUG, "Internal error: couldn't encode service ID.");
+            strmap_free(parsed_clients, rend_authorized_client_free);
+            return -1;
+          }
           desc_cook_out[strlen(desc_cook_out)-3] = '\0'; /* Remove == signs
                                                             and newline. */
           entry_len = 100 + strlen(client->client_name) + len;
           entry = tor_malloc_zero(entry_len+1000);
           if (tor_snprintf(entry, entry_len+1000,
                                    "client-name %s\n"
+                                   "service-address %s.onion\n"
                                    "descriptor-cookie %s\n"
                                    "client-key\n%s",
                                  client->client_name,
+                                 service_id,
                                  desc_cook_out,
                                  out) < 0) {
             log_warn(LD_BUG, "Could not write client entry.");
@@ -614,11 +621,6 @@
           tor_free(entry);
         }
         /* Add line to hostname file. */
-        if (rend_get_service_id(client->client_key, service_id)<0) {
-          log_warn(LD_BUG, "Internal error: couldn't encode service ID.");
-          strmap_free(parsed_clients, rend_authorized_client_free);
-          return -1;
-        }
         tor_snprintf(buf, sizeof(buf),"%s.onion %s # client: %s\n", service_id,
                      desc_cook_out, client->client_name);
         append_bytes_to_file(fname, buf, strlen(buf), 0);



More information about the tor-commits mailing list