Fix possible infinite loop in all AWL deletion
authorJamie Cameron <jcameron@webmin.com>
Fri, 26 Feb 2010 00:38:55 +0000 (16:38 -0800)
committerJamie Cameron <jcameron@webmin.com>
Fri, 26 Feb 2010 00:38:55 +0000 (16:38 -0800)
spam/deleteall_awl.cgi

index 51c2ebd..d5a3abd 100755 (executable)
@@ -14,15 +14,19 @@ require './spam-lib.pl';
 print $text{'dawl_doing'},"<br>\n";
 $count = $ucount = 0;
 setpwent();
-while(@uinfo = getpwent()) {
-       next if (!&can_edit_awl($uinfo[0]));
-       &open_auto_whitelist_dbm($uinfo[0]) || next;
+while($u = getpwent()) {
+       push(@users, $u);
+       }
+endpwent();
+foreach $u (@users) {
+       next if (!&can_edit_awl($u));
+       print "doing $u<br>\n";
+       &open_auto_whitelist_dbm($u) || next;
        foreach $k (keys %awl) {
                delete($awl{$k});
                $count++;
                }
        &close_auto_whitelist_dbm();
-       print "doing $uinfo[0]<br>\n";
        $ucount++;
        }
 endpwent();