# clean up regular spool
opendir $spooldir,'.' or die "$0: $spooldir - $!\n";
while ($to = readdir $spooldir) {
+ next if $to =~ /^\./;
next if $to !~ /@/ or $_ = readlink($to) and not /\//;
+ next unless -d $to;
if (@demo and -f "$to/.demo" and time > lmtime("$to/.demo")+$demo[1]*DS) {
logdel($to,"demo user $to deleted");
next;
}
- if (-d $to and $to !~ /^\./) {
- unless (opendir TO,$to) {
- warn "$0: $spooldir/$to - $!\n";
- next;
- }
- while ($from = readdir TO) {
- next if $from !~ /@/;
- if ($from eq '@GROUP') {
- foreach $group (glob "$to/$from/*") {
- if (readlink $group and not -f $group) {
- logdel($group,"$group deleted (master has gone)");
- }
+ unless (opendir TO,$to) {
+ warn "$0: $spooldir/$to - $!\n";
+ next;
+ }
+ while ($from = readdir TO) {
+ next if $from !~ /@/;
+ if ($from eq '@GROUP') {
+ foreach $group (glob "$to/$from/*") {
+ if (readlink $group and not -f $group) {
+ logdel($group,"$group deleted (master has gone)");
}
- } else {
- if (-d "$to/$from" and $from !~ /^\./) {
- unless (opendir FROM,"$to/$from") {
- warn "$0: $spooldir/$to/$from - $!\n";
- next;
- }
- while ($file = readdir FROM) {
- next if $file eq '.' or $file eq '..';
- if (-d "$to/$from/$file" and $file !~ /^\./) {
- cleanup($to,$from,$file);
- rmdir "$to/$from/$file" unless $opt_d;
- }
+ }
+ } else {
+ if (-d "$to/$from" and $from !~ /^\./) {
+ unless (opendir FROM,"$to/$from") {
+ warn "$0: $spooldir/$to/$from - $!\n";
+ next;
+ }
+ while ($file = readdir FROM) {
+ next if $file eq '.' or $file eq '..';
+ if (-d "$to/$from/$file" and $file !~ /^\./) {
+ cleanup($to,$from,$file);
+ rmdir "$to/$from/$file" unless $opt_d;
}
- closedir FROM;
- rmdir "$to/$from" unless $opt_d;
}
+ closedir FROM;
+ rmdir "$to/$from" unless $opt_d;
}
}
- closedir TO;
- unless (-f "$to/\@PERSISTENT" or $to eq $admin) {
- @glob = glob "$to/*/* $to/\@MAINUSER/* $to/\@GROUP/*";
- unless (@glob or -f "$to/\@") {
- logdel($to,"$to deleted");
- }
- $user = $to;
- if ($login_check and -l "$user/.login") {
- my $lc = &$login_check(readlink("$user/.login"));
- if ($lc) {
- if (-f "$user/\@~" and not "$user/@") {
- rename "$user/\@~","$user/@" unless $opt_d;
- logv("$user reanimated (login_check)");
- }
- } else {
- rename "$user/@","$user/\@~" unless $opt_d;
- logv("$user deactivated (login_check)");
+ }
+ closedir TO;
+ unless (-f "$to/\@PERSISTENT" or $to eq $admin) {
+ @glob = glob "$to/*/* $to/\@MAINUSER/* $to/\@GROUP/*";
+ unless (@glob or -f "$to/\@") {
+ logdel($to,"$to deleted");
+ }
+ $user = $to;
+ if ($login_check and -l "$user/.login") {
+ my $lc = &$login_check(readlink("$user/.login"));
+ if ($lc) {
+ if (-f "$user/\@~" and not "$user/@") {
+ rename "$user/\@~","$user/@" unless $opt_d;
+ logv("$user reanimated (login_check)");
}
+ } else {
+ rename "$user/@","$user/\@~" unless $opt_d;
+ logv("$user deactivated (login_check)");
}
}
}
if (time > lmtime($user)+$expire*DS) {
# print "$spooldir/$user\n";
- my $locale = readlink "$user/\@LOCALE";
+ local $locale = readlink "$user/\@LOCALE";
$locale = 'english' unless $locale and $reactivation{$locale};
&{$reactivation{$locale}}($expire,$user);
sleep 1;