[or-cvs] r9175: Remove code to look for keys in their old locations: we have (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Sun Dec 24 02:45:55 UTC 2006


Author: nickm
Date: 2006-12-23 21:45:53 -0500 (Sat, 23 Dec 2006)
New Revision: 9175

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/router.c
Log:
 r11680 at Kushana:  nickm | 2006-12-23 21:45:05 -0500
 Remove code to look for keys in their old locations: we havent stored them there since 0.0.7.2.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11680] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-12-24 02:45:46 UTC (rev 9174)
+++ tor/trunk/ChangeLog	2006-12-24 02:45:53 UTC (rev 9175)
@@ -44,6 +44,9 @@
       has gone by, or until we have no dirservers that haven't given us
       a 503.
     - The state file gets saved less often when AvoidDiskWrites is set.
+    - We no longer look for identity and onion keys in "identity.key" and
+      "onion.key" -- these were replaced by secret_id_key and
+      secret_onion_key in 0.0.8pre1.
 
   o Security bugfixes:
     - Stop sending the HttpProxyAuthenticator string to directory

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-12-24 02:45:46 UTC (rev 9174)
+++ tor/trunk/src/or/router.c	2006-12-24 02:45:53 UTC (rev 9175)
@@ -162,26 +162,6 @@
   log_warn(LD_GENERAL, "Couldn't rotate onion key.");
 }
 
-/* Read an RSA secret key key from a file that was once named fname_old,
- * but is now named fname_new.  Rename the file from old to new as needed.
- */
-static crypto_pk_env_t *
-init_key_from_file_name_changed(const char *fname_old,
-                                const char *fname_new)
-{
-  if (file_status(fname_new) == FN_FILE || file_status(fname_old) != FN_FILE)
-    /* The new filename is there, or both are, or neither is. */
-    return init_key_from_file(fname_new);
-
-  /* The old filename exists, and the new one doesn't.  Rename and load. */
-  if (rename(fname_old, fname_new) < 0) {
-    log_warn(LD_FS, "Couldn't rename key file \"%s\" to \"%s\": %s",
-             fname_old, fname_new, strerror(errno));
-    return NULL;
-  }
-  return init_key_from_file(fname_new);
-}
-
 /** Try to read an RSA key from <b>fname</b>.  If <b>fname</b> doesn't exist,
  * create a new RSA key and save it in <b>fname</b>.  Return the read/created
  * key, or NULL on error.
@@ -245,7 +225,6 @@
 init_keys(void)
 {
   char keydir[512];
-  char keydir2[512];
   char fingerprint[FINGERPRINT_LEN+1];
   /*nickname<space>fp\n\0 */
   char fingerprint_line[MAX_NICKNAME_LEN+FINGERPRINT_LEN+3];
@@ -287,17 +266,15 @@
   }
 
   /* 1. Read identity key. Make it if none is found. */
-  tor_snprintf(keydir,sizeof(keydir),"%s/keys/identity.key",datadir);
-  tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_id_key",datadir);
-  log_info(LD_GENERAL,"Reading/making identity key \"%s\"...",keydir2);
-  prkey = init_key_from_file_name_changed(keydir,keydir2);
+  tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_id_key",datadir);
+  log_info(LD_GENERAL,"Reading/making identity key \"%s\"...",keydir);
+  prkey = init_key_from_file(keydir);
   if (!prkey) return -1;
   set_identity_key(prkey);
   /* 2. Read onion key.  Make it if none is found. */
-  tor_snprintf(keydir,sizeof(keydir),"%s/keys/onion.key",datadir);
-  tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_onion_key",datadir);
-  log_info(LD_GENERAL,"Reading/making onion key \"%s\"...",keydir2);
-  prkey = init_key_from_file_name_changed(keydir,keydir2);
+  tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_onion_key",datadir);
+  log_info(LD_GENERAL,"Reading/making onion key \"%s\"...",keydir);
+  prkey = init_key_from_file(keydir);
   if (!prkey) return -1;
   set_onion_key(prkey);
   if (state->LastRotatedOnionKey > 100) { /* allow for some parsing slop. */



More information about the tor-commits mailing list