#!/bin/bash
# Remove DSPAM web-login session files past their fixed 30-day expiry.
#
# CreateSession() (src/dspam-server/dspam-server-main.cpp) sets each
# session file's mtime to its creation time, and issues a fixed 30-day
# expiry at that same moment, so a plain mtime-based find is sufficient --
# no need to parse file contents. A session is only otherwise removed via
# an explicit Logout (DoLogout() -> DeleteSession()), so anything that
# expired naturally instead (browser closed without logging out, cookie
# cleared, etc.) would otherwise accumulate on disk forever.
find /var/lib/dspam/sessions -type f -mtime +30 -delete
