summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/aliases.py58
-rwxr-xr-xbin/digest_arch152
-rw-r--r--src/alias-wrapper.c112
3 files changed, 0 insertions, 322 deletions
diff --git a/Mailman/aliases.py b/Mailman/aliases.py
deleted file mode 100644
index a89dad812..000000000
--- a/Mailman/aliases.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# This is mailman's interface to the alias database.
-
-# TODO:
-# - fix this file! /etc/alias hacking no longer works
-
-# Write a wrapper program w/ root uid that allows the mailman user
-# only to update the alias database.
-
-import string
-_file = open('/etc/aliases', 'r')
-_lines = _file.readlines()
-aliases = {}
-_cur_line = None
-
-def _AddAlias(line):
- line = string.strip(line)
- if not line:
- return
- colon_index = string.find(line, ":")
- if colon_index < 1:
- raise "SyntaxError", "Malformed /etc/aliases file"
- alias = string.lower(string.strip(line[:colon_index]))
- rest = string.split(line[colon_index+1:], ",")
- rest = map(string.strip, rest)
- aliases[alias] = rest
-
-for _line in _lines:
- if _line[0] == '#':
- continue
- if _line[0] == ' ' or _line[0] == '\t':
- _cur_line = _cur_line + _line
- continue
- if _cur_line:
- _AddAlias(_cur_line)
- _cur_line = _line
-
-def GetAlias(str):
- str = string.lower(str)
- if not aliases.has_key(str):
- raise KeyError, "No such alias"
- return aliases[str]
-
diff --git a/bin/digest_arch b/bin/digest_arch
deleted file mode 100755
index 9d1f08dd4..000000000
--- a/bin/digest_arch
+++ /dev/null
@@ -1,152 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-"""
-NOTE: This is being deprecated since mailman has been shifted over to an
- external archiver (ie, andrew kuchling's latest version of pipermail.)
-
-This program shouldn't be attempted by people who don't understand Python.
-I wrote it to build archives for a few lists I'd been running for a long
-time under majordomo.
-
-Convert majordomo digests all stored in one directory into mailbox
-format. Note that the digests correct order in the dir should be
-alphabetical order.
-
-The output file is ARCHIVE.ME in the same directory the digests are in.
-Run this program before you transfer the majordomo list.
-
-To get the output file archived, create the list under mailman,
-run this script, and then do the following:
-
-cat ARCHIVE.ME >> ~mailman/mailman/lists/mylist/archived.mail
-
-You also need to adjust the variable:
-NUM_LINES_TO_STRIP_FROM_TOP
-"""
-
-import string, sys, os
-
-NUM_LINES_TO_STRIP_FROM_TOP = 11
-
-
-def setfromaddr(txt):
- global From
- words = string.split(txt)[1:]
- if len(words) == 1:
- From = words[0]
- return
-# This next line might be the source of an error if a digest has a
-# null message in it. If it does, remove that null message.
- if words[-1][0] == '<':
- From = words[-1][1:-1]
- return
- else:
- From = words[0]
- return
-
-days_of_week = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
-last_day = 'Sun' # See comment below ;-)
-last_dow = 0
-
-def setdateinfo(s):
- global dateinfo
- global last_day
- global last_dow
- words = string.split(s)
- if words[1][-1] <> ',':
- day, mon, year, time = words[1], words[2], words[3], words[4]
-
-# This is a quick hack that assumes someone posted every day. I
-# didn't make it more robust, because that's a lot more effort for
-# something few people will ever notice anyway.
-
- if day == last_day:
- dow = days_of_week[last_dow]
- else:
- dow = days_of_week[(last_dow + 1) % 7]
- else:
- dow, day, mon, year, time = words[1][:3], words[2], words[3], words[4], words[5]
- if len(day) == 1:
- day = '0' + day
-
- last_day = day
- last_dow = days_of_week.index(dow)
-
- if len(year) == 2:
- year = 1900 + int(year)
- outfile.write("From %s %s %s %s %s %s\n" % (From, dow, mon, day, time, year))
-# print "From %s %s %s %s %s %s" % (From, dow, mon, day, time, year)
-
-def header():
- global lines, curline, msgtextstart
- msgtextstart = curline + 2
- setfromaddr(lines[curline + 2])
- setdateinfo(lines[curline + 3])
- curline = curline + 4
-
-def text():
- global lines, curline, msgtextend
- while lines[curline] <> "------------------------------\n":
- curline = curline + 1
- msgtextend = curline - 1
-
-def output():
- for i in range(msgtextstart, msgtextend):
- if lines[i][:5] == 'From ':
- outfile.write('>')
- outfile.write(lines[i])
-
-def msg():
- global curline
- header()
- curline = curline + 2 #skip subject and blank line
- text()
- output()
-
-digest_dir = sys.argv[1]
-
-infiles = os.listdir(digest_dir)
-infiles.sort()
-try:
- infiles.remove('ARCHIVE_ME')
-except:
- pass
-outfile = open(os.path.join(digest_dir, 'ARCHIVE_ME'), 'w')
-
-for filename in infiles:
- infilename = os.path.join(digest_dir, filename)
- infile = open(infilename, 'r')
- print infilename
- lines = infile.readlines()
- curline = NUM_LINES_TO_STRIP_FROM_TOP
- numlines = len(lines)
- msgtextstart = None
- msgtextend = None
- From = None
- dateinfo = None
- subject = None
- while 1:
- # could check lines[curline] == '------------------------------\n'
- # but that should always be true.
- if (lines[curline+1] == '\n' and lines[curline+2][:6] == 'End of'
- and lines[curline+3][:6] == '******'):
- break
- msg()
- infile.close()
diff --git a/src/alias-wrapper.c b/src/alias-wrapper.c
deleted file mode 100644
index 0661eca33..000000000
--- a/src/alias-wrapper.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* alias-wrapper.c --- wrapper to allow the mailman user to modify the aliases
- * database.
- *
- * Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-
-/* passed in from configure script */
-const int LEGAL_PARENT_UID = ALIAS_UID; /* mailman's UID */
-const int LEGAL_PARENT_GID = ALIAS_GID; /* mail's GID */
-
-const char* SENDMAIL_CMD = "/usr/sbin/sendmail";
-const char* ALIAS_FILE = "/etc/aliases";
-const char* WRAPPER = "/home/mailman/mailman/mail/wrapper";
-
-/*
-** is the parent process allowed to call us?
-*/
-int
-LegalCaller()
-{
- /* compare to our parent's uid */
- if (LEGAL_PARENT_UID != getuid()) {
- printf("GOT UID %d.\n", getuid());
- return 0;
- }
- if (LEGAL_PARENT_GID != getgid()) {
- printf("GOT GID %d.\n", getgid());
- return 0;
- }
- return 1;
-}
-
-
-void
-AddListAliases(char *list)
-{
- FILE *f;
- int err = 0;
-
- f = fopen(ALIAS_FILE ,"a+");
- if (f == NULL) {
- err = 1;
- f = stderr;
- fprintf(f, "\n\n***********ERROR!!!!***********\n");
- fprintf(f, "Could not write to the /etc/aliases file.\n");
- fprintf(f, "Please become root, add the lines below to\n");
- fprintf(f, "that file, and then run the command:\n");
- fprintf(f, "%s -bi\n", SENDMAIL_CMD);
- }
-
- fprintf(f, "\n\n#-- %s -- mailing list aliases:\n", list);
- fprintf(f, "%s: \t|\"%s post %s\"\n", list, WRAPPER, list);
- fprintf(f, "%s-admin: \t|\"%s mailowner %s\"\n", list, WRAPPER, list);
- fprintf(f, "%s-request: \t|\"%s mailcmd %s\"\n", list, WRAPPER, list);
- fprintf(f, "# I think we don't want this one...\n");
- fprintf(f, "it'll change the unix from line...\n");
- fprintf(f, "#owner-%s: \t%s-admin\n", list, list);
- fprintf(f, "#%s-owner: \t%s-admin\n", list, list);
- fprintf(f, "\n");
- fclose(f);
-
- if (!err) {
- printf("Rebuilding alias database...\n");
- execlp(SENDMAIL_CMD, SENDMAIL_CMD, "-bi");
- }
-}
-
-
-int
-main(int argc, char **argv, char **env)
-{
- char *command;
- int i;
-
- if (argc != 2) {
- printf("Usage: %s [list-name]\n", argv[0]);
- exit(0);
- }
- if (LegalCaller()) {
- setuid(geteuid());
- AddListAliases(argv[1]);
- }
- else {
- printf("Illegal caller!\n");
- return 1;
- }
- return 0;
-}
-
-
-
-/*
- * Local Variables:
- * c-file-style: "python"
- * End:
- */