]> andersk Git - moira.git/blob - gen/access.gen
Command line printer manipulation client, and build goo.
[moira.git] / gen / access.gen
1 #!/moira/bin/perl -Tw
2
3 # $Id$
4
5 use DBI;
6
7 # The following exit codes are defined and MUST BE CONSISTENT withh the
8 # error codes the library uses:
9 $MR_DBMS_ERR = 47836421;
10 $MR_OCONFIG = 47836460;
11 %users = ();
12
13 $outfile = '/moira/dcm/access.out';
14
15 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
16     || exit $MR_DBMS_ERR;
17
18 # Get the list of valid MIT.EDU user e-mail addresses
19 $sth = $dbh->prepare("SELECT login FROM users WHERE status != 3");
20
21 $sth->execute;
22
23 umask 022;
24 open(OUT, ">$outfile") || exit $MR_OCONFIG;
25
26 while(($login) = $sth->fetchrow_array) {
27     $login =~ s/\0//g;
28     $users{$login} = $login;
29     
30     print OUT "From:$login\@MIT.EDU RELAY\n";
31 }
32
33 # Get all the valid MIT.EDU mailing list addresses
34 $sth = $dbh->prepare("SELECT name FROM list WHERE active !=0 " .
35                      "AND maillist = 1");
36
37 $sth->execute;
38
39 while(($name) = $sth->fetchrow_array) {
40     $name =~ s/\0//g;
41     
42     # Ensure we do not re-print an entry that may be a personal user group
43     # and was already handled by the user e-mail addresses
44     if(!$users{$name}) { 
45         print OUT "From:$name\@MIT.EDU RELAY\n";
46     }
47 }
48
49 close(OUT);
50 exit;
This page took 0.408777 seconds and 5 git commands to generate.