emailauth, passwordauth: Avoid leaving cgisess_* files in the system temp directory.

Due to the use/abuse of CGI::Session to generate a token for the login
process, a new session database was created for each login, and left behind
afterwards. While each file is small, with many logings this could bloat
the size of /tmp significantly. Fixed by making CGI::Session write to
/dev/null, since there does not seem to be a way to entirely prevent the
writing.

This commit was sponsored by Henrik Riomar on Patreon.
master
Joey Hess 2017-08-23 13:13:23 -04:00
parent 056349a7f0
commit e3dfb26b90
No known key found for this signature in database
GPG Key ID: DB12DB0FF05F8F38
3 changed files with 6 additions and 2 deletions

View File

@ -148,7 +148,7 @@ sub gentoken ($$) {
my $session=shift;
eval q{use CGI::Session};
error($@) if $@;
my $token = CGI::Session->new->id;
my $token = CGI::Session->new("driver:DB_File", undef, {FileName => "/dev/null"})->id;
IkiWiki::userinfo_set($email, "emailauthexpire", time+(60*60*24));
IkiWiki::userinfo_set($email, "emailauth", $token);
IkiWiki::userinfo_set($email, "emailauthpostsignin", defined $session->param("postsignin") ? $session->param("postsignin") : "");

View File

@ -113,7 +113,7 @@ sub gentoken ($$;$) {
eval q{use CGI::Session};
error($@) if $@;
my $token = CGI::Session->new->id;
my $token = CGI::Session->new("driver:DB_File", undef, {FileName => "/dev/null"})->id;
if (! $reversable) {
setpassword($user, $token, $tokenfield);
}

4
debian/changelog vendored
View File

@ -9,6 +9,10 @@ ikiwiki (3.20170623) UNRELEASED; urgency=medium
* core: Don't decode the result of strftime if it is already tagged as
UTF-8, as it might be since Perl >= 5.21.1. (Closes: #869240)
[ Joey Hess ]
* emailauth, passwordauth: Avoid leaving cgisess_* files in the
system temp directory.
-- Joey Hess <id@joeyh.name> Tue, 11 Jul 2017 15:48:39 -0400
ikiwiki (3.20170622) unstable; urgency=medium