]> andersk Git - moira.git/commitdiff
Mailman DCM for initial rollout, and Makefile.in change to install it.
authorzacheiss <zacheiss>
Thu, 2 Jan 2003 01:05:05 +0000 (01:05 +0000)
committerzacheiss <zacheiss>
Thu, 2 Jan 2003 01:05:05 +0000 (01:05 +0000)
Tweak new mailhub code so that we actually look at list membership for
mailman lists, rather than just assuming it; this behavior seems less
confusing.

gen/Makefile.in
gen/mailhub.pc
gen/mailman.gen [new file with mode: 0755]

index fb301f6553792beb3d6a35eb26a5263638b5d57b..0d79947409cef0e6878112961dc4768faa053de3 100644 (file)
@@ -44,9 +44,9 @@ TARGET=       acl.gen boot.gen dhcp.gen directory.gen hesiod.gen hosts.gen \
 
 SCRIPTS=acl.sh aliases.sh 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 \
-       install_dirs install_quotas zero_quotas
+       mailman.gen 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 install_dirs install_quotas zero_quotas
 
 .SUFFIXES: .pc .gen
 
index 591ac0152eebc4333cc401ebc658dbd8b8e294be..cd0f8b2892df95427862cb447276ee106e79fb87 100644 (file)
@@ -396,9 +396,6 @@ void output_mlist(int id, void *list, void *out)
              l->mailman_server);
       fprintf(out, "%s-request: %s-request@%s\n", l->name, l->name,
              l->mailman_server);
-      fprintf(out, "%s: %s@%s\n", l->name, l->name, l->mailman_server);
-      incount++;
-      return;
     }
 
   if (l->acl_t ==  'L' && (l1 = hash_lookup(lists, l->acl_id)))
diff --git a/gen/mailman.gen b/gen/mailman.gen
new file mode 100755 (executable)
index 0000000..5764451
--- /dev/null
@@ -0,0 +1,89 @@
+#!/moira/bin/perl -Tw
+
+# $Id$
+
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+$MR_DBMS_ERR = 47836421;
+
+$outdir = '/moira/dcm/mailman';
+umask 022;
+
+use DBI;
+
+$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira") || exit $MR_DBMS_ERR;
+
+$sth0 = $dbh->prepare("SELECT m.name FROM machine m, serverhosts sh " .
+                    "WHERE m.mach_id = sh.mach_id AND " .
+                    "sh.service = 'MAILMAN' AND sh.enable = 1");
+$sth0->execute;
+
+while (($hostname) = $sth0->fetchrow_array) {
+    open(OUT, ">$outdir/$hostname");
+
+    $sth1 = $dbh->prepare("SELECT l.name, l.memacl_type, l.memacl_id " .
+                         "FROM list l, machine m WHERE ".
+                         "l.mailman = 1 AND " .
+                         "m.name = " . $dbh->quote($hostname) .
+                         "AND m.mach_id = l.mailman_id AND l.active = 1" .
+                         "AND l.memacl_type != 'KERBEROS'")
+       || exit $MR_DBMS_ERR;
+    $sth1->execute;
+
+    while (($listname, $memacl_type, $memacl_id) = $sth1->fetchrow_array) { 
+       $row = "$listname:";
+       $row =~ s/\0//g;
+       print OUT $row;
+       
+       if ($memacl_type eq "USER") {
+           ($member) = $dbh->selectrow_array("SELECT login FROM users " .
+                                             "WHERE users_id = " .
+                                             $dbh->quote($memacl_id)) ||
+                                             exit $MR_DBMS_ERR;
+           $member = $member . "\@mit.edu";
+           $row = "$member";
+           print OUT $row;
+       } else {
+           $sth2 = $dbh->prepare("SELECT UNIQUE i.member_type, i.member_id " .
+                                 "FROM imembers i, list l " .
+                                 "WHERE l.list_id = " . 
+                                 $dbh->quote($memacl_id) .
+                                 "AND i.list_id = l.list_id " .
+                                 "AND (i.member_type = 'USER' " .
+                                 "OR i.member_type = 'STRING')") || 
+                                 exit $MR_DBMS_ERR;
+           $sth2->execute;
+           $maybecomma = "";
+
+           while (($type, $id) = $sth2->fetchrow_array) {
+               if ($type eq "USER") {
+                   ($member) = $dbh->selectrow_array("SELECT login " .
+                                                     "FROM users " .
+                                                     "WHERE users_id = " . 
+                                                     $dbh->quote($id)) ||
+                                                      exit $MR_DBMS_ERR;
+                   $member = $member . "\@mit.edu";
+               }
+               elsif ($type eq "STRING") {
+                   ($member) = $dbh->selectrow_array("SELECT string " .
+                                                     "FROM strings " .
+                                                     "WHERE string_id = " .
+                                                     $dbh->quote($id)) ||
+                                                      exit $MR_DBMS_ERR;
+               }
+               $row = "$maybecomma$member";
+               $row =~ s/\0//g;
+               print OUT $row;
+               $maybecomma = ",";
+           }
+       }
+       $row = "\n";
+       $row =~ s/\0//g;
+       print OUT $row; 
+    }
+    close(OUT);
+}
+
+$dbh->disconnect;
+
+exit 0;
This page took 0.067661 seconds and 5 git commands to generate.