[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16354: Encode authorization type in client authorization string. (tor/branches/121-hs-authorization/src/or)
Author: kloesing
Date: 2008-08-02 04:55:19 -0400 (Sat, 02 Aug 2008)
New Revision: 16354
Modified:
tor/branches/121-hs-authorization/src/or/rendservice.c
Log:
Encode authorization type in client authorization string.
Modified: tor/branches/121-hs-authorization/src/or/rendservice.c
===================================================================
--- tor/branches/121-hs-authorization/src/or/rendservice.c 2008-08-02 02:26:42 UTC (rev 16353)
+++ tor/branches/121-hs-authorization/src/or/rendservice.c 2008-08-02 08:55:19 UTC (rev 16354)
@@ -599,8 +599,6 @@
REND_DESC_COOKIE_LEN);
} else {
crypto_rand(client->descriptor_cookie, REND_DESC_COOKIE_LEN);
- desc_cook_out[strlen(desc_cook_out)-3] = '\0'; /* Remove == signs
- and newline. */
}
if (base64_encode(desc_cook_out, 3*REND_DESC_COOKIE_LEN_BASE64+1,
client->descriptor_cookie,
@@ -666,6 +664,19 @@
append_bytes_to_file(cfname, buf, strlen(buf), 0);
/* Add line to hostname file. */
if (s->auth_type == 2) {
+ char extended_desc_cookie[REND_DESC_COOKIE_LEN+1];
+ memcpy(extended_desc_cookie, client->descriptor_cookie,
+ REND_DESC_COOKIE_LEN);
+ extended_desc_cookie[REND_DESC_COOKIE_LEN] = (s->auth_type-1)<<4;
+ if (base64_encode(desc_cook_out, 3*REND_DESC_COOKIE_LEN_BASE64+1,
+ extended_desc_cookie,
+ REND_DESC_COOKIE_LEN+1) < 0) {
+ log_warn(LD_BUG, "Could not base64-encode descriptor cookie.");
+ strmap_free(parsed_clients, rend_authorized_client_free);
+ return -1;
+ }
+ desc_cook_out[strlen(desc_cook_out)-3] = '\0'; /* Remove A= and
+ newline. */
tor_snprintf(buf, sizeof(buf),"%s.onion %s # client: %s\n",
service_id, desc_cook_out, client->client_name);
} else {