diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-10-02 13:56:28 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-10-02 13:56:28 +0200 |
commit | 67182226f10fde686f7d541cad3c608f74415205 (patch) | |
tree | d59932f13d0a198a71df4f5947b63ca373ffaf35 /src | |
parent | 488e9a0502d0f177a00c4bf5f49ec218fdc65870 (diff) | |
parent | 763cb393d3ae6dee8f25afca011e5ec1796ed970 (diff) | |
download | tor-67182226f10fde686f7d541cad3c608f74415205.tar.gz tor-67182226f10fde686f7d541cad3c608f74415205.zip |
Merge remote-tracking branch 'teor/warn-when-time-goes-backwards'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/statefile.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c index dd1894beb7..7481cd71cb 100644 --- a/src/or/statefile.c +++ b/src/or/statefile.c @@ -372,6 +372,19 @@ or_state_load(void) new_state = or_state_new(); } else if (contents) { log_info(LD_GENERAL, "Loaded state from \"%s\"", fname); + /* Warn the user if their clock has been set backwards, + * they could be tricked into using old consensuses */ + if (new_state->LastWritten > time(NULL)) { + char last_written_str[ISO_TIME_LEN+1]; + char now_str[ISO_TIME_LEN+1]; + format_iso_time(last_written_str, new_state->LastWritten), + format_iso_time(now_str, time(NULL)); + log_warn(LD_GENERAL, "Your system clock has been set back in time. " + "Tor needs an accurate clock to know when the consensus " + "expires. You might have an empty clock battery or bad NTP " + "server. Clock time is %s, state file time is %s.", + now_str, last_written_str); + } } else { log_info(LD_GENERAL, "Initialized state"); } |