source: trunk/third/moira/gen/access.gen @ 23740

Revision 23740, 1.2 KB checked in by broder, 16 years ago (diff)
In moira: * New CVS snapshot (Trac: #195) * Drop patches that have been incorporated upstream. * Update to build without krb4 on systems that no longer have it. This doesn't build yet on squeeze, which lacks a krb4 library, but I'm committing now before I start hacking away at a patch to fix that.
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2
3# $Id: access.gen,v 1.1 2003-10-21 18:35:48 zacheiss Exp $
4
5use 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
23umask 022;
24open(OUT, ">$outfile") || exit $MR_OCONFIG;
25
26while(($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
39while(($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
49close(OUT);
50exit;
Note: See TracBrowser for help on using the repository browser.