]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Check for and rebuild busted password stuff.
authorterry%mozilla.org <>
Tue, 18 Jan 2000 22:26:16 +0000 (22:26 +0000)
committerterry%mozilla.org <>
Tue, 18 Jan 2000 22:26:16 +0000 (22:26 +0000)
sanitycheck.cgi

index fe1708986219b02441a9c47362f1ded6435a834e..33890be787338d93dce5fca190c7622318875045 100755 (executable)
@@ -80,6 +80,26 @@ if (exists $::FORM{'rebuildvotecache'}) {
 
 print "OK, now running sanity checks.<P>\n";
 
+Status("Checking passwords");
+SendSQL("SELECT COUNT(*) FROM profiles WHERE cryptpassword != ENCRYPT(password, left(cryptpassword, 2))");
+my $count = FetchOneColumn();
+if ($count) {
+    Alert("$count entries have problems in their crypted password.");
+    if ($::FORM{'rebuildpasswords'}) {
+        Status("Rebuilding passwords");
+        SendSQL("UPDATE profiles
+                 SET cryptpassword = ENCRYPT(password,
+                                            left(cryptpassword, 2))
+                 WHERE cryptpassword != ENCRYPT(password,
+                                                left(cryptpassword, 2))");
+        Status("Passwords have been rebuilt.");
+    } else {
+        print qq{<a href="sanitycheck.cgi?rebuildpasswords=1">Click here to rebuild the crypted passwords</a><p>\n};
+    }
+}
+
+
+
 Status("Checking groups");
 SendSQL("select bit from groups where bit != pow(2, round(log(bit) / log(2)))");
 while (my $bit = FetchOneColumn()) {