]> dxcluster.net Git - spider.git/blob - cmd/show/lockout.pl
Fix unset/startup cmd
[spider.git] / cmd / show / lockout.pl
1 #
2 # show/lockout
3 #
4 # show all excluded users 
5 #
6 # Copyright (c) 2000 Dirk Koopman G1TLH
7 #
8 #
9 #
10
11 my ($self, $line) = @_;
12 return (1, $self->msg('e5')) unless $self->priv >= 9;
13
14 my @out;
15
16 use DB_File;
17
18 if ($line) {
19         $line =~ s/[^\w\-\/]+//g;
20         $line = "\U\Q$line";
21 }
22
23 return (1, $self->msg('lockoutuse')) unless $line;
24
25 @out = $self->spawn_cmd("show lockout $line", sub {
26                                                         my @out;
27                                                         my @val;
28                                                         my ($action, $count, $key, $data) = (0,0,0,0);
29                                                         eval qq{for (\$action = DXUser::R_FIRST, \$count = 0; !\$DXUser::dbm->seq(\$key, \$data, \$action); \$action = DXUser::R_NEXT) {
30         if (\$data =~ m{lockout}) {
31                 if (\$line eq 'ALL' || \$key =~ /^$line/) {
32                         my \$ur = DXUser::get_current(\$key);
33                         if (\$ur && \$ur->lockout) {
34                                 push \@val, \$key;
35                                 ++\$count;
36                         }
37                 }
38         }
39 } };
40
41                                                         my @l;
42                                                         foreach my $call (@val) {
43                                                                 if (@l >= 5) {
44                                                                         push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
45                                                                         @l = ();
46                                                                 }
47                                                                 push @l, $call;
48                                                         }
49                                                         if (@l) {
50                                                                 push @l, "" while @l < 5;
51                                                                 push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
52                                                         }
53
54                                                         push @out, $@ if $@;
55                                                         push @out, $self->msg('rec', $count);
56                                                         return @out;
57                                                 });
58
59
60 return (1, @out);
61
62