summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authorbbaetz%student.usyd.edu.au <>2002-02-04 21:23:04 +0100
committerbbaetz%student.usyd.edu.au <>2002-02-04 21:23:04 +0100
commit788e94b41f8124a05c6f25bf3084fcdaa36f4d63 (patch)
treee7313868133ce351cc5719c3da5da944ee2a6515 /checksetup.pl
parent7398c1d65281cf04584652f3b854dc5e9d471175 (diff)
downloadbugzilla-788e94b41f8124a05c6f25bf3084fcdaa36f4d63.tar.gz
bugzilla-788e94b41f8124a05c6f25bf3084fcdaa36f4d63.tar.xz
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
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl24
1 files changed, 23 insertions, 1 deletions
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.
#