diff options
author | corvid <corvid@lavabit.com> | 2010-01-12 00:27:14 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2010-01-12 00:27:14 +0000 |
commit | 388754c08adb5da535d94690ae327d0e2493e89c (patch) | |
tree | 5f3588b441d349605a3cf70b9e562d46688d0b35 /dpi/cookies.c | |
parent | 61f64402d7f4efbff0e2c8e1d0f38787365b7138 (diff) |
don't bother to save expired cookies
Diffstat (limited to 'dpi/cookies.c')
-rw-r--r-- | dpi/cookies.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dpi/cookies.c b/dpi/cookies.c index dc355f04..7bef14ff 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -343,6 +343,7 @@ static void Cookies_save_and_free() int i, fd; CookieNode *node; CookieData_t *cookie; + time_t now; #ifndef HAVE_LOCKF struct flock lck; @@ -351,6 +352,8 @@ static void Cookies_save_and_free() if (disabled) return; + now = time(NULL); + rewind(file_stream); fd = fileno(file_stream); if (ftruncate(fd, 0) == -1) @@ -360,7 +363,7 @@ static void Cookies_save_and_free() /* Iterate cookies per domain, saving and freeing */ while ((node = dList_nth_data(cookies, 0))) { for (i = 0; (cookie = dList_nth_data(node->dlist, i)); ++i) { - if (!cookie->session_only) { + if (!cookie->session_only && (cookie->expires_at > now)) { fprintf(file_stream, "%s\tTRUE\t%s\t%s\t%ld\t%s\t%s\n", cookie->domain, cookie->path, |