/[smecontribs]/rpms/smeserver-ezmlm-web/contribs10/smeserver-ezmlm-web-1.1.3-bz6978-bz9468-bz11910-sme10next.patch
ViewVC logotype

Contents of /rpms/smeserver-ezmlm-web/contribs10/smeserver-ezmlm-web-1.1.3-bz6978-bz9468-bz11910-sme10next.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Mar 20 06:23:09 2022 UTC (2 years, 2 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-ezmlm-web-1_1_3-10_el7_sme, smeserver-ezmlm-web-1_1_3-11_el7_sme
* Sun Mar 20 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.1.3-10.sme
- fix only subscribers may post  [SME: 6978]
- fix cannot create archive [SME: 9468]
- add more ml properties in server-manager  [SME: 11910]

1 diff -Nur --no-dereference smeserver-ezmlm-web-1.1.3.old/createlinks smeserver-ezmlm-web-1.1.3/createlinks
2 --- smeserver-ezmlm-web-1.1.3.old/createlinks 2022-03-20 02:09:58.724000000 -0400
3 +++ smeserver-ezmlm-web-1.1.3/createlinks 2022-03-20 02:19:44.859000000 -0400
4 @@ -33,7 +33,7 @@
5 console-save
6 email-update
7 mailinglist-create
8 - mailinglist-update
9 + mailinglist-modify
10 mailinglist-assign
11 ));
12 templates2events("/home/e-smith/files/ezmlm/lists/webusers",
13 @@ -42,7 +42,7 @@
14 console-save
15 email-update
16 mailinglist-create
17 - mailinglist-update
18 + mailinglist-modify
19 mailinglist-assign
20 ));
21 my $event="smeserver-ezmlm-web-update";
22 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
23 --- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/events/actions/ezmlm-update 2014-06-16 11:54:25.000000000 -0400
24 +++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/events/actions/ezmlm-update 2022-03-20 02:11:36.623000000 -0400
25 @@ -38,7 +38,7 @@
26 die "event argument missing." unless defined ($event);
27
28 my $listName = $ARGV[1];
29 -die "listName argument missing." unless defined ($listName);
30 +die "listName argument missing." unless defined ($listName) || $event eq "smeserver-ezmlm-web-update";
31
32 # We really want to do all ezmlm functions as the user ezmlm - saves
33 # lots of permissions fixups later on
34 @@ -63,6 +63,47 @@
35 # XXX The permissions should be in the RPM spec file - just fix it for now
36 esmith::util::chownFile("ezmlm", "ezmlm", $ownerHome);
37
38 +
39 +if ( $event eq "smeserver-ezmlm-web-update" )
40 +{
41 + my $ezmlm = new Mail::Ezmlm;
42 + # check default hostname
43 + my $thisdomain = $ezmlm->_getdefaultdomain;
44 + # fix perms
45 + my $listHomeBase="$ownerHome/lists";
46 + opendir(DIR, $listHomeBase)|| die "can't opendir $listHomeBase: $!";
47 + foreach my $listName ( grep { not /^\./ and -d "$listHomeBase/$_" } readdir(DIR) )
48 + {
49 + next unless $accounts->get($listName);
50 + my $listHost=$accounts->get($listName)->prop("Domain");
51 + my $listHome="$listHomeBase/$listName";
52 + my $dotQmail = ".qmail-${listName}";
53 + my $listAlias = "${ownerHome}/${dotQmail}";
54 + # fix file perms
55 + fixperms($listHost,$thisdomain,$listHome,$listName);
56 + # fix list version
57 + if (-f "$listHome/flags")
58 + {
59 + $ezmlm->setlist("$listHome");
60 + my $flags = $ezmlm->_getconfig_idx5();
61 + $flags =~ s/[CV]//ig;
62 + print "$flags\n";
63 + $ezmlm->update($flags);# or die $ezmlm->error();
64 + }
65 + }
66 + # delete broken .qmail links
67 + opendir(DIR, $ownerHome)|| die "can't opendir $ownerHome: $!";
68 + foreach my $link (readdir DIR) {
69 + next unless -l "$ownerHome/$link" and not -e readlink("$ownerHome/$link");
70 + print "Removing broken link $link\n";
71 + unlink "$ownerHome/$link" or die "Can't delete '$link': $!";;
72 + closedir(DIR);
73 + }
74 +
75 + exit 0
76 +}
77 +
78 +
79 $> = $pw->uid;
80 $) = $pw->gid;
81
82 @@ -104,32 +145,85 @@
83 elsif ( $event eq "mailinglist-delete" )
84 {
85 # Remove the .qmail files for this list
86 - find(\&deleteWanted, $ownerHome);
87 -
88 + #$> = 0;
89 + #$) = 0;
90 + for ( readdir(DIR) )
91 + {
92 + unlink "$ownerHome/$_" if /^$dotQmail$/ ||
93 + /^$dotQmail-accept-default$/ ||
94 + /^$dotQmail-default$/ ||
95 + /^$dotQmail-digest-owner$/ ||
96 + /^$dotQmail-digest-return-default$/ ||
97 + /^$dotQmail-owner$/ ||
98 + /^$dotQmail-reject-default$/ ||
99 + /^$dotQmail-return-default$/;
100 + }
101 + closedir(DIR);
102 # And the list management directory
103 system( '/bin/rm', '-rf', $listHome ) ==0 or
104 die "Couldn't remove list directory $listHome";
105 }
106 +elsif ( $event eq "mailinglist-modify" )
107 +{
108 + my $ezmlm = new Mail::Ezmlm;
109 + # check default hostname
110 + my $thisdomain = $ezmlm->_getdefaultdomain;
111 + # update /create inlocal if needed.
112 + $> = 0;
113 + $) = 0;
114 + fixperms($listHost,$thisdomain,$listHome,$listName);
115 +
116 +}
117 else
118 {
119 die "Couldn't work out function to call for $0";
120 }
121
122 -#----------------------------------------------------------------------
123 -# Called by File::Find
124 -#----------------------------------------------------------------------
125 -sub deleteWanted
126 +#==============================================================
127 +# fix ml perms and needed files
128 +#==============================================================
129 +our @content;
130 +our $search="";
131 +sub fixperms
132 {
133 - return unless
134 - /^$dotQmail$/ ||
135 - /^$dotQmail-accept-default$/ ||
136 - /^$dotQmail-default$/ ||
137 - /^$dotQmail-digest-owner$/ ||
138 - /^$dotQmail-digest-return-default$/ ||
139 - /^$dotQmail-owner$/ ||
140 - /^$dotQmail-reject-default$/ ||
141 - /^$dotQmail-return-default$/;
142 -
143 - unlink($_) || die "Couldn't unlink($_)";
144 + my $listHost = shift;
145 + my $thisdomain = shift;
146 + my $listHome = shift;
147 + my $listName = shift;
148 +
149 + if ( "$listHost" ne "$thisdomain")
150 + {
151 + open(INLOCAL, ">$listHome/inlocal");
152 + print INLOCAL "$listName\n";
153 + close INLOCAL;
154 + }
155 + # check all file in folder are "ezmlm", "admin"
156 + my @readread= qw(archnum inlocal mimeremove num prefix webnames);
157 + opendir(DIR, $listHome) || die "can't opendir $listHome: $!";
158 + for $a ( grep { not /^\./ } readdir(DIR) )
159 + {
160 + esmith::util::chownFile("ezmlm", "admin", "$listHome/$a");
161 + if ( -d "$listHome/$a" )
162 + {
163 + chmod 0700, "$listHome/$a";
164 + }
165 + elsif ( $a ~~ @readread)
166 + {
167 + chmod 0644, "$listHome/$a";
168 + }
169 + else
170 + {
171 + chmod 0600, "$listHome/$a";
172 + }
173 + }
174 + closedir DIR;
175 + # all archives subfolder and files "ezmlm", "ezmlm"
176 + @content=();
177 + $search="$listHome/archive"; find( \&wanted, $search);
178 + $search="$listHome/bounce"; find( \&wanted, $search);
179 + map {esmith::util::chownFile("ezmlm","ezmlm",$_) } @content;
180 +}
181 +sub wanted {
182 + push @content, $File::Find::name unless $File::Find::name eq $search;
183 + return;
184 }
185 -
186 diff -Nur --no-dereference smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/templates/opt/mailinglist/config.pm smeserver-ezmlm-web-1.1.3/root/etc/e-smith/templates/opt/mailinglist/config.pm
187 --- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/templates/opt/mailinglist/config.pm 1969-12-31 19:00:00.000000000 -0500
188 +++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/templates/opt/mailinglist/config.pm 2022-03-20 02:11:36.056000000 -0400
189 @@ -0,0 +1,101 @@
190 +#---------------------------------------------------------------------------
191 +# ezmlm-www (configuration file - see README)
192 +#---------------------------------------------------------------------------
193 +
194 +#---------------------------------------------------------------------------
195 +#-- Mailing list configuration goes here:
196 +{
197 + use esmith::AccountsDB;
198 + my $adb = esmith::AccountsDB->open_ro();
199 + $OUT = "";
200 + my @sortings=('thread' , 'date' , 'subject' );
201 + foreach my $list ($adb->get_all_by_prop(type => 'mailinglist'))
202 + {
203 + next if (($list->prop('DisplayArchives') || 'disabled') ne 'enabled');
204 + my $key= $list->key;
205 + my $dompart=$list->prop('Domain');
206 + my $name = "$key\@$dompart" ;
207 + my $conceal_senders = ( ( $list->prop('conceal_senders') || 'enabled' ) eq 'enabled')? 1 : 0;
208 + my $Description = $list->prop('Description') || "no description";
209 + my $default_sorting = ( $list->prop('default_sorting') ~~ @sortings ) ? $list->prop('default_sorting') : 'thread';
210 + my $show_html = (( $list->prop('show_html') || 'enabled') eq 'enabled')? 1 : 0;
211 + my $highlight = (( $list->prop('highlight') ||'enabled') eq 'enabled')? 1 : 0;
212 + my $show_inline_images = (( $list->prop('show_inline_images') || 'enabled') eq 'enabled')? 1 : 0;
213 + my $subscription_info = (( $list->prop('subscription_info') || 'disabled') eq 'enabled') ? 1 : 0;
214 + my $descending_by_default = (( $list->prop('descending_by_default') || 'enabled') eq 'enabled')? 1 : 0;
215 + my $search = (( $list->prop('search') || 'disabled') eq 'enabled') ? 1 : 0;
216 +
217 + $OUT.=<<"END_TXT";
218 +push \@\$lists, {
219 + name => '$name',
220 + local_part => '$key',
221 + host_part => '$dompart',
222 + description => '$Description',
223 + archive => Mail::Ezmlm::Archive->new('/home/e-smith/files/ezmlm/lists/$key'),
224 + conceal_senders => $conceal_senders,
225 + subscription_info => $subscription_info ,
226 + descending_by_default => 1,
227 + default_sorting => '$default_sorting', #may be 'thread', 'date' or 'subject'
228 + show_html => $show_html,
229 + highlight => $highlight,
230 + show_inline_images => $show_inline_images,
231 + search => $search
232 +};
233 +END_TXT
234 + }
235 +
236 +}
237 +
238 +#---------------------------------------------------------------------------
239 +#-- This option specifies the language used for localized strings:
240 +
241 +$lang = '{
242 +my @langs = ('bg', 'de', 'en', 'es' , 'fr', 'it', 'no', 'pt' , 'tr', 'zh');
243 +my $syslang = (( substr($sysconfig{'Language'}, 0, 2) || 'unknown' ) ~~ @langs ) ? substr($sysconfig{'Language'}, 0, 2) : 'en' ;
244 +my $langu = (( $ezmlm{'lang'} || 'unknown') ~~ @langs) ? $ezmlm{'lang'} : $syslang;
245 +return $langu;
246 +}';
247 +
248 +#---------------------------------------------------------------------------
249 +#-- To enable vpopmail support just uncomment the following line:
250 +#-- (this will disable the configuration done with the "push @$lists"
251 +#-- syntax above, as all information will be taken from vpopmail local
252 +#-- database and the %Config defaults below.)
253 +
254 +#use vpopmail;
255 +
256 +
257 +#---------------------------------------------------------------------------
258 +#--Additional configuration options:
259 +{
260 + my $ListServerName = $ezmlm{'ListServerName'} || $DomainName ;
261 + $OUT.=<<"END_TXT";
262 +%Config = (
263 + ListServerName => '$ListServerName',
264 +
265 + #--These settings will be used for vpopmail-based mailing lists:
266 + # NOT IN USE WITH SME #
267 + DefaultVpopmailSettings => {
268 + conceal_senders => 1,
269 + subscription_info => 1,
270 + descending_by_default => 1,
271 + default_sorting => 'thread', #may be 'thread', 'date' or 'subject'
272 + show_html => 1,
273 + highlight => 1
274 + },
275 + VpopmailAccess => {
276 + default_policy => 'allow',
277 + allow_lists => [],
278 + deny_lists => [],
279 + allow_domains => [],
280 + deny_domains => []
281 + },
282 +
283 + #--CSS web path:
284 + CSSPath => 'style.css'
285 +);
286 +END_TXT
287 +
288 +}
289 +
290 +1;
291 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
292 --- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:09:58.725000000 -0400
293 +++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:20:41.660000000 -0400
294 @@ -49,6 +49,8 @@
295 sub performDeleteList ($);
296 sub performWebusersList ($);
297 sub webusersList ($);
298 +sub archivesConfig ($);
299 +sub performArchiveModify ($);
300
301 BEGIN
302 {
303 @@ -117,6 +119,15 @@
304 webusersList ($q);
305 }
306
307 +elsif ($q->param ('state') eq "archives")
308 +{
309 + archivesConfig ($q);
310 +}
311 +
312 +elsif ($q->param ('state') eq "performArchiveModify")
313 +{
314 + performArchiveModify ($q)
315 +}
316
317 elsif ($q->param ('state') eq "performWebusers")
318 {
319 @@ -186,6 +197,7 @@
320 esmith::cgi::genSmallCell ($q, $q->b ('Description')),
321 $q->td ('&nbsp;'),
322 $q->td ('&nbsp;'),
323 + $q->td ('&nbsp;'),
324 $q->td ('&nbsp;')
325 );
326
327 @@ -210,6 +222,12 @@
328 'Webusers...')),
329
330 esmith::cgi::genSmallCell ($q,
331 + $q->a ( { href => $q->url (-absolute => 1) .
332 + "?state=archives&list=" .
333 + $list->key },
334 + 'Archives...')),
335 +
336 + esmith::cgi::genSmallCell ($q,
337 $q->a ({href => $q->url (-absolute => 1)
338 . "?state=delete&list="
339 . $list->key}, 'Remove...'))
340 @@ -255,6 +273,170 @@
341 #------------------------------------------------------------
342 #
343 #------------------------------------------------------------
344 +sub archivesConfig ($)
345 +{
346 + my ($q) = @_;
347 + my $members = "";
348 + my $listName = $q->param ('list');
349 + esmith::cgi::genHeaderNonCacheable
350 + ($q, undef, 'Manage Archives Display for ezmlm-www for the following mailinglist: '. $listName );
351 +
352 + print $q->startform (-method => 'POST',
353 + -action => $q->url (-absolute => 1));
354 +
355 + if ($listName eq "ALL") {
356 + return 0
357 + }
358 + elsif ($listName eq "ALLOW_CREATE") {
359 + return 0
360 + }
361 + return unless $accounts->get($listName);
362 + my $DisplayArchives = $accounts->get($listName)->prop('DisplayArchives') || 'disabled';
363 + my $conceal_senders = $accounts->get($listName)->prop('conceal_senders') || 'enabled';
364 + my $Description = $accounts->get($listName)->prop('Description') || '';
365 + my $default_sorting = $accounts->get($listName)->prop('default_sorting') || 'thread';
366 + my $show_html = $accounts->get($listName)->prop('show_html') || 'enabled';
367 + my $highlight = $accounts->get($listName)->prop('highlight') || 'enabled';
368 + my $show_inline_images = $accounts->get($listName)->prop('show_inline_images') || 'enabled';
369 + my $subscription_info = $accounts->get($listName)->prop('subscription_info') || 'disabled';
370 + my $descending_by_default = $accounts->get($listName)->prop('descending_by_default') || 'enabled';
371 + my $search = $accounts->get($listName)->prop('search') || 'disabled';
372 + my @sorting = qw(thread date subject);
373 + my @yesno = qw(enabled disabled);
374 +
375 + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
376 +
377 + esmith::cgi::genTextRow ($q,
378 +
379 + $q->p ('The list name should contain only lower-case',
380 + 'letters, numbers, and hyphens and must start with ',
381 + 'a lower-case',
382 + 'letter. For example "betty", "hjohnson", and "abc-12" are',
383 + 'all valid account names, but "3friends", "John Smith"',
384 + 'and "Henry-Miller" are not.') . ' ' ),
385 +
386 + esmith::cgi::genWidgetRow ($q,
387 + "Display archives",
388 + $q->popup_menu (-name => 'DisplayArchives',
389 + -values => \@yesno,
390 + -default => $DisplayArchives)),
391 + esmith::cgi::genNameValueRow ($q,
392 + "Brief description",
393 + "Description",
394 + "$Description"),
395 + esmith::cgi::genWidgetRow ($q,
396 + "Conceal senders",
397 + $q->popup_menu (-name => 'conceal_senders',
398 + -values => \@yesno,
399 + -default => $conceal_senders)),
400 + esmith::cgi::genWidgetRow ($q,
401 + "Show HTML",
402 + $q->popup_menu (-name => 'show_html',
403 + -values => \@yesno,
404 + -default => $show_html)),
405 + esmith::cgi::genWidgetRow ($q,
406 + "Highlight parts of messages such as replies, signatures, URLs",
407 + $q->popup_menu (-name => 'highlight',
408 + -values => \@yesno,
409 + -default => $highlight)),
410 + esmith::cgi::genWidgetRow ($q,
411 + "Display inline images",
412 + $q->popup_menu (-name => 'show_inline_images',
413 + -values => \@yesno,
414 + -default => $show_inline_images)),
415 + esmith::cgi::genWidgetRow ($q,
416 + "Display subscription information",
417 + $q->popup_menu (-name => 'subscription_info',
418 + -values => \@yesno,
419 + -default => $subscription_info)),
420 + esmith::cgi::genWidgetRow ($q,
421 + "Default sorting of list",
422 + $q->popup_menu (-name => 'default_sorting',
423 + -values => \@sorting,
424 + -default => $default_sorting)),
425 + esmith::cgi::genWidgetRow ($q,
426 + "Sorting descending by default",
427 + $q->popup_menu (-name => 'descending_by_default',
428 + -values => \@yesno,
429 + -default => $descending_by_default)),
430 +
431 + esmith::cgi::genWidgetRow ($q,
432 + "Display search box (need search indexing)",
433 + $q->popup_menu (-name => 'search',
434 + -values => \@yesno,
435 + -default => $search)),
436 +
437 +
438 +
439 + esmith::cgi::genButtonRow ($q,
440 + $q->submit (-name => 'action',
441 + -value => 'Create')));
442 +
443 + print '</table>';
444 +
445 + print $q->hidden (-name => 'list',
446 + -override => 1,
447 + -default => $listName);
448 +
449 + print $q->hidden (-name => 'state',
450 + -override => 1,
451 + -default => 'performArchiveModify');
452 +
453 + print $q->endform;
454 +
455 + esmith::cgi::genFooter ($q);
456 + return;
457 +
458 +}
459 +
460 +#------------------------------------------------------------
461 +#
462 +#------------------------------------------------------------
463 +sub performArchiveModify ($)
464 +{
465 + my $q = shift;
466 +
467 + my $listName = $q->param('list');
468 + # Untaint groupName before use in system()
469 + ($listName) = ($listName =~ /^([a-zA-Z][\-\_\.a-zA-Z0-9]*)$/);
470 + my %sorting = qw(thread thread
471 + date date
472 + subject subject);
473 + my %yesno = qw(enabled enabled
474 + disabled disabled);
475 +
476 + my $DisplayArchives = $yesno{$q->param('DisplayArchives')}||""; #;
477 + $accounts->get($listName)->set_prop('DisplayArchives', $DisplayArchives) unless $DisplayArchives eq "";
478 + my $conceal_senders = $yesno{$q->param('conceal_senders')}||"";
479 + $accounts->get($listName)->set_prop('conceal_senders',$conceal_senders) unless $conceal_senders eq "";
480 + my $Description = $q->param('Description')||"";
481 + ($Description) = ($Description=~ /^([a-zA-Z][\-_.a-zA-Z0-9 ]*)$/);
482 + $accounts->get($listName)->set_prop('Description',$Description) unless $Description eq "";
483 + my $default_sorting = $sorting{$q->param('default_sorting')}||"";
484 + $accounts->get($listName)->set_prop('default_sorting',$default_sorting) unless $default_sorting eq "";;
485 + my $show_html = $yesno{$q->param('show_html')}||"";
486 + $accounts->get($listName)->set_prop('show_html', $show_html) unless $show_html eq "";
487 + my $highlight = $yesno{$q->param('highlight')}||"";
488 + $accounts->get($listName)->set_prop('highlight',$highlight ) unless $highlight eq "";
489 + my $show_inline_images = $yesno{$q->param('show_inline_images')}||"";
490 + $accounts->get($listName)->set_prop('show_inline_images', $show_inline_images) unless $show_inline_images eq "";
491 + my $subscription_info = $yesno{$q->param('subscription_info')}||"";
492 + $accounts->get($listName)->set_prop('subscription_info', $subscription_info) unless $subscription_info eq "";
493 + my $descending_by_default = $yesno{$q->param('descending_by_default')}||"";
494 + $accounts->get($listName)->set_prop('descending_by_default',$descending_by_default ) unless $descending_by_default eq "";
495 + my $search = $yesno{$q->param('search')}||"";
496 + $accounts->get($listName)->set_prop('search', $search ) unless $search eq "";
497 +
498 + return ( system ('/sbin/e-smith/signal-event', 'mailinglist-modify', $listName) == 0 ) ?
499 + showInitial ($q, "Error: updating Archive for $listName") : showInitial ($q, "Successfully updated Archive for $listName.");
500 + #return;
501 +
502 +
503 +}
504 +
505 +#------------------------------------------------------------
506 +#
507 +#------------------------------------------------------------
508 sub webusersList ($)
509 {
510 my ($q) = @_;
511 @@ -474,8 +656,7 @@
512
513 my $listOwner = $q->param ('listOwner');
514 $listOwner = "admin" if ($listOwner eq "Administrator");
515 - my @users = sort { $a->key() cmp $b->key() } ( $accounts->users() , $accounts->get('admin') );
516 -
517 + my $webusers = ($listOwner eq "admin") ? $listOwner : "admin,$listOwner";
518 #------------------------------------------------------------
519 # Looks good. Find out if this account has been taken
520 #------------------------------------------------------------
521 @@ -499,7 +680,7 @@
522 Domain => $listDomain,
523 Description => $listDescription,
524 Owner => $listOwner,
525 - webusers => $webusers,
526 + webusers => $webusers,
527 } );
528
529 system ('/sbin/e-smith/signal-event', 'mailinglist-create', $listName) == 0

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed