char *description;
char acl_t;
int acl_id;
+ char mailman;
+ char *mailman_server;
struct member *m;
};
{
time_t tm = time(NULL);
char filename[MAXPATHLEN], *targetfile;
- struct stat sb;
- int flag1, flag2;
FILE *out = stdout;
srand(tm);
if (argc == 2)
{
- if (stat(argv[1], &sb) == 0)
- {
- if (ModDiff(&flag1, "users", sb.st_mtime) ||
- ModDiff(&flag2, "list", sb.st_mtime))
- exit(MR_DATE);
- if (flag1 < 0 && flag2 < 0)
- {
- fprintf(stderr, "File %s does not need to be rebuilt.\n",
- argv[1]);
- exit(MR_NO_CHANGE);
- }
- }
targetfile = argv[1];
sprintf(filename, "%s~", targetfile);
if (!(out = fopen(filename, "w")))
void get_info(void)
{
EXEC SQL BEGIN DECLARE SECTION;
- int id, pid, iid, bid, cnt, maillistp, acl, mid;
+ int id, pid, iid, bid, cnt, maillistp, acl, mid, mailman;
char mname[MACHINE_NAME_SIZE], str[STRINGS_STRING_SIZE];
char login[USERS_LOGIN_SIZE], potype[USERS_POTYPE_SIZE];
char lname[LIST_NAME_SIZE], desc[LIST_DESCRIPTION_SIZE];
- char type[LIST_ACL_TYPE_SIZE];
+ char type[LIST_ACL_TYPE_SIZE], mailman_server[MACHINE_NAME_SIZE];
EXEC SQL END DECLARE SECTION;
char *s;
struct user *u;
lists = create_hash(15000);
EXEC SQL DECLARE l_cursor CURSOR FOR
- SELECT list_id, name, maillist, description, acl_type, acl_id
- FROM list
- WHERE active != 0
+ SELECT l.list_id, l.name, l.maillist, l.description, l.acl_type, l.acl_id,
+ l.mailman, m.name
+ FROM list l, machine m
+ WHERE active != 0 AND l.mailman_id = m.mach_id
ORDER BY list_id;
EXEC SQL OPEN l_cursor;
while (1)
{
- EXEC SQL FETCH l_cursor INTO :id, :lname, :maillistp, :desc, :type, :acl;
+ EXEC SQL FETCH l_cursor INTO :id, :lname, :maillistp, :desc, :type, :acl,
+ :mailman, :mailman_server;
if (sqlca.sqlcode)
break;
l = malloc(sizeof(struct list));
l->description = strdup(strtrim(desc));
l->acl_t = type[0];
l->acl_id = acl;
+ l->mailman = mailman;
+ l->mailman_server = strdup(strtrim(mailman_server));
l->m = NULL;
if (hash_store(lists, id, l) < 0)
{
}
int line_width, alias_width;
+static const char *mailman_suffixes[] = { "-admin", "-owner", "-request",
+ "-bounces", "-confirm", "-join",
+ "-leave", "-subscribe",
+ "-unsubscribe", NULL };
void output_mlist(int id, void *list, void *out)
{
struct list *l = list, *l1;
struct user *u;
- int len = strlen(l->name);
+ int len = strlen(l->name), i;
if (!l->maillist || !check_string(l->name))
return;
put_fill(out, l->description);
- if (l->acl_t == 'L' && (l1 = hash_lookup(lists, l->acl_id)))
+ if (l->mailman && strcmp(l->mailman_server, "[NONE]"))
+ {
+ for (i = 0; mailman_suffixes[i]; i++)
+ fprintf(out, "%s%s: %s%s@%s\n", l->name, mailman_suffixes[i], l->name,
+ mailman_suffixes[i], l->mailman_server);
+ fprintf(out, "owner-%s: %s-owner@%s\n", l->name, l->name,
+ l->mailman_server);
+ }
+ else 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)))
}
-/* Illegal chars: this should correspond to the array used by
- * setup_alis. */
+/* Illegal chars: this no longer corresponds to the array
+ * in setup_alis. '+' is a valid character in a string on
+ * a list, but is not a valid character in a listname.
+ */
static int illegalchars[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* ^@ - ^O */