[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11606: Backport r11566 so that --list-fingerprint will not die when (in tor/branches/tor-0_1_2-patches: . doc src/or)
Author: nickm
Date: 2007-09-24 11:53:47 -0400 (Mon, 24 Sep 2007)
New Revision: 11606
Modified:
tor/branches/tor-0_1_2-patches/
tor/branches/tor-0_1_2-patches/doc/TODO.012
tor/branches/tor-0_1_2-patches/src/or/router.c
Log:
r15318@catbus: nickm | 2007-09-24 11:42:25 -0400
Backport r11566 so that --list-fingerprint will not die when it finds no state file.
Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
svk:merge ticket from /tor/012 [r15318] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/branches/tor-0_1_2-patches/doc/TODO.012
===================================================================
--- tor/branches/tor-0_1_2-patches/doc/TODO.012 2007-09-24 15:41:28 UTC (rev 11605)
+++ tor/branches/tor-0_1_2-patches/doc/TODO.012 2007-09-24 15:53:47 UTC (rev 11606)
@@ -11,7 +11,7 @@
o r11138: PROTOCOLINFO support.
D r11141: CookieAuthFile and CookieAuthFileGroupReadable.
- r11166: Don't believe future dates from the state file.
- - r11566: make r11438 not actually break things.
+ o r11566: make r11438 not actually break things.
Backport for 0.1.2.x once better tested:
Modified: tor/branches/tor-0_1_2-patches/src/or/router.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/router.c 2007-09-24 15:41:28 UTC (rev 11605)
+++ tor/branches/tor-0_1_2-patches/src/or/router.c 2007-09-24 15:53:47 UTC (rev 11606)
@@ -239,7 +239,6 @@
char digest[20];
char *cp;
or_options_t *options = get_options();
- or_state_t *state = get_or_state();
if (!key_lock)
key_lock = tor_mutex_new();
@@ -284,15 +283,21 @@
prkey = init_key_from_file(keydir);
if (!prkey) return -1;
set_onion_key(prkey);
- if (state->LastRotatedOnionKey > 100) { /* allow for some parsing slop. */
- onionkey_set_at = state->LastRotatedOnionKey;
- } else {
- /* We have no LastRotatedOnionKey set; either we just created the key
- * or it's a holdover from 0.1.2.4-alpha-dev or earlier. In either case,
- * start the clock ticking now so that we will eventually rotate it even
- * if we don't stay up for a full MIN_ONION_KEY_LIFETIME. */
- state->LastRotatedOnionKey = onionkey_set_at = time(NULL);
- or_state_mark_dirty(state, options->AvoidDiskWrites ? time(NULL)+3600 : 0);
+
+ if (options->command == CMD_RUN_TOR) {
+ /* Only mess with the state file if we're actually running Tor */
+ or_state_t *state = get_or_state();
+ if (state->LastRotatedOnionKey > 100) { /* allow for some parsing slop. */
+ onionkey_set_at = state->LastRotatedOnionKey;
+ } else {
+ /* We have no LastRotatedOnionKey set; either we just created the key
+ * or it's a holdover from 0.1.2.4-alpha-dev or earlier. In either case,
+ * start the clock ticking now so that we will eventually rotate it even
+ * if we don't stay up for a full MIN_ONION_KEY_LIFETIME. */
+ state->LastRotatedOnionKey = onionkey_set_at = time(NULL);
+ or_state_mark_dirty(state,
+ options->AvoidDiskWrites ? time(NULL)+3600 : 0);
+ }
}
tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_onion_key.old",datadir);