initial commit of file from CVS for smeserver-mailman on Sat Sep 7 19:55:48 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 19:55:48 +10:00
parent b4cf41e403
commit aeebf1b0da
64 changed files with 2941 additions and 2 deletions

View File

@@ -0,0 +1,55 @@
# Copyright (C) 2001,2002 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.
"""Creation/deletion hooks for the SME and Q-Mail
"""
import os
import time
import errno
import pwd
from stat import *
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import LockFile
from Mailman.i18n import _
from Mailman.MTA.Utils import makealiases
from Mailman.Logging.Syslog import syslog
def create(mlist, cgi=0, nolock=0):
listname = mlist.internal_name()
msg = 'command failed: %s (status: %s, %s)'
acmd = '/usr/lib/mailman/bin/smelist addlist ' + listname
status = (os.system(acmd) >> 8) & 0xff
if status:
errstr = os.strerror(status)
syslog('error', msg, acmd, status, errstr)
raise RuntimeError, msg % (acmd, status, errstr)
def remove(mlist, cgi=0):
listname = mlist.internal_name()
msg = 'command failed: %s (status: %s, %s)'
acmd = '/usr/lib/mailman/bin/smelist rmlist ' + listname
status = (os.system(acmd) >> 8) & 0xff
if status:
errstr = os.strerror(status)
syslog('error', msg, acmd, status, errstr)
raise RuntimeError, msg % (acmd, status, errstr)

View File

@@ -0,0 +1,33 @@
#!/bin/bash
[ -d /var/lib/mailman/lists/mailman ] && exit 0
echo " "
DOMAIN=`/sbin/e-smith/config get DomainName`
if [ ! -d /var/lib/mailman/lists/mailman ]; then
MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
LENGTH="18"
while [ "${n:=1}" -le "$LENGTH" ]; do
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
let n+=1
done
/sbin/e-smith/config setprop mailman SitePass $PASS
/usr/lib/mailman/bin/mmsitepass "$PASS" > /dev/null 2>&1 || :
/usr/lib/mailman/bin/newlist -q mailman admin@${DOMAIN} dummypass > /dev/null 2>&1 || :
cat > /tmp/hide << EOF
advertised = 0
archive_private = 1
description = 'Mailman Mailing List'
EOF
/usr/lib/mailman/bin/config_list -i /tmp/hide mailman > /dev/null 2>&1 || :
rm -f /tmp/hide
echo -n "* "
/usr/lib/mailman/bin/change_pw -l mailman 2> /dev/null || echo "New mailman password: *UNCHANGED*"; :
"/usr/lib/mailman/bin/add_members -r - -a n mailman << EOF
admin@${DOMAIN}
EOF" > /dev/null 2>&1 || :
else
/etc/e-smith/events/actions/email-assign || :
fi
/usr/lib/mailman/bin/check_perms -f

View File

@@ -0,0 +1,31 @@
#!/usr/bin/perl -wT
package esmith;
use strict;
use esmith::util;
my $usage = "$0 is not meant to be called from the command line.
";
my ($event, $list) = @ARGV;
die $usage unless $event;
die $usage unless $list;
BEGIN
{
$ENV {'PATH'} = '';
$ENV {'SHELL'} = '/bin/bash';
delete $ENV {'ENV'};
}
die "Unknown event $event"
unless ($event =~ /^(addlist|rmlist|update)$/);
$event = $1;
die "Invalid list name $list"
unless ($list =~ /^([\w\-\._]+)$/);
$list = $1;
esmith::util::setRealToEffective ();
system ("/sbin/e-smith/signal-event", "mailman-$event", "$list") == 0
or die ("Error occurred while modifying mailman list $list.\n");