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/web/functions/mailinglists smeserver-ezmlm-web-1.1.3/root/etc/e-smith/web/functions/mailinglists |
187 |
--- smeserver-ezmlm-web-1.1.3.old/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:09:58.725000000 -0400 |
188 |
+++ smeserver-ezmlm-web-1.1.3/root/etc/e-smith/web/functions/mailinglists 2022-03-20 02:20:41.660000000 -0400 |
189 |
@@ -49,6 +49,8 @@ |
190 |
sub performDeleteList ($); |
191 |
sub performWebusersList ($); |
192 |
sub webusersList ($); |
193 |
+sub archivesConfig ($); |
194 |
+sub performArchiveModify ($); |
195 |
|
196 |
BEGIN |
197 |
{ |
198 |
@@ -117,6 +119,15 @@ |
199 |
webusersList ($q); |
200 |
} |
201 |
|
202 |
+elsif ($q->param ('state') eq "archives") |
203 |
+{ |
204 |
+ archivesConfig ($q); |
205 |
+} |
206 |
+ |
207 |
+elsif ($q->param ('state') eq "performArchiveModify") |
208 |
+{ |
209 |
+ performArchiveModify ($q) |
210 |
+} |
211 |
|
212 |
elsif ($q->param ('state') eq "performWebusers") |
213 |
{ |
214 |
@@ -186,6 +197,7 @@ |
215 |
esmith::cgi::genSmallCell ($q, $q->b ('Description')), |
216 |
$q->td (' '), |
217 |
$q->td (' '), |
218 |
+ $q->td (' '), |
219 |
$q->td (' ') |
220 |
); |
221 |
|
222 |
@@ -210,6 +222,12 @@ |
223 |
'Webusers...')), |
224 |
|
225 |
esmith::cgi::genSmallCell ($q, |
226 |
+ $q->a ( { href => $q->url (-absolute => 1) . |
227 |
+ "?state=archives&list=" . |
228 |
+ $list->key }, |
229 |
+ 'Archives...')), |
230 |
+ |
231 |
+ esmith::cgi::genSmallCell ($q, |
232 |
$q->a ({href => $q->url (-absolute => 1) |
233 |
. "?state=delete&list=" |
234 |
. $list->key}, 'Remove...')) |
235 |
@@ -255,6 +273,170 @@ |
236 |
#------------------------------------------------------------ |
237 |
# |
238 |
#------------------------------------------------------------ |
239 |
+sub archivesConfig ($) |
240 |
+{ |
241 |
+ my ($q) = @_; |
242 |
+ my $members = ""; |
243 |
+ my $listName = $q->param ('list'); |
244 |
+ esmith::cgi::genHeaderNonCacheable |
245 |
+ ($q, undef, 'Manage Archives Display for ezmlm-www for the following mailinglist: '. $listName ); |
246 |
+ |
247 |
+ print $q->startform (-method => 'POST', |
248 |
+ -action => $q->url (-absolute => 1)); |
249 |
+ |
250 |
+ if ($listName eq "ALL") { |
251 |
+ return 0 |
252 |
+ } |
253 |
+ elsif ($listName eq "ALLOW_CREATE") { |
254 |
+ return 0 |
255 |
+ } |
256 |
+ return unless $accounts->get($listName); |
257 |
+ my $DisplayArchives = $accounts->get($listName)->prop('DisplayArchives') || 'disabled'; |
258 |
+ my $conceal_senders = $accounts->get($listName)->prop('conceal_senders') || 'enabled'; |
259 |
+ my $Description = $accounts->get($listName)->prop('Description') || ''; |
260 |
+ my $default_sorting = $accounts->get($listName)->prop('default_sorting') || 'thread'; |
261 |
+ my $show_html = $accounts->get($listName)->prop('show_html') || 'enabled'; |
262 |
+ my $highlight = $accounts->get($listName)->prop('highlight') || 'enabled'; |
263 |
+ my $show_inline_images = $accounts->get($listName)->prop('show_inline_images') || 'enabled'; |
264 |
+ my $subscription_info = $accounts->get($listName)->prop('subscription_info') || 'disabled'; |
265 |
+ my $descending_by_default = $accounts->get($listName)->prop('descending_by_default') || 'enabled'; |
266 |
+ my $search = $accounts->get($listName)->prop('search') || 'disabled'; |
267 |
+ my @sorting = qw(thread date subject); |
268 |
+ my @yesno = qw(enabled disabled); |
269 |
+ |
270 |
+ print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, |
271 |
+ |
272 |
+ esmith::cgi::genTextRow ($q, |
273 |
+ |
274 |
+ $q->p ('The list name should contain only lower-case', |
275 |
+ 'letters, numbers, and hyphens and must start with ', |
276 |
+ 'a lower-case', |
277 |
+ 'letter. For example "betty", "hjohnson", and "abc-12" are', |
278 |
+ 'all valid account names, but "3friends", "John Smith"', |
279 |
+ 'and "Henry-Miller" are not.') . ' ' ), |
280 |
+ |
281 |
+ esmith::cgi::genWidgetRow ($q, |
282 |
+ "Display archives", |
283 |
+ $q->popup_menu (-name => 'DisplayArchives', |
284 |
+ -values => \@yesno, |
285 |
+ -default => $DisplayArchives)), |
286 |
+ esmith::cgi::genNameValueRow ($q, |
287 |
+ "Brief description", |
288 |
+ "Description", |
289 |
+ "$Description"), |
290 |
+ esmith::cgi::genWidgetRow ($q, |
291 |
+ "Conceal senders", |
292 |
+ $q->popup_menu (-name => 'conceal_senders', |
293 |
+ -values => \@yesno, |
294 |
+ -default => $conceal_senders)), |
295 |
+ esmith::cgi::genWidgetRow ($q, |
296 |
+ "Show HTML", |
297 |
+ $q->popup_menu (-name => 'show_html', |
298 |
+ -values => \@yesno, |
299 |
+ -default => $show_html)), |
300 |
+ esmith::cgi::genWidgetRow ($q, |
301 |
+ "Highlight parts of messages such as replies, signatures, URLs", |
302 |
+ $q->popup_menu (-name => 'highlight', |
303 |
+ -values => \@yesno, |
304 |
+ -default => $highlight)), |
305 |
+ esmith::cgi::genWidgetRow ($q, |
306 |
+ "Display inline images", |
307 |
+ $q->popup_menu (-name => 'show_inline_images', |
308 |
+ -values => \@yesno, |
309 |
+ -default => $show_inline_images)), |
310 |
+ esmith::cgi::genWidgetRow ($q, |
311 |
+ "Display subscription information", |
312 |
+ $q->popup_menu (-name => 'subscription_info', |
313 |
+ -values => \@yesno, |
314 |
+ -default => $subscription_info)), |
315 |
+ esmith::cgi::genWidgetRow ($q, |
316 |
+ "Default sorting of list", |
317 |
+ $q->popup_menu (-name => 'default_sorting', |
318 |
+ -values => \@sorting, |
319 |
+ -default => $default_sorting)), |
320 |
+ esmith::cgi::genWidgetRow ($q, |
321 |
+ "Sorting descending by default", |
322 |
+ $q->popup_menu (-name => 'descending_by_default', |
323 |
+ -values => \@yesno, |
324 |
+ -default => $descending_by_default)), |
325 |
+ |
326 |
+ esmith::cgi::genWidgetRow ($q, |
327 |
+ "Display search box (need search indexing)", |
328 |
+ $q->popup_menu (-name => 'search', |
329 |
+ -values => \@yesno, |
330 |
+ -default => $search)), |
331 |
+ |
332 |
+ |
333 |
+ |
334 |
+ esmith::cgi::genButtonRow ($q, |
335 |
+ $q->submit (-name => 'action', |
336 |
+ -value => 'Create'))); |
337 |
+ |
338 |
+ print '</table>'; |
339 |
+ |
340 |
+ print $q->hidden (-name => 'list', |
341 |
+ -override => 1, |
342 |
+ -default => $listName); |
343 |
+ |
344 |
+ print $q->hidden (-name => 'state', |
345 |
+ -override => 1, |
346 |
+ -default => 'performArchiveModify'); |
347 |
+ |
348 |
+ print $q->endform; |
349 |
+ |
350 |
+ esmith::cgi::genFooter ($q); |
351 |
+ return; |
352 |
+ |
353 |
+} |
354 |
+ |
355 |
+#------------------------------------------------------------ |
356 |
+# |
357 |
+#------------------------------------------------------------ |
358 |
+sub performArchiveModify ($) |
359 |
+{ |
360 |
+ my $q = shift; |
361 |
+ |
362 |
+ my $listName = $q->param('list'); |
363 |
+ # Untaint groupName before use in system() |
364 |
+ ($listName) = ($listName =~ /^([a-zA-Z][\-\_\.a-zA-Z0-9]*)$/); |
365 |
+ my %sorting = qw(thread thread |
366 |
+ date date |
367 |
+ subject subject); |
368 |
+ my %yesno = qw(enabled enabled |
369 |
+ disabled disabled); |
370 |
+ |
371 |
+ my $DisplayArchives = $yesno{$q->param('DisplayArchives')}||""; #; |
372 |
+ $accounts->get($listName)->set_prop('DisplayArchives', $DisplayArchives) unless $DisplayArchives eq ""; |
373 |
+ my $conceal_senders = $yesno{$q->param('conceal_senders')}||""; |
374 |
+ $accounts->get($listName)->set_prop('conceal_senders',$conceal_senders) unless $conceal_senders eq ""; |
375 |
+ my $Description = $q->param('Description')||""; |
376 |
+ ($Description) = ($Description=~ /^([a-zA-Z][\-_.a-zA-Z0-9 ]*)$/); |
377 |
+ $accounts->get($listName)->set_prop('Description',$Description) unless $Description eq ""; |
378 |
+ my $default_sorting = $sorting{$q->param('default_sorting')}||""; |
379 |
+ $accounts->get($listName)->set_prop('default_sorting',$default_sorting) unless $default_sorting eq "";; |
380 |
+ my $show_html = $yesno{$q->param('show_html')}||""; |
381 |
+ $accounts->get($listName)->set_prop('show_html', $show_html) unless $show_html eq ""; |
382 |
+ my $highlight = $yesno{$q->param('highlight')}||""; |
383 |
+ $accounts->get($listName)->set_prop('highlight',$highlight ) unless $highlight eq ""; |
384 |
+ my $show_inline_images = $yesno{$q->param('show_inline_images')}||""; |
385 |
+ $accounts->get($listName)->set_prop('show_inline_images', $show_inline_images) unless $show_inline_images eq ""; |
386 |
+ my $subscription_info = $yesno{$q->param('subscription_info')}||""; |
387 |
+ $accounts->get($listName)->set_prop('subscription_info', $subscription_info) unless $subscription_info eq ""; |
388 |
+ my $descending_by_default = $yesno{$q->param('descending_by_default')}||""; |
389 |
+ $accounts->get($listName)->set_prop('descending_by_default',$descending_by_default ) unless $descending_by_default eq ""; |
390 |
+ my $search = $yesno{$q->param('search')}||""; |
391 |
+ $accounts->get($listName)->set_prop('search', $search ) unless $search eq ""; |
392 |
+ |
393 |
+ return ( system ('/sbin/e-smith/signal-event', 'mailinglist-modify', $listName) == 0 ) ? |
394 |
+ showInitial ($q, "Error: updating Archive for $listName") : showInitial ($q, "Successfully updated Archive for $listName."); |
395 |
+ #return; |
396 |
+ |
397 |
+ |
398 |
+} |
399 |
+ |
400 |
+#------------------------------------------------------------ |
401 |
+# |
402 |
+#------------------------------------------------------------ |
403 |
sub webusersList ($) |
404 |
{ |
405 |
my ($q) = @_; |
406 |
@@ -474,8 +656,7 @@ |
407 |
|
408 |
my $listOwner = $q->param ('listOwner'); |
409 |
$listOwner = "admin" if ($listOwner eq "Administrator"); |
410 |
- my @users = sort { $a->key() cmp $b->key() } ( $accounts->users() , $accounts->get('admin') ); |
411 |
- |
412 |
+ my $webusers = ($listOwner eq "admin") ? $listOwner : "admin,$listOwner"; |
413 |
#------------------------------------------------------------ |
414 |
# Looks good. Find out if this account has been taken |
415 |
#------------------------------------------------------------ |
416 |
@@ -499,7 +680,7 @@ |
417 |
Domain => $listDomain, |
418 |
Description => $listDescription, |
419 |
Owner => $listOwner, |
420 |
- webusers => $webusers, |
421 |
+ webusers => $webusers, |
422 |
} ); |
423 |
|
424 |
system ('/sbin/e-smith/signal-event', 'mailinglist-create', $listName) == 0 |