From 788e94b41f8124a05c6f25bf3084fcdaa36f4d63 Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Mon, 4 Feb 2002 20:23:04 +0000 Subject: Bug 95732 - remove logincookies.cryptpassword, and invalidate cookies from the db when required instead. (Also fixes bug 58242 as a side effect) r=myk, kiko --- checksetup.pl | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'checksetup.pl') diff --git a/checksetup.pl b/checksetup.pl index 125b18a6c..71e501ffb 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1082,7 +1082,6 @@ $table{groups} = $table{logincookies} = 'cookie mediumint not null auto_increment primary key, userid mediumint not null, - cryptpassword varchar(34), hostname varchar(128), lastused timestamp, @@ -2596,6 +2595,29 @@ AddField("bugs", "cclist_accessible", "tinyint not null default 1"); # using the attachment manager can record changes to attachments. AddField("bugs_activity", "attach_id", "mediumint null"); +# 2001-01-17 bbaetz@student.usyd.edu.au bug 95732 +# Remove logincookies.cryptpassword, and delete entries which become +# invalid +if (GetFieldDef("logincookies", "cryptpassword")) { + # We need to delete any cookies which are invalid, before dropping the + # column + + print "Removing invalid login cookies...\n"; + + # mysql doesn't support DELETE with multi-table queries, so we have + # to iterate + my $sth = $dbh->prepare("SELECT cookie FROM logincookies, profiles " . + "WHERE logincookies.cryptpassword != " . + "profiles.cryptpassword AND " . + "logincookies.userid = profiles.userid"); + $sth->execute(); + while (my ($cookie) = $sth->fetchrow_array()) { + $dbh->do("DELETE FROM logincookies WHERE cookie = $cookie"); + } + + DropField("logincookies", "cryptpassword"); +} + # If you had to change the --TABLE-- definition in any way, then add your # differential change code *** A B O V E *** this comment. # -- cgit v1.2.3-24-g4f1b