diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/createlinks mezzanine_patched_smeserver-ezmlm-web-1.1.2/createlinks --- smeserver-ezmlm-web-1.1.2/createlinks 2005-10-24 20:42:33.000000000 -0400 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/createlinks 2006-02-17 16:20:54.000000000 -0500 @@ -1,15 +1,6 @@ #!/usr/bin/perl -w -sub panel_link -{ - my ($function, $panel) = @_; - - unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function"; - symlink("../../../functions/$function", - "root/etc/e-smith/web/panels/$panel/cgi-bin/$function") - or die "Can't symlink to root/etc/e-smith/web/panels/$panel". - "/cgi-bin/$function: $!"; -} +use esmith::Build::CreateLinks qw(:all); #-------------------------------------------------- # functions for manager panel @@ -18,32 +9,19 @@ panel_link("mailinglists", $panel); -sub event_link -{ - my ($action, $event, $level) = @_; - - unlink "root/etc/e-smith/events/${event}/S${level}${action}"; - symlink("../actions/${action}", - "root/etc/e-smith/events/${event}/S${level}${action}") - or die "Can't symlink to root/etc/e-smith/events/${event}/S${level}${action}:". - " $!"; -} - -#-------------------------------------------------- -# actions for bootstrap-console-save event -#-------------------------------------------------- -# my $event = "bootstrap-console-save"; - -#event_link("xxx-conf", $event, "60"); - foreach my $event ( qw(create delete modify) ) { - event_link("ezmlm-conf", "mailinglist-${event}", "10"); event_link("ezmlm-update", "mailinglist-${event}", "60"); - event_link("email-assign", "mailinglist-${event}", "90"); + templates2events("/var/qmail/users/assign", $event); + safe_symlink("/var/qmail/bin/qmail-newu", + "root/etc/e-smith/events/$event/S55email-assign"); } -foreach my $event ( qw(bootstrap-console-save email-update) ) -{ - event_link("ezmlm-conf", "email-update", "90"); -} +templates2events("/etc/ezmlm/ezmlmwebrc", + qw( + bootstrap-console-save + email-update + mailinglist-create + mailinglist-update + mailinglist-assign + )); diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf 2005-10-24 20:42:33.000000000 -0400 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-conf 1969-12-31 19:00:00.000000000 -0500 @@ -1,34 +0,0 @@ -#!/usr/bin/perl -w -#---------------------------------------------------------------------- -# copyright (C) 2000 Gormand Pty Ltd -# copyright (C) 2001 Mitel Networks Corporation -# -# 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 -# -# Technical support for this program is available from Mitel Networks -# Please visit our web site www.e-smith.com for details. -#---------------------------------------------------------------------- -package esmith; - -use strict; -use Errno; -use esmith::config; -use esmith::util; - -tie my %conf, 'esmith::config'; - -esmith::util::processTemplate(\%conf, "/etc/ezmlm/ezmlmwebrc"); - -exit (0); diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update 2006-02-17 17:04:08.000000000 -0500 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/events/actions/ezmlm-update 2006-02-17 16:44:04.000000000 -0500 @@ -1,7 +1,7 @@ #!/usr/bin/perl -w #---------------------------------------------------------------------- # copyright (C) 2000-2002 Gormand Pty Ltd -# copyright (C) 2002 Mitel Networks Corporation +# copyright (C) 2002,2006 Mitel Networks Corporation # # 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 @@ -17,24 +17,22 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Technical support for this program is available from Mitel Networks -# Please visit our web site www.mitel.com/sme/ for details. #---------------------------------------------------------------------- package esmith; use strict; use Errno; -use esmith::config; +use esmith::ConfigDB; +use esmith::AccountsDB; use esmith::util; -use esmith::db; use File::Find; use User::pwent; use Mail::Ezmlm; -tie my %conf, 'esmith::config'; -tie my %accounts, 'esmith::config', '/home/e-smith/db/accounts'; +my $conf = esmith::ConfigDB->open; +my $accounts = esmith::AccountsDB->open; my $event = $ARGV [0]; die "event argument missing." unless defined ($event); @@ -53,7 +51,8 @@ -s /bin/false ezmlm)) == 0 or warn("Could not create user 'ezmlm'\n"); - db_set(\%accounts, "ezmlm", "system", { Uid => "80", Gid => "80" } ); + $accounts->new_record("ezmlm", "system", { Uid => "80", Gid => "80" } ); + unless ($accounts->get("ezmlm")); } my $pw = getpwnam("ezmlm") or die "User ezmlm not found"; @@ -67,10 +66,11 @@ $> = $pw->uid; $) = $pw->gid; +my $list = $accounts->get($listName) or die "$listName not found in accounts db"; die "$listName is not a mailing list account." - unless (db_get_type(\%accounts, $listName) eq "mailinglist"); + unless ($list->prop('type') eq "mailinglist"); -my $listHost = db_get_prop(\%accounts, $listName, "Domain"); +my $listHost = $list->prop("Domain"); my $listHomeBase = "${ownerHome}/lists"; @@ -86,7 +86,7 @@ { my $list = new Mail::Ezmlm; - my $listOwner = db_get_prop(\%accounts, $listName, "Owner"); + my $listOwner = $list->prop("Owner"); $list->make(-dir => $listHome, -qmail => $listAlias, diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists 2006-02-17 17:04:08.000000000 -0500 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/templates/var/qmail/users/assign/90mailinglists 2006-02-17 16:37:36.000000000 -0500 @@ -1,15 +1,14 @@ { - use esmith::config; - use esmith::db; + use esmith::AccountsDB; $OUT = ''; # Generate qmail user assignments for mailing lists. These will be handled # by ~ezmlm/.qmail-listname and ~ezmlm/.qmail-listname-ext. - my %accounts; - tie %accounts, 'esmith::config', "/home/e-smith/db/accounts"; + my $adb = esmith::AccountsDB->open_ro; + setpwent; my (undef, undef, $uid, $gid, undef, undef, undef, $dir, undef) = getpwnam("ezmlm"); @@ -32,9 +31,9 @@ my $ezmlm_assign = "ezmlm:${uid}:${gid}:${dir}"; - foreach my $listname (db_get(\%accounts)) + foreach my $list ($adb->get_all_by_prop(type => "mailinglist")) { - next unless db_get_type(\%accounts, $listname) eq "mailinglist"; + my $listname = $list->key; # Assign mail for listname@ $OUT .= "=${listname}:${ezmlm_assign}:-:${listname}:\n"; @@ -42,15 +41,4 @@ # Assign mail for listname-ext@ $OUT .= "+${listname}-:${ezmlm_assign}:-${listname}-::\n"; } - - # Need to remove the final newline character. Blank lines in - # /var/qmail/users/assign are prohibited. - - chomp($OUT); - - # Failsafe: /var/qmail/users/assign cannot have blank lines. - # Therefore, if $OUT is empty, simply set up an assign for the - # ezmlm user. - - $OUT = "=ezmlm:${ezmlm_assign}:::" unless $OUT; } diff -Nur -x '*.orig' -x '*.rej' smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists --- smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists 2006-02-17 17:04:08.000000000 -0500 +++ mezzanine_patched_smeserver-ezmlm-web-1.1.2/root/etc/e-smith/web/functions/mailinglists 2006-02-17 17:02:57.000000000 -0500 @@ -6,7 +6,7 @@ # navigation : 3000 3600 # # copyright (C) 2000 Gormand Pty Ltd -# copyright (C) 2001 Mitel Networks Corporation +# copyright (C) 2001,2006 Mitel Networks Corporation # # 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 @@ -22,8 +22,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Technical support for this program is available from Mitel Networks -# Please visit our web site www.e-smith.com for details. +# Technical support for this program is available from Gorman Pty Ltd +# Please visit our web site www.gormand.com.au for contact details. #---------------------------------------------------------------------- package esmith; @@ -33,9 +33,10 @@ use CGI::Carp qw(fatalsToBrowser); use esmith::cgi; -use esmith::config; +use esmith::ConfigDB; +use esmith::AccountsDB; +use esmith::DomainsDB; use esmith::util; -use esmith::db; use User::pwent; sub showInitial ($$); @@ -65,14 +66,9 @@ use constant EZMLMWEB => '/common/ezmlm-web'; -my %conf; -tie %conf, 'esmith::config'; - -my %accounts; -tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; - -my %domains; -tie %domains, 'esmith::config', '/home/e-smith/db/domains'; +my $conf = esmith::ConfigDB->open; +my $accounts = esmith::AccountsDB->open; +my $domains = esmith::DomainsDB->open; #------------------------------------------------------------ # examine state parameter and display the appropriate form @@ -115,7 +111,7 @@ } else { - esmith::cgi::genStateError ($q, \%conf); + esmith::cgi::genStateError ($q, undef); } exit (0); @@ -136,12 +132,12 @@ if ($msg eq '') { esmith::cgi::genHeaderNonCacheable - ($q, \%conf, 'Create, remove, or modify mailing lists'); + ($q, undef, 'Create, remove, or modify mailing lists'); } else { esmith::cgi::genHeaderNonCacheable - ($q, \%conf, 'Operation status report'); + ($q, undef, 'Operation status report'); print $q->p ($msg); print $q->hr; @@ -151,9 +147,7 @@ # Look up current lists #------------------------------------------------------------ - my @mailingLists = - grep { db_get_type(\%accounts, $_) eq "mailinglist" } - keys %accounts; + my @mailingLists = $accounts->get_all_by_prop('type' => 'mailinglist'); print $q->p ($q->a ({href => $q->url (-absolute => 1) . "?state=create"}, 'Click here'), @@ -180,12 +174,12 @@ $q->td (' ') ); - foreach my $list (sort @mailingLists) + foreach my $list (@mailingLists) { - my $domain = db_get_prop(\%accounts, $list, 'Domain'); - my $description = db_get_prop(\%accounts, $list, 'Description'); + my $domain = $list->prop('Domain'); + my $description = $list->prop('Description'); - print $q->Tr ( esmith::cgi::genSmallCell ($q, $list), + print $q->Tr ( esmith::cgi::genSmallCell ($q, $list->key), esmith::cgi::genSmallCell ($q, $domain), esmith::cgi::genSmallCell ($q, $description), esmith::cgi::genSmallCell ($q, @@ -196,7 +190,7 @@ esmith::cgi::genSmallCell ($q, $q->a ({href => $q->url (-absolute => 1) . "?state=delete&list=" - . $list}, 'Remove...')) + . $list->key}, 'Remove...')) ); } @@ -214,19 +208,14 @@ my ($q) = @_; esmith::cgi::genHeaderNonCacheable - ($q, \%conf, 'Create a new mailing list'); + ($q, undef, 'Create a new mailing list'); print $q->startform (-method => 'POST', -action => $q->url (-absolute => 1)); - my @existingDomains = ( db_get(\%conf, "DomainName"), - grep { db_get_type(\%domains, $_) eq "domain" } - keys %domains - ); - - my @existingAccounts = ( "Administrator", - grep { db_get_type(\%accounts, $_) eq "user" } - keys %accounts ); + my @existingDomains = map { $_->key } $domains->domains; + + my @existingAccounts = ( "Administrator", map { $_->key } $accounts->users ); print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, @@ -327,11 +316,12 @@ #------------------------------------------------------------ # Looks good. Find out if this account has been taken #------------------------------------------------------------ - if ( defined db_get_type(\%accounts, $listName) ) + my $list = $accounts->get($listName); + if ($list) { showInitial ($q, "Error: account \"$listName\" is an existing " . - db_get_type(\%accounts, $listName) . " account."); + $list->prop('type') . " account."); return; } @@ -340,8 +330,10 @@ # mailinglist-create event. #------------------------------------------------------------ - db_set( \%accounts, $listName, "mailinglist", - { Domain => $listDomain, + $accounts->new_record($listName, + { + type => 'mailinglist', + Domain => $listDomain, Description => $listDescription, Owner => $listOwner, } ); @@ -360,16 +352,17 @@ { my ($q) = @_; - esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Remove mailing list'); + esmith::cgi::genHeaderNonCacheable ($q, undef, 'Remove mailing list'); print $q->startform (-method => 'POST', -action => $q->url (-absolute => 1)); - my $list = $q->param ('list'); + my $listName = $q->param ('list'); - if ( defined db_get(\%accounts, $list) ) + my $list = $accounts->get($listName); + if ($list) { - print $q->p ("You are about to remove the mailing list \"$list\""); + print $q->p ("You are about to remove the mailing list \"$listName\""); print $q->p ('The mailing list address will no longer be usable', 'and current items and the list archives will be removed'); @@ -377,7 +370,7 @@ print $q->p ($q->b ('Are you sure you wish to remove this list?')); print $q->submit (-name => 'action', -value => 'Remove'); - print $q->hidden (-name => 'list', -override => 1, -default => $list); + print $q->hidden (-name => 'list', -override => 1, -default => $listName); print $q->hidden (-name => 'state', -override => 1, @@ -400,13 +393,14 @@ #------------------------------------------------------------ # Attempt to delete list #------------------------------------------------------------ - my $list = $q->param ('list'); - - system ('/sbin/e-smith/signal-event', 'mailinglist-delete', $list) == 0 - or die ("Error occurred while deleting list.\n"); - - delete $accounts {$list}; - - showInitial ($q, "Successfully deleted mailing list $list."); + my $listName = $q->param ('list'); + my $list = $accounts->get($listName); + if ($list) + { + system ('/sbin/e-smith/signal-event', 'mailinglist-delete', $listName) == 0 + or die ("Error occurred while deleting list.\n"); + $list->delete; + showInitial ($q, "Successfully deleted mailing list $list."); + } }