]> andersk Git - moira.git/blobdiff - gen/aliases.qc
added fsgroup
[moira.git] / gen / aliases.qc
index eff025c7264644ae4b1e2079e5e21d561acc2607..e37758863fa862a23419b3d5332a561c3fc3fa16 100644 (file)
@@ -5,9 +5,14 @@
  *     user pobox entries
  *     maillist expansions
  *     sublists of maillists
+ *
+ *  (c) Copyright 1988 by the Massachusetts Institute of Technology.
+ *  For copying and distribution information, please see the file
+ *  <mit-copyright.h>.
  */
 
 
+#include <mit-copyright.h>
 #include <stdio.h>
 #include <string.h>
 #include <sms.h>
@@ -22,6 +27,7 @@
 
 char *divide = "########################################################################";
 extern int errno;
+char *whoami = "aliases.gen";
 char *ingres_date_and_time();
 
 
@@ -35,7 +41,9 @@ char **argv;
     struct stat sb;
 ##  int flag1, flag2, flag3;
 ##  char *filetime;
+    int ingerr();
 
+    IIseterr(ingerr);
 ##  ingres sms
 
     if (argc == 2) {
@@ -90,6 +98,32 @@ char **argv;
 }
 
 
+/*
+ * ingerr: (supposedly) called when Ingres indicates an error.
+ * I have not yet been able to get this to work to intercept a
+ * database open error.
+ */
+#define INGRES_DEADLOCK 4700
+
+static int ingerr(num)
+    int *num;
+{
+    char buf[256];
+    int ingres_errno;
+
+    switch (*num) {
+    case INGRES_DEADLOCK:
+       ingres_errno = SMS_DEADLOCK;
+       break;
+    default:
+       ingres_errno = SMS_INGRES_ERR;
+    }
+    com_err(whoami, SMS_INGRES_ERR, " code %d\n", *num);
+    critical_alert("DCM", "Alias build encountered INGRES ERROR %d", *num);
+    exit(ingres_errno);
+}
+
+
 struct hash *users, *machines, *strings, *lists;
 struct user {
     char login[9];
@@ -118,6 +152,7 @@ get_info()
     register struct user *u;
     register struct list *l;
     register struct member *m;
+    register struct list *memberlist;
 
     fprintf(stderr, "Loading machines\n");
     machines = create_hash(1000);
@@ -186,8 +221,8 @@ get_info()
                  m->name = u->login;
            } else if (type[0] == 'L') {
                m->list_id = mid;
-               if (l = (struct list *) hash_lookup(lists, mid))
-                 m->name = l->name;
+               if (memberlist = (struct list *) hash_lookup(lists, mid))
+                 m->name = memberlist->name;
            } else if (type[0] == 'S') {
                m->list_id = 0;
                if (s = hash_lookup(strings, mid))
@@ -212,23 +247,12 @@ struct save_queue *sq;
 }
 
 
-/* Determine if a list, given by list_id, is a user group. 
- * We really need to figure out a way to do this right.
- */
-
-int user_group(id)
-int id;
-{
-    return(0);
-}
-
-
 /* Extract mailing lists.  Make a list of all mailinglists, then
  * process them, adding any sub-lists or acl lists to the list of lists
  * to be processed.  If further sublists are encountered, repeat...
  */
 
-int lwid, bol;
+int lwid, bol, awid;
 
 do_mlists(out)
 FILE *out;
@@ -256,8 +280,7 @@ FILE *out;
        if (l->acl_t ==  'L') {
            if (l1 = (struct list *) hash_lookup(lists, l->acl_id)) {
                fprintf(out, "owner-%s: %s\n", l->name, l1->name);
-               if (!user_group(l->acl_id))
-                 sq_save_unique_data(sq, l->acl_id);
+               sq_save_unique_data(sq, l->acl_id);
            }
        } else if (l->acl_t ==  'U') {
            if (u = (struct user *) hash_lookup(users, l->acl_id))
@@ -267,14 +290,16 @@ FILE *out;
        lwid = strlen(l->name) + 2;
        bol = 1;
        for (m = l->m; m; m = m->next) {
-           if (m->list_id != 0  && user_group(m->list_id))
+           if (m->list_id != 0)
              sq_save_unique_data(sq, m->list_id);
            do_member(out, m->name);
        }
        fprintf(out, "\n\n");
     }
 
-    sq_destroy(sq);
+/*  Removed for speed, since this take 10 minutes to free, and we don't
+ *  really need the memory reclaimed.
+ *  sq_destroy(sq); */
 }
 
 
@@ -285,13 +310,12 @@ FILE *out;
 register char *s;
 {
     register wwid;
-    static int awid;
     static int cont = 1;
 
     strtrim(s);
     wwid = strlen(s);
 
-    if (awid + wwid + 2 > AL_MAX_WID) {
+    if (!bol && awid + wwid + 2 > AL_MAX_WID) {
        fprintf(out, ",\n\tcontinuation-%d\ncontinuation-%d: ", cont, cont);
        cont++;
        awid = lwid = bol = 17;
@@ -306,7 +330,7 @@ register char *s;
     }
     if (lwid + wwid + 2 > ML_WID) {
        fprintf(out, ",\n\t%s", s);
-       awid = lwid + wwid + 2;
+       awid += lwid + wwid + 2;
        lwid = wwid + 8;
        return;
     }
This page took 0.122516 seconds and 4 git commands to generate.