[1554] in Moira

home help back first fref pref prev next nref lref last post

RE: some suggested mailhub.gen changes

daemon@ATHENA.MIT.EDU (Tom Coppeto)
Wed May 31 09:28:38 2000

From: "Tom Coppeto" <tom@MIT.EDU>
To: "Garry Zacheiss" <zacheiss@mit.edu>, <moiradev@mit.edu>
Cc: <postmaster@mit.edu>
Date: Wed, 31 May 2000 09:42:07 -0400
Message-ID: <NDBBKHCHPJDKBDPHJLDAOEKCCPAA.tom@mit.edu>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
In-Reply-To: <200005310106.VAA20287@sweet-transvestite.mit.edu>

Thanks for taking this up.

I think there needs to be an owner list for every mailing list. In moira,
this is overloaded with the acl field. One suggestion is to have an explicit
email owner for very list.

What is the sender if the owner list is expanded? If the list is expanded,
the sender becomes "tom@mit.edu, dick@mit.edu, harry@spot.com"? If so we
should check on the validity of this.

-----Original Message-----
From: Garry Zacheiss [mailto:zacheiss@MIT.EDU]
Sent: Tuesday, May 30, 2000 9:06 PM
To: moiradev@MIT.EDU
Subject: some suggested mailhub.gen changes


	These patches have 2 effects:

1.) If the owner of the list isn't a mailing list, expand the owner-foo
alias to the members of the owning list, so that the owner list doesn't
become a mailing list.  People have complained about this at various
points since roughly the dawn of time.

2.) Do the same expansion in the case of self-owned lists, to work
around the envelope-from looping lossage that bit fps when it was first
deployed.

I'm not especially attached to these, but I thought they might make some
postmaterly lives easier.  Let me know if you want them.

Garry

Index: mailhub.pc
===================================================================
RCS file:
/afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/mailhub.pc,
v
retrieving revision 1.12
diff -c -r1.12 mailhub.pc
*** mailhub.pc	2000/01/28 00:31:56	1.12
--- mailhub.pc	2000/05/30 22:39:59
***************
*** 34,41 ****
  #define FALSE 0
  #define TRUE (!FALSE)

- FILE *out = stdout;
-
  struct hash *users, *machines, *strings, *lists;
  struct user {
    char *login;
--- 34,39 ----
***************
*** 56,65 ****
  };

  void get_info(void);
- void save_mlist(int id, void *list, void *force);
  int check_string(char *s);
  void output_login(int dummy, void *names, void *out);
! void output_mlist(int id, struct list *l);
  void put_fill(FILE *aliases, char *string);
  void do_people(void);

--- 54,63 ----
  };

  void get_info(void);
  int check_string(char *s);
  void output_login(int dummy, void *names, void *out);
! void output_mlist(int id, void *list, void *out);
! void output_membership(struct list *l, FILE *out);
  void put_fill(FILE *aliases, char *string);
  void do_people(void);

***************
*** 71,77 ****
--- 69,77 ----
    char filename[MAXPATHLEN], *targetfile;
    struct stat sb;
    int flag1, flag2;
+   FILE *out = stdout;

+   srand(tm);
    EXEC SQL CONNECT :db;

    if (argc == 2)
***************
*** 112,118 ****

    incount = 0;
    fprintf(out, "\n%s\n# Mailing lists\n%s\n\n", divide, divide);
!   hash_step(lists, save_mlist, FALSE);
    fprintf(stderr, "Output %d lists\n", incount);

    incount = 0;
--- 112,118 ----

    incount = 0;
    fprintf(out, "\n%s\n# Mailing lists\n%s\n\n", divide, divide);
!   hash_step(lists, output_mlist, out);
    fprintf(stderr, "Output %d lists\n", incount);

    incount = 0;
***************
*** 363,429 ****
  }


! void save_mlist(int id, void *list, void *force)
  {
!   struct member *m;
    struct list *l = list, *l1;

!   if (l->maillist > 1 || (l->maillist == 0 && !force) ||
!       !check_string(l->name))
      return;

!   /* If user group appears on list, replace with user. */
    if (l->m && l->m->next == NULL && !strcasecmp(l->name, l->m->name))
!     {
!       l->maillist = 3;
!       return;
!     }
!   l->maillist = 2;
!   output_mlist(id, l);

!   if (l->acl_t == 'L' && (l1 = hash_lookup(lists, l->acl_id)))
!     save_mlist(0, l1, (void *)TRUE);

!   for (m = l->m; m; m = m->next)
      {
!       if (m->list_id && (l1 = hash_lookup(lists, m->list_id)))
! 	save_mlist(0, l1, (void *)TRUE);
      }
! }
!
! void output_login(int dummy, void *user, void *out)
! {
!   struct user *u = user;

    incount++;
-   if (u->pobox && check_string(u->login) && u->login[0] != '#')
-     fprintf(out, "%s: %s\n", u->login, u->pobox);
  }

! void output_mlist(int id, struct list *l)
  {
-   struct list *l1;
    struct member *m;
!   struct user *u;
!   int line_width, alias_width, word_width, beginning;
    static int cont = 1;
    char str[8];

-   put_fill(out, l->description);
-   if (l->acl_t ==  'L' && (l1 = hash_lookup(lists, l->acl_id)))
-     fprintf(out, "owner-%s: %s\n%s: ", l->name, l1->name, l->name);
-   else if (l->acl_t ==  'U' && (u = hash_lookup(users, l->acl_id)))
-     fprintf(out, "owner-%s: %s\n%s: ", l->name, u->login, l->name);
-   else
-     fprintf(out, "%s: ", l->name);
-
-   alias_width = line_width = strlen(l->name) + 2;
-   beginning = 1;
    for (m = l->m; m; m = m->next)
      {
        word_width = strlen(m->name);

!       if (!beginning && alias_width + word_width + 2 > MAX_ALIAS_WIDTH)
  	{
  	  /* Make a continuation. */
  	  sprintf(str, "%c%c%c%c%c%c", rand() % 26 + 97, rand() % 26 + 97,
--- 363,429 ----
  }


! void output_login(int dummy, void *user, void *out)
  {
!   struct user *u = user;
!
!   incount++;
!   if (u->pobox && check_string(u->login) && u->login[0] != '#')
!     fprintf(out, "%s: %s\n", u->login, u->pobox);
! }
!
! int line_width, alias_width;
!
! void output_mlist(int id, void *list, void *out)
! {
    struct list *l = list, *l1;
+   struct user *u;
+   int len = strlen(l->name);

!   if (!l->maillist || !check_string(l->name))
      return;

!   /* If standard user group appears on a list, substitute in the user. */
    if (l->m && l->m->next == NULL && !strcasecmp(l->name, l->m->name))
!     return;

!   put_fill(out, l->description);

!   if (l->acl_t ==  'L' && (l1 = hash_lookup(lists, l->acl_id)))
      {
!       fprintf(out, "owner-%s: ", l->name);
!       if ((l1->maillist) && (strcmp(l->name, l1->name)))
! 	fprintf(out, "%s\n", l1->name);
!       else
! 	{
! 	  alias_width = line_width = len + 8;
! 	  output_membership(l1, out);
! 	  fprintf(out, "\n");
! 	}
      }
!   else if (l->acl_t ==  'U' && (u = hash_lookup(users, l->acl_id)))
!     fprintf(out, "owner-%s: %s\n", l->name, u->login);

+   fprintf(out, "%s: ", l->name);
+   alias_width = line_width = len + 2;
+   output_membership(l, out);
+   fprintf(out, "\n\n");
    incount++;
  }

! void output_membership(struct list *l, FILE *out)
  {
    struct member *m;
!   struct list *l1;
!   int word_width, linestart = 1;
    static int cont = 1;
    char str[8];

    for (m = l->m; m; m = m->next)
      {
        word_width = strlen(m->name);

!       if (!linestart && alias_width + word_width + 2 > MAX_ALIAS_WIDTH)
  	{
  	  /* Make a continuation. */
  	  sprintf(str, "%c%c%c%c%c%c", rand() % 26 + 97, rand() % 26 + 97,
***************
*** 432,451 ****
  	  fprintf(out, ",\n\tcont%d-%s\ncont%d-%s: ", cont, str, cont, str);
  	  cont++;
  	  alias_width = line_width = 17 + word_width;
- 	  fputs(m->name, out);
  	}
!       else if (beginning)
  	{
! 	  /* Beginning of alias, so don't wrap. */
  	  line_width += word_width;
  	  alias_width = line_width;
! 	  fputs(m->name, out);
! 	  beginning = 0;
  	}
        else if (line_width + word_width + 2 > MAX_LINE_WIDTH)
  	{
  	  /* Wrap. */
! 	  fprintf(out, ",\n\t%s", m->name);
  	  alias_width += line_width + word_width + 2;
  	  line_width = word_width + 8;
  	}
--- 432,449 ----
  	  fprintf(out, ",\n\tcont%d-%s\ncont%d-%s: ", cont, str, cont, str);
  	  cont++;
  	  alias_width = line_width = 17 + word_width;
  	}
!       else if (linestart)
  	{
! 	  /* First word on line, so we can't wrap. */
  	  line_width += word_width;
  	  alias_width = line_width;
! 	  linestart = 0;
  	}
        else if (line_width + word_width + 2 > MAX_LINE_WIDTH)
  	{
  	  /* Wrap. */
! 	  fputs(",\n\t", out);
  	  alias_width += line_width + word_width + 2;
  	  line_width = word_width + 8;
  	}
***************
*** 453,465 ****
  	{
  	  /* Continue line. */
  	  line_width += word_width + 2;
! 	  fprintf(out, ", %s", m->name);
  	}
      }
    if (!l->m)
      fprintf(out, "/dev/null");
-   fprintf(out, "\n\n");
-   incount++;
  }

  /* Write a word-wrapped list description to the aliases file as a
--- 451,466 ----
  	{
  	  /* Continue line. */
  	  line_width += word_width + 2;
! 	  fputs(", ", out);
  	}
+
+       if (m->list_id && (l1 = hash_lookup(lists, m->list_id)) &&
!l1->maillist)
+ 	output_membership(l1, out);
+       else
+ 	fputs(m->name, out);
      }
    if (!l->m)
      fprintf(out, "/dev/null");
  }

  /* Write a word-wrapped list description to the aliases file as a


home help back first fref pref prev next nref lref last post