diff -Nur --no-dereference smeserver-ezmlm-web-1.1.3.old/createlinks smeserver-ezmlm-web-1.1.3/createlinks --- smeserver-ezmlm-web-1.1.3.old/createlinks 2022-03-20 02:09:58.724000000 -0400 +++ smeserver-ezmlm-web-1.1.3/createlinks 2022-03-20 02:19:44.859000000 -0400 @@ -33,7 +33,7 @@ console-save email-update mailinglist-create - mailinglist-update + mailinglist-modify mailinglist-assign )); templates2events("/home/e-smith/files/ezmlm/lists/webusers", @@ -42,7 +42,7 @@ console-save email-update mailinglist-create - mailinglist-update + mailinglist-modify mailinglist-assign )); my $event="smeserver-ezmlm-web-update"; diff -Nur --no-dereference smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/events/actions/ezmlm-update smeserver-ezmlm-web-1.1.3/root/etc/e-smith/events/actions/ezmlm-update --- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/events/actions/ezmlm-update 2014-06-16 11:54:25.000000000 -0400 +++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/events/actions/ezmlm-update 2022-03-20 02:11:36.623000000 -0400 @@ -38,7 +38,7 @@ die "event argument missing." unless defined ($event); my $listName = $ARGV[1]; -die "listName argument missing." unless defined ($listName); +die "listName argument missing." unless defined ($listName) || $event eq "smeserver-ezmlm-web-update"; # We really want to do all ezmlm functions as the user ezmlm - saves # lots of permissions fixups later on @@ -63,6 +63,47 @@ # XXX The permissions should be in the RPM spec file - just fix it for now esmith::util::chownFile("ezmlm", "ezmlm", $ownerHome); + +if ( $event eq "smeserver-ezmlm-web-update" ) +{ + my $ezmlm = new Mail::Ezmlm; + # check default hostname + my $thisdomain = $ezmlm->_getdefaultdomain; + # fix perms + my $listHomeBase="$ownerHome/lists"; + opendir(DIR, $listHomeBase)|| die "can't opendir $listHomeBase: $!"; + foreach my $listName ( grep { not /^\./ and -d "$listHomeBase/$_" } readdir(DIR) ) + { + next unless $accounts->get($listName); + my $listHost=$accounts->get($listName)->prop("Domain"); + my $listHome="$listHomeBase/$listName"; + my $dotQmail = ".qmail-${listName}"; + my $listAlias = "${ownerHome}/${dotQmail}"; + # fix file perms + fixperms($listHost,$thisdomain,$listHome,$listName); + # fix list version + if (-f "$listHome/flags") + { + $ezmlm->setlist("$listHome"); + my $flags = $ezmlm->_getconfig_idx5(); + $flags =~ s/[CV]//ig; + print "$flags\n"; + $ezmlm->update($flags);# or die $ezmlm->error(); + } + } + # delete broken .qmail links + opendir(DIR, $ownerHome)|| die "can't opendir $ownerHome: $!"; + foreach my $link (readdir DIR) { + next unless -l "$ownerHome/$link" and not -e readlink("$ownerHome/$link"); + print "Removing broken link $link\n"; + unlink "$ownerHome/$link" or die "Can't delete '$link': $!";; + closedir(DIR); + } + + exit 0 +} + + $> = $pw->uid; $) = $pw->gid; @@ -104,32 +145,85 @@ elsif ( $event eq "mailinglist-delete" ) { # Remove the .qmail files for this list - find(\&deleteWanted, $ownerHome); - + #$> = 0; + #$) = 0; + for ( readdir(DIR) ) + { + unlink "$ownerHome/$_" if /^$dotQmail$/ || + /^$dotQmail-accept-default$/ || + /^$dotQmail-default$/ || + /^$dotQmail-digest-owner$/ || + /^$dotQmail-digest-return-default$/ || + /^$dotQmail-owner$/ || + /^$dotQmail-reject-default$/ || + /^$dotQmail-return-default$/; + } + closedir(DIR); # And the list management directory system( '/bin/rm', '-rf', $listHome ) ==0 or die "Couldn't remove list directory $listHome"; } +elsif ( $event eq "mailinglist-modify" ) +{ + my $ezmlm = new Mail::Ezmlm; + # check default hostname + my $thisdomain = $ezmlm->_getdefaultdomain; + # update /create inlocal if needed. + $> = 0; + $) = 0; + fixperms($listHost,$thisdomain,$listHome,$listName); + +} else { die "Couldn't work out function to call for $0"; } -#---------------------------------------------------------------------- -# Called by File::Find -#---------------------------------------------------------------------- -sub deleteWanted +#============================================================== +# fix ml perms and needed files +#============================================================== +our @content; +our $search=""; +sub fixperms { - return unless - /^$dotQmail$/ || - /^$dotQmail-accept-default$/ || - /^$dotQmail-default$/ || - /^$dotQmail-digest-owner$/ || - /^$dotQmail-digest-return-default$/ || - /^$dotQmail-owner$/ || - /^$dotQmail-reject-default$/ || - /^$dotQmail-return-default$/; - - unlink($_) || die "Couldn't unlink($_)"; + my $listHost = shift; + my $thisdomain = shift; + my $listHome = shift; + my $listName = shift; + + if ( "$listHost" ne "$thisdomain") + { + open(INLOCAL, ">$listHome/inlocal"); + print INLOCAL "$listName\n"; + close INLOCAL; + } + # check all file in folder are "ezmlm", "admin" + my @readread= qw(archnum inlocal mimeremove num prefix webnames); + opendir(DIR, $listHome) || die "can't opendir $listHome: $!"; + for $a ( grep { not /^\./ } readdir(DIR) ) + { + esmith::util::chownFile("ezmlm", "admin", "$listHome/$a"); + if ( -d "$listHome/$a" ) + { + chmod 0700, "$listHome/$a"; + } + elsif ( $a ~~ @readread) + { + chmod 0644, "$listHome/$a"; + } + else + { + chmod 0600, "$listHome/$a"; + } + } + closedir DIR; + # all archives subfolder and files "ezmlm", "ezmlm" + @content=(); + $search="$listHome/archive"; find( \&wanted, $search); + $search="$listHome/bounce"; find( \&wanted, $search); + map {esmith::util::chownFile("ezmlm","ezmlm",$_) } @content; +} +sub wanted { + push @content, $File::Find::name unless $File::Find::name eq $search; + return; } - diff -Nur --no-dereference smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/web/functions/mailinglists smeserver-ezmlm-web-1.1.3/root/etc/e-smith/web/functions/mailinglists --- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:09:58.725000000 -0400 +++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:20:41.660000000 -0400 @@ -49,6 +49,8 @@ sub performDeleteList ($); sub performWebusersList ($); sub webusersList ($); +sub archivesConfig ($); +sub performArchiveModify ($); BEGIN { @@ -117,6 +119,15 @@ webusersList ($q); } +elsif ($q->param ('state') eq "archives") +{ + archivesConfig ($q); +} + +elsif ($q->param ('state') eq "performArchiveModify") +{ + performArchiveModify ($q) +} elsif ($q->param ('state') eq "performWebusers") { @@ -186,6 +197,7 @@ esmith::cgi::genSmallCell ($q, $q->b ('Description')), $q->td (' '), $q->td (' '), + $q->td (' '), $q->td (' ') ); @@ -210,6 +222,12 @@ 'Webusers...')), esmith::cgi::genSmallCell ($q, + $q->a ( { href => $q->url (-absolute => 1) . + "?state=archives&list=" . + $list->key }, + 'Archives...')), + + esmith::cgi::genSmallCell ($q, $q->a ({href => $q->url (-absolute => 1) . "?state=delete&list=" . $list->key}, 'Remove...')) @@ -255,6 +273,170 @@ #------------------------------------------------------------ # #------------------------------------------------------------ +sub archivesConfig ($) +{ + my ($q) = @_; + my $members = ""; + my $listName = $q->param ('list'); + esmith::cgi::genHeaderNonCacheable + ($q, undef, 'Manage Archives Display for ezmlm-www for the following mailinglist: '. $listName ); + + print $q->startform (-method => 'POST', + -action => $q->url (-absolute => 1)); + + if ($listName eq "ALL") { + return 0 + } + elsif ($listName eq "ALLOW_CREATE") { + return 0 + } + return unless $accounts->get($listName); + my $DisplayArchives = $accounts->get($listName)->prop('DisplayArchives') || 'disabled'; + my $conceal_senders = $accounts->get($listName)->prop('conceal_senders') || 'enabled'; + my $Description = $accounts->get($listName)->prop('Description') || ''; + my $default_sorting = $accounts->get($listName)->prop('default_sorting') || 'thread'; + my $show_html = $accounts->get($listName)->prop('show_html') || 'enabled'; + my $highlight = $accounts->get($listName)->prop('highlight') || 'enabled'; + my $show_inline_images = $accounts->get($listName)->prop('show_inline_images') || 'enabled'; + my $subscription_info = $accounts->get($listName)->prop('subscription_info') || 'disabled'; + my $descending_by_default = $accounts->get($listName)->prop('descending_by_default') || 'enabled'; + my $search = $accounts->get($listName)->prop('search') || 'disabled'; + my @sorting = qw(thread date subject); + my @yesno = qw(enabled disabled); + + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, + + esmith::cgi::genTextRow ($q, + + $q->p ('The list name should contain only lower-case', + 'letters, numbers, and hyphens and must start with ', + 'a lower-case', + 'letter. For example "betty", "hjohnson", and "abc-12" are', + 'all valid account names, but "3friends", "John Smith"', + 'and "Henry-Miller" are not.') . ' ' ), + + esmith::cgi::genWidgetRow ($q, + "Display archives", + $q->popup_menu (-name => 'DisplayArchives', + -values => \@yesno, + -default => $DisplayArchives)), + esmith::cgi::genNameValueRow ($q, + "Brief description", + "Description", + "$Description"), + esmith::cgi::genWidgetRow ($q, + "Conceal senders", + $q->popup_menu (-name => 'conceal_senders', + -values => \@yesno, + -default => $conceal_senders)), + esmith::cgi::genWidgetRow ($q, + "Show HTML", + $q->popup_menu (-name => 'show_html', + -values => \@yesno, + -default => $show_html)), + esmith::cgi::genWidgetRow ($q, + "Highlight parts of messages such as replies, signatures, URLs", + $q->popup_menu (-name => 'highlight', + -values => \@yesno, + -default => $highlight)), + esmith::cgi::genWidgetRow ($q, + "Display inline images", + $q->popup_menu (-name => 'show_inline_images', + -values => \@yesno, + -default => $show_inline_images)), + esmith::cgi::genWidgetRow ($q, + "Display subscription information", + $q->popup_menu (-name => 'subscription_info', + -values => \@yesno, + -default => $subscription_info)), + esmith::cgi::genWidgetRow ($q, + "Default sorting of list", + $q->popup_menu (-name => 'default_sorting', + -values => \@sorting, + -default => $default_sorting)), + esmith::cgi::genWidgetRow ($q, + "Sorting descending by default", + $q->popup_menu (-name => 'descending_by_default', + -values => \@yesno, + -default => $descending_by_default)), + + esmith::cgi::genWidgetRow ($q, + "Display search box (need search indexing)", + $q->popup_menu (-name => 'search', + -values => \@yesno, + -default => $search)), + + + + esmith::cgi::genButtonRow ($q, + $q->submit (-name => 'action', + -value => 'Create'))); + + print ''; + + print $q->hidden (-name => 'list', + -override => 1, + -default => $listName); + + print $q->hidden (-name => 'state', + -override => 1, + -default => 'performArchiveModify'); + + print $q->endform; + + esmith::cgi::genFooter ($q); + return; + +} + +#------------------------------------------------------------ +# +#------------------------------------------------------------ +sub performArchiveModify ($) +{ + my $q = shift; + + my $listName = $q->param('list'); + # Untaint groupName before use in system() + ($listName) = ($listName =~ /^([a-zA-Z][\-\_\.a-zA-Z0-9]*)$/); + my %sorting = qw(thread thread + date date + subject subject); + my %yesno = qw(enabled enabled + disabled disabled); + + my $DisplayArchives = $yesno{$q->param('DisplayArchives')}||""; #; + $accounts->get($listName)->set_prop('DisplayArchives', $DisplayArchives) unless $DisplayArchives eq ""; + my $conceal_senders = $yesno{$q->param('conceal_senders')}||""; + $accounts->get($listName)->set_prop('conceal_senders',$conceal_senders) unless $conceal_senders eq ""; + my $Description = $q->param('Description')||""; + ($Description) = ($Description=~ /^([a-zA-Z][\-_.a-zA-Z0-9 ]*)$/); + $accounts->get($listName)->set_prop('Description',$Description) unless $Description eq ""; + my $default_sorting = $sorting{$q->param('default_sorting')}||""; + $accounts->get($listName)->set_prop('default_sorting',$default_sorting) unless $default_sorting eq "";; + my $show_html = $yesno{$q->param('show_html')}||""; + $accounts->get($listName)->set_prop('show_html', $show_html) unless $show_html eq ""; + my $highlight = $yesno{$q->param('highlight')}||""; + $accounts->get($listName)->set_prop('highlight',$highlight ) unless $highlight eq ""; + my $show_inline_images = $yesno{$q->param('show_inline_images')}||""; + $accounts->get($listName)->set_prop('show_inline_images', $show_inline_images) unless $show_inline_images eq ""; + my $subscription_info = $yesno{$q->param('subscription_info')}||""; + $accounts->get($listName)->set_prop('subscription_info', $subscription_info) unless $subscription_info eq ""; + my $descending_by_default = $yesno{$q->param('descending_by_default')}||""; + $accounts->get($listName)->set_prop('descending_by_default',$descending_by_default ) unless $descending_by_default eq ""; + my $search = $yesno{$q->param('search')}||""; + $accounts->get($listName)->set_prop('search', $search ) unless $search eq ""; + + return ( system ('/sbin/e-smith/signal-event', 'mailinglist-modify', $listName) == 0 ) ? + showInitial ($q, "Error: updating Archive for $listName") : showInitial ($q, "Successfully updated Archive for $listName."); + #return; + + +} + +#------------------------------------------------------------ +# +#------------------------------------------------------------ sub webusersList ($) { my ($q) = @_; @@ -474,8 +656,7 @@ my $listOwner = $q->param ('listOwner'); $listOwner = "admin" if ($listOwner eq "Administrator"); - my @users = sort { $a->key() cmp $b->key() } ( $accounts->users() , $accounts->get('admin') ); - + my $webusers = ($listOwner eq "admin") ? $listOwner : "admin,$listOwner"; #------------------------------------------------------------ # Looks good. Find out if this account has been taken #------------------------------------------------------------ @@ -499,7 +680,7 @@ Domain => $listDomain, Description => $listDescription, Owner => $listOwner, - webusers => $webusers, + webusers => $webusers, } ); system ('/sbin/e-smith/signal-event', 'mailinglist-create', $listName) == 0