From c949fc104c0e0ed6ed7707ff4d627aaac8cad87c Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Tue, 5 Dec 2017 19:20:58 +0100 Subject: [PATCH] Unlink CookieAuthFile when tor_cleanup() is called. Removing control port authentication cookie file when tor_cleanup() is called. Fixes #23271 Signed-off-by: Fernando Fernandez Mancera --- changes/ticket23271 | 2 ++ src/or/main.c | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 changes/ticket23271 diff --git a/changes/ticket23271 b/changes/ticket23271 new file mode 100644 index 000000000..e74997a0f --- /dev/null +++ b/changes/ticket23271 @@ -0,0 +1,2 @@ + o Minor feature: + - Unlink CookieAuthFile when tor_cleanup() is called. Closes 23271. diff --git a/src/or/main.c b/src/or/main.c index c340e4128..53fe29260 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -3325,6 +3325,14 @@ tor_cleanup(void) strerror(errno)); } } + if (options->CookieAuthFile) { + if (unlink(options->CookieAuthFile) != 0) { + log_warn(LD_FS, "Couldn't unlink control port authentication cookie" + " file %s: %s", + options->CookieAuthFile, + strerror(errno)); + } + } if (accounting_is_enabled(options)) accounting_record_bandwidth_usage(now, get_or_state()); or_state_mark_dirty(get_or_state(), 0); /* force an immediate save. */ -- 2.15.1