mailhub.gen ndb.gen network.gen nfs.gen pobox.gen \
postoffice.gen print.gen warehouse.gen winad.gen www.gen zephyr.gen
-SCRIPTS=boot.sh ca.gen dhcp.sh hesiod.sh ip-billing.gen ip-billing.sh \
+SCRIPTS=boot.sh ca.gen calendar.gen dhcp.sh hesiod.sh ip-billing.gen ip-billing.sh \
longjobs.gen longjobs.sh mailhub.sh ndb.sh nfs.sh null.sh \
postoffice.sh print.sh sapprint.gen sapprint.sh spwatch.gen \
stellar.gen stellar.sh warehouse.sh www.sh zephyr.sh \
--- /dev/null
+#!/moira/bin/perl -Tw
+
+# $Id$
+
+# The following exit codes are defined and MUST BE CONSISTENT withh the
+# error codes the library uses:
+$MR_DBMS_ERR = 47836421;
+$MR_OCONFIG = 47836460;
+
+$outfile = '/moira/dcm/calendar.out';
+
+use DBI;
+
+$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
+ || exit $MR_DBMS_ERR;
+
+$sth = $dbh->prepare("SELECT UNIQUE u.clearid, u.login, u.first, u.middle, " .
+ "u.last FROM users u, list l, imembers i " .
+ "WHERE l.name = 'calendar-acl' " .
+ "AND l.list_id = i.list_id AND l.list_id = i.list_id " .
+ "AND i.member_type='USER' AND i.member_id = u.users_id")
+ || exit $MR_DBMS_ERR;
+$sth->execute || exit $MR_DBMS_ERR;
+
+umask 022;
+open(OUT, ">$outfile") || exit $MR_OCONFIG;
+
+while (($clearid, $login, $first, $middle, $last) = $sth->fetchrow_array) {
+ $row = "$clearid^UID=$login/S=$last/G=$first/I=$middle/";
+ $row .= "EMAIL=$login\@mit.edu\n";
+ $row =~ s/\0//g;
+ print OUT $row;
+}
+close(OUT);
+$dbh->disconnect;
+exit 0;