pax_global_header00006660000000000000000000000064150230311350014503gustar00rootroot0000000000000052 comment=10b128b02456ada94242d9944f6048590c71c6e6 mlmmj/000077500000000000000000000000001502303113500121635ustar00rootroot00000000000000mlmmj/.builds/000077500000000000000000000000001502303113500135235ustar00rootroot00000000000000mlmmj/.builds/alpine.yml000066400000000000000000000005641502303113500155230ustar00rootroot00000000000000image: alpine/latest packages: - musl-dev - gcc - autoconf - automake - make - pkgconf - kyua - m4 - atf-dev sources: - https://codeberg.org/mlmmj/mlmmj tasks: - configure: | cd mlmmj autoreconf -if ./configure - build: | cd mlmmj make - test: | cd mlmmj make check || { kyua report --verbose; exit 1 ;} mlmmj/.builds/debian-unstable.yml000066400000000000000000000006101502303113500173000ustar00rootroot00000000000000image: debian/unstable packages: - build-essential - kyua - atf-sh - libatf-dev - autotools-dev - pkg-config - autoconf - automake sources: - https://codeberg.org/mlmmj/mlmmj tasks: - configure: | cd mlmmj autoreconf -if ./configure - build: | cd mlmmj make - test: | cd mlmmj make check || { kyua report --verbose; exit 1 ;} mlmmj/.builds/debian.yml000066400000000000000000000006071502303113500154730ustar00rootroot00000000000000image: debian/testing packages: - build-essential - kyua - atf-sh - libatf-dev - autotools-dev - pkg-config - autoconf - automake sources: - https://codeberg.org/mlmmj/mlmmj tasks: - configure: | cd mlmmj autoreconf -if ./configure - build: | cd mlmmj make - test: | cd mlmmj make check || { kyua report --verbose; exit 1 ;} mlmmj/.builds/freebsd.yml000066400000000000000000000005401502303113500156570ustar00rootroot00000000000000image: freebsd/latest packages: - kyua - autoconf-switch - autoconf - automake - atf - pkgconf sources: - https://codeberg.org/mlmmj/mlmmj tasks: - configure: | cd mlmmj autoreconf -fi ./configure - build: | cd mlmmj make - test: | cd mlmmj make check || { kyua report --verbose; exit 1 ;} mlmmj/.gitignore000066400000000000000000000010571502303113500141560ustar00rootroot00000000000000*~ *.o *.a *.la *.lo *.exe .libs .deps .dirstamp Makefile Makefile.in /aclocal.m4 /autom4te.cache/ /build-aux/ /config.h /config.h.in /config.log /config.status /configure /kyua.conf /src/mlmmj-bounce /src/mlmmj-list /src/mlmmj-maintd /src/mlmmj-make-ml /src/mlmmj-process /src/mlmmj-receive /src/mlmmj-send /src/mlmmj-sub /src/mlmmj-unsub /stamp-h1 /tests/fakesmtpd /tests/functional-tests /tests/mlmmj /tests/mlmmj-bounce /tests/mlmmj-list /tests/mlmmj-maintd /tests/mlmmj-process /tests/mlmmj-receive /tests/mlmmj-send /tests/mlmmj-sub /tests/test_env.sh mlmmj/.hgignore000066400000000000000000000012051502303113500137640ustar00rootroot00000000000000# Use regular expressions for following lines syntax: regexp # Files generated by autoconf -if ^depcomp$ ^missing$ ^install-sh$ ^aclocal.m4$ ^autom4te.cache$ ^configure$ (^|/)Makefile.in$ ^config.h.in$ # Files generated by ./configure ^config.log$ ^config.status$ (^|/)Makefile$ ^config.h$ ^stamp-h1$ .*\.Po$ ^src/mlmmj-make-ml$ # Files generated by make .*\.o$ ^src/mlmmj-bounce$ ^src/mlmmj-list$ ^src/mlmmj-maintd$ ^src/mlmmj-process$ ^src/mlmmj-receive$ ^src/mlmmj-send$ ^src/mlmmj-sub$ ^src/mlmmj-unsub$ ^contrib/receivestrip/mlmmj_src/ # Other generated files (^|/)TAGS$ # Vim swap files (^|/)\..*\.swp$ # Mac files (^|/)\.DS_Store$ mlmmj/.hgtags000066400000000000000000000027031502303113500134430ustar00rootroot000000000000002b70ab44683228abd309948de8c38883961341e3 RELEASE_1_2_15_RC1 4efe830e57dda4ea27caef1ea9dda1834da35805 start 71c6e16a30c2f19f88f26998c312b1dfe8be5d94 RELEASE_1_2_0 71c6e16a30c2f19f88f26998c312b1dfe8be5d94 help 75c4867e3622a4209a67f605ae9dce269c764c92 RELEASE_1_2_13_RC1 95ca5e4104df87d1ae2e897c2056bf211117f9b3 RELEASE_1_2_14_RC1 9b32890a008ecb0ec582c11b0193a7498cd21372 RELEASE_1_2_16 9de854a13e8b5042d90f948ca33299e588a1b75d RELEASE_1_2_12_RC4 b7cad7a582379a8cf608a8e951cadeb0ecc8a031 RELEASE_1_2_13 b9505eccf55520d7c6dace3e91825e921ab88536 RELEASE_1_1_0 dae40c9e616d75dfac7de6d742723848c9de3da0 MLMMJ_1_2_12_RC1 ee89b545818a0b6c785ee3f79f43f848834f674b RELEASE_1_2_12_RC2 fa4e4c0220a2232fc697083789bb08615a02896c RELEASE_1_0_0 19531ac31a24eb93bbdc04edfed86353d9b40e86 RELEASE_1_2_17 df592ffbe26466d2457f5fd3882a39a93425b0b8 RELEASE_1_2_14 dae40c9e616d75dfac7de6d742723848c9de3da0 MLMMJ_1_2_12_RC1 0000000000000000000000000000000000000000 MLMMJ_1_2_12_RC1 dae40c9e616d75dfac7de6d742723848c9de3da0 RELEASE_1_2_12_RC1 f1155f6b28123bf64dbf34d57c185b94008a6c4b RELEASE_1_2_12 a0e7464ec2b32c6ef205ebf6975ed01189d7127a RELEASE_1_2_18a1 4c3c8b1845767177845d477ac708fd464f9c2542 RELEASE_1_2_18rc1 0f90ad70a59f784540bb8cd281f370bcbb4d24d5 RELEASE_1_2_18_0 3f4aee02898be84c0a7c6780aaac39c7ad5f4ff0 RELEASE_1_2_19b1 b202ed626645cc909956d6b80fd5bcfdf6497367 RELEASE_1_2_19_0 31c88127180c873d922fe861dcdbb8f5950c0379 RELEASE_1_3_0a1 570dd6d4942b7eaddaf8525401f97ffbda649ab1 RELEASE_1_3_0 mlmmj/AUTHORS000066400000000000000000000001701502303113500132310ustar00rootroot00000000000000Mads Martin Joergensen Morten K. Poulsen Ben Schmidt mlmmj/COPYING000066400000000000000000000021701502303113500132160ustar00rootroot00000000000000The MIT License Copyright (c) 2002, 2003, 2004 Mads Martin Joergensen 2004 Morten K. Poulsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mlmmj/ChangeLog000066400000000000000000000757371502303113500137600ustar00rootroot000000000000001.6.0 o Remove blanks in customheaders prefix and skip empty lines o $bouncenumbers$ in probe are now expended to number, messageid when possible o customheaeders allow now substitution of $posteraddr$ (Erwan Mas) o Fix portability issue on Hurd (Erwan Mas) 1.5.2 o Plenty of portability fixes 1.5.1 o Fix tests on system with a running smtp server on port 25 o Fix portability issue on arm64 o Fix tests where some struct were not initialised properly 1.5.0 o Add option to copy From: to Reply-To: (Graham Leggett) o remove contrib/pymime o remove contrib/foot_filter o granular access rejection message o fix duplicated bounce recording o Remove support for all deprecated syntax in templates 1.4.7 o fix duplicate queued moderation notification email o fix build on macOS 1.4.6 o mlmmj-make-ml: fix on OpenBSD o Fix another regression regarding RFC 5321 1.4.5 o Improve error messages in case of smtp failure o Regression: fix mlmmj-send -r o Modernize autotools usage 1.4.4 o fix regression which results in probe not containing the list of bounced emails 1.4.3 o fix regression which results in loosing track of probes 1.4.2 o fix regression in lastdigest parser 1.4.1 o fix regression in incremental updates 1.4.0-rc3 o fix unattended usage of mlmmj-makeml o fix regression regarding RFC 5321 o fix subscription validation 1.4.0-rc2 o fix notifymod regression o fix VERP regression 1.4.0-rc1 o moderation cookie for subscription is now under the sub directory moderation/subscribe o mlmmj-make-ml: now supports non interactive mailing list creation o listtext: reintegrate the tree (not a submodule anymore) o lots of code deduplication 1.4.0-b1 o manpage converted from man(7) to mdoc(7) o Fix a potential crash with mail without separator between headers and body o mlmmj-send: -l 6 has been removed o mlmmj-send: accept file descriptor number as -s argument o mlmmj-send: accept file descriptor number as -m argument o cleanup .omit files leftover if moderated emails are rejected and notmetoo is set. 1.4.0-a2 o Fix a crash with forged probe emails o mlmmj-send does not need anymore absolute path o Use copy_file_range if available o Use arc4random_uniform if available o Logs are not limited anymore to 256 characters per lines 1.4.0-a1 o Add a test suite o Modernize code (dprintf, posix_spawn, asprintf, getline, daemon, ...) o Supporting passing email to a mta over ipv6 o Fix relaying in IPV6-only systems o Fix decode quoted printable subject o Fix parsing RFC1891 o Fix a crash if no owner has been defined o Validate ranges of all integers conversion o New 'send' tunable to allow email passthrough o Add support for 'X-Original-From' o Reduce subscription confirmation address length to fit RFC 5321 o Use arc4random is available o Reduce memory manipulation o When unsubscribing bouncers, keep the bounce file if something went wrong and report in syslog what went wrong o Remove the -b option from mlmmj-unsub, it is not used anymore 1.3.0 o Czech translation (Jiří Šolc) o Don't use address extensions from non-list addresses o Fix some RFC 5321 compliance issues (Martijn Grendelman) o Add smtphelo tunable (Andreas Schulze) o Implement modonlypost 1.2.19.0 o Add README.footers and footer-related resources o Support ESMTP so OpenSMTPD uses 8 bits (Paul Fariello) o Use iconv to convert unknown character sets o Handle unfolded header lines better o Add a tunable for moderation request lifetime (Timo Boettcher) o Ensure mlmmj-send always honours tunables (e.g. relayhost) o Fix reason in denial messages for mails without the list in To: or CC: 1.2.18.1 o Stop mlmmj-maintd deleting list posts while they are being sent o Fix +list from crashing Mlmmj o Fix bug that made double subscription possible 1.2.18.0 o New list texts (Ben Schmidt, Xuacu Saturio, Nino Novak, Sophie Gautier, Epaminondas Diamantopoulos, Valter Mura, Sérgio Marques, Milos Sramek, Dean Lee) o Add %nowrap% to facilitate more complex formatting o Add subscription ability to php-admin o Add ability to except characters from width reckoning (and be zero-width) to facilitate wrapping even more languages well o Add different width-reckoning modes to facilitate wrapping many languages o Add different wrapping modes to facilitate wrapping many languages o Fix backslash escaping mechanism so double backslash can't effectively recurse and form part of another escape sequence, other non-unicode escapes aren't ignored, and first lines of included files don't 'escape' escaping. o Add ability to subscribe to both (normal and digest). o Fix access logic so subonlypost doesn't override a send access rule. o Make +unsubscribe remove the requester from all versions of the list. o Make mlmmj-unsub default to removing the requester from all versions of the list. o Make mlmmj-sub and +subscribe[-digest|-nomail] switch existing subscriptions. o Add a switch to bypass notifying the owner on subscribe/unsubscribe. o Introduce \ to indicate non-breakable space, \= to mark other locations where breaks should not occur, and \/ to mark locations where breaks can occur o Add rejection of posts and obstruction of subscriptions. o Avoid bogus error messages when logging that the list address has been found in To: or CC: headers. o Escape dashes in man pages. o Remove 'bashisms' from mlmmj-make-ml script (patch from Dan forwarded by Thomas Goirand). o Automatically skip blank lines followed by unsatisfied conditionals with no else part in list texts o Automatically skip lines with only whitespace and directives in list texts o Add support for conditionals in list texts o Add %wrap% and %wrap W% formatting directives o Add %digestthreads%, %gatekeepers%, %listsubs%, %digestsubs%, %nomailsubs%, %moderators% and %bouncenumbers% o Deprecate various list text substitutions such as $newsub$, $oldsub$, $moderateaddr$ o Add $permitaddr$ and $releaseaddr$ substitutions o Make $subject$, $posteraddr$ and $subaddr$ more widely available o Fix potential crash when mail to the owner arrives with no From: header o Add %originalmail% and %originalmail N% directives o Allow more characters in control and text filenames for substitutions o Add %%, %^%, %comment%, %control C% and %text T% formatting directives o Improve algorithm for list text substitutions o Add $text T$ substitution o Add $$ substitution o Allow list texts to include real UTF-8 characters, as documented o Fix bug where the normal listtext would be sent when unsubscribing from the nomail version of the list o New listtext naming scheme o Avoid trailing whitespace in MAIL FROM line (Lukas Fleischer) o Better end-of-line handling and error reporting in php-admin (Franky Van Liedekerke) o Avoid losing mail when connecting to relayhost fails o Improved and more consistent closing of SMTP sessions in error cases o Check the relayhost gives a reply before reading it to avoid a crash o Avoid checking addresses multiple times for notmetoo and make it work even when delivering messages individually o Fixed small memory leaks when SMTP errors occur o Improved error logging when requeuing o Fix php-admin to work when topdir contains a symlink (e.g. on Mac) o Better techniques for locating support files in php-admin -- existing installations will need to have their conf/config.php altered to set the variable $confdir o Add $control C$ substitution o Fix theoretically possible memory corruption by chomp() o Remove .sh from mlmmj-make-ml.sh; symlink original name o Correct spelling of 'receive' and 'voodoo' throughout the code and documentation, making mlmmj-recieve a symlink to mlmmj-receive (Chris Webb) o Richer MIME list texts with inline messages o Add $random0$ through $random5$ substitutions o Add a $subject$ substitution for list texts o Allow arbitrary headers in list texts o Ensure digest listtext is always closed o Fix Content-Transfer-Encoding: header for digests and list texts o Fixed a bug that could cause a crash if $posteraddr$ appeared in the maxmailsize listtext o Documented listtexts o Makes the random strings produced always the same length rather than smaller random numbers producing shorter strings which could be problematic o Make random number generation more efficient by only seeding the generator once o Added feature to notify users when their posts are moderated o Fixed documentation regarding silent subscription, and added ability to silently subscribe o Added notmetoo feature where posts are not mirrored to their senders o Check return status in mlmmj-perl-admin when adding subscribers (Florian Streibelt, Bitmand) o Better validation of input in php-admin (Thomas Goirand) o Fixed security bug in mlmmj-php-admin (Florian Streibelt, Morten Shearman Kirkegaard) o Added README.postfix to distribution tarball o Added "send" keyword to control/access handling (Ben Schmidt) o Added contrib/amime-receive (Gerd v. Egidy) o Fixed memory leak in substitute_one() (Ben Schmidt) o Updated TUNABLES file (Ben Schmidt) 1.2.17 o Added ifmodsendonlymodmoderate tunable o Replaced class.FastTemplate.php with class.rFastTemplate.php in contrib/web/php-admin (Christoph Thiel) 1.2.17-RC1 o Added information about digest and nomail to listhelp (Robin H. Johnson) o Fixed bug in mlmmj-maintd which caused loss of archive files in some requeue cases (Robin H. Johnson) o Added README.postfix (Jeremy Hinegardner, Andreas Schneider) o Added support for digest and nomail to +list (Christoph Wilke) o Caseinsensitive string compare for owner addr when +list is invoked. Spotted by Pavel Kolar. o Added contrib/web/php-moderation (Thomas Goirand) 1.2.16 o Fixed injection in contrib/web/perl-user (Gerd von Egidy) 1.2.16-RC1 o Updated Dutch listtexts (Franky Van Liedekerke) o Updated Italian listtexts (Fabio Busatto) o Added Postfix pipe backend support (Niki Guldbrand) o PHP admin interface bugfix (Niki Guldbrand) o Added support for static bounce addresses (Thomas Jarosch) o Added a sanity check in mlmmj-receive-strip (Chris Webb) o Added miscellaneous sanity checks (Thomas Jarosch) o Disabled digest mails when 'noarchive' is set (Thomas Jarosch) o Added Russian listtexts (Nikolay Derkach) o Fixed mmap()ing of zero-sized files (Robin H. Johnson) o Fixed mlmmj-recieve [sic] for architectures where sizeof(int) and sizeof(char *) differ o Added support for the 'originalmail' keyword (Sascha Sommer) o Merged various changes to the web interface from Franky Van Liedekerke 1.2.15-RC1 o Added --enable-recieve-strip configure option (Ansgar Burchardt) o Added unicode support to listtexts o Fixed build outside the source directory (Ansgar Burchardt) o Moved English listtexts and install all languages (Ansgar Burchardt) o Fixed missing exit()s in case of failed execl() calls (Ansgar Burchardt) o Changed Message-ID headers to include FQDN (Ansgar Burchardt) o Added support for 'discard' keyword in access rules (Sascha Sommer) 1.2.14 o Updated Danish listtexts (Jesper Lund) 1.2.14-RC1 o Fixed a small memory leak in log_oper() log rotation o Fixed address parsing for cases with quotes and multiple addresses o Added contrib/recievestrip/ MIME processor (Sascha Sommer) o Fixed digest multipart boundary (Thanks to Ulrich Mueller) o Added support for mail size limit (Christoph Wilke) o Log the result of access rules in the operation log (Henne Vogelsang) o Ignore empty lines in control files 1.2.13 o Added Dutch listtexts (Raymond den Ouden) 1.2.13-RC1 o Added 'nonomailsub' tunable which will disable nomail subscriptions to a list (Henne Vogelsang) o Added 'nodigestsub' tunable which will disable subscription to the digest version of a list (Henne Vogelsang) o Added list FAQ feature (Henne Vogelsang) o Added support for default list text directory (Henne Vogelsang) o Fixed a Bourne Shell issue in mlmmj-make-ml.sh (Magnus Naeslund) o Fixed hostnamestr() for hosts that can't find themselves using gethostbyname() (Benoit Dolez) o Add 'modnonsubposts' tunable that when set will moderate all posts from non subscribers o Fixed requeue for lists with noarchive enabled 1.2.12 o Fixed memory corruption in cleanquotedp() o Fixed bug in gethdrline() introduced in 1.2.12-RC3 1.2.12-RC4 o Fixed memory leak in checkwait_smtpreply() o Changed mlmmj-process to look at environment variable DEFAULT instead of EXT for qmail (Fabio Busatto) o Added Frensh listtext unsub-confirm-digest (Christophe Gallienne) 1.2.12-RC3 o Fixed EOF handling in checkwait_smtpreply() o Fixed header unfolding in gethdrline() 1.2.12-RC2 o Changed German listtexts (Stefan Reinauer, Christian Lackas) o Changed English listtexts (Stefan Reinauer) o Changed chomp() to also remove CR from CRLF sequences 1.2.12-RC1 o Update web interface with new tunables o Add support for qmail (envelope from address in environment variable) o Add digest text part o Add subscriber moderation o Fix default subject in administrative mails o Add French listtexts (Christophe Gallienne) o Add search and pagination functionality to the perl-admin web interface o Only add To: header when sending out actual list mail o Close stdin, stdout and stderr in the child of mlmmj-receive after forking. This is neccesary on FreeBSD. o No need to check for subscribers in 0-sized files o Make sure chomp works with empty strings (Frank Denis) 1.2.11 o Previous fix to find_email_adr() was incomplete, so in some cases mails would get rejected due to the To: or Cc: rule. Thanks again lcars for finding this o Sanity check to make sure there's a '@' in listaddress 1.2.10 o Fix nasty bug in the new 1.2.9 find_email_adr() making comma in quoted text in From: being discarded as invalid o Simply make all addresses lowercase before doing anything else wrt. sub/unsub and bounce o Add czech listtexts (Lukas Hluze) o Make non list emails (subconf, moderation etc.) also honor relayhost and smtpport o Add tunable to be able to close for subscription only (closedlistsub) 1.2.9 o Make find_email_adr() more robust (BSD, Neale Pickett) o Make the email address check case-insensitive. (Neale Pickett) o Add spanish listtext translations (Enrique Matías Sánchez) o Make recipient delimiter configurable per list. SIC! (Joel Aelwyn) o Added italian list texts translation. A thanks to Andrea Barisani, he has checked italian texts. (Filippo F. Fadda) o Use is_subbed_in instead of find_subscriber when subscribing people (Christian Laursen) o Make it possible to confirm subscription even though it's a closedlist. It makes sense to be able to confirm a request submitted by the sysadmin on the commandline o Add 'subonlyget' tunable which makes +get-N only work for subscribers 1.2.8 o Don't closedir() before done (GOOD spotting Christian Laursen) o Make sure the resend of queue files will not loop indefinately o Make Date: header RFC2822 compliant (Jakob Hirsch) o Add -s switch to mlmmj-{,un}sub to control whether or not to send a mail telling about already subscribed, or not subscribed when trying to subscribe or unsubscribe (Christian Laursen) 1.2.7 o Remove old superflous cruft in the smtpreply reader function, making mlmmj-send not segfault in rare cases when SIGTERM was sent o Another printf had snuck in there printing a free'ed variable 1.2.6.1 o Make sure the fromaddr is correct on sub-subscribed mails o Don't add an empty subject if there was one present 1.2.6 o If prefix but no Subject: header is present, add one (Jakob Hirsch) o Add notification mail when subbed people try to sub (Jakob Hirsch) o Install SIGTERM handler in mlmmj-send to allow it to shut down gracefully o Also remove mails when it's a bounce from a person not subbed o Introduce read() wrapper (Stevens) o Bouncing confirmation mails of sub or unsub should be cleaned from the queue as well o Normally mails which doesn't have exactly one From: emailaddress are discarded but certain ISPs have bounce mails with no From: header, forcing us to allow bounce mails with no From: to make sure they're caught o In case of a succesful DSN parse, we werent deleting the mail, and thus littering the queue o When sending moderated mails, rename them so that they wont be moderated again while sending 1.2.5 o Make listname+list send the list of regular subscribers to the owner who requested it. o Michael Fleming corrected some spelling / grammatical errors and made occasional minor clarifications in the english list texts. o Add README.sendmail from Andrea Barisani o Add README.exim4 from Jakob Hirsch o Skip addresses without a @ when sending o Set SO_KEEPALIVE for our connection socket 1.2.4 o Spend some time making valgrind completely happy o Unlink totally harmless .lock files in subscribers dir. o Make it possible to specify more than one listaddress in LISTDIR/control/listaddress. The first one is the "real" one. o Make the port to connect to controlable with LISTDIR/control/smtpport 1.2.3 o Only allow subscription of addresses with '@' in them o Fix return value from unsubscribe function o Add extra lock layer when accessing subscribers files o In case of listname+bounces-INDEX use the DSN (RFC1891) report to extract the bouncing address o Fix usage of a zero sized control/verp string o Make the Date: header RFC2822 conformant 1.2.2 o Make mlmmj-send work allthough no subscribers exist o Bring webinterfaces up to speed (Christian Laursen) o Fix moderate tag in access o Make mlmmj-make-ml.sh default the listtext dir to where they were installed in the system (Stephan Kulow) 1.2.1 o Introduce switches to turn off mails about posts being denied. 1.2.0 o Remove debug info printing 1.2.0-RC2 o Fix uninitialized strlist o Add logging regular operation to mlmmj.operation.log o Fix the sending loop by not sending the rest of the batch in every iteration 1.2.0-RC1 o Add VERP support. http://cr.yp.to/proto/verp.txt For Postfix: http://www.postfix.org/VERP_README.html, add "postfix" to LISTDIR/control/verp $smtpd_authorized_verp_clients should be the only one needed to touch 1.1.1-RC2 o It's ok to log to a symbolic link to somewhere else o Add Message-Id: and Date: headers to mail from mlmmj o Make log_oper() varargs capable (Rob Holland) 1.1.1-RC1 o Never discard anything from LISTDIR/queue/, let the admin be able to judge o Grab the lock when sending a mail to make sure noone does bad things to it underneath us o Danish listtexts, thanks Jesper Lund o Add control/noget to turn off listname+get-INDEX o Rearrange envelope from to be listname+bounces-index-user=domain.tld@ instead of listname+bounces-user=domain.tld-index@ to prepare for VERP support 1.1.0 o If mlmmj-recieve was invoked with a uid not root or not the owner of listdir inform about the uid actually invoked with o Add German listtexts (Hendrik Norman Vogelsang) o Add hooks for installing listtexts into $(pkgdatadir) (Drake Wyrm) o Add mlmmj-list manual page o Make mlmmj-list be capable of listing owners, moderators too o Perl interface updates 1.1.0-RC3 o Add 'moderate' tag for usage in control/access when one wants to have the moderators moderate posts hitting this regexp. See README.access o Add a To: header with the recipient's address when sending digests 1.1.0-RC2 o Strip envelope from before resending to +owner o Make statctrl bail if it's not possible to stat() o Add mlmmj-list binary to list the subcribers (-count) of a list 1.1.0-RC1 o Rewrite the way listtexts are managed, and in the process move the Subject: out into the listtext file making mlmmj completely translateable o Enhance perl webinterface - including group writable patch o Add option control/nosubconfirm which makes it possible to subscribe without confirmation by just sending the mail. USE WITH CARE! o Make files discarded by maintd end in .by-maintd to make them distinct o Fix off-by-one error in the function cleaning quoted printable chars o Close the correct fd's in mlmmj-process o Be consistent when using To: or Delivered-To: o mlmmj-unsub should also change user id to the listdir owner o Add support for not archiving the list by touching listdir/control/noarchive o Add 'nomail' version of lists. Subscribers to the nomail version are subscribed, but does not get any mail o Don't talk about changing uid in mlmmj-sub when we're not really doing it o Add sanity checks to disallow denial mails going to the list o Add digest functionality o Implement -d option for mlmmj-maintd to be able to supply it with a directory containing several listdirs, where mlmmj-maintd then will run maintenance o Chown option and a fix for mlmmj-make-ml.sh. Thanks Ingo Lameter 1.0.0 o Replace index() with strchr() o Add parenthesis around realloc call to make sure we alloc correctly o Make header matching case insensitive o Fix dumping of addresses to requeue o Make the time an address can bounce before unsubscribed configurable with listdir/control/bouncelife o Correct mlmmj-make-ml.sh cronentry line to include -F o Add manual pages. Thanks Soeren Boll for the initial ones o Make random numbers lowercase hex since gmail is lowercasing the address it replies to. o Also make sanity check in mlmmj-maintd to ensure it's invoke either as root or as listdir owner 1.0.0-RC4 o Fix brown paper bag bug not allowing enough space for the new better random strings introduced in RC3 so subscribe and unsubscribe works again. 1.0.0-RC3 o NULL and 0 are not the same on 64-bit platforms, so fix execlp(..., 0); to be execlp(..., NULL); o Add web-interface (PHP). Thank you Christoph Thiel o Have the random numbers be somewhat longer everywhere and not just somewhere o Move free() to where it belongs fixing problems with mlmmj-process some people have been seen o Fix printing of cron entry in mlmmj-make-ml.sh 1.0.0-RC2 o Do not allow mails from <> going to the list o Fix mailing to +owner again by adding missing 'break;' to switch in mlmmj-send o perl-admin updates from Christian Laursen o php-user updates from Christoph Thiel o Use Delivered-To: instead of To: when available 1.0.0-RC1 o Add web-interface. Thanks Christian Laursen for new perl-admin o Dump the customheaders before any Mime headers o Implement +get-N functionality, so it's possible to send a mail to foolist+get-101@domain.tld to retrieve mail 101 from that list. It's deliberately only possible to request one mail at a time. o Make sure that only either root or the listdir owner can execute the binaries when it has something to do with lists. o Don't leave bounces-help@ mails lying around in queue/ o Remove unanchored ".*" from beginning of regexp 0.8.3 o Have mlmmj-make-ml.sh remind people about using cron if they want o Replying to the confirmation address is enough to sub/unsub, no matter what address is used the second time o Fix possible DoS wrt. unsubscribing. Thank you Erik Toubro Nielsen o Add 'notifysub' functionality to have owner know when people sub/unsub. Thank you Kenneth Vestergaard Schmidt o Use Return-Path: for envelope From. Thanks Anders Johansson o Specification of which relayhost to use can now be done in control/relayhost o Add configure check to link against libnsl if needed. o Implement our own daemon() function since we don't have daemon() on Solaris 0.8.2 o Make sure we don't cut of the first char of an emailaddress o Fix header value copying (thanks Anders Johansson) o Don't segfault if there's no email address in the To: header o Clean up the subconf and unsubconf directories for stale requests as well 0.8.1.1 o Fix bug with prepstdreply not opening correct file. Thanks Christian Laursen for spotting. 0.8.1 o Go through all open() calls and retry in case we (allthough it's extremely unlikely) did get EEXIST o Add the option to add a To: header including the recipient emailaddress. NOTE that this does not remove any existing To: headers, they should be removed in control/delheaders o Optimize mlmmj-send by preparing the mail in memory to reduce the amount of write syscalls. control/memmailsize (size in bytes) controls how big it can be. Default is 16k before it's send line by line. o Make sure we check if the Subject: prefix might be present in the de-quoted printable version of the Subject. If so, don't add it. o Fix bug with queuefilename not being correctly initialized when generating standard mails o Let mlmmj-send be capable of handling relayhost local users bounce probes bouncing. o Don't litter the queuedirectory with files when rejecting mails (the maintenance daemon would take care of it, but lets be nice) 0.8.0 o Added regular expression based access control. o Added wrappers for malloc(), realloc(), free() and strdup(), so we can bail out if any of them fail. 0.7.3 o Implement control/delheaders in where one can specify all the headers to delete in incoming mail to the list. o Add +owner functionality (control/owner). Several addresses possible. o Relicense the whole thing to be MIT instead of GPL 0.7.2 o Make it possible to only let subscribers post o Implement feature to deny posts where the listaddress is not in To: or Cc:. Enabled pr. default, but can be disabled by touching control/tocc o Make mlmmj-sub change uid to the owner of listdir to avoid permission problems. Disable with -U to mlmmj-sub. o More memory debugging 0.7.1 o Fix bug with .reciptto and .mailfrom getting swapped o Plug a few small memory leaks in mlmmj-maintd o Fix bug with maintenance logfile not being opened at the right spot 0.7.0 o Add a macro to make sure mlmmj binaries are invoked with full path o Add the function to mlmmj-maintd to unsubscribe people who've been bouncing for BOUNCELIFE (default 432000 sec, 5 days) time. This completes the bouncehandling of mlmmj. SIC! o Add logging to mlmmj-maintd. mlmmj-maintd.lastrun.log in the listdir always has the log of the last run. This is work in progress. o Make mlmmj-bounce capable of sending probes o Include a function for easy generation of standard mail replies 0.6.0 o Add several unlinks. No need to litter queue/ with useless files o Don't use moderation/queue for outgoing, just use queue/ o Christoph Thiel pointed out that listaddress and moderators belong in control/ so move them there o Get rid of all FILE * instances and replace them with fd's o Also mmap the subscribers file when reading subcribers o Do an mmap of the mail to send once, instead of reading the mail for each mail to send o Rip out the ability to fork to make more than one connection to relayhost. It turned out to not make any performance gain (tested with lists with more than 120000 subscribers), and thus only complicated things. KISS won, so it's gone. o mlmmj-maint now handles resends and cleanup o Fixed interrupted fgets() in write_mailbody_from_file() o Fixed leak of subfile in mlmmj-send 0.5.2 o footer and customheaders are now accessed from listdir/control/ where they belong o Discard mails that doesn't have one and only one From: address. Discard here means moving them to queue/discard o Make sure we retrieve info from all headers matching the token we want o Fixed error handling in mlmmj-send if we can not open subscribers.d/ o Make mlmmj-send a lot more robust with SMTP and handle bounces from the relayhost. o Fix BUG in mlmmj-bounce still using listdir/subscribers o Handle subconf/unsubconf bounces o Begin work on mlmmj-maintd--the mlmmj maintenance daemon o Make help consistent and up to date with all options o Make mlmmj-send print the replies from the mailserver o Send our hostname in the HELO instead of relayhost o Implement requeueing mechanism to be able to resend mail when relayhost trouble occur 0.5.1 o Add a file TUNABLES which documents the ways to tune mlmmj lists. o Add support for Subject: prefix o Added WAITTIME (time to sleep before checking if we should spawn another mlmmj-send process) option in mlmmj.h o Fixed error handling in mlmmj-unsub if we can not open subscribers.d/ 0.5.0 o Use a subscribers.d/ directory for several subscribers files. mlmmj-send will now fork for each file (up to MAX_CONNECTIONS) for faster delivery. mlmmj-unsub will search for subscribers in all of these files. mlmmj-sub will now add emailaddresses to the file in subscribers.d/ with the name of the first character in the emailaddress (foo@bar.com will be in subscribers.d/f). o Major cleanup of listcontrol() and in the process add closed list functionality (touch listdir/control/closedlist and it's closed) 0.4.0 o Add moderation functionality 0.3.4 o Fix handling of lines which start with a dot 0.3.3 o Add primitive bounce handling o mlmmj-recieve now forks before exec() o mlmmj-{,un}sub now uses mmap and friends for better performance 0.3.2 o Logging enhancement o Send on the full path to the binaries around in the program since execlp needs it. o Make mlmmj-make-ml.sh use /bin/sh not /bin/bash o Rename mlmmj-{subscribe,unsubscribe} to mlmmj-{sub,unsub} o Cleanup and reimplementation of several functions that needed it badly 0.3.1 o Add BINDIR (mortenp) o Fix retstruct->emaillist initialize (mortenp) o Log handling adjustments (mortenp) o Touch subscribers and index (mortenp) 0.3.0 o Footer addition. Make a file called /path/to/listname/footer and it will be added to all mails. o Implement the help function. Send a mail to listname+help to get help. Also address used as From: address when sending sub/unsub mails o Make find_subscriber more safe (mortenp) o Completely use EXIT_macro (mortenp) 0.2.2 o Add proper checks for the execpl (mortenp) o Use EXIT_ macros for exit (mortenp) o Try /dev/urandom before /dev/random o Make the random_int() function work without /dev/random, which is not present on DEC-Unix/Tru64 (mortenp) o Make -V print the version 0.2.1 o Make the From: header on sub/unsub mails be listname+help o Double check the subscription address before adding. o The From header should be generated according to archive in the list mails for proper bounce handling o Cannot specify both -c and -C to mlmmj-{unsub,sub}scribe o Small bugfixes 0.2.0 o Implement subscription and unsubscription by email o Remove the need for the -l switch by introducing a listaddress file in the mailinglist directory o Make use of a queue directory, and not move mails to the archive before they are processed by mlmmj-send. 0.1.4 o Properly handle the replies from the mailserver on our requests. Still need some kind of requeing mechanism though. o Use automake and autoconf o Use fcntl instead of flock o Add a script to make the mailinglist directories - thanks hennebird 0.1.3 o Make it write \r\n for each \n. o Convert everything possible to snprintf o Make valgrind (http://developer.kde.org/~sewardj/) find no error, leaks anything 0.1.2 o Made mlmmj-unsubscribe o Made mlmmj-subscribe o Fix the indexnumber in the From header. Was reversed. 0.1.1 o Custom headers. Add a file called 'customheaders' in the listdir and it will be added. Should be used for Reply-To: if God forbid someone wants to use that. o Cleanup a bit 0.1.0 o Initial version working with archiving and not much else apart from the same functionality as a list in /etc/aliases mlmmj/FAQ000066400000000000000000000011771502303113500125230ustar00rootroot00000000000000Q: How does people subscribe/unsubscribe to mlmmj controlled mailinglists? A: They send a mail to listname+subscribe@domain.tld or listname+unsubscribe@domain.tld. So if we had a list called jokes@humour.org people would send a mail to jokes+subscribe@humour.org to subscribe and jokes+unsubscribe@humour.org to unsubscribe Q: Why is my queue/ in the listdirectory filled with files with cryptip names such as '4b35160eee7f63d' '287e3509509e4577' and '49123e175f68fcbc' A: mlmmj had a tendency of leaking files in the queue/ in the past. They're safe to delete as long as they're not accompanied by .from and .rcptto files mlmmj/Kyuafile000066400000000000000000000000711502303113500136550ustar00rootroot00000000000000syntax(2) test_suite("mlmmj") include("tests/Kyuafile") mlmmj/LICENSE000066400000000000000000000021701502303113500131700ustar00rootroot00000000000000The MIT License Copyright (c) 2002, 2003, 2004 Mads Martin Joergensen 2004 Morten K. Poulsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mlmmj/Makefile.am000066400000000000000000000031331502303113500142170ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in EXTRA_DIST = include LICENSE UPGRADE FAQ \ TUNABLES.md README.access.md README.archives.md README.listtexts.md \ man README.exim4.md README.sendmail.md README.qmail.md \ README.postfix.md README.footers.md Kyuafile tests/Kyuafile \ tests/dsnmail CLEANFILES = *~ mlmmj-*.tar.* man1_MANS = man/mlmmj-bounce.1 man/mlmmj-make-ml.1 man/mlmmj-receive.1 \ man/mlmmj-sub.1 man/mlmmj-maintd.1 man/mlmmj-process.1 \ man/mlmmj-send.1 man/mlmmj-unsub.1 man/mlmmj-list.1 SUBDIRS = src listtexts contrib if WANT_TESTS AM_CFLAGS += @ATF_CFLAGS@ check_PROGRAMS = \ tests/fakesmtpd \ tests/mlmmj dist_noinst_HEADERS = \ tests/mlmmj_tests.h tests_mlmmj_SOURCES = \ tests/mlmmj.c \ tests/mlmmj_tests.c tests_mlmmj_LDADD = \ $(top_builddir)/src/libmlmmj.a \ @ATF_LIBS@ tests_fakesmtpd_SOURCES = \ tests/fakesmtpd.c test_scripts = \ tests/mlmmj-send \ tests/functional-tests \ tests/mlmmj-maintd \ tests/mlmmj-sub \ tests/mlmmj-bounce \ tests/mlmmj-list \ tests/mlmmj-process \ tests/mlmmj-receive # Run the Kyua test suite when the 'check' target is invoked check-local: $(check_PROGRAMS) $(test_scripts) failed=no; \ $(KYUA) --config='$(top_builddir)/kyua.conf' test \ --kyuafile='$(top_srcdir)/Kyuafile' --build-root='$(top_builddir)' \ || failed=yes; \ if [ "$${failed}" = yes ]; then \ $(KYUA) report --results-file='$(abs_top_srcdir)' \ --verbose --results-filter=broken,failed; \ exit 1; \ fi # Build the test programs when the 'all' target is invoked all-local: $(check_PROGRAMS) endif mlmmj/README.access.md000066400000000000000000000077701502303113500147150ustar00rootroot00000000000000README.access present in mlmmj versions >= 0.8.0 (moderate tag since 1.1.0-RC3) Access control in mlmmj ======================= If the file listdir/control/access is present, access control is enabled. NOTE: the default action is to deny access (reject the mail), so an empty access control file will cause mlmmj to reject all posts, whereas a non- existant file will change nothing, and mlmmj will behave as usual. Each header in the mail is tested against each rule, rule by rule. That is, all headers are first tested against the first rule, then all headers are tested against the second rule, and so on. The first rule to match a header decides which action to take - allow, deny, discard or moderate the post. The syntax is quite simple: action[ [!]regexp] - "Action" can be "allow", "send", "deny", "discard" or "moderate". - The optional "!" makes the rule a match, if NO header matches the regular expression. - "Regexp" is a POSIX.2 extended regular expression. Matching is done case insensitive. The action "allow" will pass the mail on to the next step in processing. The mail may still be held for moderation, if it would have been so without access rules. The action "send" will send the mail unconditionally. It will not be moderated, nor subject to subonlypost, nor modnonsubposts. The action "deny" will not send the mail to the mailing list, but will send a rejection mail to the sender. The action "deny" can be specialised with "dash-extension". The dash-extension is used to identify the listtext to use, if present. For example, if "deny-html" is triggered, the rejection message is loaded from listtexts/deny-post-access-html The action "discard" will not send the mail to the list, and will not send a rejection mail. The action "moderate" will hold the mail for moderation. IMPORTANT: if "moderate" is used then don't forget to add people who should function as moderators in listdir/control/moderators The flow through the access system is something like this: ```` deny +------+ +----------------->| deny | | +------+ | | discard +---------+ | +-------------->| discard | | | +---------+ | | ^ | | | expire +--------+ moderate +------+ +------+ --->| access |----------->| hold |---------->| send |---> +--------+ +------+ confirm +------+ | | ^ ^ ^ | | | yes | | | | allow +--------------+ no | | | +-------------->| moderation * |-----+ | | +--------------+ | | send | +------------------------------------------+ ```` * modnonsubposts is also processed here, and subonlypost (the flow may be to deny or discard for subonlypost without modnonsubposts). First a simple example. This rule set will reject any mail that is NOT plain text, or has a subject that contains "BayStar", and allow anything else: ```` deny !^Content-Type: text/plain deny ^Subject:.*BayStar allow ```` To allow only text mails, but have the moderators moderate every html mail one would use this: ```` allow ^Content-Type: text/plain moderate ^Content-Type: text/html deny ```` Now on to a more advanced example. Morten can post anything, Mads Martin can post if the subject does not contain "SCO". Everything else is denied: ```` allow ^From: Morten deny ^Subject:.*SCO allow ^From: Mads Martin deny ```` The last rule (deny) can be left out, as deny is the default action. A third example. Deny any mails with "discount", "weightloss", or "bonus" in the subject. Allow PGP signed and plain text mails. Anything else is denied: ```` deny ^Subject:.*discount deny ^Subject:.*weightloss deny ^Subject:.*bonus allow ^Content-Type: multipart/signed allow ^Content-Type: text/plain ```` mlmmj/README.archives.md000066400000000000000000000012761502303113500152530ustar00rootroot00000000000000README.archives Generating web-browseable archives of Mlmmj lists ================================================= There are a couple of options for making web-browseable archives of Mlmmj lists. mlmmj-webarchiver (mhonarc) --------------------------- Andreas Schneider has created mlmmj-webarchiver, based on mhonarc and perl. You can get it here: http://git.cryptomilk.org/projects/mlmmj-webarchiver.git/ And see the kind of output it gives here: http://www.libssh.org/archive/ hypermail --------- Wolf Bergenheim has written some scripts which use hypermail to create web-browseable archives. The scripts and details can be found here: http://mlmmj.org/archive/mlmmj/2010-08/1710.html mlmmj/README.exim4.md000066400000000000000000000072021502303113500144700ustar00rootroot00000000000000 README.exim4 May 7th 2005 This is a step-by-step guide to run mlmmj with Exim4. The most current version of this can be found on http://plonk.de/sw/mlmmj/README.exim4. Notes: - We assume that you have a user and group called mlmmj to use with mlmmj - The exim user needs rx access rights to mlmmj's spool directory. (If you don't want that, see below.) The easiest way is "chmod 755 /path/to/mlmmj/spool", if it's ok that local users can see which lists there are. Note that the owner of the mlmmj spool must still be the mlmmj user (and this user must have at least x rights to the directories below). - Existence of mailing lists is automatically checked ($listdir) and you don't need to put anything into your aliases file - If you want VERP to be done by your MTA, follow the instructions below and put an empty file named verp into the control directory of your lists 1. In the main configuration section: ``` MLMMJ_HOME=/var/spool/mlmmj domainlist mlmmj_domains = list.example.net ``` 2. Add +mlmmj\_domains to relay\_to\_domains: ``` domainlist relay_to_domains = other.domain : +mlmmj_domains ``` 3. mlmmj is barely interested in delay warnings, so add this in the main configuration: ``` delay_warning_condition = ${if match_domain{$domain}{+mlmmj_domains}{no}{yes}} ``` 4. In the routers section (before the dnslookup router, preferably at the beginning): ``` mlmmj_router: driver = accept domains = +mlmmj_domains require_files = MLMMJ_HOME/${lc::$local_part} # Use this instead, if you don't want to give Exim rx rights to mlmmj spool. # Exim will then spawn a new process running under the UID of "mlmmj". #require_files = mlmmj:MLMMJ_HOME/${lc::$local_part} local_part_suffix = +* local_part_suffix_optional headers_remove = Delivered-To headers_add = Delivered-To: $local_part$local_part_suffix@$domain transport = mlmmj_transport ``` If you want VERP to be done by your MTA, also add this: ``` verp_router: driver = dnslookup domains = !+mlmmj_domains # we only consider messages sent in through loopback condition = ${if eq{$sender_host_address}{127.0.0.1}{yes}{no}} ignore_target_hosts = <; 0.0.0.0; 127.0.0.0/8; ::1/128; fe80::/10; ff00::/8 # only the un-VERPed bounce addresses are handled senders = \N^.+\+bounces-\d+@.+\N transport = verp_smtp ``` To prevent temporary errors for not-existing lists, add !+mlmmj\_domains to the domains condition of the dnslookup router: ``` dnslookup: driver = dnslookup domains = !+mlmmj_domains : !+local_domains [...] ``` 5. Somewhere in the transports section. (Change the path of mlmmj-receive if you don't use the default location!): ``` mlmmj_transport: driver = pipe return_path_add user = mlmmj group = mlmmj home_directory = MLMMJ_HOME current_directory = MLMMJ_HOME command = /usr/local/bin/mlmmj-receive -F -L MLMMJ_HOME/${lc:$local_part} ``` If you want VERP to be done by your MTA, also add this: ``` verp_smtp: driver = smtp # put recipient address into return_path return_path = ${quote_local_part:${local_part:$return_path}}-\ ${original_local_part}=${original_domain}@\ ${domain:$return_path} # must restrict to one recipient at a time max_rcpt = 1 # Errors-To: may carry old return_path headers_remove = Errors-To headers_add = Errors-To: $return_path ``` 6. Test your setup with ``` $ exim -bt mlmmj-test@your.list.domain mlmmj-test@your.list.domain router = mlmmj_router, transport = mlmmj_transport ``` If you get different output, run it with -d to see what's going wrong. If not, you're done! Jakob Hirsch (jh at plonk dot de) mlmmj/README.footers.md000066400000000000000000000017431502303113500151270ustar00rootroot00000000000000README.footers # Footers in Mlmmj Mlmmj's built-in footer support is very rudimentary. It will work for plain text emails, and that's about it. It doesn't understand HTML or MIME or anything like that. There are a few solutions to this. They all involve piping incoming mail through a filter before it reaches Mlmmj. A script to do this, called mlmmj-amime-receive, is included in amime-receive in the contrib directory. It can be used with a number of different pre-processors. One day we also hope to improve the integration of these external filters with Mlmmj, e.g. so only list posts are processed. However, the piping solution has worked for a number of people over the years quite satisfactorily, so this is not a high priority. Here are some pre-processors you can use. ## alterMIME The mlmmj-amime-receive script is designed to work with a program called alterMIME. The script itself (in amime-receive in the contrib directory) contains links to that software, and instructions. mlmmj/README.listtexts.md000066400000000000000000000513421502303113500155110ustar00rootroot00000000000000README.listtexts List texts in Mlmmj =================== List texts are stored in listdir/text and subdirectories of prefix/share/mlmmj/text.skel. They specify the content of various automatic emails that Mlmmj sends. They are provided in a number of different languages. The language to use for a list is chosen when you run the mlmmj-make-ml script and the appropriate files are copied into your listdir/text directory. This file documents the following aspects of list texts: - Naming scheme - Supported list texts - Format - Conditionals - Wrapping - Formatting and comments - Formatted substitutions - Unformatted substitutions - Escapes Naming scheme ------------- List texts are named following a scheme of: purpose-action-reason-type Mlmmj will look for the full four-part name first, then for files with shorter names obtained by dropping parts off the end, and finally for a file with a compatibility filename. It will use the first one it finds. (Note that use of the compatibility filename is DEPRECATED and will be removed in a future release.) So, the complete search order is: - purpose-action-reason-type - purpose-action-reason - purpose-action - purpose - compatibility filename (DEPRECATED) When using shortened names, the %ifaction%, %ifreason%, %iftype% and related conditionals can be used to customise the list text according to the values of the missing parts. Mlmmj checks these three paths for each candidate filename, and then moves on to the next candidate filename: - listdir/text - prefix/share/mlmmj/text.skel/default - prefix/share/mlmmj/text.skel/en The second path does not exist by default, but can be created by copying or symlinking the language of your choice to that path. Note that this search order means that if there is a more specific list text in a system directory, it will override a less-specific or compatibility list text in the listdir. This may be surprising, and may change in a future version, so should not be relied upon. Best practice is to ensure each list has its own copy of all textx present in system directories, or none of them. Supported list texts -------------------- The following list texts are supported. The compatibility filename (DEPRECATED) is given in brackets. Those with asterisks (*) are not yet used. - help (listhelp) sent in response to an email to listname+help@domain.tld - faq (listfaq) sent in response to an email to listname+faq@domain.tld - confirm-sub-{request|admin}-normal (sub-confirm) - confirm-sub-{request|admin}-digest (sub-confirm-digest) - confirm-sub-{request|admin}-nomail (sub-confirm-nomail) - confirm-unsub-{request|admin}-normal (unsub-confirm) - confirm-unsub-{request|admin}-digest (unsub-confirm-digest) - confirm-unsub-{request|admin}-nomail (unsub-confirm-nomail) sent to a requester to allow them to confirm a (un-)subscription request - moderate-post-{modnonsubposts|access|moderated} (moderation) sent to the appropriate moderators when moderation is required because a user has submitted a post - gatekeep-sub-{request|admin|confirm}-{normal|digest|nomail} (submod-moderator) sent to the appropriate gatekeepers when gatekeeping is required because a subscription request has been received - wait-post-{modnonsubposts|access|moderated} (moderation-poster) sent to a person submitting a post when they need to wait for moderation before it is released to the list - wait-sub-{request|admin|confirm}-{normal|digest|nomail} (submod-requester) sent to a person requesting subscription when they need to wait for gatekeeping for permission to join - deny-sub-disabled-{digest|both} (sub-deny-digest) - deny-sub-disabled-nomail (sub-deny-nomail) - deny-sub-subbed-{normal|digest|nomail|both} (sub-subscribed) - deny-sub-closed * - deny-sub-expired * - deny-sub-obstruct * - deny-unsub-unsubbed-{normal|digest|nomail|all} (unsub-notsubscribed) - deny-post-subonlypost (subonlypost) - deny-post-modonlypost - deny-post-access (access) - deny-post-maxmailsize (maxmailsize) - deny-post-tocc (notintocc) - deny-post-expired * - deny-post-reject * - deny-release-notfound * - deny-release-moderators * - deny-reject-notfound * - deny-reject-moderators * - deny-permit-notfound * - deny-permit-gatekeepers * - deny-obstruct-notfound * - deny-obstruct-gatekeepers * sent to the requestor when an action is denied or fails for some reason ('requestor' here means the person who requested the action, so e.g. for a reject action, deny-reject will go to the moderator requesting the rejection if the rejection fails; but deny-post-reject will go to the person requesting the post if the rejection succeeds, causing the post to fail) - finish-sub-{request|confirm|admin|permit|switch}-normal (sub-ok) - finish-sub-{request|confirm|admin|permit|switch}-digest (sub-ok-digest) - finish-sub-{request|confirm|admin|permit|switch}-nomail (sub-ok-nomail) - finish-unsub-{request|confirm|admin}-normal (unsub-ok) - finish-unsub-{request|confirm|admin}-digest (unsub-ok-digest) - finish-unsub-{request|confirm|admin}-nomail (unsub-ok-nomail) - finish-post-request * - finish-post-confirm * - finish-post-release * - finish-release * - finish-reject * - finish-permit * - finish-obstruct * sent to the requestor when an action completes successfully ('requestor' here means the person who requested the action, so e.g. for a release action, the moderator requesting the release will receive finish-release, and the person who submitted the released post will receive finish-post-release because the release action caused their post action to succeed) - notify-sub-{request|confirm|admin|permit}-normal (notifysub) - notify-sub-{request|confirm|admin|permit}-digest (notifysub-digest) - notify-sub-{request|confirm|admin|permit}-nomail (notifysub-nomail) - notify-unsub-{request|confirm|admin|bouncing}-normal (notifyunsub) - notify-unsub-{request|confirm|admin|bouncing}-digest (notifyunsub-digest) - notify-unsub-{request|confirm|admin|bouncing}-nomail (notifyunsub-nomail) sent to the list owner when somebody is (un-)subscribed - digest sent at the start of a digest (NOTE: the only header supported in this list text so far is a single-line 'Subject:' header; however, the contents of control/customheaders is included when digests are sent) - probe (bounce-probe) sent to a subscriber after an email to them bounced to inform them of the bounce and probe when the address is no longer bouncing - list---all (listsubs) - list---normal * - list---digest * - list---nomail * sent in response to an email to listname+list@domain.tld from the list owner (DEPRECATED: if none of %listsubs%, %digestsubs% and %nomailsubs% is encountered in the text, then they will be automatically added with some default formatting; this functionality is expected to be removed in the future) * Not yet used. Format ------ List texts have the following format: - Headers - Blank line - Body They are expected to be in UTF-8 encoding and have Unix line endings. The headers should be formatted as they should appear in the mail message. They will begin the mail message. Header continuation via lines beginning with linear whitespace is supported. Following the headers found in the list text, Mlmmj will output the following default headers, unless the same header is already provided in the list text. - From: - To: - Message-ID: - Date: - Subject: mlmmj administrivia - MIME-Version: 1.0 - Content-Type: text/plain; charset=utf-8 - Content-Transfer-Encoding: 8bit The Subject: header is treated specially: it may include UTF-8 characters, which will automatically be escaped using the =?utf-8?q?...?= quoting mechanism. (NOTE: the 'digest' list text is a bit different. See its description above.) Both headers and bodies of list texts may include conditionals, formatting directives and substitutions. These are explained in the following sections. Conditionals ------------ Conditionals allow text in list texts to be included or omitted based on conditions. The following are available: - %ifaction A ...% the action is one of those given - %ifreason R ...% the reason is one of those given - %iftype T ...% the type is one of those given - %ifcontrol C ...% one of the given control files exists - %ifnaction A% the action is not the one given - %ifnreason R% the reason is not the one given - %ifntype T% the type is not the one given - %ifncontrol C ...% at least one of the given control files does not exist The text after the %if...% directive is only included if the condition is satisfied, until an %else% or %endif% is encountered. These behave as you would expect. The %else% is optional. If a line with any of these conditional directives (%if...%, %else% or %endif%), after processing, contains only whitespace, the line does not appear at all in the output (the newline and any whitespace is omitted). Furthermore, if the preceding processed output ends with a blank line, when an unsatisfied conditional is encountered which has no %else% part, that preceding blank line is removed (unless it is the blank line that ends the headers). On the whole, this is what you would want and expect, so you probably don't need to worry about it. Note that when multiple parameters can be given for the directives, these have 'or' behaviour; to get 'and' behaviour, nest conditionals. Wrapping -------- There are various directives available to assist with wrapping and formatting. Wrapping needs to be enabled for each paragraph with: - %wrap% - %wrap W% concatenate and rewrap lines until the next empty line, whitespace-only line, or %nowrap% directive to a width of W (or 76 if W is omitted); second and later lines are preceded with as many spaces as the width preceding the directive; the width is reckoned including any text preceding the directive and any indentation preserved from a file which included the current one, so it is an absolute maximum width To turn off wrapping before the end of a paragraph, use: - %nowrap% stop wrapping; usually placed at the end of a line so the following line break is honoured but all preceding text is properly wrapped; if you want wrapping to continue after the break, you need to use %wrap% to turn it on again on the following line To cater for various languages, there are a number of different wrapping modes that can be set. These can be set either before or after wrapping is specified, and can even be changed part way through a paragraph if desired. The following directives control them: - %wordwrap% - %ww% use word-wrapping (this is the default; good for English, French, Greek and other languages that use an alphabet and spaces between words); lines have whitespace trimmed from both ends and are joined with a single space; lines are broken at spaces or at points marked for breaking with \/, but not at spaces escaped with a backslash - %charwrap% - %cw% use character-wrapping (good for Chinese, Japanese and Korean which use characters without spaces between words); lines have only leading whitespace trimmed and are joined without inserting anything at the joint; lines are broken at space or any non-ASCII character except where disallowed with \= - %userwrap% - %uw% use user-wrapping (for more complex languages or wherever complete manual control is desired); lines have only leading whitespace trimmed and are joined without inserting anything at the joint; lines are broken only where marked for breaking with \/ - %thin% assume non-ASCII characters are thin (equivalent to one unit, the same as ASCII characters) when reckoning the width for wrapping (this is the default; good for languages like Greek which use a non-Latin alphabet) - %wide% assume non-ASCII characters are wide (equivalent to two units, twice as wide as ASCII characters) when reckoning the width for wrapping (good for Chinese, Japanese, Korean) - %zero ABC% (ABC represents a sequence of non-ASCII characters) treat the listed characters as having zero-width when reckoning the width for wrapping (useful for ignoring combining characters such as accents so they don't affect the width calculation); usefully, the listed characters can be represented as unicode escapes (\uNNNN) If a line with any of the directives in this section, after processing, contains only whitespace, the line does not appear at all in the output (the newline and any whitespace is omitted). Formatting and comments ----------------------- The following directives are available to assist with formatting and readability: - %^% start the line here; anything preceding this directive is ignored (useful for using indentation for readability without ruining the formatting of the text when it is processed) - %comment% - %$% end the line here; anything following this directive is ignored/a comment If a line with any of these directives, after processing, contains only whitespace, the line does not appear at all in the output (the newline and any whitespace is omitted). Formatted substitutions ----------------------- These formatted substitutions work with multiple lines, so are generally not appropriate for use in headers. They are: - %text T% text from the file named T in the listdir/text directory; the name may only include letters, digits, underscore, dot and hyphen, and may not start with a dot; note that there is an unformatted version of this directive - %control C% the contents of the control file named C in listir/control; the name may only include letters, digits, underscore, dot and hyphen, and may not start with a dot; note that there is an unformatted version of this directive - %originalmail% - %originalmail N% (available only in moderate-post-*, wait-post-* and deny-post-{access|maxmailsize|tocc|subonlypost|modonlypost}) the email message being processed (usually a mail being moderated); N represents a number, which is how many lines of the message (including headers) to include: if omitted, the whole message will be included - %digestthreads% (available only in digest) the list of threads included in the digest - %gatekeepers% (available only in gatekeep-sub and wait-sub) the list of moderators to whom the moderation request has been sent - %listsubs% (available only in list---*) the list of normal subscribers DEPRECATED: use %normalsubs% - %normalsubs% (available only in list---*) the list of normal subscribers - %digestsubs% (available only in list---*) the list of digest subscribers - %nomailsubs% (available only in list---*) the list of nomail subscribers - %moderators% (available only in moderate-post-* and wait-post-*) the list of moderators to whom the moderation request has been sent - %bouncenumbers% (available only in probe) the list of indexes of messages which may not have been received as they bounced Directives which include a list of items have the behaviour that each item is preceded and followed by the same text as preceded and followed the directive on its line; only one such directive is supported per line. Those which include a block of text have the behaviour that second and later lines are preceded with as many spaces as there were bytes preceding the directive; any text following such directives on the same line is omitted. If a line with any of these directives, after processing, contains only whitespace, the line does not appear at all in the output (the newline and any whitespace is omitted). Unformatted substitutions ------------------------- Unformatted substitutions that are available are: - $bouncenumbers$ (available only in probe) the formatted list of indexes of messages which may not have been received as they bounced DEPRECATED: use %bouncenumbers% - $confaddr$ - $confirmaddr$ (available only in confirm-[un]sub-*) the address to which to send mail to confirm the (un-)subscription in question NOTE: the short version of this substitution is DEPRECATED - $control C$ the contents of the control file named C in listdir/control, with its final newline stripped; the name may only include letters, digits, underscore, dot and hyphen, and may not start with a dot; note that there is a formatted version of this directive - $digestfirst$ (available only in digest) index of the first message included in a digest - $digestinterval$ (available only in digest) indexes of the first and last messages included in a digest (e.g. 1-5), or just the index if only a single message is included - $digestissue$ (available only in digest) the issue number of the digest - $digestlast$ (available only in digest) index of the last message included in a digest - $digestsubaddr$ listname+subscribe-digest@domain.tld DEPRECATED: use $list+$subscribe-digest@$domain$ instead - $digestthreads$ (available only in digest) the formatted list of threads included in the digest DEPRECATED: use %digestthreads% - $digestunsubaddr$ listname+unsubscribe-digest@domain.tld DEPRECATED: use $list+$unsubscribe-digest@$domain$ instead - $domain$ domain.tld - $faqaddr$ listname+faq@domain.tld DEPRECATED: use $list+$faq@$domain$ instead - $helpaddr$ listname+help@domain.tld DEPRECATED: use $list+$help@$domain$ instead - $list$ listname - $list+$ listname+ - $listaddr$ listname@domain.tld DEPRECATED: use $list$@$domain$ instead - $listgetN$ listname+get-N@domain.tld (the N here is nothing special, so this won't actually work, but is used to explain to users how to use the +get functionality) DEPRECATED: use $list+$get-N@$domain$ instead - $listowner$ listname+owner@domain.tld DEPRECATED: use $list+$owner@$domain$ instead - $listsubaddr$ listname+subscribe@domain.tld DEPRECATED: use $list+$subscribe@$domain$ instead - $listunsubaddr$ listname+unsubscribe@domain.tld DEPRECATED: use $list+$unsubscribe@$domain$ instead - $maxmailsize$ (available only in deny-post-maxmailsize) the maximum size of mail that Mlmmj will accept - $moderateaddr$ (available only in moderate-post-* and gatekeep-sub) the address to which to send mail to approve the post or subscription in question DEPRECATED: use $releaseaddr$ or $permitaddr$ instead - $moderators$ (available only in moderate-post-*, wait-post-*, gatekeep-sub and wait-sub) the formatted list of moderators to whom the moderation request has been sent DEPRECATED: use %moderators% or %gatekeepers% instead - $newsub$ (available only in notify-sub-*-*) the address that has been subscribed DEPRECATED: use $subaddr$ instead - $nomailsubaddr$ listname+subscribe-nomail@domain.tld DEPRECATED: use $list+$subscribe-nomail@$domain$ instead - $nomailunsubaddr$ listname+unsubscribe-nomail@domain.tld DEPRECATED: use $list+$unsubscribe-nomail@$domain$ instead - $oldsub$ (available only in notify-sub-*-*) the address that has been unsubscribed DEPRECATED: use $subaddr$ instead - $originalmail$ the same as %originalmail 100% preceded by a space DEPRECATED: use %originalmail% - $permitaddr$ (available only in gatekeep-sub) the address to which to send mail to permit the subscription in question - $posteraddr$ (available only in deny-post-{access|tocc|subonlypost|modonlypost| maxmailsize}, moderate-post-* and wait-post-*) the from address of the message that was received as determined by Mlmmj - $random0$ - $random1$ - $random2$ - $random3$ - $random4$ - $random5$ these are 6 distinct random strings; they allow list texts to be constructed that are MIME messages with attachments by creating boundaries that are unlikely to appear in the attached messages - $releaseaddr$ (available only in moderate-post-*) the address to which to send mail to release the post in question - $subaddr$ (available only in gatekeep-sub, confirm-[un]sub-*, finish-[un]sub-*, notify-[un]sub-* and deny-[un]sub-*) the address requested to be (un-)subscribed - $subject$ (available only in deny-post-{access|tocc|subonlypost|modonlypost| maxmailsize}, moderate-post-* and wait-post-*) the subject line of the message in question - $text T$ text from the file named T in the listdir/text directory, with its final newline stripped; the name may only include letters, digits, underscore, dot and hyphen, and may not start with a dot; note that there is a formatted version of this directive Escapes ------- These allow you to avoid special meanings of characters used for other purposes in list texts, as well as control the construction of the texts at a fairly low level. - $$ a single $ - %% a single % - \\ a single \ - \uNNNN (NNNN represents four hex digits) a Unicode character (this is not really appropriate for use in a header, except perhaps the Subject: header as Mlmmj does automatic quoting for that header as described above) - \ a space, but don't allow the line to be broken here when wrapping - \/ nothing, but allow the line to be broken here when wrapping - \= nothing, but don't allow the line to be broken here when wrapping mlmmj/README.md000066400000000000000000000126701502303113500134500ustar00rootroot00000000000000This is an attempt at implementing a mailing list manager with the same functionality as the brilliant ezmlm, but with a decent license and mail server independence. The functionality: * Archive * Custom headers / footer * Fully automated bounce handling (similar to ezmlm) * Complete requeueing functionality * Moderation functionality * Subject prefix * Subscribers only posting * Regular expression access control * Functionality to retrieve old posts * Web interface * Digests * No-mail subscription * VERP support * Delivery Status Notification (RFC1891) support * Rich, customisable texts for automated operations To use mlmmj, do the following: 0) Compile it if you're not using a binary package such as dpkg, rpm or a ports collection from a BSD or Gentoo. To compile, untar the tar-ball and do: $ autoreconf -i && ./configure && make && make install If you want to filter multipart/mime messages, pass the option --enable-receive-strip to configure, and take a look at contrib/receivestrip/README. 1) Configure a recipient delimiter. The default is to use '+', and in Postfix it's done by adding recipient_delimiter = + to /etc/postfix/main.cf. In Exim it can be done by adding local_part_suffix = +* local_part_suffix_optional to the "userforward:" and the "localuser:" router in /etc/exim/exim.conf, and also add "local_part_suffix = +*" to the system_aliases function. Also make sure that exim will add the envelope from in the Return-Path: header. There is a nice FAQ explaining recipient delimiter configuration here: http://faqs.org/faqs/mail/addressing/ The mlmmj TUNABLE "delimiter" configures this on a per list basis NOTE: Using '-' as a delimiter is unlikely to work. Mlmmj uses '-' as its own kind of minor delimiter. Of course, you also cannot use the delimiter in your list names or you will encounter problems. 2) Create the mailinglist. There's a script, mlmmj-make-ml, that will make a mailinglist for mlmmj. It is highly recommended to use this script to make the lists! What is does is described here: In the case of a list called mlmmj-test below /var/spool/mlmmj it makes the following directories: ``` /var/spool/mlmmj/mlmmj-test/incoming /var/spool/mlmmj/mlmmj-test/queue /var/spool/mlmmj/mlmmj-test/queue/discarded /var/spool/mlmmj/mlmmj-test/archive /var/spool/mlmmj/mlmmj-test/text /var/spool/mlmmj/mlmmj-test/subconf /var/spool/mlmmj/mlmmj-test/unsubconf /var/spool/mlmmj/mlmmj-test/bounce /var/spool/mlmmj/mlmmj-test/control /var/spool/mlmmj/mlmmj-test/moderation /var/spool/mlmmj/mlmmj-test/subscribers.d /var/spool/mlmmj/mlmmj-test/digesters.d /var/spool/mlmmj/mlmmj-test/nomailsubs.d /var/spool/mlmmj/mlmmj-test/requeue ``` NOTE: The mailinglist directory (/var/spool/mlmmj/mlmmj-test in our example) have to be owned by the user the mailserver writes as. On some Postfix installations Postfix is run by the user postfix, but still writes files as nobody:nogroup or nobody:nobody 3) Make the changes to your mailserver aliases that came as output from mlmmj-make-ml. Following the example above they will look like this: mlmmj-test: "|/usr/bin/mlmmj-receive -L /var/spool/mlmmj/mlmmj-test" NOTE: Don't forget newaliases. 4) Start mlmmj-maintd (remember full path when starting it!) or add it to crontab with -F switch. The recommended way for now is to run it via cron: "0 */2 * * * /usr/bin/mlmmj-maintd -F -L /var/spool/mlmmj/mlmmj-test" It should be started as root, as mlmmj-maintd will become the user owning the listdir (/var/spool/mlmmj/mlmmj-test), and log it's last maintenance run to listdir/mlmmj-maintd.lastrun.log. If you have several lists below /var/spool/mlmmj you can use -d: /usr/bin/mlmmj-maintd -F -d /var/spool/mlmmj If you have lists more deeply nested below /var/spool/mlmmj, use something like: ``` find /var/spool/mlmmj -mindepth 1 -maxdepth 1 -type d \ -exec /usr/bin/mlmmj-maintd -F -d {} \; ``` That's it! You probably want to go through the next steps too. 5) Subscribe some people /usr/bin/mlmmj-sub -L /var/spool/mlmmj/mlmmj-test/ -a joe@domain.tld etc. 6) If you want custom headers like X-Mailinglist, Reply-To: etc. just add a file called 'customheaders' in the list control/ directory like this: $ cat /var/spool/mlmmj/mlmmj-test/control/customheaders X-Mailinglist: mlmmj-test Reply-To: mlmmj-test@domain.tld 7) If you want every mail to have something like: To unsubscribe send a mail to coollist+unsubscribe@lists.domain.net Just add what you want to a file named "footer" in the same dir as "customheaders" (listdir/control/). 8) If you want a prefix on the subject, to make it look like this: Subject: [mlmmj-test] how are we doing? Simply do 'echo "[mlmmj-test]" > control/prefix 9) For having a moderated list, simply create a file called 'moderated' in the control/ directory. Moderators are added to a file called 'moderators' in the control/ dir as well. 10) Have a look at the file TUNABLES for runtime configurable things. Tunables in include/mlmmj.h: · There's some time intervals for how mlmmj-maintd operates. I've chosen non-strict defaults, so depending on your BOFH rate you might want to tweak. The defaults should be good for most people though. Have fun! mlmmj/README.postfix.md000066400000000000000000000203421502303113500151360ustar00rootroot00000000000000README.postfix Jan 28th 2012 The main challenge to setting up Mlmmj with Postfix is that Mlmmj must be executed by root or the owner of the list directory, but by default Postfix will execute Mlmmj as 'nobody'[1]. There are a number of possible ways around this: - Making 'nobody' own your lists (insecure) [2] - Changing the Postfix default to an 'mlmmj' user (possibly insecure or impractical) [3] - .forward files (impractical) [4] - Using an :include: file owned by an 'mlmmj' user (possibly insecure and suboptimal) [5] - Adding an alias table owned by an 'mlmmj' user (suboptimal) [6] - Using a Postfix transport to run Mlmmj as an 'mlmmj' user (recommended) As you can see, the last option is recommended. Here is how to set it up using Postfix virtual domains (so you can host multiple domains on the same server). (It can also be done with regular non-virtual aliases[7].) 1) Add an 'mlmmj' user to your system (e.g. using 'useradd'). It usually makes sense to make this a 'system' user, with no password and no shell (/usr/false for the shell), and for its home directory to be /var/spool/mlmmj (or wherever you want to put your Mlmmj spool directory). 2) Create your Mlmmj spool directory (we'll assume it's /var/spool/mlmmj) and change its owner to the 'mlmmj' user. 3) Add an 'mlmmj' transport which uses the pipe(8) delivery agent to execute mlmmj-receive as the mlmmj user by adding something like the following to master.cf (often in /etc/postfix)[8]: # mlmmj mailing lists mlmmj unix - n n - - pipe flags=ORhu user=mlmmj argv=/usr/local/bin/mlmmj-receive -F -L /var/spool/mlmmj/$nexthop Note that $nexthop is used to specify the list directory. We will return to that later. 4) Integrate some necessary options in main.cf (also often in /etc/postfix): # Only deliver one message to Mlmmj at a time mlmmj_destination_recipient_limit = 1 # Consider the part after '+' but before '@' to be an address extension # i.e. addresses have the form user+extension@domain.tld recipient_delimiter = + # A map to forward mail to a dummy domain virtual_alias_maps = hash:/var/spool/mlmmj/virtual # Allow virtual alias maps to specify only the user part of the address # and have the +extension part preserved when forwarding, so that # list-name+subscribe, list-name+confsub012345678, etc. will all work propagate_unmatched_extensions = virtual # A map to forward mail for the dummy domain to the Mlmmj transport transport_maps = hash:/var/spool/mlmmj/transport Of course, you may need to merge these options with existing ones (e.g. you probably have existing virtual_alias_maps if you run a multi-domain server). It is probably unnecessary to change propagate_unmatched_extensions because it defaults to something including 'virtual'. You can check this with something like 'postconf | grep propagate'. 5) (For each list) Create a mailing list (e.g. by using mlmmj-make-ml). The list directory should be like /var/spool/mlmmj/list-dir for a flat structure, or /var/spool/mlmmj/domain.tld/list-name for a hierarchical structure (the -s option to mlmmj-make-ml may be useful to get the list created where you want it). Ensure the list directory and everything in it is owned by the mlmmj user (except you may want control files to be owned by your www server user in order to use web configuration interfaces; they must be readable by the mlmmj user though). 6) (For each list) Add entries to the Postfix tables to accept mail for the list and forward it to the Mlmmj transport: /var/spool/mlmmj/virtual: list-name@domain.tld domain.tld--list-name@localhost.mlmmj /var/spool/mlmmj/transport: # for a flat structure domain.tld--list-name@localhost.mlmmj mlmmj:list-dir # for a hierarchical structure domain.tld--list-name@localhost.mlmmj mlmmj:domain.tld/list-name Note that we have used a dummy domain 'localhost.mlmmj' to connect the virtual alias with the Mlmmj transport. This could be anything as long as it isn't a real domain. The user part of the address could also be anything; as long as the address matches in both tables it should work. Also note that the text after 'mlmmj:' becomes $nexthop which was mentioned earlier, so it is used to specify the list directory when executing mlmmj-receive. 7) Refresh your postfix tables and reload your configuration so it takes effect. postmap /var/spool/mlmmj/virtual postmap /var/spool/mlmmj/transport postfix reload Enjoy your new lists! [1] Actually, the standard local(8) delivery agent will execute external programs (such as Mlmmj) as the 'receiving user'. However, unless you direct your mail to Mlmmj using a .forward file (see local(8)) or an :include: file (see aliases(5)), or your aliases file is not owned by root, there is no 'receiving user'. Without a 'receiving user', Postfix uses the user from the configuration option 'default_privs', which defaults to 'nobody'. [2] Making 'nobody' own your lists is insecure because other programs and daemons rely on 'nobody' not owning any files or having access to anything; they use 'nobody' as a way of denying access and keeping all your files and system secure. Most notably, some NFS implementations use 'nobody' when somebody connects but fails to authenticate. Your mailing lists should not be accessible in such situations, but they may be if they are owned by 'nobody'. [3] Changing 'default_privs' to an 'mlmmj' user may open other security holes, and may not be appropriate if Postfix is used for other external programs besides Mlmmj. [4] Using .forward files is not practical, as it requires a user to be created for every mailing list. [5] Using :include: files would require delivery to commands to be enabled in :include: files, which is not recommended for security reasons. It is also messy for virtual domains in the same way as an alias table owned by an 'mlmmj' user is[6]. [6] Adding an alias table owned by an 'mlmmj' user works, and doesn't pose any great security risk. However, it is messy for virtual domains as you need to forward mail from the virtual domain to your non-virtual domain and then to Mlmmj. This results in each list having an additional address, which is not desirable. That extra intermediate address is also included in mail headers, which is not desirable (though it could be filtered out by Mlmmj). Setting up an Mlmmj transport is about the same amount of work and doesn't have these drawbacks. However, If you are not using virtual domains, this is a good and simple option; but it will not be explained in detail here. [7] To use non-virtual alises, at step 4, you'll need to incorporate: alias_maps = hash:/var/spool/mlmmj/aliases propagate_unmatched_extensions = alias You probably will need to adjust propagate_unmatched_extensions in this case, probably by adding 'alias' to the existing value rather than using 'alias' alone. If you want to use 'newaliases' to update the alias table, you should also incorporate: alias_database = hash:/var/spool/mlmmj/aliases At step 6, entries in /var/spool/mlmmj/aliases should look something like: list-name: list-name@localhost.mlmmj At step 7, you'll need: postalias /var/spool/mlmmj/aliases or (if you included alias_database above) newaliases And of course you can omit the virtual stuff if you're not using it. Note that this has not been tested, but we believe it should work. [8] The flags for the transport are pretty critical. In particular if the 'R' option is not used mlmmj-receive fails to receive the mail correctly. The options mean: D - Prepend a 'Delivered-To: recipient' header (not used) O - Prepend an 'X-Original-To: recipient' header R - Prepend a 'Return-Path:'. header h - fold $nexthop to lowercase u - fold $recipient to lowercase mlmmj/README.qmail.md000066400000000000000000000045141502303113500145500ustar00rootroot00000000000000This mini-HOWTO is a step-by-step guide for using mlmmj with qmail MTA (http://www.qmail.org/), and it has been successfully tested also with vpopmail virtual domains (http://www.inter7.com/vpopmail/). Prerequisites: - qmail (and vpopmail) correctly installed - mlmmj correctly installed Conventions: - ${BINDIR}: directory with mlmmj binary files (/usr/local/bin/) - ${LISTDIR}: directory with list configuration files (/var/spool/mlmmj/listname) - ${DQFILE}: dot-qmail file (see below) Configuration: - the first thing you've to do is to create the list, using the mlmmj-make-ml script (follow the classic procedure to do this step) - enter the control directory for the list (${LISTDIR}/control/), and execute the following command: # cd ${LISTDIR}/control/; echo '-' > delimiter - chown and chmod the file according to the mlmmj configuration - create dot-qmail files for the list to handle direct requests and extensions: # echo -e "|${BINDIR}/mlmmj-receive -L ${LISTDIR}" > ${DQFILE} - chown and chmod the files according to the qmail (and vpopmail) configuration WARNING: REMEMBER that the delimiter is -, so do not use + when composing mail addresses for extensions!!! WARNING: DO NOT USE 'preline' command in dot-qmail files, it will result in mlmmj to not work properly!!! ---- Example: - Configuring mlmmj to handle ml@programmazione.it mailing list using qmail as MTA and vpopmail for virtual domain support: # mlmmj-make-ml -c vpopmail:vchkpw -L ml Creating Directorys below /var/spool/mlmmj. Use '-s spooldir' to change The Domain for the List? [] : programmazione.it The emailaddress of the list owner? [postmaster] : postmaster@programmazione.it The path to texts for the list? [/usr/local/share/mlmmj/text.skel] : chown -R vpopmail:vchkpw /var/spool/mlmmj/ml? [y/n]: y # cd /var/spool/mlmmj/ml/control/ # echo '-' > delimiter # chown vpopmail:vchkpw delimiter # cd /home/vpopmail/domains/programmazione.it/ # echo -e "|/usr/local/bin/mlmmj-receive -L /var/spool/mlmmj/ml/" > .qmail-ml # cp -a .qmail-ml .qmail-ml-default # cat *-default # chown vpopmail:vchkpw .qmail-ml .qmail-ml-default # chmod 600 .qmail-ml .qmail-ml-default ---- Fabio Busatto mlmmj/README.sendmail.md000066400000000000000000000074541502303113500152470ustar00rootroot00000000000000Using sendmail + VERP ===================== The following configuration enables VERP (http://cr.yp.to/proto/verp.txt) which is useful for mailing list managers that are able to take advantage of that feature. This configuration is currently used for using the mlmmj manager (http://mlmmj.mmj.dk) with VERP enabled + sendmail. The hack consists in hooking VERP rewriting in a replacement ruleset for the existing EnvFromSMTP one (called VerpEnvFromSMTP). This is going to work *only* if we are splitting messages with multiple recipients in separate queue files since the macro we are using for the rewriting ($u) is not set when multiple rcpt are present. The first step consists in forcing envelope splitting, this is done using the QUEUE\_GROUP feature, here we are definining r=1 (max 1 rcpt per message) for the default queue group: QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, F=f, I=1m, R=2, r=1') Since we are going to split a lot it's advisable to use the FAST\_SPLIT option, additionally we need to enforce return-path inclusion in the local mailer: define(`confFAST_SPLIT', `100')dnl define(`LOCAL_SHELL_FLAGS', `eu9P')dnl Then we define a regex map for matching the addresses that we are going to rewrite, in our example we'll rewrite addresses like with where user@foo.net is the recipient address of the message. So we need to apply our verp ruleset *only* to those addresses. Additionally we are also adding the Delivered-To header: LOCAL_CONFIG Kmatch_verp regex -m -a@VERP (listname\+bounces\-[0-9]+<@domain\.net\.?>) H?l?Delivered-To: $u Here's the ruleset, the first half of the ruleset is the existing EnvFromSMTP ruleset present in default sendmail.cf, the seconf half is the VERP stuff: SVerpEnvFromSMTP R$+ $: $>PseudoToReal $1 sender/recipient common R$* :; <@> $@ list:; special case R$* $: $>MasqSMTP $1 qualify unqual'ed names R$+ $: $>MasqEnv $1 do masquerading R $* $: $(match_verp $1 $) match the address R $* + $* < @ $* . > $* @VERP $: $1 + $2 - $&u < @ $3 . > $4 VERP rewrite it using $u macro and add VERP string for failsafe R $* - < @ $* . > $* VERP $: $1 < @ $2 . > $3 if $u wasn't defined rewrite the address back R $* - < $+ @ $+ > < @ $* . > $* VERP $: $(dequote $1 "-" $2 "=" $3 $) < @ $4 . > $5 replace the "@" in rcpt address with "=" R $* - $+ @ $+ < @ $* . > $* VERP $: $(dequote $1 "-" $2 "=" $3 $) < @ $4 . > $5 replace the "@" in rcpt address with "=" Finally we need to rewrite the mailer definition for the used mailer (typically esmtp) specifying VerpEnvFromSMTP as the sender rewrite ruleset: MAILER_DEFINITIONS Mesmtp, P=[IPC], F=mDFMuXa, S=VerpEnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h NOTE: for mailing list servers it's also a good idea keeping existing Delivered-To headers, sendmail needs the following patch for doing this --- sendmail/conf.c.orig 2004-07-14 21:54:23.000000000 +0000 +++ sendmail/conf.c 2004-12-06 15:22:05.000000000 +0000 @@ -117,6 +117,7 @@ { "content-length", H_ACHECK, NULL }, { "subject", H_ENCODABLE, NULL }, { "x-authentication-warning", H_FORCE, NULL }, + { "delivered-to", H_FORCE, NULL }, { NULL, 0, NULL } }; Andrea Barisani mlmmj/TODO000066400000000000000000000005441502303113500126560ustar00rootroot00000000000000Code cleanup: o Make RECIPDELIM configurable (compile and/or runtime) o Add some more logging to mlmmj-maintd--actually we have to rethink logging a bit. We want to log everything to syslog/mlmmj. Functionality items: o control/preexec and control/postexec. Nice to do: o Add memory debugging features ("At exit you had the following allocated:") mlmmj/TUNABLES.md000066400000000000000000000220661502303113500137300ustar00rootroot00000000000000 TUNABLES for lists managed with mlmmj ===================================== The following files can be used for changing the behaviour of a list. The filename is supposed to be below listdir/control. In the case it's a "boolean", the contents of a file does not matter, the mere presence of it, will set the variable to "true". If it's a "normal" file, the first line will be used as value, leaving line 2 and forward ready for commentary etc. If it's possible to specify several entries (one pr. line), it's marked "list". If the file's entire content is used as value, it's marked "text". * listaddress (list) This file contains all addresses which mlmmj sees as listaddresses (see tocc below). The first one is the one used as the primary one, when mlmmj sends out mail. * closedlist (boolean) Is the list is open or closed. If it's closed subscription and unsubscription via mail is disabled. * closedlistsub (boolean) Closed for subscription. Unsubscription is possible. * moderated (boolean) If this file is present, the emailaddresses in the file listdir/control/moderators will act as moderators for the list. * submod (list) If this file is present, subscription will be moderated by owner(s). If there are emailaddresses in this file, then these will be used instead of owner. * tocc (boolean) If this file is present, the list address does not have to be in the To: or Cc: header of the email to the list. * subonlypost (boolean) When this file is present, only people who are subscribed to the list, are allowed to post to it. The check is made against the "From:" header. * modonlypost (boolean) When this file is present, only people listed in listdir/control/moderators are allowed to post to it. The check is made against the "From:" header. * modnonsubposts (boolean) When this file is present, all postings from people who are not allowed to post to the list will be moderated instead of denied. * modreqlife (normal) This specifies how long in seconds a mail awaits moderation before it's discarded. Defaults to 604800 seconds, which is 7 days. * prefix (normal) The prefix for the Subject: line of mails to the list. This will alter the Subject: line, and add a prefix if it's not present elsewhere. * replyto (boolean) When this file is present, the From: line of mails will be added as a Reply-To: header. This allows the mail to be delivered safely when DMARC protected emails are received from the list. * owner (list) The emailaddresses in this file (1 pr. line) will get mails to listname+owner@listdomain.tld * customheaders (list) These headers are added to every mail coming through. This is the place you want to add Reply-To: header in case you want such. * delheaders (list) In this file is specified *ONE* headertoken to match pr. line. If the file consists of: Received: Message-ID: Then all occurences of these headers in incoming list mail will be deleted. "From " and "Return-Path:" are deleted no matter what. * access (list) If this file exists, all headers of a post to the list is matched against the rules. The first rule to match wins. See README.access for syntax and examples. * addtohdr (boolean) When this file is present, a To: header including the recipients emailaddress will be added to outgoing mail. Recommended usage is to remove existing To: headers with delheaders (see above) first. * relayhost (normal) The host specified (IP address or hostname, both works) in this file will be used for relaying the mail sent to the list. Defaults to 127.0.0.1. * notifysub (boolean) If this file is present, the owner(s) will get a mail with the address of someone sub/unsubscribing to a mailinglist. * notifymod (boolean) If this file is present, the poster (based on the envelope from) will get a mail when their post is being moderated. * digestinterval (normal) This file specifies how many seconds will pass before the next digest is sent. Defaults to 604800 seconds, which is 7 days. * digestmaxmails (normal) This file specifies how many mails can accumulate before digest sending is triggered. Defaults to 50 mails, meaning that if 50 mails arrive to the list before digestinterval have passed, the digest is delivered. * bouncelife (normal) This specifies how long in seconds an address can bounce before it's unsubscribed. Defaults to 432000 seconds, which is 5 days. * noarchive (boolean) If this file exists, the mail won't be saved in the archive but simply deleted. * nosubconfirm (boolean) If this file exists, no mail confirmation is needed to subscribe to the list. This should in principle never ever be used, but there are times on local lists etc. where this is useful. HANDLE WITH CARE! * noget (boolean) If this file exists, then retrieving old posts with +get-N is disabled. * subonlyget (boolean) If this file exists, then retrieving old posts with +get-N is only possible for subscribers. The above mentioned 'noget' have precedence. * verp (normal) Control how Mlmmj does VERP (variable envelope return path). If this tunable does not exist, Mlmmj will send a message to the SMTP server for each recipient, with an appropriate envelope return path, i.e. it will handle VERP itself. If the tunable does exist, Mlmmj will instead divide the recipients into groups (the maximum number of recipients in a group can be controlled by the maxverprecips tunable) and send one message to the SMTP server per group. The content of this tunable allows VERP to be handled by the SMTP server. If the tunable contains "postfix", Mlmmj will make Postfix use VERP by adding XVERP=-= to the MAIL FROM: line. If it contains something else, that text will be appended to the MAIL FROM: line. If it contains nothing, VERP will effectively be disabled, as neither Mlmmj nor the SMTP server will do it. * maxverprecips (normal) How many recipients per mail delivered to the SMTP server. Defaults to 100. * notoccdenymails (boolean) * noaccessdenymails (boolean) * nosubonlydenymails (boolean) * nomodonlydenymails (boolean) These switches turns off whether mlmmj sends out notification about postings being denied due to the listaddress not being in To: or Cc: (see 'tocc'), when it was rejected due to an access rule (see 'access') or whether it's a subscribers/moderators only posting list (see 'subonlypost/modonlypost'). * nosubmodmails (boolean) This switch turns off whether mlmmj sends out notification about subscription being moderated to the person requesting subscription (see 'submod'). * smtpport (normal) In this file a port other than port 25 for connecting to the relayhost can be specified. * delimiter (normal) This specifies what to use as recipient delimiter for the list. Default is "+". * nodigesttext (boolean) If this file exists, digest mails won't have a text part with a thread summary. * nodigestsub (boolean) If this file exists, subscription to the digest version of the mailinglist will be denied. (Useful if you don't want to allow digests and notify users about it). * nonomailsub (boolean) If this file exists, subscription to the nomail version of the mailinglist will be denied. (Useful if you don't want to allow nomail and notify users about it). * maxmailsize (normal) With this option the maximal allowed size of incoming mails can be specified. * nomaxmailsizedenymails (boolean) If this is set, no reject notifications caused by violation of maxmailsize will be sent. * nolistsubsemail (boolean) If this is set, the LISTNAME+list@ functionality for requesting an email with the subscribers for owner is disabled. * staticbounceaddr (normal) If this is set to something@example.org, the bounce address (Return-Path:) will be fixed to something+listname-bounces-and-so-on@example.org in case you need to disable automatic bounce handling. * ifmodsendonlymodmoderate (boolean) If this file is present, then mlmmj in case of moderation checks the envelope from, to see if the sender is a moderator, and in that case only send the moderation mails to that address. In practice this means that a moderator sending mail to the list won't bother all the other moderators with his mail. * footer (text) The content of this file is appended to mail sent to the list. * notmetoo (boolean) If this file is present, mlmmj attempts to exclude the sender of a post from the distribution list for that post so people don't receive copies of their own posts. * smtphelo (normal) When this file is present, it contains the hostname to send in the SMTP EHLO or HELO command. Otherwise the machine hostname is used. * send (list) The file contains a list of email address for which the mail will be sent unconditionally. It will not be moderated, nor subject to subonlypost, nor modnonsubposts. mlmmj/UPGRADE000066400000000000000000000036301502303113500131770ustar00rootroot00000000000000 This applies to everyone using Mlmmj < 1.2.18.0: ------------------------------------------------ Updating the list texts is optional but highly recommended, as they have been vastly improved for this version. Users of the php-admin interface need to modify configuration files to define $confdir. Be aware of the following new features you may wish to turn on or use: - Richer list texts (including a new naming scheme, conditionals, automatic wrapping and true UTF-8 support). See README.listtexts for more details. - Notifying posters when their posts are being moderated (notifymod tunable). - Not-me-too feature to avoid having the poster receiving their own messages (notmetoo tunable). - Ability to explicitly reject posts (exposed in new list texts). - Ability to explicitly obstruct subscriptions (exposed in new list texts). - Unsubscribe from all versions of a list at once (changed behaviour of +unsubscribe[-{digest|nomail}]; they now all remove the subscriber from all versions of the list). - Ability to switch between different versions of a list by using +subscribe[-{digest|nomail|both}] ('both' means normal and digest, and is a 'hidden feature' not mentioned in the supplied list texts). - Subscription ability in php-admin. This applies to everyone using mlmmj < 1.1.0: --------------------------------------------- Don't forget to upgrade the listtexts. Listtext handling was completely rewritten and the subject is now translateable as well. Don't forget to create the new directories needed for digest and nomail version of the list. listdir/subscribers.d and listdir/nomailsubs.d This applies to everyone using mlmmj < 0.8.3: --------------------------------------------- Don't forget to upgrade the listtexts! This applies to everyone using mlmmj > 0.7.2: --------------------------------------------- Don't forget to add the emailaddress of the list owner in listdir/control/owner mlmmj/configure.ac000066400000000000000000000073741502303113500144640ustar00rootroot00000000000000# Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) AC_INIT([mlmmj],[1.6.0],[bapt@nours.eu]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) AC_CONFIG_SRCDIR([src/mlmmj-receive.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.13 dist-xz foreign subdir-objects]) # Enable silent rules by default AM_SILENT_RULES([yes]) # Checks for programs. AC_PROG_CC AC_PROG_RANLIB # Checks for libraries. AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(iconv,iconv_open) AC_CHECK_HEADERS([syslog.h ]) AC_CHECK_HEADER([iconv.h]) savex=$exec_prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix tmp=$datadir/$PACKAGE/text.skel while textlibdir=`eval echo "$tmp"`; test "x$textlibdir" != "x$tmp"; do tmp=$textlibdir; done exec_prefix=$savex AC_SUBST(textlibdir) AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [build with coverage flags activated (default is no)])) AS_IF([test x"$enable_coverage" = xyes], [ COVERAGE_CFLAGS="-O0 -ggdb -fprofile-arcs -ftest-coverage -fprofile-generate" COVERAGE_LDFLAGS="-fprofile-generate" ]) AC_ARG_ENABLE([asan], AS_HELP_STRING([--enable-asan], [build with libasan (default is no)])) AS_IF([test x"$enable_asan" = xyes], [ ASAN_CFLAGS="-O0 -ggdb -fsanitize=address" ASAN_LDFLAGS="-fsanitize=address" ]) AC_ARG_ENABLE([ubsan], AS_HELP_STRING([--enable-ubsan], [build with libubsan (default is no)])) AS_IF([test x"$enable_ubsan" = xyes], [ UBSAN_CFLAGS="-O0 -ggdb -fsanitize=undefined" UBSAN_LDFLAGS="-fsanitize=undefined" ]) AC_ARG_ENABLE([receive-strip], AS_HELP_STRING([--enable-receive-strip], [build mlmmj-receive-strip (default is no)])) AM_CONDITIONAL(WANT_RECEIVESTRIP, test x"$enable_receive_strip" = xyes) AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [build tests (default is yes)]), [:], [enable_tests=yes] ) # Checks for library functions. AC_FUNC_MALLOC AC_CHECK_FUNCS([syslog]) AC_CHECK_FUNCS([arc4random_uniform copy_file_range]) AS_IF([test x"$enable_tests" = xyes], [ PKG_CHECK_MODULES([ATF], [atf-c]) AC_PATH_PROG([ATFSH], [atf-sh]) AC_PATH_PROG([KYUA], [kyua]) AS_IF([test "x$KYUA" == "x"], [ AC_MSG_ERROR([A 'kyua' binary is required when the tests are enabled. Set the PATH or use the KYUA environment variable to specify its location.]) ]) AS_IF([test "x$ATFSH" == "x"], [ AC_MSG_ERROR([An 'atf-sh' binary is required when the tests are enabled. Set the PATH or use the ATFSH environment variable to specify its location.]) ]) ]) AM_CONDITIONAL([WANT_TESTS], [test x"$enable_tests" = xyes]) AM_CPPFLAGS="-I\$(top_srcdir)/include -DDEFAULTTEXTDIR='\"\$(textlibdir)\"'" AC_SUBST(AM_CPPFLAGS) AM_CFLAGS="-g -Wall -std=gnu99 -D_GNU_SOURCE=1 -Wextra -pedantic -Wsign-compare $COVERAGE_CFLAGS $ASAN_CFLAGS $UBSAN_CFLAGS" AC_SUBST(AM_CFLAGS) AM_LDFLAGS="$COVERAGE_LDFLAGS $ASAN_LDFLAGS $UBSAN_LDFLAGS" AC_SUBST(AM_LDFLAGS) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([kyua.conf]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([src/mlmmj-make-ml]) AC_CONFIG_FILES([listtexts/Makefile]) AC_CONFIG_FILES([contrib/Makefile]) AC_CONFIG_FILES([contrib/receivestrip/Makefile]) AC_CONFIG_FILES([tests/test_env.sh]) AC_CONFIG_FILES([tests/functional-tests],[chmod +x tests/functional-tests]) AC_CONFIG_FILES([tests/mlmmj-bounce],[chmod +x tests/mlmmj-bounce]) AC_CONFIG_FILES([tests/mlmmj-list],[chmod +x tests/mlmmj-list]) AC_CONFIG_FILES([tests/mlmmj-maintd],[chmod +x tests/mlmmj-maintd]) AC_CONFIG_FILES([tests/mlmmj-process],[chmod +x tests/mlmmj-process]) AC_CONFIG_FILES([tests/mlmmj-receive],[chmod +x tests/mlmmj-receive]) AC_CONFIG_FILES([tests/mlmmj-send],[chmod +x tests/mlmmj-send]) AC_CONFIG_FILES([tests/mlmmj-sub],[chmod +x tests/mlmmj-sub]) AC_OUTPUT mlmmj/contrib/000077500000000000000000000000001502303113500136235ustar00rootroot00000000000000mlmmj/contrib/Makefile.am000066400000000000000000000001611502303113500156550ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in EXTRA_DIST = web amime-receive SUBDIRS = receivestrip mlmmj/contrib/amime-receive/000077500000000000000000000000001502303113500163335ustar00rootroot00000000000000mlmmj/contrib/amime-receive/mlmmj-amime-receive000077500000000000000000000042111502303113500221010ustar00rootroot00000000000000#!/bin/bash # # mlmmj-amime-receive # # Take mail from stdin, pipe it through altermime and then to mlmmj-receive # needed to add footers in a MIME-aware way # # requires altermime, see http://www.pldaniels.com/altermime/ # # just replace mlmmj-receive with mlmmj-amime-receive, e.g. in /etc/aliases: # myml: "|/usr/bin/mlmmj-amime-receive -L /var/spool/mlmmj/myml/" # # put the footer-text for the different MIME-types into # control/amime-footer-text # control/amime-footer-html # control/amime-footer-base64 # # Copyright 2008 by Gerd v. Egidy, # # Licensed under MIT License, see LICENSE file coming with mlmmj # MLMMJRECEIVE=/usr/bin/mlmmj-receive ALTERMIME=/usr/bin/altermime # check executables if ! [ -x $MLMMJRECEIVE ]; then echo "can't find $MLMMJRECEIVE executable, aborting" exit 1 fi if ! [ -x $ALTERMIME ]; then echo "can't find $ALTERMIME executable, aborting" exit 1 fi # read parameters I=1 PARAM_L=0 while [ $I -le $# ] && [ $PARAM_L == 0 ]; do if [ "${!I}" == "-L" ]; then PARAM_L=1 fi I=$[$I+1] done if [ $PARAM_L == 1 ] && [ $I -le $# ]; then MLPATH="${!I}" else echo "parameter -L /path/to/listdir missing, aborting" exit 1 fi if ! [ -d "${MLPATH}" ]; then echo "${MLPATH} is not existing or no directory, aborting" exit 1 fi CONTROLD="${MLPATH}/control" if ! [ -d "${CONTROLD}" ]; then echo "${CONTROLD} is not existing or no directory, aborting" exit 1 fi # look for footer-files and build parameters if ! [ -f "${CONTROLD}/amime-footer-text" ]; then echo "${CONTROLD}/amime-footer-text is not existing or no regular file, aborting" exit 1 fi PARAM="--disclaimer=${CONTROLD}/amime-footer-text" if [ -f "${CONTROLD}/amime-footer-html" ]; then PARAM="${PARAM} --disclaimer-html=${CONTROLD}/amime-footer-html --htmltoo --force-for-bad-html" fi if [ -f "${CONTROLD}/amime-footer-base64" ]; then PARAM="${PARAM} --disclaimer-b64=${CONTROLD}/amime-footer-base64" fi PARAM="${PARAM} --altersigned --log-syslog" # go to a dir where altermime can write it's tmp-files safely cd $MLPATH # pipe the calls $ALTERMIME --input=- ${PARAM} | $MLMMJRECEIVE "$@" mlmmj/contrib/receivestrip/000077500000000000000000000000001502303113500163275ustar00rootroot00000000000000mlmmj/contrib/receivestrip/Makefile.am000066400000000000000000000003051502303113500203610ustar00rootroot00000000000000# if WANT_RECEIVESTRIP bin_PROGRAMS = mlmmj-receive-strip endif mlmmj_receive_strip_SOURCES = mlmmj-receive-strip.c $(MLMMJ_SOURCES) mlmmj_receive_strip_LDADD = $(top_builddir)/src/libmlmmj.a mlmmj/contrib/receivestrip/README000066400000000000000000000023531502303113500172120ustar00rootroot00000000000000mlmmj-receive-strip is a replacement for mlmmj-receive It opens the files control/mimedeny and control/mimestrip to get a list of mimetypes for parts of multipart/mime messages that should be denied or stripped The parts then get stripped directly when the mail is received. mlmmj-receive-strip also appends an extra header X-ThisMailContainsUnwantedMimeParts: Y when the mail contains unwanted mime parts Usage: Compile the program in this directory with make and use "make install" to install it. Afterwards replace mlmmj-receive with mlmmj-receive-strip in /etc/aliases for the mailinglist you want to enable stripping and run newaliases Then create the files mimedeny mimestrip in the control directory of your mailinglist. If control/mimestrip for example contains: text/html application/octet-stream html texts and binarys will be stripped from the mail. When you also want to deny mails with certain mimeparts add the mimetypes to the mimedeny file and add the following lines to the control/access file: deny ^X-ThisMailContainsUnwantedMimeParts: Y allow You will most likely want to remove the X-ThisMailContainsUnwantedMimeParts header by adding the following line to the control/delheaders file: X-ThisMailContainsUnwantedMimeParts: mlmmj/contrib/receivestrip/mlmmj-receive-strip.c000066400000000000000000000245231502303113500223740ustar00rootroot00000000000000/* Copyright (C) 2007 Sascha Sommer * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /* a version of mlmmj-receive that parses the mail on the fly and strips unwanted mime parts opens the files control/mimedeny and control/mimestrip for a list of mime types for body parts that should be denied or stripped. It adds an extra header X-ThisMailContainsUnwantedMimeParts: Y for mails that contain disallowed mimeparts and X-ThisMailContainsUnwantedMimeParts: N otherwise */ #include #include #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "mygetline.h" #include "gethdrline.h" #include "strgen.h" #include "chomp.h" #include "ctrlvalue.h" #include "ctrlvalues.h" #include "utils.h" #include "do_all_the_voodoo_here.h" #include "log_error.h" #include "wrappers.h" #include "xmalloc.h" #include "utils.h" #define UNWANTED_MIME_HDR "X-ThisMailContainsUnwantedMimeParts: N\n" /* read all mail headers and save them in a strlist * check what to do with parts that contain the given mime_type *return values * 0: ok * 1: strip * sets deny to 1 if the entire mail should be denied */ #define MIME_OK 0 #define MIME_STRIP 1 static int read_hdrs(int fd, strlist *allhdrs, strlist* delmime, strlist* denymime,int* deny,char** boundary) { int result = MIME_OK; char* mime_type = NULL; char *tmp; /* read headers */ while(1) { char* line = mygetline(fd); if(!line) /* end of file and also end of headers */ break; /* end of headers */ if(line[0] == '\n'){ free(line); break; } if(!tll_length(*allhdrs) || ((line[0] != '\t') && (line[0] != ' '))) /* first header line or no more unfolding */ tll_push_back(*allhdrs, line); else{ xasprintf(&tmp, "%s%s", tll_back(*allhdrs), line); free(tll_pop_back(*allhdrs)); tll_push_back(*allhdrs, tmp); } free(line); } parse_content_type(allhdrs,&mime_type,boundary); if(mime_type) { /* check if this part should be stripped */ if(delmime && findit(mime_type, delmime)) result = MIME_STRIP; /* check if the mail should be denied */ if(denymime && findit(mime_type, denymime)) *deny = 1; free(mime_type); } return result; } /* writes the mail headers if unwantedmime_hdrpos is not NULL an UNWANTED_MIME_HDR * is inserted and its position saved in unwantedmime_hdrpos * returns 0 on success */ static int write_hdrs(int outfd, strlist* hdrs,off_t* unwantedmime_hdrpos) { tll_foreach(*hdrs, hdr) { if(dprintf(outfd, "%s", hdr->item) < 0){ log_error(LOG_ARGS, "Error when dumping headers"); return -1; } } /* if this is not the header of an embedded part add the header that will indicate if the mail contains unwanted mime parts */ if(unwantedmime_hdrpos) { if(dprintf(outfd, "%s", UNWANTED_MIME_HDR) < 0){ log_error(LOG_ARGS, "Error writting unwanted mime header"); return -1; } /* get the current position so that we can update the header later */ *unwantedmime_hdrpos = lseek(outfd,0,SEEK_CUR); if(*unwantedmime_hdrpos < 2){ log_error(LOG_ARGS, "Error getting file position"); return -1; } *unwantedmime_hdrpos -= 2; } /* write a single line feed to terminate the header part */ if(dprintf(outfd, "\n") < 0) { log_error(LOG_ARGS,"Error writting end of hdrs."); return -1; } return 0; } /* set the unwanted mime_hdr to Y */ static int update_unwantedmime_hdr(int outfd,off_t unwantedmime_hdrpos) { /* seek to the header position */ if(lseek(outfd,unwantedmime_hdrpos,SEEK_SET) < 0) { log_error(LOG_ARGS,"Error seeking to the unwantedmime_hdr"); return -1; } /* update the header */ if(dprintf(outfd, "Y\n") < 0){ log_error(LOG_ARGS, "Error writting extra header"); return -1; } /* seek back to the end of the mail */ if(lseek(outfd,0,SEEK_END) < 0) { log_error(LOG_ARGS,"Error seeking to the mail end"); return -1; } return 0; } static int parse_body(int infd,int outfd, strlist* delmime, strlist* denymime, int* deny,char* boundary){ int strip = 0; char* line; while((line = mygetline(infd))) { if(boundary && !strncmp(line,boundary,strlen(boundary))){ strip = 0; /* check if the boundary is the beginning of a new part */ if(strncmp(line + strlen(boundary),"--",2)){ strlist hdrs = tll_init(); char* new_boundary = NULL; /* check if this part should be stripped */ if(read_hdrs(infd, &hdrs,delmime,denymime,deny,&new_boundary) == MIME_STRIP) strip = 1; else { /* write boundary */ if(dprintf(outfd, "%s", line) < 0){ log_error(LOG_ARGS, "Error writting boundary"); return -1; } /* write hdr */ if(write_hdrs(outfd, &hdrs, NULL) < 0){ log_error(LOG_ARGS, "Error writting hdrs"); return -1; } /* parse embedded part if a new boundary was found */ if(new_boundary && parse_body(infd,outfd,delmime,denymime,deny,new_boundary) != 0) { log_error(LOG_ARGS, "Could not parse embedded part"); return -1; } } tll_free_and_free(hdrs, free); if(new_boundary) free(new_boundary); }else{ /* write end of part */ if(dprintf(outfd, "%s", line) < 0){ log_error(LOG_ARGS, "Error writting hdrs"); return -1; } /* and leave */ free(line); break; } }else { if(!strip) { /* write the current line */ if(dprintf(outfd, "%s", line) < 0){ log_error(LOG_ARGS, "Error when dumping line"); return -1; } } } free(line); } return 0; } /* read a mail stripping unwanted parts */ static int dump_mail(int infd, int outfd,char* listdir) { strlist hdrs = tll_init(); strlist *delmime; strlist *denymime; char* boundary=NULL; int deny = 0; int result, ctrlfd; off_t unwantedmime_hdr_pos = 0; char *dir; xasprintf(&dir, "%s/control", listdir); ctrlfd = open(dir, O_RDONLY|O_CLOEXEC); /* get list control values */ delmime = ctrlvalues(ctrlfd, "mimestrip"); denymime = ctrlvalues(ctrlfd, "mimedeny"); /* read mail header */ result = read_hdrs(infd, &hdrs,delmime,denymime,&deny,&boundary); /* write mail header */ if(write_hdrs(outfd,&hdrs,&unwantedmime_hdr_pos) < 0) { log_error(LOG_ARGS, "Could not write mail headers"); return -1; } /* free mail header */ tll_free_and_free(hdrs, free); if(result == MIME_OK && !deny) { /* try to parse the mail */ if(parse_body(infd,outfd,delmime,denymime,&deny,boundary) != 0) { log_error(LOG_ARGS, "Could not parse mail"); return -1; } free(boundary); }else deny = 1; /* dump rest of mail */ if(dumpfd2fd(infd, outfd) != 0) { log_error(LOG_ARGS, "Could not receive mail"); return -1; } /* update header */ if(deny) { if(update_unwantedmime_hdr(outfd,unwantedmime_hdr_pos) != 0) { log_error(LOG_ARGS, "Could not update header"); return -1; } } /* free mime types */ if(delmime) { tll_free_and_free(*delmime, free); free(delmime); } if(denymime) { tll_free_and_free(*denymime, free); free(denymime); } return 0; } static void print_help(const char *prg) { printf("Usage: %s -L /path/to/listdir [-h] [-V] [-P] [-F]\n" " -h: This help\n" " -F: Don't fork in the background\n" " -L: Full path to list directory\n" " -P: Don't execute mlmmj-process\n" " -V: Print version\n", prg); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { char *infilename = NULL, *listdir = NULL; char *randomstr = NULL; char *mlmmjprocess, *bindir; int fd, opt, noprocess = 0, nofork = 0; int incfd, listfd; CHECKFULLPATH(argv[0]); log_set_name(argv[0]); bindir = mydirname(argv[0]); xasprintf(&mlmmjprocess, "%s/mlmmj-process", bindir); free(bindir); while ((opt = getopt(argc, argv, "hPVL:s:e:F")) != -1) { switch(opt) { case 'h': print_help(argv[0]); break; case 'L': listdir = optarg; break; case 's': setenv("SENDER", optarg, 1); break; case 'e': setenv("EXTENSION", optarg, 1); break; case 'P': noprocess = 1; break; case 'F': nofork = 1; break; case 'V': print_version(argv[0]); exit(0); } } if(listdir == NULL) { errx(EXIT_FAILURE, "You have to specify -L\n" "%s -h for help", argv[0]); } listfd = open_listdir(listdir, true); incfd = openat(listfd, "incoming", O_DIRECTORY|O_CLOEXEC); if (incfd == -1) err(EXIT_FAILURE, "Cannot open(%s/incoming)", listdir); do { free(randomstr); randomstr = random_str(); fd = openat(incfd, randomstr, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while(fd < 0 && errno == EEXIST); xasprintf(&infilename, "%s/incoming/%s", listdir, randomstr); free(randomstr); if(fd < 0) { log_error(LOG_ARGS, "could not create mail file in " "%s/incoming directory", listdir); free(infilename); exit(EXIT_FAILURE); } if(dump_mail(fileno(stdin), fd, listdir) != 0) { log_error(LOG_ARGS, "Could not receive mail"); exit(EXIT_FAILURE); } #if 0 log_oper(listdir, OPLOGFNAME, "mlmmj-receive got %s", infilename); #endif fsync(fd); close(fd); if(noprocess) { free(infilename); exit(EXIT_SUCCESS); } /* * Now we fork so we can exit with success since it could potentially * take a long time for mlmmj-send to finish delivering the mails and * returning, making it susceptible to getting a SIGKILL from the * mailserver invoking mlmmj-receive. */ if (!nofork) daemon(1, 0); exec_or_die(mlmmjprocess, "-L", listdir, "-m", infilename, NULL); } mlmmj/contrib/web/000077500000000000000000000000001502303113500144005ustar00rootroot00000000000000mlmmj/contrib/web/perl-admin/000077500000000000000000000000001502303113500164305ustar00rootroot00000000000000mlmmj/contrib/web/perl-admin/README000066400000000000000000000050151502303113500173110ustar00rootroot00000000000000mlmmj-1.0.0 August 20th 2004 To use this web-interface you have to: 0) Make sure you have the CGI::FastTemplate perl module installed. If not, then install it. It has no dependencies to other perl modules. 1) Copy the files from the perl-admin directory of the mlmmj distribution to a suitable location and point your webroot to the htdocs directory. If you don't want the webinterface in the root of your website it is recommended to make an alias in your web server configuration in order to keep the conf directory at the same level as the htdocs directory and still outside webscope. 2) You need to enable cgi in your apache configuration like this Options ExecCGI DirectoryIndex index.cgi AddHandler cgi-script .cgi 3) Change the permissions of the listdir/control directories of any list you want to control using the web-interface, so the web server can write in it: # chown -R wwwrun /var/spool/mlmmj/mlmmj-test/control/ 4) If the web server does not run as the same user the mailserver writes as you need to create a group (eg. mlmmj) and add both users to it. The subscribers.d directory then needs to be writable by that group: # chgrp -R mlmmj /var/spool/mlmmj/mlmmj-test/subscribers.d # chmod -R g+w /var/spool/mlmmj/mlmmj-test/subscribers.d # chgrp -R mlmmj /var/spool/mlmmj/mlmmj-test/digesters.d # chmod -R g+w /var/spool/mlmmj/mlmmj-test/digesters.d # chgrp -R mlmmj /var/spool/mlmmj/mlmmj-test/nomailsubs.d # chmod -R g+w /var/spool/mlmmj/mlmmj-test/nomailsubs.d # chgrp -R mlmmj /var/spool/mlmmj/mlmmj-test/text # chmod -R g+w /var/spool/mlmmj/mlmmj-test/text To enable access control on Apache you have to: 5) Rename dot.htaccess to .htaccess and edit the path inside the file to point to a htpasswd file somewhere outside the webscope. If you don't have one already, you can create one like this htpasswd -c /home/mlmmj/htpasswd USER It will then ask you for a password for the given username. 6) That is it, you are ready to use the interface. Further customization: You can set two environment variables in your apache config to control the configuration of the mlmmj webinterface. Remember to have mod_env loaded if you do this. SetEnv CONFIG_PATH /home/mlmmj/conf/config.pl SetEnv TUNABLES_PATH /home/mlmmj/conf/tunables.pl This allows you to run several instances of the webinterface with e.g. different topdirs, translated to another language or with another layout. mlmmj/contrib/web/perl-admin/conf/000077500000000000000000000000001502303113500173555ustar00rootroot00000000000000mlmmj/contrib/web/perl-admin/conf/config.pl000077500000000000000000000001061502303113500211570ustar00rootroot00000000000000$topdir = "/var/spool/mlmmj"; $templatedir = "/home/mlmmj/templates"; mlmmj/contrib/web/perl-admin/conf/tunables.pl000066400000000000000000000234541502303113500215370ustar00rootroot00000000000000mlmmj_list("listaddress", "List address", "This option contains all addresses which mlmmj sees as listaddresses (see ". "tocc below). The first one is the one used as the primary one, when mlmmj ". "sends out mail."); mlmmj_boolean("closedlist", "Closed list", "If the list is open or closed. If it's closed subscription ". "and unsubscription via mail is disabled."); mlmmj_boolean("closedlistsub", "Closed for subscription", "Closed for subscription. Unsubscription is possible."); mlmmj_boolean("nosubconfirm", "No subscribe confirmation", "If this option is set, the user is not required to confirm when subscribing or unsubscribing."); mlmmj_boolean("moderated", "Moderated", "If this option is set, the emailaddresses in the file listdir/control/moderators will act as moderators for the list."); mlmmj_list("moderators", "Moderators", "If the list is moderated, this is the list of moderators."); mlmmj_list("submod", "Subscription moderators", "This is the list of moderators that will approve subscriptions."); mlmmj_boolean("tocc", "To: Cc:", "If this option is set, the list address does not have to be in the To: or Cc: header of the email to the list."); mlmmj_boolean("addtohdr", "Add To: header", "If this option is set, a To: header including the recipients emailaddress will be added to outgoing mail. ". "Recommended usage is to remove existing To: headers with delheaders (see below) first."); mlmmj_boolean("subonlypost", "Subscribers only post", "If this option is set, only people who are subscribed to the list, are allowed to post to it. ". "The check is made against the \"From:\" header."); mlmmj_boolean("modonlypost", "Moderators only post", "When this file is present, only people listed in listdir/control/moderators ". "are allowed to post to it. The check is made against the "From:" header."); mlmmj_boolean("modnonsubposts", "Moderate non-allowed posts", "If this option is set, postings from people who are not allowed to post ". "to the list will be moderated instead of denied."); mlmmj_string("modreqlife", "Moderation request lifetime", "This specifies how long in seconds a mail awaits moderation before it's ". "discarded. Defaults to 604800 seconds, which is 7 days."); mlmmj_string("prefix", "Prefix", "The prefix for the Subject: line of mails to the list. This will alter the Subject: line, ". "and add a prefix if it's not present elsewhere."); mlmmj_list("owner", "Owner", "The emailaddresses in this list will get mails to ".encode_entities($list)."+owner"); mlmmj_list("customheaders", "Custom headers", "These headers are added to every mail coming through. This is ". "the place you want to add Reply-To: header in case you want ". "such. ". "If a header should not occur twice in the mail it should be listed in the 'Delete headers' box too."); mlmmj_list("delheaders", "Delete headers", "In this file is specified *ONE* headertoken to match pr. line. ". "If the file consists of: Received: Message-ID: Then all occurences of these headers in incoming list mail will be deleted. ". "\"From \" and \"Return-Path:\" are deleted no matter what."); mlmmj_list("access", "Access", "If this option is set, all headers of a post to the list is matched against the rules. The first rule to match wins. ". "See README.access for syntax and examples. NOTE: If this field is empty access control is *disabled*, ". "unlike having an empty control/access file."); mlmmj_string("memorymailsize", "Memory mail size", "Here is specified in bytes how big a mail can be and still be prepared for sending in memory. ". "It's greatly reducing the amount of write system calls to prepare it in memory before sending it, ". "but can also lead to denial of service attacks. Default is 16k (16384 bytes)."); mlmmj_string("relayhost", "Relay host", "The host specified (IP address or domainname, both works) in this file will be used for relaying the mail sent to the list. ". "Defaults to 127.0.0.1."); mlmmj_string("smtpport", "SMTP port", "In this file a port other than port 25 for connecting to the relayhost can be specified."); mlmmj_string("delimiter", "Delimiter", "This specifies what to use as recipient delimiter for the list.". "Default is \"+\"."); mlmmj_boolean("notifysub", "Notify subscribers", "If this option is set, the owner(s) will get a mail with the address of someone sub/unsubscribing to a mailinglist."); mlmmj_boolean("notifymod", "Notify moderation", "If this option is set, the poster (based on the envelope from) will ". "get a mail when their post is being moderation."); mlmmj_string("digestinterval", "Digest interval", "This option specifies how many seconds will pass before the ". "next digest is sent. Defaults to 604800 seconds, which is 7 ". "days."); mlmmj_string("digestmaxmails", "Max. digest mails", "This option specifies how many mails can accumulate before ". "digest sending is triggered. Defaults to 50 mails, meaning ". "that if 50 mails arrive to the list before digestinterval have ". "passed, the digest is delivered."); mlmmj_string("bouncelife", "Bouncing lifetime", "This specifies how long in seconds an address can bounce before it's ". "unsubscribed. Defaults to 432000 seconds, which is 5 days."); mlmmj_boolean("noarchive", "No archive", "If this option is set, the mails won't be saved in the ". "archive but simply deleted"); mlmmj_boolean("noget", "No get", "If this option is set, listname+get-INDEX is turned off."); mlmmj_boolean("subonlyget", "Subscribers only get", "If this option is set, retrieving old posts with +get-N is only possible for subscribers."); mlmmj_string("verp", "VERP", "Enable VERP support. Anything added in this variable will be appended the ". "MAIL FROM: line. If \"postfix\" is put in the file, it'll make postfix use ". "VERP by adding XVERP=-= to the MAIL FROM: line."); mlmmj_string("maxverprecips", "Maximum VERP recipients", "How many recipients pr. mail delivered to the smtp server. Defaults to 100."); mlmmj_boolean("notoccdenymails", "No To: Cc: deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being denied due to the listaddress not being in To: or Cc: (see 'tocc')."); mlmmj_boolean("noaccessdenymails", "No access deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to an access rule (see 'access')."); mlmmj_boolean("nosubonlydenymails", "No subscribers only deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to a subscribers only posting list (see 'subonlypost')."); mlmmj_boolean("nomodonlydenymails", "No moderators only deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to a moderators only posting list (see 'modonlypost')."); mlmmj_boolean("nosubmodmails", "No subscription moderated mails", "This switch turns off whether mlmmj sends out notification about ". "subscription being moderated to the person requesting subscription". "(see 'submod')."); mlmmj_boolean("nodigesttext", "No digest text summary", "This switch turns off whether digest mails will have a text part with a thread ". "summary."); mlmmj_boolean("nodigestsub", "No digest subscribers", "If this option is set, subscription to the digest version of the mailinglist ". "will be denied. (Useful if you don't want to allow digests and notify users ". "about it)."); mlmmj_boolean("nonomailsub", "No nomail subscribers", "If this option is set, subscription to the nomail version of the mailinglist ". "will be denied. (Useful if you don't want to allow nomail and notify users ". "about it)."); mlmmj_string("maxmailsize", "Max. mail size", "With this option the maximal allowed size of incoming mails can be specified."); mlmmj_boolean("nomaxmailsizedenymails", "No max. mail size deny mails", "If this is set, no reject notifications caused by violation of maxmailsize ". "will be sent."); mlmmj_boolean("nolistsubsemail", "No list subscribers email", "If this is set, the LISTNAME+list\@ functionality for requesting an ". "email with the subscribers for owner is disabled."); mlmmj_string("staticbounceaddr", "Static bounce address", "If this is set to something\@example.org, the bounce address (Return-Path:) ". "will be fixed to something+listname-bounces-and-so-on\@example.org ". "in case you need to disable automatic bounce handling."); mlmmj_boolean("ifmodsendonlymodmoderate", "If moderator send only moderator moderate", "If this is set, then mlmmj in case of moderation checks the ". "envelope from, to see if the sender is a moderator, and in that case ". "only send the moderation mails to that address. In practice this means that ". "a moderator sending mail to the list won't bother all the other moderators ". "with his mail."); mlmmj_list("footer", "Footer", "The content of this option is appended to mail sent to the list."); mlmmj_boolean("notmetoo", "Not me too", "If this is set, mlmmj attempts to exclude the sender of a post ". "from the distribution list for that post so people don't receive copies ". "of their own posts."); mlmmj_string("smtphelo", "SMTP Helo Name", "When this file is present, it contains the hostname to send in the SMTP ". "EHLO or HELO command. Otherwise the machine hostname is used."); mlmmj/contrib/web/perl-admin/htdocs/000077500000000000000000000000001502303113500177145ustar00rootroot00000000000000mlmmj/contrib/web/perl-admin/htdocs/dot.htaccess000066400000000000000000000001431502303113500222170ustar00rootroot00000000000000Require valid-user AuthType Basic AuthName "mlmmj web-interface" AuthUserFile /home/mlmmj/htpasswd mlmmj/contrib/web/perl-admin/htdocs/edit.cgi000077500000000000000000000065671502303113500213460ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2004 Morten K. Poulsen # Copyright (C) 2004 Christian Laursen # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. use strict; use CGI; use CGI::FastTemplate; use HTML::Entities; use vars qw($topdir $templatedir $list); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $tpl = new CGI::FastTemplate($templatedir); my $q = new CGI; $list = $q->param("list"); die "no list specified" unless $list; die "non-existent list" unless -d("$topdir/$list"); $tpl->define(main => "edit.html", boolean => "edit_boolean.html", string => "edit_string.html", list => "edit_list.html"); $tpl->assign(LIST => encode_entities($list)); my $tunables_file = "../conf/tunables.pl"; if (exists $ENV{TUNABLES_PATH}) { $tunables_file = $ENV{TUNABLES_PATH}; } do $tunables_file; print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; sub mlmmj_boolean { my ($name, $nicename, $text) = @_; my $checked = -f "$topdir/$list/control/$name"; $tpl->assign(NAME => encode_entities($name)); $tpl->assign(NICENAME => encode_entities($nicename)); $tpl->assign(TEXT => encode_entities($text)); $tpl->assign(CHECKED => $checked ? ' checked' : ''); $tpl->parse(ROWS => ".boolean"); } sub mlmmj_string { my ($name, $nicename, $text) = @_; my $file = "$topdir/$list/control/$name"; my $value; if (! -f $file) { $value = ""; } else { open(F, $file) or die("can't open $file"); $value = ; close(F); chomp($value); } $tpl->assign(NAME => encode_entities($name)); $tpl->assign(NICENAME => encode_entities($nicename)); $tpl->assign(TEXT => encode_entities($text)); $tpl->assign(VALUE => encode_entities($value)); $tpl->parse(ROWS => ".string"); } sub mlmmj_list { my ($name, $nicename, $text) = @_; my $file = "$topdir/$list/control/$name"; my $value; if (! -f $file) { $value = ""; } else { open(F, $file) or die("can't open $file"); while () { $value .= $_; } close(F); chomp($value); } $tpl->assign(NAME => encode_entities($name)); $tpl->assign(NICENAME => encode_entities($nicename)); $tpl->assign(TEXT => encode_entities($text)); $tpl->assign(VALUE => encode_entities($value)); $tpl->parse(ROWS => ".list"); } mlmmj/contrib/web/perl-admin/htdocs/edit_text.cgi000077500000000000000000000046001502303113500223740ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2007 Franky Van Liedekerke # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. use strict; use CGI; use CGI::FastTemplate; use HTML::Entities; use vars qw($topdir $templatedir $list); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $tpl = new CGI::FastTemplate($templatedir); my $q = new CGI; $list = $q->param("list"); die "no list specified" unless $list; die "non-existent list" unless -d("$topdir/$list"); $tpl->define(main => "edit_text.html", list => "edit_textstring.html"); $tpl->assign(LIST => encode_entities($list)); my $textdir = "$topdir/$list/text"; my @files; opendir(DIR, $textdir ) || die "can't opendir $textdir: $!"; @files = grep { !/^\./ && -f "$textdir/$_" } readdir(DIR); closedir DIR; for my $textfile (sort @files) { mlmmj_text($textfile); } print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; sub mlmmj_text { my ($name) = @_; my $file = "$textdir/$name"; my $value; if (! -f $file) { $value = ""; } else { open(F, $file) or die("can't open $file"); while () { $value .= $_; } close(F); chomp($value); } $tpl->assign(NAME => encode_entities($name)); $tpl->assign(VALUE => encode_entities($value)); $tpl->parse(ROWS => ".list"); } mlmmj/contrib/web/perl-admin/htdocs/index.cgi000077500000000000000000000035601502303113500215160ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2004 Morten K. Poulsen # Copyright (C) 2004 Christian Laursen # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. use strict; use URI::Escape; use HTML::Entities; use CGI::FastTemplate; use vars qw($topdir $templatedir); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $tpl = new CGI::FastTemplate($templatedir); $tpl->define(main => "index.html", row => "index_row.html"); my $lists = ""; opendir(DIR, $topdir) or die "Couldn't open $topdir for reading: $!"; while (my $list = readdir(DIR)) { next if $list =~ /^\./; $tpl->assign(LIST => encode_entities($list)); $tpl->assign(ULIST => uri_escape($list)); $tpl->parse(LISTS => '.row'); } closedir(DIR); print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; mlmmj/contrib/web/perl-admin/htdocs/save.cgi000077500000000000000000000053661502303113500213530ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2004 Morten K. Poulsen # Copyright (C) 2004, 2005 Christian Laursen # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # We might want some kind of validation of the values we are about to save, # but that would require save.cgi to know about all kind of options that mlmmj # accepts. I am not sure we want that. -- mortenp 20040709 use strict; use CGI; use CGI::FastTemplate; use HTML::Entities; use vars qw($topdir $templatedir $list); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $tpl = new CGI::FastTemplate($templatedir); my $q = new CGI; $list = $q->param("list"); die "no list specified" unless $list; die "non-existent list" unless -d("$topdir/$list"); $tpl->define(main => "save.html"); $tpl->assign(LIST => encode_entities($list)); my $tunables_file = "../conf/tunables.pl"; if (exists $ENV{TUNABLES_PATH}) { $tunables_file = $ENV{TUNABLES_PATH}; } do $tunables_file; print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; sub mlmmj_boolean { my ($name, $nicename, $text) = @_; my $file = "$topdir/$list/control/$name"; my $value = $q->param($name); if ($value) { open (FILE, ">$file") or die "Couldn't open $file for writing: $!"; close FILE; } else { unlink $file; } } sub mlmmj_string { mlmmj_list(@_); } sub mlmmj_list { my ($name, $nicename, $text) = @_; my $file = "$topdir/$list/control/$name"; my $value = $q->param($name); if (defined $value && $value !~ /^\s*$/) { $value .= "\n" if $value !~ /\n$/; $value =~ s/\s*\r?\n/\n/g; open (FILE, ">$file") or die "Couldn't open $file for writing: $!"; print FILE $value; close FILE; } else { unlink $file; } } mlmmj/contrib/web/perl-admin/htdocs/save_text.cgi000077500000000000000000000045341502303113500224130ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2007 Franky Van Liedekerke # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # We might want some kind of validation of the values we are about to save, # but that would require save.cgi to know about all kind of options that mlmmj # accepts. I am not sure we want that. -- mortenp 20040709 use strict; use CGI; use CGI::FastTemplate; use HTML::Entities; use vars qw($topdir $templatedir $list); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $tpl = new CGI::FastTemplate($templatedir); my $q = new CGI; $list = $q->param("list"); die "no list specified" unless $list; die "non-existent list" unless -d("$topdir/$list"); $tpl->define(main => "save_text.html"); $tpl->assign(LIST => encode_entities($list)); my $textdir = "$topdir/$list/text"; my @files; opendir(DIR, $textdir ) || die "can't opendir $textdir: $!"; @files = grep { !/^\./ && -f "$textdir/$_" } readdir(DIR); closedir DIR; for my $textfile (sort @files) { mlmmj_text($textfile); } print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; sub mlmmj_text { my ($name, $nicename, $text) = @_; my $file = "$textdir/$name"; my $value = $q->param($name); open (FILE, ">$file") or die "Couldn't open $file for writing: $!"; print FILE $value; close FILE; } mlmmj/contrib/web/perl-admin/htdocs/subscribers.cgi000077500000000000000000000174321502303113500227400ustar00rootroot00000000000000#!/usr/bin/perl -w # Copyright (C) 2004, 2005, 2006, 2007 Christian Laursen # Copyright (C) 2007 Franky Van Liedekerke # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. use strict; use URI::Escape; use HTML::Entities; use CGI; use CGI::FastTemplate; use Digest::MD5; use vars qw($topdir $templatedir $list); if (exists $ENV{CONFIG_PATH}) { require $ENV{CONFIG_PATH}; } else { require "../conf/config.pl"; } my $mlmmjsub = "/usr/local/bin/mlmmj-sub"; my $mlmmjunsub = "/usr/local/bin/mlmmj-unsub"; my $tpl = new CGI::FastTemplate($templatedir); my $q = new CGI; $list = $q->param("list"); my $update = $q->param("update"); my $search = $q->param("search"); my $email = $q->param("email"); my $file = $q->param("file"); my $removeall = $q->param("removeall"); # Everything is submitted from the same form so a little hackery is needed # to pick the right action to perform. When doing subscribe and search we # don't depend on the submit buttons since hitting enter in either of the # text fields will pick the "Subscribe" button. # # If an email has been entered for subscription, clear the search field. if (defined $email && $email !~ /^$/) { $search = undef; } else { $email = undef; } die "no list specified" unless $list; die "non-existent list" unless -d("$topdir/$list"); $tpl->define(main => "subscribers.html", row => "subscribers_row.html"); my $action = ''; my $subscribers; my $subcount; if (defined $removeall) { my $removeall_check = $q->param("removeall_check"); if ($removeall_check) { unlink <$topdir/$list/subscribers.d/*>; unlink <$topdir/$list/nomailsubs.d/*>; unlink <$topdir/$list/digesters.d/*>; $action = "All subscribers have been removed."; } else { $action = "Safety check not clicked, nothing done."; } } elsif (defined $file) { my $subscriber = $q->param("subscriber"); my $digester = $q->param("digester"); my $nomailsub = $q->param("nomailsub"); my $upload_handle = $q->upload("file"); binmode $upload_handle; while (<$upload_handle>) { s/\r?\n$//; my $email=$_; if ($email =~ /^[a-z0-9\.\-_\@]+$/i) { if ($subscriber) { system "$mlmmjsub -L $topdir/$list -a $email -U -s"; } if ($digester) { system "$mlmmjsub -L $topdir/$list -a $email -Ud -s"; } if ($nomailsub) { system "$mlmmjsub -L $topdir/$list -a $email -Un -s"; } if ($? == 0) { $action .= "$email has been subscribed.
\n"; } else { $action .= "error subscribing $email (code $?)
\n"; } } else { $action .= '"'.encode_entities($email).'" is not a valid email address.
'; } } } elsif (defined $email) { my $subscriber = $q->param("subscriber"); my $digester = $q->param("digester"); my $nomailsub = $q->param("nomailsub"); if ($email =~ /^[a-z0-9\.\-_\@]+$/i) { if ($subscriber) { system "$mlmmjsub -L $topdir/$list -a $email -U -s"; } if ($digester) { system "$mlmmjsub -L $topdir/$list -a $email -Ud -s"; } if ($nomailsub) { system "$mlmmjsub -L $topdir/$list -a $email -Un -s"; } if ($? == 0) { $action = "$email has been added"; } else { $action = "error adding $email (code $?)"; } } else { $action = '"'.encode_entities($email).'" is not a valid email address.'; } } elsif (defined $update) { my $maxid = $q->param("maxid"); $subscribers = get_subscribers(); for (my $i = 0; $i < $maxid; ++$i) { my $email = $q->param("email$i"); if (defined $email) { if ($email =~ /^[a-z0-9\.\-_\@]+$/i) { my $updated = 0; my @actions = (); push @actions, {oldstatus => exists $subscribers->{$email}->{subscriber}, newstatus => defined $q->param("subscriber$i"), action => ''}; push @actions, {oldstatus => exists $subscribers->{$email}->{digester}, newstatus => defined $q->param("digester$i"), action => '-d'}; push @actions, {oldstatus => exists $subscribers->{$email}->{nomailsub}, newstatus => defined $q->param("nomailsub$i"), action => '-n'}; for my $action (@actions) { if ($action->{oldstatus} && !$action->{newstatus}) { system "$mlmmjunsub -L $topdir/$list -a $email $action->{action}"; $updated = 1; } elsif (!$action->{oldstatus} && $action->{newstatus}) { system "$mlmmjsub -L $topdir/$list -a $email $action->{action}"; $updated = 1; } } if ($updated) { $action .= "Subscription for $email has been updated.
\n"; } } else { $action .= '"'.encode_entities($email).'" is not a valid email address.'."
\n"; } } } } $tpl->assign(ACTION => $action); $subscribers = get_subscribers(); my $paginator = ''; my $page = $q->param('page'); $page = 0 unless defined $page && $page =~ /^\d+$/; if (keys %$subscribers > 50) { $paginator = 'Pages: '; my $pages = (keys %$subscribers) / 50; $page = 0 unless ($page >= 0 && $page < $pages); my $searchstr = (defined $search && $search ne '') ? '&search='.uri_escape($search) : ''; for (my $i = 0; $ i < $pages; ++$i) { if ($page == $i) { $paginator .= ($i + 1)." "; } else { $paginator .= "".($i + 1)." "; } } } my $i = 0; my @addresses = sort {lc $a cmp lc $b} keys %$subscribers; if ($paginator ne '') { @addresses = @addresses[$page * 50 .. ($page + 1) * 50 - 1]; pop @addresses until defined $addresses[@addresses - 1]; } for my $address (@addresses) { $tpl->assign(EMAIL => $address, ID => $i++, SCHECKED => $subscribers->{$address}->{subscriber} ? 'checked' : '', DCHECKED => $subscribers->{$address}->{digester} ? 'checked' : '', NCHECKED => $subscribers->{$address}->{nomailsub} ? 'checked' : ''); $tpl->parse(ROWS => '.row'); } if (keys %$subscribers == 0) { $tpl->assign(ROWS => ''); } $tpl->assign(LIST => encode_entities($list), MAXID => scalar(@addresses), SEARCH => defined $search ? $search : '', PAGINATOR => $paginator, PAGE => $page, SUBCOUNT => $subcount); print "Content-type: text/html\n\n"; $tpl->parse(CONTENT => "main"); $tpl->print; sub get_subscribers { my %subscribers = (); my @subscribers = `/usr/local/bin/mlmmj-list -L $topdir/$list`; my @digesters = `/usr/local/bin/mlmmj-list -L $topdir/$list -d`; my @nomailsubs = `/usr/local/bin/mlmmj-list -L $topdir/$list -n`; chomp @subscribers; chomp @digesters; chomp @nomailsubs; if (defined $search) { $search = lc $search; @subscribers = grep {index(lc $_, $search) != -1} @subscribers; @digesters = grep {index(lc $_, $search) != -1} @digesters; @nomailsubs = grep {index(lc $_, $search) != -1} @nomailsubs; } for my $address (@subscribers) { $subscribers{$address}->{subscriber} = 1; } for my $address (@digesters) { $subscribers{$address}->{digester} = 1; } for my $address (@nomailsubs) { $subscribers{$address}->{nomailsub} = 1; } $subcount = scalar(keys %subscribers); return \%subscribers; } mlmmj/contrib/web/perl-admin/templates/000077500000000000000000000000001502303113500204265ustar00rootroot00000000000000mlmmj/contrib/web/perl-admin/templates/edit.html000066400000000000000000000007121502303113500222410ustar00rootroot00000000000000mlmmj config

mlmmj config

Index | Subscribers | Edit texts

List: $LIST

$ROWS
mlmmj/contrib/web/perl-admin/templates/edit_boolean.html000066400000000000000000000001511502303113500237350ustar00rootroot00000000000000$NICENAME$TEXT mlmmj/contrib/web/perl-admin/templates/edit_list.html000066400000000000000000000001451502303113500232740ustar00rootroot00000000000000$NICENAME$TEXT mlmmj/contrib/web/perl-admin/templates/edit_string.html000066400000000000000000000001421502303113500236240ustar00rootroot00000000000000$NICENAME$TEXT mlmmj/contrib/web/perl-admin/templates/edit_text.html000066400000000000000000000007001502303113500233020ustar00rootroot00000000000000mlmmj config

mlmmj config

Index | Configuration | Subscribers

List: $LIST

$ROWS
mlmmj/contrib/web/perl-admin/templates/edit_textstring.html000066400000000000000000000001351502303113500245330ustar00rootroot00000000000000$NAME mlmmj/contrib/web/perl-admin/templates/index.html000066400000000000000000000001751502303113500224260ustar00rootroot00000000000000mlmmj config

mlmmj config

$LISTS
mlmmj/contrib/web/perl-admin/templates/index_row.html000066400000000000000000000003061502303113500233110ustar00rootroot00000000000000$LISTConfigureSubscribersEdit texts mlmmj/contrib/web/perl-admin/templates/save.html000066400000000000000000000004211502303113500222470ustar00rootroot00000000000000mlmmj config

mlmmj config

$LIST control values saved!

Index | Configuration | Edit texts

mlmmj/contrib/web/perl-admin/templates/save_text.html000066400000000000000000000004161502303113500233170ustar00rootroot00000000000000mlmmj config

mlmmj config

$LIST text values saved!

Index | Configuration | Edit texts

mlmmj/contrib/web/perl-admin/templates/subscribers.html000066400000000000000000000054371502303113500236530ustar00rootroot00000000000000mlmmj subscribers

mlmmj subscribers

Index | Reload subscriber list | Configuration | Edit texts

$ACTION


Remove all subscribers:  
Click this as extra safety check:

Bulk add subscribers:   File:
Normal subscribers:
Digest subscribers:
No-mail subscribers:
Add subscriber:   Email address:
Normal subscriber:
Digest subscriber:
No-mail subscriber:
Search for subscriber: Email address:

List: $LIST
Subscribers: $SUBCOUNT


$PAGINATOR $ROWS
Email addressNormal subscriberDigest subscriberNo-mail subscriber
$PAGINATOR

mlmmj/contrib/web/perl-admin/templates/subscribers_row.html000066400000000000000000000004721502303113500245340ustar00rootroot00000000000000 $EMAIL mlmmj/contrib/web/perl-user/000077500000000000000000000000001502303113500163165ustar00rootroot00000000000000mlmmj/contrib/web/perl-user/config.pl000077500000000000000000000001211502303113500201150ustar00rootroot00000000000000$topdir = "/var/spool/mlmmj"; $sendmail = "/usr/lib/sendmail"; $delimiter = "+"; mlmmj/contrib/web/perl-user/example.html000066400000000000000000000021571502303113500206440ustar00rootroot00000000000000 mlmmj-webinterface

subscribe


unsubscribe


mlmmj/contrib/web/perl-user/mlmmj.cgi000077500000000000000000000062611502303113500201260ustar00rootroot00000000000000#!/usr/bin/perl # Copyright (C) 2004 Morten K. Poulsen # # $Id$ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. use CGI qw(:standard); require "config.pl"; # You might want to customize this function if you are not running the web # server on the same host as the mail server running the lists, or if your # lists are not in $topdir/list-name. sub mlmmj_check_list { my $list = shift; if ($list !~ /^([a-z0-9-.]+)\@/) { return false; } if (!-f "$topdir/$1/control/listaddress") { return false; } open(FILE, "$topdir/$1/control/listaddress") or die('unable to open control/listaddress'); $listaddr = readline(FILE); chomp($listaddr); if ($list ne $listaddr) { return false; } return true; } sub mlmmj_mail { my $from = shift; my $to = shift; my $subject = shift; my $body = shift; my $date = `/bin/date -R`; $mail = "Received: from " . $query->remote_addr() . " by " . $query->server_name() . " with HTTP;\n" . "\t$date" . "X-Originating-IP: " . $query->remote_addr() . "\n" . "X-Mailer: mlmmj-webinterface powered by Perl\n" . "Date: $date" . "From: $from\n" . "To: $to\n" . "Subject: $subject\n" . "\n" . "$body\n"; open(P, "|$sendmail -i -t") or die('unable to send mail'); print(P $mail); close(P); } sub mlmmj_gen_to { my $list = shift; my $job = shift; if (($job ne 'subscribe') && ($job ne 'unsubscribe')) { return false; } ($user, $domain) = split(/@/, $list); return sprintf("%s%s%s@%s", $user, $delimiter, $job, $domain); } sub check_email { my $addr = shift; if ($addr !~ /^[-!#$%&\'*+\.\/0-9=?A-Z^_a-z{|}~]+@[-0-9A-Za-z]+\.[-\.0-9A-Za-z]+$/) { return false; } else { return true; } } $query = new CGI; $list = $query->param('mailinglist'); $job = $query->param('job'); $redirect_failure = $query->param('redirect_failure'); $redirect_success = $query->param('redirect_success'); $email = $query->param('email'); if (mlmmj_check_list($list) ne false && check_email($email) ne false)) { $to = mlmmj_gen_to($list, $job); if ($to ne false) { mlmmj_mail($email, $to, "$job to $list", $job); print $query->redirect($redirect_success); exit(0); } } print $query->redirect($redirect_failure); mlmmj/contrib/web/php-admin/000077500000000000000000000000001502303113500162555ustar00rootroot00000000000000mlmmj/contrib/web/php-admin/README000066400000000000000000000054121502303113500171370ustar00rootroot00000000000000mlmmj-1.0.0 August 31th 2004 To use this web-interface you have to: 1) Copy the files from the php-admin directory of the mlmmj distribution to a suitable location and point your webroot to the htdocs directory. If you don't want the webinterface in the root of your website it is recommended to make an alias in your web server configuration in order to keep the conf directory at the same level as the htdocs directory and still outside webscope. If you want to keep it somewhere else, you will need to modify the first line of code in index.php, edit.php and save.php. 2) If your lists are stored somewhere other than /var/spool/mlmmj, edit conf/config.php to reflect this. 3) Change the permissions of the listdir/control directories of any list you want to control using the web-interface, so the web server can write in it: # chown -R wwwrun /var/spool/mlmmj/mlmmj-test/control/ 4) If the web server does not run as the same user the mailserver writes as you need to create a group (eg. mlmmj) and add both users to it. The subscribers.d directory then needs to be writable by that group: # addgroup mlmmj # adduser wwwrun mlmmj # adduser mailuser mlmmj # chgrp -R mlmmj /var/spool/mlmmj/mlmmj-test/subscribers.d/ # chmod -R g+w /var/spool/mlmmj/mlmmj-test/subscribers.d/ # chmod g+s /var/spool/mlmmj/mlmmj-test/subscribers.d/ setgid flag is needed when the webserver calls mlmmj-sub and creates a file under subscribers.d, to keep the mlmmj group. If using the Exim mailserver, you should add initgroups = true in your mlmmj_transport, otherwise it won't be able to write files having write permission to mlmmj group. 5) To enable access control on Apache you have to rename dot.htaccess to .htaccess and edit the path inside the file to point to a htpasswd file somewhere outside the webscope. If you don't have one already, you can create one like this htpasswd -c /home/mlmmj/htpasswd USER It will then ask you for a password for the given username. 6) Use 2 extra configs to limit per list the people who can access the php admin itf and/or who can manage the subscribers To limit who can access the php admin interface per list, create for the list in question the control file admin_users and put in it the userids of the people allowed to manage just that list (one per line) To limit who can manage subscribers per list, create for the list in question the control file subsadmin_users and put in it the userids of the people allowed to manage subscribers just that list (one per line) If subsadmin_users does not exist and admin_users exists, the content of that file will be used. 7) That is it, you are ready to use the interface. mlmmj/contrib/web/php-admin/conf/000077500000000000000000000000001502303113500172025ustar00rootroot00000000000000mlmmj/contrib/web/php-admin/conf/config.php000066400000000000000000000001771502303113500211650ustar00rootroot00000000000000 mlmmj/contrib/web/php-admin/conf/tunables.pl000066400000000000000000000234501502303113500213600ustar00rootroot00000000000000mlmmj_list("listaddress", "List address", "This option contains all addresses which mlmmj sees as listaddresses (see ". "tocc below). The first one is the one used as the primary one, when mlmmj ". "sends out mail."); mlmmj_boolean("closedlist", "Closed list", "If the list is open or closed. If it's closed subscription ". "and unsubscription via mail is disabled."); mlmmj_boolean("closedlistsub", "Closed for subscription", "Closed for subscription. Unsubscription is possible."); mlmmj_boolean("nosubconfirm", "No subscribe confirmation", "If this option is set, the user is not required to confirm when subscribing or unsubscribing."); mlmmj_boolean("moderated", "Moderated", "If this option is set, the emailaddresses in the file listdir/control/moderators will act as moderators for the list."); mlmmj_list("moderators", "Moderators", "If the list is moderated, this is the list of moderators."); mlmmj_list("submod", "Subscription moderators", "This is the list of moderators that will approve subscriptions."); mlmmj_boolean("tocc", "To: Cc:", "If this option is set, the list address does not have to be in the To: or Cc: header of the email to the list."); mlmmj_boolean("addtohdr", "Add To: header", "If this option is set, a To: header including the recipients emailaddress will be added to outgoing mail. ". "Recommended usage is to remove existing To: headers with delheaders (see below) first."); mlmmj_boolean("subonlypost", "Subscribers only post", "If this option is set, only people who are subscribed to the list, are allowed to post to it. ". "The check is made against the \"From:\" header."); mlmmj_boolean("modonlypost", "Moderators only post", "When this file is present, only people listed in listdir/control/moderators ". "are allowed to post to it. The check is made against the "From:" header."); mlmmj_boolean("modnonsubposts", "Moderate non-allowed posts", "If this option is set, postings from people who are not allowed to post ". "to the list will be moderated instead of denied."); mlmmj_string("modreqlife", "Moderation request lifetime", "This specifies how long in seconds a mail awaits moderation before it's ". "discarded. Defaults to 604800 seconds, which is 7 days."); mlmmj_string("prefix", "Prefix", "The prefix for the Subject: line of mails to the list. This will alter the Subject: line, ". "and add a prefix if it's not present elsewhere."); mlmmj_list("owner", "Owner", "The emailaddresses in this list will get mails to ".encode_entities($list)."+owner"); mlmmj_list("customheaders", "Custom headers", "These headers are added to every mail coming through. This is ". "the place you want to add Reply-To: header in case you want ". "such. ". "If a header should not occur twice in the mail it should be listed in the 'Delete headers' box too."); mlmmj_list("delheaders", "Delete headers", "In this file is specified *ONE* headertoken to match pr. line. ". "If the file consists of: Received: Message-ID: Then all occurences of these headers in incoming list mail will be deleted. ". "\"From \" and \"Return-Path:\" are deleted no matter what."); mlmmj_list("access", "Access", "If this option is set, all headers of a post to the list is matched against the rules. The first rule to match wins. ". "See README.access for syntax and examples. NOTE: If this field is empty access control is *disabled*, ". "unlike having an empty control/access file."); mlmmj_string("memorymailsize", "Memory mail size", "Here is specified in bytes how big a mail can be and still be prepared for sending in memory. ". "It's greatly reducing the amount of write system calls to prepare it in memory before sending it, ". "but can also lead to denial of service attacks. Default is 16k (16384 bytes)."); mlmmj_string("relayhost", "Relay host", "The host specified (IP address or domainname, both works) in this file will be used for relaying the mail sent to the list. ". "Defaults to 127.0.0.1."); mlmmj_string("smtpport", "SMTP port", "In this file a port other than port 25 for connecting to the relayhost can be specified."); mlmmj_string("delimiter", "Delimiter", "This specifies what to use as recipient delimiter for the list.". "Default is '+'."); mlmmj_boolean("notifysub", "Notify subscribers", "If this option is set, the owner(s) will get a mail with the address of someone sub/unsubscribing to a mailinglist."); mlmmj_boolean("notifymod", "Notify moderation", "If this option is set, the poster (based on the envelope from) will ". "get a mail when their post is being moderation."); mlmmj_string("digestinterval", "Digest interval", "This option specifies how many seconds will pass before the ". "next digest is sent. Defaults to 604800 seconds, which is 7 ". "days."); mlmmj_string("digestmaxmails", "Max. digest mails", "This option specifies how many mails can accumulate before ". "digest sending is triggered. Defaults to 50 mails, meaning ". "that if 50 mails arrive to the list before digestinterval have ". "passed, the digest is delivered."); mlmmj_string("bouncelife", "Bouncing lifetime", "This specifies how long in seconds an address can bounce before it's ". "unsubscribed. Defaults to 432000 seconds, which is 5 days."); mlmmj_boolean("noarchive", "No archive", "If this option is set, the mails won't be saved in the ". "archive but simply deleted"); mlmmj_boolean("noget", "No get", "If this option is set, listname+get-INDEX is turned off."); mlmmj_boolean("subonlyget", "Subscribers only get", "If this option is set, retrieving old posts with +get-N is only possible for subscribers."); mlmmj_string("verp", "VERP", "Enable VERP support. Anything added in this variable will be appended the ". "MAIL FROM: line. If 'postfix' is put in the file, it'll make postfix use ". "VERP by adding XVERP=-= to the MAIL FROM: line."); mlmmj_string("maxverprecips", "Maximum VERP recipients", "How many recipients pr. mail delivered to the smtp server. Defaults to 100."); mlmmj_boolean("notoccdenymails", "No To: Cc: deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being denied due to the listaddress not being in To: or Cc: (see 'tocc')."); mlmmj_boolean("noaccessdenymails", "No access deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to an access rule (see 'access')."); mlmmj_boolean("nosubonlydenymails", "No subscribers only deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to a subscribers only posting list (see 'subonlypost')."); mlmmj_boolean("nomodonlydenymails", "No moderators only deny mails", "This switch turns off whether mlmmj sends out notification about postings ". "being rejected due to a moderators only posting list (see 'modonlypost')."); mlmmj_boolean("nosubmodmails", "No subscription moderated mails", "This switch turns off whether mlmmj sends out notification about ". "subscription being moderated to the person requesting subscription". "(see 'submod')."); mlmmj_boolean("nodigesttext", "No digest text summary", "This switch turns off whether digest mails will have a text part with a thread ". "summary."); mlmmj_boolean("nodigestsub", "No digest subscribers", "If this option is set, subscription to the digest version of the mailinglist ". "will be denied. (Useful if you don't want to allow digests and notify users ". "about it)."); mlmmj_boolean("nonomailsub", "No nomail subscribers", "If this option is set, subscription to the nomail version of the mailinglist ". "will be denied. (Useful if you don't want to allow nomail and notify users ". "about it)."); mlmmj_string("maxmailsize", "Max. mail size", "With this option the maximal allowed size of incoming mails can be specified."); mlmmj_boolean("nomaxmailsizedenymails", "No max. mail size deny mails", "If this is set, no reject notifications caused by violation of maxmailsize ". "will be sent."); mlmmj_boolean("nolistsubsemail", "No list subscribers email", "If this is set, the LISTNAME+list\@ functionality for requesting an ". "email with the subscribers for owner is disabled."); mlmmj_string("staticbounceaddr", "Static bounce address", "If this is set to something\@example.org, the bounce address (Return-Path:) ". "will be fixed to something+listname-bounces-and-so-on\@example.org ". "in case you need to disable automatic bounce handling."); mlmmj_boolean("ifmodsendonlymodmoderate", "If moderator send only moderator moderate", "If this is set, then mlmmj in case of moderation checks the ". "envelope from, to see if the sender is a moderator, and in that case ". "only send the moderation mails to that address. In practice this means that ". "a moderator sending mail to the list won't bother all the other moderators ". "with his mail."); mlmmj_list("footer", "Footer", "The content of this option is appended to mail sent to the list."); mlmmj_boolean("notmetoo", "Not me too", "If this is set, mlmmj attempts to exclude the sender of a post ". "from the distribution list for that post so people don't receive copies ". "of their own posts."); mlmmj_string("smtphelo", "SMTP Helo Name", "When this file is present, it contains the hostname to send in the SMTP ". "EHLO or HELO command. Otherwise the machine hostname is used."); mlmmj/contrib/web/php-admin/htdocs/000077500000000000000000000000001502303113500175415ustar00rootroot00000000000000mlmmj/contrib/web/php-admin/htdocs/class.rFastTemplate.php000066400000000000000000001224041502303113500241340ustar00rootroot00000000000000 // 2001 Alister Bulman Re-Port multi template-roots + more // PHP3 Port: Copyright © 1999 CDI , All Rights Reserved. // Perl Version: Copyright © 1998 Jason Moore , All Rights Reserved. // // RCS Revision // @(#) $Id$ // $Source$ // // Copyright Notice // // 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, or (at your option) // any later version. // // class.rFastTemplate.php 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. // // Comments // // I would like to thank CDI for pointing out the // copyright notice attached to his PHP3 port which I had blindly missed // in my first release of this code. // // This work is derived from class.FastTemplate.php3 version 1.1.0 as // available from http://www.thewebmasters.net/. That work makes // reference to the "GNU General Artistic License". In correspondence // with the author, the intent was to use the GNU General Public License; // this work does the same. // // Authors // // Roland Roberts // Alister Bulman (multi template-roots) // Michal Rybarik (define_raw()) // CDI , PHP3 port // Jason Moore , original Perl version // // Synopsis // // require ("PATH-TO-TEMPLATE-CODE/class.Template.php"); // $t = new Template("PATH-TO-TEMPLATE-DIRECTORY"); // $t->define (array(MAIN => "diary.html")); // $t->setkey (VAR1, "some text"); // $t->subst (INNER, "inner") // $t->setkey (VAR1, "some more text"); // $t->subst (INNER, ".inner") // $t->setkey (VAR2, "var2 text"); // $t->subst (CONTENT, "main"); // $t->print (CONTENT); // // Description // // This is a class.FastTemplate.php3 replacement that provides most of the // same interface but has the ability to do nested dynamic templates. The // default is to do dynamic template expansion and no special action is // required for this to happen. // // class.FastTemplate.php3 Methods Not Implemented // // clear_parse // Same as clear. In fact, it was the same as clear in FastTemplate. // clear_all // If you really think you need this, try // unset $t; // $t = new Template ($path); // which gives the same effect. // clear_tpl // Use unload instead. This has the side effect of unloading all parent // and sibling templates which may be more drastic than you expect and // is different from class.FastTemplate.php3. This difference is // necessary since the only way we can force the reload of an embedded // template is to force the reload of the parent and sibling templates. // // class.FastTemplate.php3 Methods by Another Name // // The existence of these functions is a historical artifact. I // originally had in mind to write a functional equivalent from scratch. // Then I came my senses and just grabbed class.FastTemplate.php3 and // started hacking it. So, you can use the names on the right, but the // ones on the left are equivalent and are the names used in the original // class.FastTemplate.php3. // // parse --> subst // get_assiged --> getkey // assign --> setkey // clear_href --> unsetkey // clear_assign --> unsetkey // FastPrint --> xprint // class rFastTemplate { // File name to be used for debugging output. Needs to be set prior to // calling anything other than option setting commands (debug, debugall, // strict, dynamic) because once the file has been opened, this is ignored. var $DEBUGFILE = '/tmp/class.rFastTemplate.php.dbg'; // File descriptor for debugging output. var $DEBUGFD = -1; // Array for individual member functions. You can turn on debugging for a // particular member function by calling $this->debug(FUNCTION_NAME) var $DEBUG = array (); // Turn this on to turn on debugging in all member functions via // $this->debugall(). Turn if off via $this->debugall(false); var $DEBUGALL = false; // Names of actual templates. Each element will be an array with template // information including is originating file, file load status, parent // template, variable list, and actual template contents. var $TEMPLATE = array(); // Holds paths-to-templates (See: set_root and FindTemplate) var $ROOT = array(); // Holds the HANDLE to the last template parsed by parse() var $LAST = ''; // Strict template checking. Unresolved variables in templates will generate a // warning. var $STRICT = true; // If true, this suppresses the warning generated by $STRICT=true. var $QUIET = false; // If true, throw an error if the template file is empty. This was previously the default // behavior. I'm not sure how this compares to the original FastTemplate(). var $NOEMPTY = false; // If true, a non-existent directory in the template path will not // generate an error. This was added to allow a directory to be // prepended to the template path array based on where in the directory // tree we are. If the template path is non-existent, it is skipped. var $MISSING_DIR_OKAY = false; // Holds handles assigned by a call to parse(). var $HANDLE = array(); // Holds all assigned variable names and values. var $VAR = array(); // Set to true is this is a WIN32 server. This was part of the // class.FastTemplate.php3 implementation and the only real place it kicks // in is in setting the terminating character on the value of $ROOT, the // path where all the templates live. var $WIN32 = false; // Automatically scan template for dynamic templates and assign new values // to TEMPLATE based on whatever names the HTML comments use. This can be // changed up until the time the first parse() is called. Well, you can // change it anytime, but it will have no effect on already loaded // templates. Also, if you have dynamic templates, the first call to parse // will load ALL of your templates, so changing it after that point will // have no effect on any defined templates. var $DYNAMIC = true; // Grrr. Don't try to break these extra long regular expressions into // multiple lines for readability. PHP 4.03pl1 chokes on them if you do. // I'm guessing the reason is something obscure with the parenthesis // matching, the same sort of thing Tcl might have, but I'm not sure. // Regular expression which matches the beginning of a dynamic/inferior // template. The critical bit is that we need two parts: (1) the entire // match, and (2) the name of the dynamic template. The first part is // required because will do a strstr() to split the buffer into two // pieces: everything before the dynamic template declaration and // everything after. The second is needed because after finding a BEGIN // we will search for an END and they both have to have the same name of // we consider the template malformed and throw and error. // Both of these are written with PCRE (Perl-Compatible Regular // Expressions) because we need the non-greedy operators to insure that // we don't read past the end of the HTML comment marker in the case that // the BEGIN/END block have trailing comments after the tag name. var $REGEX_DYNBEG = '/()/s'; // Regular expression which matches the end of a dynamic/inferior // template; see the comment about on the BEGIN match. var $REGEX_DYNEND = '/()/s'; // Regular expression which matches a variable in the template. var $REGEX_VAR = '/\{[A-Za-z][-_A-Za-z0-9]*\}/'; // // Description // Constructor. // public function __construct ($pathToTemplates = '') { // $pathToTemplates can also be an array of template roots, handled in set_root global $php_errormsg; if (!empty($pathToTemplates)) { $this->set_root ($pathToTemplates); } $this->DEBUG = array ('subst' => false, 'parse_internal' => false, 'parse_internal_1' => false, 'parsed' => false, 'clear' => false, 'clear_dynamic' => false, 'load' => false); return $this; } // // Description // Set the name to be used for debugging output. If another file has // already been opened, close it so the next call to logwrite will // reopen under this name. // function debugfile ($name) { $this->DEBUGFILE = $name; } // // Description // Turn on/off debugging output of an individual member function. // function debug ($what, $on = true) { $this->DEBUG[$what] = $on; } // // Description // Turn on/off debugging output of all member functions. // function debugall ($on = true) { $this->DEBUGALL = $on; } // // Description // Turn on/off automatic dynamic template expansion. Note that a // template with an inferior dynamic template embedded will still // parse but only as if it were part of the main template. When this // is turned on, it will be parsed out as as if it were a full-blown // template and can thus be both parsed and appended to as a separate // entity. // function dynamic ($on = true) { $this->DYNAMIC = $on; } // // Description // Turn on/off strict template checking. When on, all template tags // must be assigned or we throw an error (but stilll parse the // template). // function strict ($on = true) { $this->STRICT = $on; } function quiet ($on = true) { $this->QUIET = $on; } // // Description // For compatibility with class.FastTemplate.php3. // function no_strict () { $this->STRICT = false; } // // Description // Turn off errors for missing template directories. This allows you // to specify a template path that may not yet exist. // function missing_dir_okay ($on = true) { $this->MISSING_DIR_OKAY = $on; } // // Description // Utility function for debugging. // function logwrite ($msg) { if ($this->DEBUGFD < 0) { $this->DEBUGFD = fopen ($this->DEBUGFILE, 'a'); } fputs ($this->DEBUGFD, strftime ('%Y/%m/%d %H:%M:%S ') . $msg . "\n"); } // // Description // This was lifted as-is from class.FastTemplate.php3. Based on what // platform is in use, it makes sure the path specification ends with // the proper path separator; i.e., a slash on unix systems and a // back-slash on WIN32 systems. When we can run on Mac or VMS I guess // we'll worry about other characters.... // // $root can now be an array of template roots which will be searched to // find the first matching name. function set_root ($root) { if (!is_array($root)) { $trailer = substr ($root, -1); if ($trailer != ($this->WIN32 ? '\\' : '/')) $root .= ($this->WIN32 ? '\\' : '/'); if (!is_dir($root)) { if (!$this->MISSING_DIR_OKAY) $this->error ("Specified ROOT dir [$root] is not a directory", true); return false; } $this->ROOT[] = $root; } else { reset($root); foreach ($root as $k=>$v) { if (is_dir($v)) { $trailer = substr ($v,-1); if ($trailer != ($this->WIN32 ? '\\' : '/')) $v .= ($this->WIN32 ? '\\' : '/'); $this->ROOT[] = $v; } else if (!$this->MISSING_DIR_OKAY) { $this->error ("Specified ROOT dir [$v] is not a directory", true); } } } // FIXME: should add something here to make sure there is at least one // entry in ROOT[]. } // // Description // Associate files with a template names. // // Sigh. At least with the CVS version of PHP, $dynamic = false sets it // to true. // function define ($fileList, $dynamic = 0) { reset ($fileList); foreach ($fileList as $tpl=>$file) { $this->TEMPLATE[$tpl] = array ('file' => $file, 'dynamic' => $dynamic); } return true; } function define_dynamic ($tplList, $parent='') { if (is_array($tplList)) { reset ($tplList); foreach ($tplList as $tpl=>$parent) { $this->TEMPLATE[$tpl]['parent'] = $parent; $this->TEMPLATE[$tpl]['dynamic'] = true; } } else { // $tplList is not an array, but a single child/parent pair. $this->TEMPLATE[$tplList]['parent'] = $parent; $this->TEMPLATE[$tplList]['dynamic'] = true; } } // // Description // Defines a template from a string (not a file). This function has // not been ported from original PERL module to CDI's // class.FastTemplate.php3, and it comebacks in rFastTemplate // class. You can find it useful if you want to use templates, stored // in database or shared memory. // function define_raw ($stringList, $dynamic = 0) { reset ($stringList); foreach ($stringList as $tpl=>$string) { $this->TEMPLATE[$tpl] = array ('string' => $string, 'dynamic' => $dynamic, 'loaded' => 1); } return true; } // // Description // Try each directory in our list of possible roots in turn until we // find a matching template // function FindTemplate ($file) { // first try for a template in the current directory short path for // absolute filenames if (substr($file, 0, 1) == '/') { if (file_exists($file)) { return $file; } } // search path for a matching file reset($this->ROOT); foreach ($this->ROOT as $k=>$v) { $f = $v . $file; if (file_exists($f)) { return $f; } } $this->error ("FindTemplate: file $file does not exist anywhere in " . implode(' ', $this->ROOT), true); return false; } // // Description // Load a template into memory from the underlying file. // function &load ($file) { $debug = $this->DEBUGALL || $this->DEBUG['load']; if (! count($this->ROOT)) { if ($debug) $this->logwrite ("load: cannot open template $file, template base directory not set"); $this->error ("cannot open template $file, template base directory not set", true); return false; } else { $contents = ''; unset ($contents); $filename = $this->FindTemplate ($file); if ($filename) @ $contents = implode ('', (@file($filename))); // This is inconsistent and depends on the setting of track_errors. First, with no // @-directive above, the error will be reported immediately. Second, if the template // is empty, it may be that no error occurred and we still end up here. To get around // this, we explicitly unset $contents and then check to see if it isset(). If so, // the template was empty and we treat that as a non-error. if (isset($contents) && ($this->NOEMPTY && empty($contents)) ) { if ($debug) $this->logwrite ("load($file): empty template file"); $this->error ("load($file): empty template file", true); } else if (!isset($contents)) { if ($debug) $this->logwrite ("load($file) failure: $php_errormsg"); $this->error ("load($file): failure: $php_errormsg", true); } else { if ($debug) $this->logwrite ("load: found $filename"); return $contents; } } } // // Description // Recursive internal parse routine. This will recursively parse a // template containing dynamic inferior templates. Each of these // inferior templates gets their own entry in the TEMPLATE array. // function &parse_internal_1 ($tag, $rest = '') { $debug = $this->DEBUGALL || $this->DEBUG['parse_internal_1']; if (empty($tag)) { $this->error ("parse_internal_1: empty tag invalid", true); } if ($debug) $this->logwrite ("parse_internal_1 (tag=$tag, rest=$rest)"); while (!empty($rest)) { if ($debug) $this->logwrite ('parse_internal_1: REGEX_DYNBEG search: rest => ' . $rest); if (preg_match ($this->REGEX_DYNBEG, $rest, $dynbeg)) { // Found match, now split into two pieces and search the second // half for the matching END. The string which goes into the // next element includes the HTML comment which forms the BEGIN // block. if ($debug) $this->logwrite ('parse_internal_1: match beg => ' . $dynbeg[1]); $pos = strpos ($rest, $dynbeg[1]); // See if the text on either side of the BEGIN comment is only // whitespace. If so, we delete the entire line. $okay = false; for ($offbeg = $pos - 1; $offbeg >= 0; $offbeg--) { $c = $rest[$offbeg]; if ($c == "\n") { $okay = true; $offbeg++; break; } if (($c != ' ') && ($c != "\t")) { $offbeg = $pos; break; } } if (! $okay) { $offend = $pos + strlen($dynbeg[1]); } else { $l = strlen ($rest); for ($offend = $pos + strlen($dynbeg[1]); $offend < $l; $offend++) { $c = $rest[$offend]; if ($c == "\n") { $offend++; break; } if (($c != ' ') && ($c != "\t")) { $offend = $pos + strlen($dynbeg[1]); break; } } } // This includes the contents of the REGEX_DYNBEG in the output // $part[] = substr ($rest, 0, $pos); // This preserves whitespace on the END block line(s). // $part[] = substr ($rest, 0, $pos+strlen($dynbeg[1])); // $rest = substr ($rest, $pos+strlen($dynbeg[1])); // Catch case where BEGIN block is at position 0. if ($offbeg > 0) $part[] = substr ($rest, 0, $offbeg); $rest = substr ($rest, $offend); $sub = ''; if ($debug) $this->logwrite ("parse_internal_1: found at pos = $pos"); // Okay, here we are actually NOT interested in just the next // END block. We are only interested in the next END block that // matches this BEGIN block. This is not the most efficient // because we really could do this in one pass through the // string just marking BEGIN and END blocks. But the recursion // makes for a simple algorithm (if there was a reverse // preg...). $found = false; while (preg_match ($this->REGEX_DYNEND, $rest, $dynend)) { if ($debug) $this->logwrite ('parse_internal_1: REGEX_DYNEND search: rest => ' . $rest); if ($debug) $this->logwrite ('parse_internal_1: match beg => ' . $dynend[1]); $pos = strpos ($rest, $dynend[1]); if ($dynbeg[2] == $dynend[2]) { $found = true; // See if the text on either side of the END comment is // only whitespace. If so, we delete the entire line. $okay = false; for ($offbeg = $pos - 1; $offbeg >= 0; $offbeg--) { $c = $rest[$offbeg]; if ($c == "\n") { $offbeg++; $okay = true; break; } if (($c != ' ') && ($c != "\t")) { $offbeg = $pos; break; } } if (! $okay) { $offend = $pos + strlen($dynend[1]); } else { $l = strlen ($rest); for ($offend = $pos + strlen($dynend[1]); $offend < $l; $offend++) { $c = $rest[$offend]; if ($c == "\n") { $offend++; break; } if (($c != ' ') && ($c != "\t")) { $offend = $pos + strlen($dynend[1]); break; } } } // if ($debug) // $this->logwrite ("parse_internal_1: DYNAMIC BEGIN: (pos,len,beg,end) => ($pos, " . strlen($dynbeg[1]) . ", $offbeg, $offend) // This includes the contents of the REGEX_DYNEND in the output // $rest = substr ($rest, $pos); // This preserves whitespace on the END block line(s). // $rest = substr ($rest, $pos+strlen($dynend[1])); // $sub .= substr ($rest, 0, $pos); $sub .= substr ($rest, 0, $offbeg); $rest = substr ($rest, $offend); // Already loaded templates will not be reloaded. The // 'clear' test was actually hiding a bug in the clear() // logic.... if (false && isset($this->TEMPLATE[$dynend[2]]['clear']) && $this->TEMPLATE[$dynend[2]]['clear']) { $this->TEMPLATE[$dynend[2]]['string'] = ''; $this->TEMPLATE[$dynend[2]]['result'] = ''; $this->TEMPLATE[$dynend[2]]['part'] = $this->parse_internal_1 ($dynend[2], ' '); } else if (!isset($this->TEMPLATE[$dynend[2]]['loaded']) || !$this->TEMPLATE[$dynend[2]]['loaded']) { // Omit pathological case of empty dynamic template. if (strlen($sub) > 0) { $this->TEMPLATE[$dynend[2]]['string'] = $sub; $this->TEMPLATE[$dynend[2]]['part'] = $this->parse_internal_1 ($dynend[2], $sub); $this->TEMPLATE[$dynend[2]]['part']['parent'] = $tag; } } $this->TEMPLATE[$dynend[2]]['loaded'] = true; $part[] = &$this->TEMPLATE[$dynend[2]]; $this->TEMPLATE[$dynend[2]]['tag'] = $dynend[2]; break; } else { $sub .= substr ($rest, 0, $pos+strlen($dynend[1])); $rest = substr ($rest, $pos+strlen($dynend[1])); if ($debug) $this->logwrite ("parse_internal_1: $dynbeg[2] != $dynend[2]"); } } if (!$found) { $this->error ("malformed dynamic template, missing END
\n" . "$dynbeg[1]
\n", true); } } else { // Although it would appear to make sense to check that we don't // have a dangling END block, we will, in fact, ALWAYS appear to // have a dangling END block. We stuff the BEGIN string in the // part before the inferior template and the END string in the // part after the inferior template. So for this test to work, // we would need to look just past the final match. if (preg_match ($this->REGEX_DYNEND, $rest, $dynend)) { // $this->error ("malformed dynamic template, dangling END
\n" . // "$dynend[1]
\n", 1); } $part[] = $rest; $rest = ''; } } return $part; } // // Description // Parse the template. If $tag is actually an array, we iterate over // the array elements. If it is a simple string tag, we may still // recursively parse the template if it contains dynamic templates and // we are configured to automatically load those as well. // function parse_internal ($tag) { $debug = $this->DEBUGALL || $this->DEBUG['parse_internal']; $append = false; if ($debug) $this->logwrite ("parse_internal (tag=$tag)"); // If we are handed an array of tags, iterate over all of them. This // is really a holdover from the way class.FastTemplate.php3 worked; // I think subst() already pulls that array apart for us, so this // should not be necessary unless someone calls the internal member // function directly. if (gettype($tag) == 'array') { reset ($tag); foreach ($tag as $t) { $this->parse_internal ($t); } } else { // Load the file if it hasn't already been loaded. It might be // nice to put in some logic that reloads the file if it has // changed since we last loaded it, but that probably gets way too // complicated and only makes sense if we start keeping it floating // around between page loads as a persistent variable. if (!isset($this->TEMPLATE[$tag]['loaded'])) { if ($this->TEMPLATE[$tag]['dynamic']) { // Template was declared via define_dynamic(). if ($this->TEMPLATE[$tag]['parent']) $tag = $this->TEMPLATE[$tag]['parent']; else { // Try to find a non-dynamic template with the same file. // This would have been defined via define(array(), true) reset ($this->TEMPLATE); foreach (array_keys($this->TEMPLATE) as $ptag) { if ($debug) $this->logwrite ("parse_internal: looking for non-dynamic parent, $ptag"); if (!$this->TEMPLATE[$ptag]['dynamic'] && ($this->TEMPLATE[$ptag]['file'] == $this->TEMPLATE[$tag]['file'])) { $tag = $ptag; break; } } } } $this->TEMPLATE[$tag]['string'] = &$this->load($this->TEMPLATE[$tag]['file']); $this->TEMPLATE[$tag]['loaded'] = 1; } // If we are supposed to automatically detect dynamic templates and the dynamic // flag is not set, scan the template for dynamic sections. Dynamic sections // markers have a very rigid syntax as HTML comments.... if ($this->DYNAMIC) { $this->TEMPLATE[$tag]['tag'] = $tag; if (!isset($this->TEMPLATE[$tag]['parsed']) || !$this->TEMPLATE[$tag]['parsed']) { $this->TEMPLATE[$tag]['part'] = $this->parse_internal_1 ($tag, $this->TEMPLATE[$tag]['string']); $this->TEMPLATE[$tag]['parsed'] = true; } } } } // // Description // class.FastTemplate.php3 compatible interface. // // Notes // I prefer the name `subst' to `parse' since during this phase we are // really doing variable substitution into the template. However, at // some point we have to load and parse the template and `subst' will // do that as well... // function parse ($handle, $tag, $autoload = true) { return $this->subst ($handle, $tag, $autoload); } // // Description // Perform substitution on the template. We do not really recurse // downward in the sense that we do not do subsitutions on inferior // templates. For each inferior template which is a part of this // template, we insert the current value of their results. // // Notes // Do I want to make this return a reference? function subst ($handle, $tag, $autoload = true) { $append = false; $debug = $this->DEBUGALL || $this->DEBUG['subst']; $this->LAST = $handle; if ($debug) $this->logwrite ("subst (handle=$handle, tag=$tag, autoload=$autoload)"); // For compatibility with FastTemplate, the results need to overwrite // for an array. This really only seems to be useful in the case of // something like // $t->parse ('MAIN', array ('array', 'main')); // Where the 'main' template has a variable named MAIN which will be // set on the first pass (i.e., when parasing 'array') and used on the // second pass (i.e., when parsing 'main'). if (gettype($tag) == 'array') { foreach (array_values($tag) as $t) { if ($debug) $this->logwrite ("subst: calling subst($handle,$t,$autoload)"); $this->subst ($handle, $t, $autoload); } return $this->HANDLE[$handle]; } // Period prefix means append result to pre-existing value. if (substr($tag,0,1) == '.') { $append = true; $tag = substr ($tag, 1); if ($debug) $this->logwrite ("subst (handle=$handle, tag=$tag, autoload=$autoload) in append mode"); } // $this->TEMPLATE[$tag] will only be set if it was explicitly // declared via define(); i.e., inferior templates will not have an // entry. if (isset($this->TEMPLATE[$tag])) { if (!isset($this->TEMPLATE[$tag]['parsed']) || !$this->TEMPLATE[$tag]['parsed']) $this->parse_internal ($tag); } else { if (!$this->DYNAMIC) { $this->error ("subst (handle=$handle, tag=$tag, autoload=$autoload): " . 'no such tag and dynamic templates are turned off', true); } if ($autoload) { if ($debug) $this->logwrite ("subst: TEMPLATE[tag=$tag] not found, trying autoload"); foreach (array_keys($this->TEMPLATE) as $t) { if ($debug) $this->logwrite ("subst: calling parse_internal (tag=$t)"); if (!isset($this->TEMPLATE[$tag]['parsed']) || !$this->TEMPLATE[$tag]['parsed']) $this->parse_internal ($t); } if ($debug) $this->logwrite ('subst: retrying with autoload = false'); $this->subst ($handle, $tag, false); if ($debug) $this->logwrite ('subst: completed with autoload = false'); return; } else { $this->error ("subst (handle=$handle, tag=$tag, autoload=$autoload): no such tag", true); } } if (!$append) { $this->TEMPLATE[$tag]['result'] = ''; if ($debug) $this->logwrite ("subst (handle=$handle, tag=$tag, autoload=$autoload) in overwrite mode"); } if ($debug) $this->logwrite ('subst: type(this->TEMPLATE[$tag][\'part\']) => ' . gettype($this->TEMPLATE[$tag]['part'])); // Hmmm, clear() called before subst() seems to result in this not // being defined which leaves me a bit confused.... $result = ''; if (isset($this->TEMPLATE[$tag]['part'])) { reset ($this->TEMPLATE[$tag]['part']); foreach (array_keys($this->TEMPLATE[$tag]['part']) as $p) { if ($debug) $this->logwrite ("subst: looking at TEMPLATE[$tag]['part'][$p]"); $tmp = $this->TEMPLATE[$tag]['part'][$p]; // Don't try if ($p == 'parent').... if (strcmp ($p, 'parent') == 0) { if ($debug) $this->logwrite ("subst: skipping part $p"); $tmp = ''; } else if (gettype($this->TEMPLATE[$tag]['part'][$p]) == 'string') { if ($debug) $this->logwrite ("subst: using part $p"); reset ($this->VAR); // Because we treat VAR and HANDLE separately (unlike // class.FastTemplate.php3), we have to iterate over both or we // miss some substitutions and are not 100% compatible. foreach ($this->VAR as $key=>$val) { if ($debug) $this->logwrite ("subst: substituting VAR $key = $val in $tag"); $key = '{'.$key.'}'; $tmp = str_replace ($key, $val, $tmp); } reset ($this->HANDLE); foreach ($this->HANDLE as $key=>$val) { if ($debug) $this->logwrite ("subst: substituting HANDLE $key = $val in $tag"); $key = '{'.$key.'}'; $tmp = str_replace ($key, $val, $tmp); } $result .= $tmp; } else { $xtag = $this->TEMPLATE[$tag]['part'][$p]['tag']; if ($debug) { $this->logwrite ("subst: substituting other tag $xtag result in $tag"); } // The assignment is a no-op if the result is not set, but when // E_ALL is in effect, a warning is generated without the // isset() test. if (isset ($this->TEMPLATE[$xtag]['result'])) $result .= $this->TEMPLATE[$xtag]['result']; } } } if ($this->STRICT) { // If quiet-mode is turned on, skip the check since we're not going // to do anything anyway. if (!$this->QUIET) { if (preg_match ($this->REGEX_VAR, $result)) { $this->error ("unmatched tags still present in $tag
"); } } } else { $result = preg_replace ($this->REGEX_VAR, '', $result); } if ($append) { if ($debug) { $this->logwrite ("subst: appending TEMPLATE[$tag]['result'] = $result"); $this->logwrite ("subst: old HANDLE[$handle] = {$this->HANDLE[$handle]}"); $this->logwrite ("subst: old TEMPLATE[$tag]['result'] = {$this->TEMPLATE[$tag]['result']}"); } // The isset() tests are to suppresss warning when E_ALL is in effect // and the variables have not actually been set yet (even though the // user specified append-mode). if (isset ($this->HANDLE[$handle])) $this->HANDLE[$handle] .= $result; else $this->HANDLE[$handle] = $result; if (isset ($this->TEMPLATE[$tag]['result'])) $this->TEMPLATE[$tag]['result'] .= $result; else $this->TEMPLATE[$tag]['result'] = $result; if ($debug) { $this->logwrite ("subst: new HANDLE[$handle] = {$this->HANDLE[$handle]}"); $this->logwrite ("subst: new TEMPLATE[$tag]['result'] = {$this->TEMPLATE[$tag]['result']}"); } } else { if ($debug) $this->logwrite ("subst: setting TEMPLATE[$tag]['result'] = $result"); $this->HANDLE[$handle] = $result; $this->TEMPLATE[$tag]['result'] = $result; } return $this->HANDLE[$handle]; } // // Description // Clear a block from a template. The intent is to remove an inferior // template from a parent. This works even if the template has already // been parsed since we go straight to the specified template and clear // the results element. If the given template has not yet been // loaded, the load is forced by calling parse_internal(). // function clear_dynamic ($tag = NULL) { $debug = $this->DEBUGALL || $this->DEBUG['clear_dynamic']; if (is_null ($tag)) { // Clear all result elements. Uhm, needs to be tested. if ($debug) $this->logwrite ("clear_dynamic (NULL)"); foreach (array_values ($this->TEMPLATE) as $t) { $this->clear_dynamic ($t); } return; } else if (gettype($tag) == 'array') { if ($debug) $this->logwrite ("clear_dynamic ($tag)"); foreach (array_values($tag) as $t) { $this->clear_dynamic ($t); } return; } else if (!isset($this->TEMPLATE[$tag])) { if ($debug) $this->logwrite ("clear_dynamic ($tag) --> $tag not set, calling parse_internal"); $this->parse_internal ($tag); // $this->TEMPLATE[$tag] = array (); } if ($debug) $this->logwrite ("clear_dynamic ($tag)"); // $this->TEMPLATE[$tag]['loaded'] = true; // $this->TEMPLATE[$tag]['string'] = ''; $this->TEMPLATE[$tag]['result'] = ''; // $this->TEMPLATE[$tag]['clear'] = true; } // // Description // Clear the results of a handle set by parse(). The input handle can // be a single value, an array, or the PHP constant NULL. For the // last case, all handles cleared. // function clear ($handle = NULL) { $debug = $this->DEBUGALL || $this->DEBUG['clear']; if (is_null ($handle)) { // Don't bother unsetting them, just set the whole thing to a new, // empty array. if ($debug) $this->logwrite ("clear (NULL)"); $this->HANDLE = array (); } else if (gettype ($handle) == 'array') { if ($debug) $this->logwrite ("clear ($handle)"); foreach (array_values ($handle) as $h) { $this->clear ($h); } } else if (isset ($this->HANDLE[$handle])) { if ($debug) $this->logwrite ("clear ($handle)"); unset ($this->HANDLE[$handle]); } } // // Description // Clears all information associated with the specified tag as well as // any information associated with embedded templates. This will force // the templates to be reloaded on the next call to subst(). // Additionally, any results of previous calls to subst() will also be // cleared. // // Notes // This leaves dangling references in $this->HANDLE. Or does PHP do // reference counting so they are still valid? // function unload ($tag) { if (!isset($this->TEMPLATE[$tag])) return; if (isset ($this->TEMPLATE[$tag]['parent'])) { $ptag = $this->TEMPLATE[$tag]['parent']; foreach (array_keys($this->TEMPLATE) as $t) { if ($this->TEMPLATE[$t]['parent'] == $ptag) { unset ($this->TEMPLATE[$t]); } } } unset ($this->TEMPLATE[$tag]); return; } // // Description // class.FastTemplate.php3 compatible interface. // function assign ($tplkey, $rest = '') { $this->setkey ($tplkey, $rest); } // // Description // Set a (key,value) in our internal variable array. These will be // used during the substitution phase to replace template variables. // function setkey ($tplkey, $rest = '') { if (gettype ($tplkey) == 'array') { reset ($tplkey); foreach ($tplkey as $key=>$val) { if (!empty($key)) { $this->VAR[$key] = $val; } } } else { if (!empty($tplkey)) { $this->VAR[$tplkey] = $rest; } } } function append ($tplkey, $rest = '') { if (gettype ($tplkey) == 'array') { reset ($tplkey); foreach ($tplkey as $key=>$val) { if (!empty($key)) { $this->VAR[$key] .= $val; } } } else { if (!empty($tplkey)) { $this->VAR[$tplkey] .= $rest; } } } // // Description // class.FastTemplate.php3 compatible interface // function get_assigned ($key = '') { return $this->getkey ($key); } // // Description // Retrieve a value from our internal variable array given the key name. // function getkey ($key = '') { if (empty($key)) { return false; } else if (isset ($this->VAR[$key])) { return $this->VAR[$key]; } else { return false; } } function fetch ($handle = '') { if (empty($handle)) { $handle = $this->LAST; } return $this->HANDLE[$handle]; } function xprint ($handle = '') { if (empty($handle)) { $handle = $this->LAST; } print ($this->HANDLE[$handle]); } function FastPrint ($handle = '') { $this->xprint ($handle); } function clear_href ($key = '') { $this->unsetkey ($key); } function unsetkey ($key = '') { if (empty($key)) { unset ($this->VAR); $this->VAR = array (); } else if (gettype($key) == 'array') { reset ($key); foreach (array_values($key) as $k) { unset ($this->VAR[$k]); } } else { unset ($this->VAR[$key]); } } function define_nofile ($stringList, $dynamic = 0) { $this->define_raw ($stringList, $dynamic); } // // Description // Member function to control explicit error messages. We don't do // real PHP error handling. // function error ($errorMsg, $die = 0) { $this->ERROR = $errorMsg; echo "ERROR: {$this->ERROR}
\n"; if ($die) { exit; } return; } } mlmmj/contrib/web/php-admin/htdocs/dot.htaccess000066400000000000000000000001431502303113500220440ustar00rootroot00000000000000Require valid-user AuthType Basic AuthName "mlmmj web-interface" AuthUserFile /home/mlmmj/htpasswd mlmmj/contrib/web/php-admin/htdocs/edit.php000066400000000000000000000107721502303113500212060ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); function mlmmj_boolean($name, $nicename, $text) { global $tpl, $topdir, $list; if(is_file($topdir."/".$list."/control/".$name)) $checked = TRUE; else $checked = FALSE; $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), "TEXT" => nl2br(htmlentities($text)))); $tpl->assign(array("CHECKED" => $checked ? " checked" : "")); $tpl->parse("ROWS",".boolean"); } function mlmmj_string($name, $nicename, $text) { global $tpl, $topdir, $list; $file = $topdir."/".$list."/control/".$name; $value = ""; if(is_file($file)) { $lines = file($file); $value = $lines[0]; } // remove trailing \n if any, just to be sure $value = preg_replace('/\n$/',"",$value); $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), "TEXT" => nl2br(htmlentities($text)), "VALUE" => htmlentities($value))); $tpl->parse("ROWS",".string"); } function mlmmj_list($name, $nicename, $text) { global $tpl, $topdir, $list; $file = "$topdir/$list/control/$name"; $value = ""; if(is_file($file)) $value = file_get_contents($file); // the last \n would result in an extra empty line in the list box, // so we remove it $value = preg_replace('/\n$/',"",$value); $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), "TEXT" => nl2br(htmlentities($text)), "VALUE" => htmlentities($value))); $tpl->parse("ROWS",".list"); } // Perl's encode_entities (to be able to use tunables.pl) function encode_entities($str) { return htmlentities($str); } $tpl = new rFastTemplate($templatedir); if(empty($_GET['list'])) die("no list specified"); $list = $_GET['list']; if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) die("list outside topdir"); if(!is_dir($topdir."/".$list)) die("non-existent list"); $userfile = "$topdir/$list/control/admin_users"; if (is_file($userfile)) { // read users into array $admin_users = array_map('trim',file($userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (!isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { header("WWW-Authenticate: " . "Basic realm=\"Mlmmj Protected Area\""); header("HTTP/1.0 401 Unauthorized"); //Show failure text, which browsers usually //show only after several failed attempts print("This page is protected by HTTP " . "Authentication.
\n"); exit; } } $tpl->define(array("main" => "edit.html", "boolean" => "edit_boolean.html", "string" => "edit_string.html", "list" => "edit_list.html")); $tpl->assign(array("LIST" =>htmlentities($list))); $tunables = file_get_contents($confdir.'/tunables.pl'); eval($tunables); $tpl->parse("MAIN","main"); $tpl->FastPrint("MAIN"); ?> mlmmj/contrib/web/php-admin/htdocs/index.php000066400000000000000000000065511502303113500213700ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); $tpl = new rFastTemplate($templatedir); $tpl->define(array("main" => "index.html")); $lists = ""; # use scandir to have alphabetical order foreach (scandir($topdir) as $mlmmj_list) { if (substr($mlmmj_list,0,1) != '.' && file_exists("$topdir/$mlmmj_list/control")) { $admin_userfile = "$topdir/$mlmmj_list/control/admin_users"; $subs_userfile = "$topdir/$mlmmj_list/control/subsadmin_users"; if (!is_file($subs_userfile)) { $subs_userfile = "$topdir/$mlmmj_list/control/admin_users"; } if (isset($_SERVER['PHP_AUTH_USER']) && is_file($admin_userfile)) { // read users into array $admin_users = array_map('trim',file($admin_userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { $print_config=1; } else { $print_config=0; } } else { $print_config=1; } if (isset($_SERVER['PHP_AUTH_USER']) && is_file($subs_userfile)) { // read users into array $subs_users = array_map('trim',file($subs_userfile)); // remove empty values from array $subs_users = array_filter($subs_users); if (in_array($_SERVER['PHP_AUTH_USER'],$subs_users)) { $print_sub=1; } else { $print_sub=0; } } else { $print_sub=1; } if ($print_config || $print_sub) { $lists .= "

".htmlentities($mlmmj_list)."
\n"; if ($print_config) { $lists .= "Config - "; $lists .= "Text files"; } if ($print_config && $print_sub) $lists .= " - "; if ($print_sub) $lists .= "Subscribers\n"; if ($print_config) $lists .= " - Log"; $lists .= "

\n"; } } } $tpl->assign(array("LISTS" => $lists)); $tpl->parse("MAIN","main"); $tpl->FastPrint("MAIN"); ?> mlmmj/contrib/web/php-admin/htdocs/logs.php000066400000000000000000000105531502303113500212220ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); function mask($str, $first, $last) { $len = strlen($str); $toShow = $first + $last; return substr($str, 0, $len <= $toShow ? 0 : $first).str_repeat("*", $len - ($len <= $toShow ? 0 : $toShow)).substr($str, $len - $last, $len <= $toShow ? 0 : $last); } function mask_email($email) { $mail_parts = explode("@", $email); $domain_parts = explode('.', $mail_parts[1]); $mail_parts[0] = mask($mail_parts[0], 2, 1); // show first 2 letters and last 1 letter $domain_parts[0] = mask($domain_parts[0], 2, 1); // same here $mail_parts[1] = implode('.', $domain_parts); return implode("@", $mail_parts); } function anonymize_line($text) { $words = explode(" ", $text); foreach ($words as $key => $word) { if (strstr($word, '@')) { $words[$key] = mask_email($word); } } return implode(" ", $words); } function read_filetail($file, $lines) { //global $fsize; $handle = fopen($file, "r"); $linecounter = $lines; $pos = -2; $beginning = false; $text = array(); while ($linecounter > 0) { $t = " "; while ($t != "\n") { if(fseek($handle, $pos, SEEK_END) == -1) { $beginning = true; break; } $t = fgetc($handle); $pos --; } $linecounter --; if ($beginning) { rewind($handle); } $text[$lines-$linecounter-1] = fgets($handle); if ($beginning) break; } fclose ($handle); //return array_reverse(array_map('anonymize_line',$text)); return array_reverse($text); } if(empty($_GET['list'])) die("no list specified"); $list = $_GET['list']; if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) die("list outside topdir"); if(!is_dir($topdir."/".$list)) die("non-existent list"); $userfile = "$topdir/$list/control/admin_users"; if (is_file($userfile)) { // read users into array $admin_users = array_map('trim',file($userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (!isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { header("WWW-Authenticate: " . "Basic realm=\"Mlmmj Protected Area\""); header("HTTP/1.0 401 Unauthorized"); //Show failure text, which browsers usually //show only after several failed attempts print("This page is protected by HTTP " . "Authentication.
\n"); exit; } } $logfile = $topdir."/".$list."/mlmmj.operation.log"; if (is_file($logfile)) { $content = read_filetail($logfile,50); print "Output (last 50 lines) of operations logfile:

\n"; print nl2br(htmlentities(join('',$content))); } else { print "Operations logfile doesn't exist (yet)
\n"; } print "
Index"; ?> mlmmj/contrib/web/php-admin/htdocs/save.php000066400000000000000000000104731502303113500212150ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); function mlmmj_boolean($name, $nicename, $text) { global $tpl, $topdir, $list; $file = $topdir."/".$list."/control/".$name; if(isset($_POST[$name]) && !empty($_POST[$name])) { if(!touch($file)) die("Couldn't open ".$file." for writing"); // don't error on chmod, if the owner of the file is different it won't work @chmod($file, 0664); } else { if (file_exists($file)) { if (!unlink($file)) die("Couldn't unlink ".$file); } } } function mlmmj_string ($name, $nicename, $text) { mlmmj_list($name, $nicename, $text); } function mlmmj_list($name, $nicename, $text) { global $tpl, $topdir, $list; $file = $topdir."/".$list."/control/".$name; if(isset($_POST[$name]) && !empty($_POST[$name]) && !preg_match('/^\s*$/',$_POST[$name])) { // remove all \r $_POST[$name]=preg_replace('/\r/',"",$_POST[$name]); // no trailing \n?, then we add one if (!preg_match('/\n$/',$_POST[$name])) $_POST[$name].="\n"; // we don't like whitespace before a \n $_POST[$name]=preg_replace('/\s*\n/',"\n",$_POST[$name]); if (!$fp = fopen($file, "w")) die("Couldn't open ".$file." for writing"); // write the result in a file fwrite($fp, $_POST[$name]); fclose($fp); // don't error on chmod, if the owner of the file is different it won't work @chmod($file, 0664); } else { if (file_exists($file)) { if (!unlink($file)) die("Couldn't unlink ".$file); } } } // Perl's encode_entities (to be able to use tunables.pl) function encode_entities($str) { return htmlentities($str); } $tpl = new rFastTemplate($templatedir); if(empty($_POST['list'])) die("no list specified"); $list = $_POST['list']; if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) die("list outside topdir"); if(!is_dir($topdir."/".$list)) die("non-existent list"); $userfile = "$topdir/$list/control/admin_users"; $admin_user = ""; if(is_file($userfile)) { // read users into array $admin_users = array_map('trim',file($userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (!isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { header("WWW-Authenticate: " . "Basic realm=\"Mlmmj Protected Area\""); header("HTTP/1.0 401 Unauthorized"); //Show failure text, which browsers usually //show only after several failed attempts print("This page is protected by HTTP " . "Authentication.
\n"); exit; } } $tpl->define(array("main" => "save.html")); $tpl->assign(array("LIST" => htmlentities($list))); $tunables = file_get_contents($confdir.'/tunables.pl'); eval($tunables); $tpl->parse("MAIN","main"); $tpl->FastPrint("MAIN"); ?> mlmmj/contrib/web/php-admin/htdocs/subscribers.php000066400000000000000000000116161502303113500226050ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); $tpl = new rFastTemplate($templatedir); # get the list parameter and check that list exists if(empty($_GET['list'])) die("no list specified"); $list = $_GET['list']; if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) die("list outside topdir"); if(!is_dir($topdir."/".$list)) die("non-existent list"); $userfile = "$topdir/$list/control/subsadmin_users"; if (!is_file($userfile)) { $userfile = "$topdir/$list/control/admin_users"; } $admin_user = ""; if (is_file($userfile)) { // read users into array $admin_users = array_map('trim',file($userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (!isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { header("WWW-Authenticate: " . "Basic realm=\"Mlmmj Protected Area\""); header("HTTP/1.0 401 Unauthorized"); //Show failure text, which browsers usually //show only after several failed attempts print("This page is protected by HTTP " . "Authentication.
\n"); exit; } } $message = ""; # subscribe some people if tosubscribe is set if (isset($_POST["tosubscribe"])) { foreach (preg_split('/\r\n|\n|\r/', $_POST["tosubscribe"]) as $line) { $email = trim($line); if ($email != "") { if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $cmd = "/usr/bin/mlmmj-sub -f -q -s -L ".escapeshellarg("$topdir/$list")." -a ".escapeshellarg($email)." 2>&1"; unset($out); exec($cmd, $out, $ret); if ($ret !== 0) { $message.= "* Subscribe error for $email\ncommand: $cmd\nreturn code: $ret\noutput: ".implode("\n", $out)."\n"; } } else { $message.= "* Email address not valid: $email\n"; } } } # delete some people if delete is set } else if (isset($_POST["delete"])) { $email = $_POST["email"]; if (! filter_var($email, FILTER_VALIDATE_EMAIL)) die("Email address not valid"); $cmd = "/usr/bin/mlmmj-unsub -q -s -L ".escapeshellarg("$topdir/$list")." -a ".escapeshellarg($email)." 2>&1"; unset($out); exec($cmd, $out, $ret); if ($ret !== 0) { $message.= "* Unsubscribe error.\ncommand: $cmd\nreturn code: $ret\noutput: ".implode("\n", $out)."\n"; } } $subscribers=""; # get subscribers from mlmmj $cmd = "/usr/bin/mlmmj-list -L ".escapeshellarg("$topdir/$list")." |sort"; unset($out); exec($cmd, $out, $ret); if ($ret !== 0) { $message.= "* Error: Could not get subscribers list.\n"; } else { foreach ($out as $email) { $email = trim($email); $form = "
"; $form.= ""; $form.= ""; $form.= "
"; $subscribers.= "".htmlspecialchars($email)."$form\n"; } if (empty($subscribers)) { $subscribers = "This list is empty or the permissions are not set correctly to get the subscribers.\n"; } } # set template vars $tpl->define(array("main" => "subscribers.html")); $tpl->assign(array("LIST" => htmlspecialchars($list))); $tpl->assign(array("MESSAGE" => "
".htmlspecialchars($message)."
")); $tpl->assign(array("SUBS" => $subscribers)); $tpl->parse("MAIN","main"); $tpl->FastPrint("MAIN"); ?> mlmmj/contrib/web/php-admin/htdocs/texts.php000066400000000000000000000071011502303113500214200ustar00rootroot00000000000000 * Copyright (C) 2004 Christoph Thiel * * mlmmj/php-perl: * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Christian Laursen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ require(dirname(dirname(__FILE__))."/conf/config.php"); require(dirname(__FILE__)."/class.rFastTemplate.php"); if(empty($_GET['list'])) die("no list specified"); $list = $_GET['list']; if (dirname(realpath($topdir."/".$list)) != realpath($topdir)) die("list outside topdir"); if(!is_dir($topdir."/".$list)) die("non-existent list"); $userfile = "$topdir/$list/control/admin_users"; if (is_file($userfile)) { // read users into array $admin_users = array_map('trim',file($userfile)); // remove empty values from array $admin_users = array_filter($admin_users); if (!isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'],$admin_users)) { header("WWW-Authenticate: " . "Basic realm=\"Mlmmj Protected Area\""); header("HTTP/1.0 401 Unauthorized"); //Show failure text, which browsers usually //show only after several failed attempts print("This page is protected by HTTP " . "Authentication.
\n"); exit; } } $files = glob($topdir."/".$list."/text/*"); if (isset($_POST['save_texts'])) { foreach ($files as $mlmmj_file) { $name = basename($mlmmj_file); // values need to be in linux line endings $value = str_replace(array("\r\n", "\r", "\n"), "\n", $_POST[$name]); file_put_contents($topdir."/".$list."/text/".$name, $value); } print "######
\n"; print "###### Files updated
\n"; print "######
\n"; } print "For info on the template directives used, see here
\n"; print "
"; print ""; foreach ($files as $mlmmj_file) { $name=basename($mlmmj_file); $content = file_get_contents($mlmmj_file); print ""; } print '
".htmlentities($name)."
'; print ""; print "
"; print "
Index"; ?> mlmmj/contrib/web/php-admin/templates/000077500000000000000000000000001502303113500202535ustar00rootroot00000000000000mlmmj/contrib/web/php-admin/templates/edit.html000066400000000000000000000004521502303113500220670ustar00rootroot00000000000000mlmmj config

mlmmj config

{ROWS}

Index

mlmmj/contrib/web/php-admin/templates/edit_boolean.html000066400000000000000000000001551502303113500235660ustar00rootroot00000000000000{NICENAME}{TEXT} mlmmj/contrib/web/php-admin/templates/edit_list.html000066400000000000000000000001541502303113500231210ustar00rootroot00000000000000{NICENAME}{TEXT} mlmmj/contrib/web/php-admin/templates/edit_string.html000066400000000000000000000001461502303113500234550ustar00rootroot00000000000000{NICENAME}{TEXT} mlmmj/contrib/web/php-admin/templates/index.html000066400000000000000000000001421502303113500222450ustar00rootroot00000000000000mlmmj config

mlmmj config

{LISTS} mlmmj/contrib/web/php-admin/templates/save.html000066400000000000000000000003231502303113500220750ustar00rootroot00000000000000mlmmj config

mlmmj config

{LIST} control values saved!

Index | {LIST}

mlmmj/contrib/web/php-admin/templates/subscribers.html000066400000000000000000000011221502303113500234630ustar00rootroot00000000000000 mlmmj - {LIST} subscribers

{LIST} subscribers

{MESSAGE} {SUBS}
Add subscribers:

Index

mlmmj/contrib/web/php-moderation/000077500000000000000000000000001502303113500173265ustar00rootroot00000000000000mlmmj/contrib/web/php-moderation/README000066400000000000000000000045131502303113500202110ustar00rootroot00000000000000MLMMJ PHP Moderation Web Interface by Thomas Goirand * dependencies * This app needs: - php with gettext() support (for translations). Nearly all (if not all) Unix distributions have php with gettext support. - The Mail_mime PEAR package (php-mail-mime in Debian) * setup * - Run "./build-translations.sh" to generate the gettext binaries out of the sources - Edit the 5 variables on top of mlmmj-moderation.php to set the moderation folder, list name, domain, delimiter and the address used to send the moderation validation messages. You will need gettext installed on your system... - Eventually rename mlmmj-moderation.php and edit mlmmj.css to your taste - Edit and rename the dot.htaccess files to .htaccess to protect the moderation folder from others - make it so this app have read/write access to the moderation folder. Write access is needed because the app does some unlink() calls to delete the messages. - If using debian, you might need to dpkg-reconfigure locales and add fr_FR.UTF-8, if you want to see my French translation (there might be some other distributions needing the same kind of thing, I don't know...). * known issues * - Because this web app is sending an email to validate messages to be moderated, once you have hit "validate", validated messages will still (most of the times) show in the interface, as the folder is (most of the times) read before MLMMJ has time to send the moderated messages and remove them from the moderation folder. A workaround would be to NOT display messages that are moderated on the URL bar, but it's not a good way to go, as if the server is very busy, the next refresh of the page (the one after the validation) can still show some messages already validated. We see here that the method to send emails doesn't seem to be very good... Would it be possible for me to rename the moderated messages??? - Because it's the first version, I have not yet used POST, but some GET in order to see things on the URL bar. So, of course, we are here hitting the limitation of the URL size (if there are really a lot of messages to moderate). This can be changed later simply by adding method="POST" in the form, as I use $_REQUEST (and not the stupid $_POST / $_GET that everybody uses...). I might do this on the next version, but for now, it's more easy for debug purposes to keep it this way. mlmmj/contrib/web/php-moderation/build-translations.sh000077500000000000000000000015331502303113500235050ustar00rootroot00000000000000#!/bin/bash # # Build script for generating the MLMMJ moderation web interface locales # set -e LOCALE_TRANS=fr_FR WEB_SCRIPT_FILES=mlmmj-moderation.php if [ ! -d translations ]; then echo "Wrong working directory." >&2 exit 1 fi echo "===> Managing internationalizations and localizations" echo "=> Extracting strings from sources" xgettext $WEB_SCRIPT_FILES -o translations/templates.pot echo "=> Merging in every language .po file:" for i in $LOCALE_TRANS; do echo -n "$i " msgmerge -s -U "translations/$i.po" translations/templates.pot done echo "=> Creating l10n folders" for i in $LOCALE_TRANS; do mkdir -p "translations/locale/$i/LC_MESSAGES" done echo "=> Creating binary formats of language files:" for i in $LOCALE_TRANS; do echo -n $i" " msgfmt -c -v -o "translations/locale/$i/LC_MESSAGES/messages.mo" \ "translations/$i.po" done mlmmj/contrib/web/php-moderation/dot.htaccess000066400000000000000000000001431502303113500216310ustar00rootroot00000000000000Require valid-user AuthType Basic AuthName "mlmmj web-interface" AuthUserFile /home/mlmmj/htpasswd mlmmj/contrib/web/php-moderation/mlmmj-moderation.php000066400000000000000000000242411502303113500233150ustar00rootroot00000000000000 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // These are the configuration variables for your list $mod_dir = "/some/path/to/your/listname/moderation"; $list_name = "listname"; $list_domain = "example.com"; $delimiter = "+"; $from_addr = "user@example.com"; // Manage accepted language and cookies $txt_default_lang = "en"; session_register("lang"); if(isset($_SESSION["lang"]) && !is_string($_SESSION["lang"])){ unset($lang); } if(isset($_SESSION["lang"])){ $lang = $_SESSION["lang"]; } // TODO: Add some web stuffs to change the language manually on the web interface... // ...HERE... // // $lang = "fr_FR"; // The following code keeps the lang in sessions, so it can be changed manually above with lang=XX // and if there's nothing in session yet, then it will parse the language set in the browser if(isset($lang)){ $_SESSION["lang"] = $lang; } if (!isset($lang)){ if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && $_SERVER["HTTP_ACCEPT_LANGUAGE"]) { $all_languages = strtok($_SERVER["HTTP_ACCEPT_LANGUAGE"],";"); $langaccept = explode(",", $all_languages); for ($i = 0; $i < sizeof($langaccept); $i++) { $tmplang = trim($langaccept[$i]); $tmplang2 = substr($tmplang,0,2); if (!isset($lang) && isset($txt_langname[$tmplang]) && $txt_langname[$tmplang]) { $lang = $tmplang; }elseif (!isset($lang) && isset($txt_langname[$tmplang2])) { $lang = $tmplang2; } } } if (!isset($lang)) { $lang = $txt_default_lang; } $_SESSION["lang"] = $lang; } header("Content-type: text/html; charset=UTF-8"); switch($lang){ case "fr_FR": case "fr": $gettext_lang = "fr_FR.UTF-8"; break; default: $gettext_lang = "en_US.UTF-8"; break; } if(FALSE === putenv("LC_ALL=$gettext_lang")){ echo "Failed to putenv LC_ALL=$gettext_lang
"; } if(FALSE === putenv("LANG=$gettext_lang")){ echo "Failed to putenv LANG=$gettext_lang
"; } if(FALSE === setlocale(LC_ALL, $gettext_lang)){ echo "Failed to setlocale(LC_ALL,$gettext_lang)
"; } $pathname = bindtextdomain("messages", dirname(__FILE__) ."/translations/locale"); $message_domain = textdomain("messages"); // This comes from the Mail_Mime PEAR package, under Debian, you need // the php-mail-mime package to have this script work. require_once 'Mail/mimeDecode.php'; // Email header parsing function decodeEmail($input){ $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $decoder = new Mail_mimeDecode($input); $structure = $decoder->decode($params); return $structure; } // Reading of all the messages from the moderation folder function getMessageList(){ global $mod_dir; $all_msg = array(); // Read all files from the directory. if (is_dir($mod_dir)) { if ($dh = opendir($mod_dir)) { while (($file = readdir($dh)) !== false) { if( !ereg("^([0-9a-f]+)\$",$file) ) continue; $full_path = $mod_dir . "/" . $file; if(filetype($full_path) == "file"){ if(FALSE === ($input = file_get_contents($full_path))){ echo ""._("Warning: could not read")." $full_path
"; }else{ $struct = decodeEmail($input); $my_msg = array(); $my_msg["headers"] = $struct->headers; $my_msg["body"] = $struct->body; $my_msg["filename"] = $file; $all_msg[] = $my_msg; } } } closedir($dh); } } return $all_msg; } // Printing of the list of messages to be displayed (the big table) function printAllMessages($all_msg){ $n = sizeof($all_msg); $out = "\n"; $th = " class=\"tableTitle\" "; $out .= ""._("Date").""._("Subject").""._("From")."\n"; $out .= ""; for($i=0;$i<$n;$i++){ if($i % 2){ $cls = " class=\"alternatecolorline\" "; }else{ $cls = " class=\"alternatecolorline2\" "; } $out .= ""; $out .= ""; if( isset($all_msg[$i]["headers"]["date"]) ){ $mydate = htmlspecialchars($all_msg[$i]["headers"]["date"]); }else{ $mydate = _("No date"); } $out .= ""; if( !isset($all_msg[$i]["headers"]["subject"]) || strlen($all_msg[$i]["headers"]["subject"]) == 0){ $subject = _("No subject"); }else{ $subject = $all_msg[$i]["headers"]["subject"]; } $out .= ""; if( isset($all_msg[$i]["headers"]["from"]) ){ $myfrom = htmlspecialchars($all_msg[$i]["headers"]["from"]); }else{ $myfrom = _("No from in headers"); } $out .= ""; $out .= "\n"; } $out .= "
" . "" . "" . $mydate . "" . htmlspecialchars($subject) . "" . $myfrom . "
\n"; $out .= _("For the selection:")." "; $out .= ""; $out .= ""; return $out; } // Deletion and validation of messages if( isset($_REQUEST["validate"]) || isset($_REQUEST["delete"])){ if( !isset($_REQUEST["msg_id"]) ){ echo ""._("No message selected!")."
"; }else{ $n = sizeof($_REQUEST["msg_id"]); for($i=0;$i<$n;$i++){ if( !ereg("^([0-9a-f]+)\$",$_REQUEST["msg_id"][$i]) ){ echo "".("Moderation ID format is wrong: will ignore this one!").""; continue; } $fullpath = $mod_dir . "/" . $_REQUEST["msg_id"][$i]; if(!file_exists($fullpath)){ echo ""._("Moderation ID not found in the moderation folder!").""; continue; } // TODO: Check if message is there! if( isset($_REQUEST["validate"]) ){ // echo "Validating message ".$_REQUEST["msg_id"][$i]."
"; $to_addr = $list_name . $delimiter . "moderate-" . $_REQUEST["msg_id"][$i] . "@" . $list_domain; $headers = "From: ".$from_addr; mail($to_addr,"MLMMJ Web interface moderation","MLMMJ Web interface moderation",$headers); }else{ // echo "Deleting message ".$_REQUEST["msg_id"][$i]."
"; unlink($mod_dir . "/" . $_REQUEST["msg_id"][$i]); if( file_exists($mod_dir . "/" . $_REQUEST["msg_id"][$i] . ".orig") ){ unlink($mod_dir . "/" . $_REQUEST["msg_id"][$i] . ".orig"); } } } } } // A bit of javascript to do the checkboxes inversion. echo "

MLMMJ "._("moderation web interface")."

"._("Refresh page").""; if( isset($_REQUEST["action"]) && $_REQUEST["action"] == "show_message"){ if( !ereg("^([0-9a-f]+)\$",$_REQUEST["msgid"]) ){ echo ""._("Message ID format is wrong: can't display!").""; }else{ $full_path = $mod_dir . "/" . $_REQUEST["msgid"]; if( !file_exists($full_path) ){ echo "".("Message does not exists!").""; }else{ if(FALSE === ($input = file_get_contents($full_path))){ echo ""._("Error: could not read")." $full_path
"; }else{ $struct = decodeEmail($input); echo ""._("Back to messages list")."

"; echo ""._("From:")." " . htmlspecialchars($struct->headers["from"])."
"; echo ""._("Date:")." " . htmlspecialchars($struct->headers["date"])."
"; echo ""._("To:")." " . htmlspecialchars($struct->headers["to"])."
"; echo ""._("Subject:")." " . htmlspecialchars($struct->headers["subject"])."
"; echo ""._("Message body:")."

" . nl2br(htmlspecialchars($struct->body)); } } } }else{ $all_msg = getMessageList(); echo printAllMessages($all_msg); } echo ' '; ?> mlmmj/contrib/web/php-moderation/mlmmj.css000066400000000000000000000017661502303113500211660ustar00rootroot00000000000000.alternatecolorline2 { background-color: #E3f9ff; font-size: 10px; } .alternatecolorline { background-color: #bcd0d6; font-size: 10px; } .tableTitle { text-align: center; color: #547074; font-size: 12px; background-color: #dbe9ed; } .errorMessages { color: #FF0000; font-size: 14px; font-weight: bold; } a:link{color:#105278;text-decoration: none;} a:visited{color:#105278;text-decoration: none;} a:hover{color:#000000;text-decoration: underline;} a:active{color:#000000;text-decoration: none;} html{height:100%; margin:4;} body{height:100%;margin:4; font: 12px Arial, Helvetica, sans-serif; color: #000000;} /* Forms fields definitions */ input,select,textarea { font-family: arial; font-size: 12px; color: #000000; background-color: #F6F6F2; border-color: #ECEEE5 #F6F6F2 #F6F6F2 #ECEEE5; } h3 { text-align: center; font-size: 20px; } .footer{width:98%; text-align:center; position:absolute; bottom:0; padding:1%; } mlmmj/contrib/web/php-moderation/translations/000077500000000000000000000000001502303113500220475ustar00rootroot00000000000000mlmmj/contrib/web/php-moderation/translations/dot.htaccess000066400000000000000000000000371502303113500243540ustar00rootroot00000000000000Order Deny,Allow Deny from all mlmmj/contrib/web/php-moderation/translations/fr_FR.po000066400000000000000000000046531502303113500234150ustar00rootroot00000000000000# MLMMJ moderation web interface templates. # Copyright (C) 2009 Thomas GOIRAND # This file is distributed under the same license as MLMMJ package. # Thomas Goirand , 2009. # msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-03-05 07:25+0800\n" "PO-Revision-Date: 2009-03-05 07:29+0800\n" "Last-Translator: Thomas Goirand \n" "Language-Team: Thomas Goirand \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: mlmmj-moderation.php:259 msgid "Back to messages list" msgstr "Retour a la liste des messages" #: mlmmj-moderation.php:144 msgid "Date" msgstr "Date" #: mlmmj-moderation.php:261 msgid "Date:" msgstr "Date :" #: mlmmj-moderation.php:177 msgid "Delete" msgstr "Effacer" #: mlmmj-moderation.php:256 msgid "Error: could not read" msgstr "Erreur: impossible de lire" #: mlmmj-moderation.php:175 msgid "For the selection:" msgstr "Pour la sélection :" #: mlmmj-moderation.php:144 msgid "From" msgstr "De" #: mlmmj-moderation.php:260 msgid "From:" msgstr "De:" #: mlmmj-moderation.php:144 msgid "Inverse selection" msgstr "Inverser la selection" #: mlmmj-moderation.php:249 msgid "Message ID format is wrong: can't display!" msgstr "Le format de l'ID du message est faux: affichage impossible !" #: mlmmj-moderation.php:264 msgid "Message body:" msgstr "Corp du message :" #: mlmmj-moderation.php:194 msgid "Moderation ID not found in the moderation folder!" msgstr "ID de modération non trouve dans le dossier de modération!" #: mlmmj-moderation.php:157 msgid "No date" msgstr "Pas de date" #: mlmmj-moderation.php:169 msgid "No from in headers" msgstr "Pas de from dans les entêtes" #: mlmmj-moderation.php:184 msgid "No message selected!" msgstr "Pas de message sélectionné !" #: mlmmj-moderation.php:161 msgid "No subject" msgstr "Pas de sujet" #: mlmmj-moderation.php:245 msgid "Refresh page" msgstr "Rafraichir la page" #: mlmmj-moderation.php:144 msgid "Subject" msgstr "Sujet" #: mlmmj-moderation.php:263 msgid "Subject:" msgstr "Sujet :" #: mlmmj-moderation.php:262 msgid "To:" msgstr "Pour :" #: mlmmj-moderation.php:176 msgid "Validate" msgstr "Valider" #: mlmmj-moderation.php:122 msgid "Warning: could not read" msgstr "Alerte : impossible de lire" #: mlmmj-moderation.php:244 msgid "moderation web interface" msgstr "interface web de moderation" mlmmj/contrib/web/php-user/000077500000000000000000000000001502303113500161435ustar00rootroot00000000000000mlmmj/contrib/web/php-user/README000066400000000000000000000021551502303113500170260ustar00rootroot00000000000000README webinterface Jun 27th 2004 Ehh, what's that? The mlmmj-webinterface was created to give people the opportunity to {sub,unsub}scribe to a mailinglists via a webinterface (without having to write an initial {sub,unsub}scribe-mail). What are the requirements? You only need a webserver with PHP >= 3.0.8 support. How can I install/use the webinterface? - Upload mlmmj.php to your webserver. - Have a look at example.html and copy one or both forms into your website. - Adjust the options to satisfy your needs: The mailinglist your want to {sub,unsub}scribe to: Do you want to subscribe or unsubscribe? Where do you want to redirect your user after a failure? What should be the success redirect? That's it - have a lot of fun! Christoph Thiel mlmmj/contrib/web/php-user/example.html000066400000000000000000000020351502303113500204640ustar00rootroot00000000000000 mlmmj-webinterface

subscribe


unsubscribe


mlmmj/contrib/web/php-user/mlmmj.php000066400000000000000000000072531502303113500177770ustar00rootroot00000000000000 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ // error_reporting(E_ALL); class mlmmj { var $email; var $mailinglist; var $job; var $redirect_success; var $redirect_failure; var $delimiter; var $errors; function is_email($string="") { if (eregi("^[a-z0-9\._-]+".chr(64)."+[a-z0-9\._-]+\.+[a-z]{2,4}$", $string)) { return TRUE; } else { return FALSE; } } function error($string="") { $this->errors = TRUE; // die($string); } function mlmmj() { // set mandatory vars... $this->errors = FALSE; $this->delimiter = "+"; if (!isset($_POST["email"]) && !isset($_POST["mailinglist"]) && !isset($_POST["job"]) && !isset($_POST["redirect_success"]) && !isset($_POST["redirect_failure"])) { $this->errors = TRUE; if(isset($_POST["redirect_failure"])) { header("Location: ".$_POST["redirect_failure"]); exit; } else die("An error occurred. Please check contrib/web/php-user/README for details."); } else { if($this->is_email($_POST["email"])) $this->email = $_POST["email"]; else $this->error("ERROR: email is not a valid email address."); if($this->is_email($_POST["mailinglist"])) $this->mailinglist = $_POST["mailinglist"]; else $this->error("ERROR: mailinglist is not a valid email address."); $this->job = $_POST["job"]; if(!(($this->job == "subscribe") OR ($this->job == "unsubscribe"))) { $this->error("ERROR: job unknown."); } $this->redirect_failure = $_POST["redirect_failure"]; $this->redirect_success = $_POST["redirect_success"]; } // now we should try to go ahead and {sub,unsub}scribe... ;) if(!$this->errors) { // @ ^= char(64) $to = str_replace(chr(64),$this->delimiter.$this->job.chr(64),$this->mailinglist); $subject = $this->job." to ".$this->mailinglist; $body = $this->job; $addheader = ""; $addheader .= "Received: from ". $_SERVER["REMOTE_ADDR"] ." by ". $_SERVER["SERVER_NAME"]. " with HTTP;\r\n\t".date("r")."\n"; $addheader .= "X-Originating-IP: ".$_SERVER["REMOTE_ADDR"]."\n"; $addheader .= "X-Mailer: mlmmj-webinterface powered by PHP/". phpversion() ."\n"; $addheader .= "From: ".$this->email."\n"; $addheader .= "Cc: ".$this->email."\n"; if(!mail($to, $subject, $body, $addheader)) $this->error($this->job." failed."); } if($this->errors) { header("Location: ".$this->redirect_failure); exit; } else { header("Location: ".$this->redirect_success); exit; } } } $mailinglist = new mlmmj; ?> mlmmj/include/000077500000000000000000000000001502303113500136065ustar00rootroot00000000000000mlmmj/include/checkwait_smtpreply.h000066400000000000000000000027331502303113500200450ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef CHECK_REPLY_H #define CHECK_REPLY_H #define MLMMJ_CONNECT 1 #define MLMMJ_EHLO 2 #define MLMMJ_HELO 3 #define MLMMJ_FROM 4 #define MLMMJ_RCPTTO 5 #define MLMMJ_DATA 6 #define MLMMJ_DOT 7 #define MLMMJ_QUIT 8 #define MLMMJ_RSET 9 #include "mlmmj.h" char *checkwait_smtpreply(int sockfd, int replytype); #endif /* CHECK_REPLY_H */ mlmmj/include/chomp.h000066400000000000000000000023521502303113500150670ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MLMMJ_CHOMP__H #define MLMMJ_CHOMP__H char *chomp(char *str); #endif /* MLMMJ_CHOMP__H */ mlmmj/include/ctrlvalue.h000066400000000000000000000044701502303113500157650ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef CTRLVALUE_H #define CTRLVALUE_H #include #include #include char *ctrlvalue(int ctrlfd, const char *ctrlstr); char *ctrlcontent(int ctrlfd, const char *ctrlstr); char *textcontent(int listfd, const char *ctrlstr); intmax_t ctrlim(int ctrlfd, const char *ctrlstr, intmax_t min, intmax_t max, intmax_t fallback); uintmax_t ctrluim(int ctrlfd, const char *ctrlstr, uintmax_t min, uintmax_t max, uintmax_t fallback); static inline int ctrlint(int ctrlfd, const char *ctrlstr, int fallback) { return (ctrlim(ctrlfd, ctrlstr, INT_MIN, INT_MAX, fallback)); } static inline size_t ctrlsizet(int ctrlfd, const char *ctrlstr, uintmax_t fallback) { return (ctrluim(ctrlfd, ctrlstr, 0, SIZE_MAX, fallback)); } static inline unsigned short ctrlushort(int ctrlfd, const char *ctrlstr, unsigned short fallback) { return (ctrluim(ctrlfd, ctrlstr, 0, USHRT_MAX, fallback)); } time_t ctrltimet(int dfd, const char *ctrlstr, time_t fallback); static inline long ctrllong(int ctrlfd, const char *ctrlstr, unsigned short fallback) { return (ctrlim(ctrlfd, ctrlstr, LONG_MIN, LONG_MAX, fallback)); } #endif /* CTRLVALUE_H */ mlmmj/include/ctrlvalues.h000066400000000000000000000026031502303113500161440ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include "mlmmj.h" #include strlist *ctrlvalues(int ctrlfd, const char *ctrlstr); bool ctrlvalues_contains(int ctrlfd, const char *ctrlstr, const char *pattern, bool sensitivity); mlmmj/include/do_all_the_voodoo_here.h000066400000000000000000000032321502303113500204410ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023-2025 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include "mlmmj.h" /* For struct mailhdr and struct strlist */ bool findit(const char *line, const strlist *headers); void getinfo(const char *line, struct mailhdr *readhdrs); int do_all_the_voodoo_here(int infd, int outfd, int hdrfd, int footfd, const strlist *delhdrs, struct mailhdr *readhdrs, strlist *allhdrs, const char *subjectprefix, int replyto); void scan_headers(FILE *f, struct mailhdr *readhdrs, strlist *allhdrs, strlist *allunfoldeds); mlmmj/include/find_email_adr.h000066400000000000000000000025341502303113500167000ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef FIND_EMAIL_ADR_H #define FIND_EMAIL_ADR_H #include strlist *find_email_adr(const char *str, strlist *retval); #endif /* FIND_EMAIL_ADR_H */ mlmmj/include/getaddrsfromfile.h000066400000000000000000000024441502303113500173040ustar00rootroot00000000000000/* * Copyright (C) 2005 Mads Martin Joergensen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include #include "mlmmj.h" int getaddrsfromfile(strlist *slist, FILE *f, size_t max); mlmmj/include/gethdrline.h000066400000000000000000000023551502303113500161110ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once char *gethdrline(FILE *f,char **unfolded); mlmmj/include/getlistdelim.h000066400000000000000000000023441502303113500164500ustar00rootroot00000000000000/* Copyright 2005 Joel Aelwyn * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef GETLISTDELIM_H #define GETLISTDELIM_H char *getlistdelim(int ctrlfd); #endif /* GETLISTDELIM_H */ mlmmj/include/incindexfile.h000066400000000000000000000023601502303113500164210ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef INCINDEXFILE_H #define INCINDEXFILE_H int incindexfile(int listfd); #endif /* INCINDEXFILE_H */ mlmmj/include/init_sockfd.h000066400000000000000000000024321502303113500162540ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef INIT_SOCKFD_H #define INIT_SOCKFD_H void init_sockfd(int *sockfd, const char *relayhost, unsigned short port); #endif /* INIT_SOCKFD_H */ mlmmj/include/listcontrol.h000066400000000000000000000040021502303113500163270ustar00rootroot00000000000000/* Copyright (C) 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef LISTCONTROL_H #define LISTCONTROL_H #include "mlmmj.h" enum ctrl_e { CTRL_SUBSCRIBE_DIGEST, CTRL_SUBSCRIBE_NOMAIL, CTRL_SUBSCRIBE_BOTH, CTRL_SUBSCRIBE, CTRL_CONFSUB_DIGEST, CTRL_CONFSUB_NOMAIL, CTRL_CONFSUB_BOTH, CTRL_CONFSUB, CTRL_UNSUBSCRIBE_DIGEST, CTRL_UNSUBSCRIBE_NOMAIL, CTRL_UNSUBSCRIBE, CTRL_CONFUNSUB_DIGEST, CTRL_CONFUNSUB_NOMAIL, CTRL_CONFUNSUB, CTRL_BOUNCES, CTRL_RELEASE, CTRL_REJECT, CTRL_PERMIT, CTRL_OBSTRUCT, CTRL_MODERATE, CTRL_HELP, CTRL_FAQ, CTRL_GET, CTRL_LIST, }; struct ctrl_command { char *command; bool accepts_parameter; bool valid_when_closed_list; bool valid_when_closed_sub; enum ctrl_e type; }; struct ctrl_command *get_ctrl_command(const char *controlstr, char **param); int listcontrol(strlist *fromemails, struct ml *ml, const char *controlstr, const char *mlmmjsend, const char *mailname); #endif /* LISTCONTROL_H */ mlmmj/include/log_error.h000066400000000000000000000030461502303113500157540ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef LOG_ERROR_H #define LOG_ERROR_H #include #include #define LOG_ARGS __FILE__, __LINE__, strerror(errno) void log_set_name(const char *name); void log_set_namef(const char *fmt, ...); void log_activate_stderr(void); void log_free_name(void); void log_error(const char *file, int line, const char *errstr, const char *fmt, ...); void log_err(const char *fmt, ...); #endif /* LOG_ERROR_H */ mlmmj/include/log_oper.h000066400000000000000000000024721502303113500155720ustar00rootroot00000000000000/* * Copyright (C) 2005 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef LOG_OPER_H #define LOG_OPER_H int log_oper(int listfd, const char *basename, const char *fmt, ...); #endif /* LOG_OPER_H */ mlmmj/include/mail-functions.h000066400000000000000000000033661502303113500167170ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2023 Mads Martin Joergensen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #define WRITE_BUFSIZE 1024 #include int write_helo(int sockfd, const char *hostname); int write_ehlo(int sockfd, const char *hostname); int write_mail_from(int sockfd, const char *from_addr, const char *extra); int write_rcpt_to(int sockfd, const char *rcpt_addr); int write_custom_line(int sockfd, const char *line); void write_mailbody(int sockfd, FILE *fp, const char *tohdr); int write_replyto(int sockfd, const char *replyaddr); int write_dot(int sockfd); int write_quit(int sockfd); int write_data(int sockfd); int write_rset(int sockfd); mlmmj/include/mlmmj-process.h000066400000000000000000000025251502303113500165530ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once char *get_recipextra_from_env(int ctrlfd); bool addrmatch(const char *listaddr, const char *addr, const char *listdelim, char **recipextra); mlmmj/include/mlmmj-receive.h000066400000000000000000000023731502303113500165200ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MMJML_RECEIVE_H #define MMJML_RECEIVE_H void free_str_array(char **to_free); #endif /* MMJML_RECEIVE_H */ mlmmj/include/mlmmj-send.h000066400000000000000000000031421502303113500160220ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MMJML_SEND_H #define MMJML_SEND_H #include #include #include "send_mail.h" #include "mlmmj.h" int send_mail_many_fd(int sockfd, struct mail *mail, struct ml *ml, int subfd, const char *archivefilename); int send_mail_many_list(int sockfd, struct mail *mail, struct ml *ml, strlist *addrs, const char *archivefilename); int send_mail_verp(int sockfd, strlist *addrs, struct mail *mail, const char *extra); #endif /* MMJML_SEND_H */ mlmmj/include/mlmmj-sub.h000066400000000000000000000023331502303113500156630ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MLMMJ_SUBSCRIBE_H #define MLMMJ_SUBSCRIBE_H #endif /* MLMMJ_SUBSCRIBE_H */ mlmmj/include/mlmmj.h000066400000000000000000000130441502303113500150750ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003, 2004 Mads Martin Joergensen * Copyright (C) 2022-2024 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MLMMJ_GENERIC_INCLUDES #define MLMMJ_GENERIC_INCLUDES #include "config.h" #include #include #include #ifndef __unused #define __unused __attribute__((__unused__)) #endif #ifndef NELEM #define NELEM(array) (sizeof(array) / sizeof((array)[0])) #endif #ifndef __dead2 #define __dead2 __attribute__((__noreturn__)) #endif #define RELAYHOST "127.0.0.1" #define READ_BUFSIZE 2048 #define DEFAULT_RECIPDELIM "+" /* Default recipient delimiter */ #define MODREQLIFE 604800 /* How long time will moderation requests be kept? * 604800s is 7 days */ #define DISCARDEDLIFE 604800 /* How long time will discarded mails be kept? * 604800s is 7 days */ #define CONFIRMLIFE 604800 /* How long time will (un)sub confirmations be kept? * 604800s is 7 days */ #define BOUNCELIFE 432000 /* How long time can addresses bounce before unsubscription happens? 432000s is 5 days Tweakable with control/bouncelife */ #define WAITPROBE 43200 /* How long do we wait for a bounce of the probe mail before concluding the address is no longer bouncing? 43200 is 12 hours */ #define MAINTD_SLEEP 7200 /* How long between maintenance runs when mlmmj-maintd runs daemonized? 7200s is 2 hours */ #define MAINTD_LOGFILE "mlmmj-maintd.lastrun.log" #define DIGESTINTERVAL 604800 /* How long do we collect mails for digests * 604800s is 7 days */ #define DIGESTMAXMAILS 50 /* How many mails can accumulate before we send the * digest */ #define DIGESTMIMETYPE "digest" /* Which sub-type of multipart to use when * sending digest mails */ #define OPLOGFNAME "mlmmj.operation.log" /* logfile to log operations */ #define OPLOGSIZE 524288 #define gen_addr(addr, _ml, _cmd) \ xasprintf(&addr, "%s%s%s@%s", (_ml)->name, (_ml)->delim, _cmd, (_ml)->fqdn) #define gen_addr_cookie(addr, _ml, _cmd, _cookie) \ xasprintf(&addr, "%s%s%s%s@%s", (_ml)->name, (_ml)->delim, _cmd, _cookie, (_ml)->fqdn); struct ml { const char *dir; char *delim; char *name; const char *fqdn; char *addr; int fd; int ctrlfd; }; typedef tll(char *) strlist; typedef enum bounce { BOUNCE_OK, BOUNCE_FAIL, BOUNCE_DONE } bounce_t; #define MAXVERPRECIPS 100 struct mailhdr { const char *token; int valuecount; char **values; }; /* Has to go here, since it's used in many places */ enum subtype { SUB_NORMAL = 0, SUB_DIGEST, SUB_NOMAIL, SUB_FILE, /* For single files (moderator, owner etc.) */ SUB_ALL, /* For listing or unsubscribing all kinds of subscribers */ SUB_BOTH, /* For normal+digest subscription */ SUB_NONE /* For when an address is not subscribed at all */ }; extern char *subtype_strs[7]; /* count matches enum above; defined in subscriberfuncs.c */ enum subreason { SUB_REQUEST = 0, SUB_CONFIRM, SUB_PERMIT, SUB_ADMIN, SUB_BOUNCING, SUB_SWITCH }; extern char * subreason_strs[6]; /* count matches enum above; defined in subscriberfuncs.c */ void print_version(const char *prg); bool parse_lastdigest(char *line, long *lastindex, time_t *lasttime, long *lastissue, const char **errstr); time_t extract_bouncetime(char *line, const char **errstr); int open_subscriber_directory(int listfd, enum subtype typesub, const char **dir); bool unsubscribe(int listfd, const char *address, enum subtype typesub); bounce_t bouncemail(int listfd, const char *theaddress, const char *identifier); void save_lastbouncedmsg(int listfd, const char *address, const char *mailname); char *dsnparseaddr(const char *mailname); int open_listdir(const char *listdir, bool usercheck); void ml_init(struct ml *ml); bool ml_open(struct ml *ml, bool checkuser); void ml_close(struct ml *ml); bool send_probe(struct ml *ml, const char *addr); void parse_content_type(strlist *, char **mime_type, char **boundary); char *find_in_list(strlist *, const char *pattern); typedef enum { ACT_ALLOW = 0, ACT_SEND, ACT_DENY, ACT_MODERATE, ACT_DISCARD, } actions_t; actions_t do_access(strlist *rules, strlist *headers, const char *from, char **msg, char **qualifier); #define MY_ASSERT(expression) if (!(expression)) { \ errno = 0; \ log_error(LOG_ARGS, "assertion failed"); \ exit(EXIT_FAILURE); \ } #define CHECKFULLPATH(name) if(strchr(name, '/') == NULL) { \ errx(EXIT_FAILURE, "All mlmmj binaries have to " \ "be invoked with full path,\n" \ "e.g. /usr/local/bin/%s", name); \ }; #endif /* MLMMJ_GENERIC_INCLUDES */ mlmmj/include/mygetline.h000066400000000000000000000024051502303113500157550ustar00rootroot00000000000000/* Copyright (C) 2002, 2003, 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef MYGETLINE_H #define MYGETLINE_H #define BUFSIZE 256 char *mygetline(int fd); #endif /* #ifndef MYGETLINE_H */ mlmmj/include/prepstdreply.h000066400000000000000000000061651502303113500165240ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2011 Ben Schmidt * Copyright (C) 2023-2025 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef PREPSTDREPLY_H #define PREPSTDREPLY_H #include #include "mlmmj.h" struct text; typedef struct text text; typedef void (*rewind_function)(void *state); typedef const char *(*get_function)(void *state); struct memory_lines_state; typedef struct memory_lines_state memory_lines_state; struct file_lines_state; typedef struct file_lines_state file_lines_state; memory_lines_state *init_memory_lines(const char *lines); void rewind_memory_lines(void *state); const char *get_memory_line(void *state); void finish_memory_lines(memory_lines_state *s); file_lines_state *init_file_lines(const char *filename, char truncate); file_lines_state *init_file_lines_fd(int fd, char truncate); file_lines_state *init_file_lines_data(int fd, char truncate, void *data); void rewind_file_lines(void *state); const char *get_file_line(void *state); const char *get_msgid_line(void *state); void finish_file_lines(file_lines_state *s); char *substitute(const char *line, int listfd, int ctrlfd, text *txt); text *open_text_fd(int fd); text *open_text_file(int listfd, const char *filename); text *open_text(int listfd, const char *purpose, const char *action, const char *reason, const char *type, const char *compat); void register_unformatted(text *txt, const char *token, const char *subst); void register_originalmail(text *txt, const char *mailname); void register_formatted(text *txt, const char *token, rewind_function rew, get_function get, void * state); char *get_processed_text_line(text *txt, bool headers, struct ml *ml); bool prepstdreply_to(text *txt, struct ml *ml, const char *from, const char *to, const char *replyto, int tofd, const char *messageid); char *prepstdreply(text *txt, struct ml *ml, const char *from, const char *to, const char *replyto); void close_text(text *txt); void register_default_unformatted(text *txt, struct ml *ml); #endif /* PREPSTDREPLY_H */ mlmmj/include/remailfile.h000066400000000000000000000024041502303113500160700ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef REMAILFILE_H #define REMAILFILE_H int remailfile(const char *mailfilename, int deletewhensent); #endif /* REMAILFILE_H */ mlmmj/include/send_digest.h000066400000000000000000000024661502303113500162570ustar00rootroot00000000000000/* * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once int send_digest(struct ml *ml, int lastindex, int index, int issue, const char *addr, const char *mlmmjsend); mlmmj/include/send_help.h000066400000000000000000000025631502303113500157260ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once void send_help(struct ml *ml, const char *queuefilename, const char *emailaddr) __dead2; void send_help_noexit(struct ml *ml, const char *queuefilename, const char *emailaddr); mlmmj/include/send_list.h000066400000000000000000000030351502303113500157440ustar00rootroot00000000000000/* * Copyright (C) 2005 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include "mlmmj.h" void send_list(struct ml *ml, const char *emailaddr) __dead2; struct subs_list_state; struct subs_list_state *init_subs_list(int fd, const char *dirname); void rewind_subs_list(void *state); const char *get_sub(void *state); void finish_subs_list(struct subs_list_state *s); void print_subs(int fd, struct subs_list_state *s); mlmmj/include/send_mail.h000066400000000000000000000040271502303113500157150ustar00rootroot00000000000000/* * Copyright (C) 2004, 2003, 2004 Mads Martin Joergensen * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include #include #include #include "mlmmj.h" struct mail { const char *from; const char *to; const char *replyto; FILE *fp; bool addtohdr; }; int newsmtp(struct ml *ml, const char *relayhost); int initsmtp(int *sockfd, const char *relayhost, unsigned short port, const char *heloname); int endsmtp(int *sockfd); int send_mail(int sockfd, struct mail *mail, int listfd, int ctrlfd, bool bounce); int do_bouncemail(int listfd, int ctrlfd, const char *from); bool send_single_mail(struct mail *mail, struct ml *ml, bool bounce); void save_queue(const char *queuefilename, struct mail *mail); bool requeuemail(int listfd, int index, strlist *addrs, const char *addr); char *get_bounce_from_adr(const char *recipient, struct ml *ml, int index); int get_index_from_filename(const char *filename); mlmmj/include/statctrl.h000066400000000000000000000024061502303113500156210ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef STATCTRL_H #define STATCTRL_H #include bool statctrl(int ctrlfd, const char *ctrlstr); #endif /* STATCTRL_H */ mlmmj/include/strgen.h000066400000000000000000000033111502303113500152570ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2023 Mads Martin Joergensen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef STRGEN_H #define STRGEN_H #include char *random_str(void); char *random_plus_addr(const char *addr); char *genlistname(const char *listaddr); const char *genlistfqdn(const char *listaddr); char *hostnamestr(void); char *mydirname(const char *path); const char *mybasename(const char *path); char *genmsgid(const char *fqdn); char *gendatestr(void); char *decode_qp(const char *qpstr, bool qformat); bool splitlistaddr(const char *listaddr, char **listname, const char **listfqdn); #endif /* STRGEN_H */ mlmmj/include/subscriberfuncs.h000066400000000000000000000047651502303113500171750ustar00rootroot00000000000000/* * Copyright (C) 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include struct subscription { bool send_welcome_email; const char *modstr; enum subreason reasonsub; enum subtype typesub; bool gensubscribed; bool subconfirm; bool force; bool quiet; const char *mlmmjsend; }; bool find_subscriber(int fd, const char *address); int is_subbed_in(int fd, const char *subddirname, const char *address); enum subtype is_subbed(int listfd, const char *address, bool both); char *get_subcookie_content(int listfd, bool unsub, const char *param); void notify_sub(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub); void generate_subscription(struct ml *ml, const char *subaddr, enum subtype typesub, bool sub); void generate_subconfirm(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub); void send_confirmation_mail(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub); bool do_unsubscribe(struct ml *ml, const char *addr, enum subtype typesub, enum subreason reasonsub, bool inform_not_subscribed, bool confirm_unsubscription, bool quiet, bool send_goodbye_mail); void mod_get_addr_and_type(struct ml *ml, const char *modstr, char **addrptr, enum subtype *subtypeptr); bool do_subscribe(struct ml *ml, struct subscription *sub, const char *addr); mlmmj/include/tllist.h000066400000000000000000000301611502303113500152730ustar00rootroot00000000000000#pragma once #include #include #include #define TLL_PASTE2( a, b) a##b #define TLL_PASTE( a, b) TLL_PASTE2( a, b) /* Utility macro to generate a list element struct with a unique struct tag */ #define TLL_UNIQUE_INNER_STRUCT(TYPE, ID) \ struct TLL_PASTE(__tllist_ , ID) { \ TYPE item; \ struct TLL_PASTE(__tllist_, ID) *prev; \ struct TLL_PASTE(__tllist_, ID) *next; \ } *head, *tail; /* * Defines a new typed-list type, or directly instantiate a typed-list variable * * Example a, declare a variable (list of integers): * tll(int) my_list; * * Example b, declare a type, and then use the type: * tll(int, my_list_type); * struct my_list_type my_list; */ #define tll(TYPE) \ struct { \ TLL_UNIQUE_INNER_STRUCT(TYPE, __COUNTER__) \ size_t length; \ } /* Initializer: tll(int) my_list = tll_init(); */ #define tll_init() {.head = NULL, .tail = NULL, .length = 0} /* Length/size of list: printf("size: %zu\n", tll_length(my_list)); */ #define tll_length(list) (list).length /* Adds a new item to the back of the list */ #define tll_push_back(list, new_item) \ do { \ tll_insert_after(list, (list).tail, new_item); \ if ((list).head == NULL) \ (list).head = (list).tail; \ } while (0) /* Adds a new item to the front of the list */ #define tll_push_front(list, new_item) \ do { \ tll_insert_before(list, (list).head, new_item); \ if ((list).tail == NULL) \ (list).tail = (list).head; \ } while (0) /* * Iterates the list. is an iterator pointer. You can access the * list item with ->item: * * tll(int) my_list = vinit(); * tll_push_back(my_list, 5); * * tll_foreach(my_list i) { * printf("%d\n", i->item); * } */ #define tll_foreach(list, it) \ for (__typeof__(*(list).head) *it = (list).head, \ *it_next = it != NULL ? it->next : NULL; \ it != NULL; \ it = it_next, \ it_next = it_next != NULL ? it_next->next : NULL) /* Same as tll_foreach(), but iterates backwards */ #define tll_rforeach(list, it) \ for (__typeof__(*(list).tail) *it = (list).tail, \ *it_prev = it != NULL ? it->prev : NULL; \ it != NULL; \ it = it_prev, \ it_prev = it_prev != NULL ? it_prev->prev : NULL) /* * Inserts a new item after , which is an iterator. I.e. you can * only call this from inside a tll_foreach() or tll_rforeach() loop. */ #define tll_insert_after(list, it, new_item) \ do { \ __typeof__((list).head) __e = malloc(sizeof(*__e)); \ __e->item = (new_item); \ __e->prev = (it); \ __e->next = (it) != NULL ? (it)->next : NULL; \ if ((it) != NULL) { \ if ((it)->next != NULL) \ (it)->next->prev = __e; \ (it)->next = __e; \ } \ if ((it) == (list).tail) \ (list).tail = __e; \ (list).length++; \ } while (0) /* * Inserts a new item before , which is an iterator. I.e. you can * only call this from inside a tll_foreach() or tll_rforeach() loop. */ #define tll_insert_before(list, it, new_item) \ do { \ __typeof__((list).head) __e = malloc(sizeof(*__e)); \ __e->item = (new_item); \ __e->prev = (it) != NULL ? (it)->prev : NULL; \ __e->next = (it); \ if ((it) != NULL) { \ if ((it)->prev != NULL) \ (it)->prev->next = __e; \ (it)->prev = __e; \ } \ if ((it) == (list).head) \ (list).head = __e; \ (list).length++; \ } while (0) /* * Removes an entry from the list. is an iterator. I.e. you can * only call this from inside a tll_foreach() or tll_rforeach() loop. */ #define tll_remove(list, it) \ do { \ assert((list).length > 0); \ __typeof__((list).head) __prev = it->prev; \ __typeof__((list).head) __next = it->next; \ if (__prev != NULL) \ __prev->next = __next; \ else \ (list).head = __next; \ if (__next != NULL) \ __next->prev = __prev; \ else \ (list).tail = __prev; \ free(it); \ (list).length--; \ } while (0) /* Same as tll_remove(), but calls free_callback(it->item) */ #define tll_remove_and_free(list, it, free_callback) \ do { \ free_callback((it)->item); \ tll_remove((list), (it)); \ } while (0) #define tll_front(list) (list).head->item #define tll_back(list) (list).tail->item /* * Removes the first element from the list, and returns it (note: * returns the *actual* item, not an iterator. */ #define tll_pop_front(list) __extension__ \ ({ \ __typeof__((list).head) it = (list).head; \ __typeof__((list).head->item) __ret = it->item; \ tll_remove((list), it); \ __ret; \ }) /* Same as tll_pop_front(), but returns/removes the *last* element */ #define tll_pop_back(list) __extension__ \ ({ \ __typeof__((list).tail) it = (list).tail; \ __typeof__((list).tail->item) __ret = it->item; \ tll_remove((list), it); \ __ret; \ }) /* Frees the list. This call is *not* needed if the list is already empty. */ #define tll_free(list) \ do { \ tll_foreach(list, __it) \ free(__it); \ (list).length = 0; \ (list).head = (list).tail = NULL; \ } while (0) /* Same as tll_free(), but also calls free_callback(item) for every item */ #define tll_free_and_free(list, free_callback) \ do { \ tll_foreach(list, __it) { \ free_callback(__it->item); \ free(__it); \ } \ (list).length = 0; \ (list).head = (list).tail = NULL; \ } while (0) #define tll_sort(list, cmp) \ do { \ __typeof((list).head) __p; \ __typeof((list).head) __q; \ __typeof((list).head) __e; \ __typeof((list).head) __t; \ int __insize, __nmerges, __p_size, __q_size; \ if ((list).head == NULL) \ break; \ __insize = 1; \ while (1) { \ __p = (list).head; \ (list).head = NULL; \ __t = NULL; \ __nmerges = 0; \ while (__p != NULL) { \ __nmerges++; \ __q = __p; \ __p_size = 0; \ for (int _i = 0; _i < __insize; _i++) { \ __p_size++; \ __q = __q->next; \ if (__q == NULL) \ break; \ } \ __q_size = __insize; \ while (__p_size > 0 || (__q_size > 0 && __q != NULL)) { \ if (__p_size == 0) { \ __e = __q; \ __q = __q->next; \ __q_size--; \ } else if (__q_size == 0 || __q == NULL) { \ __e = __p; \ __p = __p->next; \ __p_size--; \ } else if (cmp(__p->item, __q->item) <= 0) { \ __e = __p; \ __p = __p->next; \ __p_size--; \ } else { \ __e = __q; \ __q = __q->next; \ __q_size--; \ } \ if (__t != NULL) { \ __t->next = __e; \ } else { \ (list).head = __e; \ } \ __e->prev = __t; \ __t = __e; \ } \ __p = __q; \ } \ (list).tail = __t; \ __t->next = NULL; \ __insize *= 2; \ if (__nmerges <= 1) \ break; \ } \ } while (0) mlmmj/include/unistr.h000066400000000000000000000034631502303113500153110ustar00rootroot00000000000000/* Copyright (C) 2005 Morten K. Poulsen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef UNISTR_H #define UNISTR_H typedef unsigned int unistr_char; typedef struct _unistr { size_t len; size_t alloc_len; unistr_char *chars; } unistr; unistr *unistr_new(void); void unistr_free(unistr *str); void unistr_append_char(unistr *str, unistr_char uc); void unistr_append_usascii(unistr *str, const char *binary, size_t bin_len); void unistr_append_utf8(unistr *str, const char *binary, size_t bin_len); void unistr_append_iso88591(unistr *str, const char *binary, size_t bin_len); char *unistr_to_utf8(const unistr *str); char *unistr_header_to_utf8(const char *str); char *unistr_utf8_to_header(const char *str); char *unistr_escaped_to_utf8(const char *str); #endif mlmmj/include/utils.h000066400000000000000000000033441502303113500151230ustar00rootroot00000000000000/* * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include #include #include #include #include #include "mlmmj.h" char *lowercase(const char *); intmax_t strtoim(const char *np, intmax_t minval, intmax_t maxval, const char **errpp); uintmax_t strtouim(const char *, uintmax_t, uintmax_t, const char **); void exec_or_die(const char *arg, ...); int exec_and_wait(const char *arg, ...); time_t strtotimet(const char *np, const char **errpp); bool lock(int fd, bool write); bool find_email(strlist *list, strlist *matches, const char *delim, char **recipextra); char *readlf(int fd, bool oneline); mlmmj/include/wrappers.h000066400000000000000000000026661502303113500156340ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef WRAPPERS_H #define WRAPPERS_H #include ssize_t readn(int fd, void *vptr, size_t n); int random_int(void); int dumpfd2fd(int infd, int outfd); int copy_file(int infd, int outfd, size_t bufsiz); int process_headers_fd(int infd, int outfd,const char *from); #endif /* WRAPPERS_H */ mlmmj/include/xmalloc.h000066400000000000000000000016261502303113500154230ustar00rootroot00000000000000#pragma once #include #include #include #include static inline void *xmalloc(size_t size) { void *ptr = malloc(size); if (ptr == NULL) abort(); return (ptr); } static inline void *xcalloc(size_t n, size_t size) { void *ptr = calloc(n, size); if (ptr == NULL) abort(); return (ptr); } static inline void *xrealloc(void *ptr, size_t size) { ptr = realloc(ptr, size); if (ptr == NULL) abort(); return (ptr); } static inline char *xstrdup(const char *str) { char *s = strdup(str); if (s == NULL) abort(); return (s); } static inline char *xstrndup(const char *str, size_t n) { char *s = strndup(str, n); if (s == NULL) abort(); return (s); } static inline int xasprintf(char **ret, const char *fmt, ...) { va_list ap; int i; va_start(ap, fmt); i = vasprintf(ret, fmt, ap); va_end(ap); if (i < 0 || *ret == NULL) abort(); return (i); } mlmmj/include/xstring.h000066400000000000000000000020451502303113500154560ustar00rootroot00000000000000#ifndef __XSTRING_H_ #define __XSTRING_H_ #include #include #include struct xstring { char* buf; size_t size; FILE* fp; }; typedef struct xstring xstring; static inline xstring * xstring_new(void) { xstring *str; str = calloc(1, sizeof(*str)); if (str == NULL) abort(); str->fp = open_memstream(&str->buf, &str->size); if (str->fp == NULL) abort(); return (str); } static inline void xstring_reset(xstring *str) { if (str->buf) memset(str->buf, 0, str->size); rewind(str->fp); } static inline void xstring_free(xstring *str) { if (str == NULL) return; fclose(str->fp); free(str->buf); free(str); } #define xstring_renew(s) \ do { \ if (s) { \ xstring_reset(s); \ } else { \ s = xstring_new(); \ } \ } while(0) static inline char * xstring_get(xstring *str) { if (str == NULL) return (NULL); fclose(str->fp); char *ret = str->buf; free(str); return (ret); } #endif mlmmj/kyua.conf.in000066400000000000000000000001631502303113500144100ustar00rootroot00000000000000syntax(2) test_suites.mlmmj.top_srcdir = "@abs_top_srcdir@" test_suites.mlmmj.top_builddir = "@abs_top_builddir@" mlmmj/listtexts/000077500000000000000000000000001502303113500142265ustar00rootroot00000000000000mlmmj/listtexts/Makefile.am000066400000000000000000000001441502303113500162610ustar00rootroot00000000000000## Process this file with automake to produce Makefile.in nobase_dist_textlib_DATA = $(srcdir)/*/* mlmmj/listtexts/ast/000077500000000000000000000000001502303113500150155ustar00rootroot00000000000000mlmmj/listtexts/ast/confirm000066400000000000000000000032421502303113500163760ustar00rootroot00000000000000%ifaction sub%Subject: Confirmar suscripción a $list$@$domain$%endif% %ifaction unsub%Subject: Confirmar des-suscripción de $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Un alministrador %endif% %ifreason request% Dalguién (esperamos que tu) %endif% pidió que la to direición de corréu <$subaddr$> s'amestara %iftype normal% a la llista. Esto quier dicir que cuando s'unvie un mensaxe a la llista, recibirás una copia del mesmu. %endif% %iftype digest% a la llista, pa recibir resumes. Esto quier dicir que recibirás múltiples mensaxes nun únicu mensaxe de corréu, a intervalos regulares, o cuando s'acumulen munchos mensaxes. %endif% %iftype nomail% a la llista, ensin entrega de corréu. Esto quier dicir que nun recibirás dengún mensaxe de la llista, pero tas consideráu miembru. Esto significa, por exemplu, que podrás escribir a una llista na que sólo los suscriptores puen facelo, mientres sigues la llista per un archivu web o otra direición de corréu suscrita. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Un alministrador %endif% %ifreason request% Dalguién (esperamos que tu) %endif% pidió que la direición de corréu <$subaddr$> se desanicie de la llista. %endif% %wrap%Pa confirmar que quies facelo, unvia un mensaxe a <$confirmaddr$> lo que de vezu pue facese simplemente respondiendo a esti mensaxe. L'asuntu y cuerpu del mensaxe puen ser cualesquier cosa. Tres facelo, tendríes de recibir una contestación pa informate de que la operación foi correuta. Si nun quies facer esto, simplemente salta esti mensaxe. mlmmj/listtexts/ast/deny000066400000000000000000000043361502303113500157050ustar00rootroot00000000000000%ifaction sub%Subject: Nun se pudo suscribir $list$@$domain$%endif% %ifaction unsub%Subject: Nun se pudo des-suscribir $list$@$domain$%endif% %ifaction release reject%Subject: Nun se pudo moderar $list$@$domain$%endif% %ifaction permit obstruct%Subject: Nun se pudo supervisar $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Nun se pudo facer la suscripción a la llista %ifreason disabled% porque la versión %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% ensin corréu %endif% de la llista ta desactivada. %endif% %ifreason closed% porque nun se permite que la xente se suscriba a esta llista per corréu. %endif% %ifreason subbed% porque yá tas suscritu. %endif% %ifreason expired% porque pasó muncho tiempu ensin qu'un supervisor te permita la entrada. %endif% %ifreason obstruct% porque un supervisor te torgó la entrada. %endif% %endif% %ifaction unsub% %^%%wrap%Nun se pudo des-suscribite de la llista %ifreason unsubbed% porque nun tas suscritu. %^%%wrap%Si tas recibiendo mensaxes, seique teas suscritu con otra direición de corréu distinta. Pa saber con qué direición tas subscritu, mira nel mensaxe que te da la bienvenida a la llista, o mira na testera "Return-Path" d'un mensaxe del corréu que recibes de la llista. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Nun pudisti desaniciar el mensaxe conseñáu de la llista %endif% %ifaction reject% Nun pudisti refugar el mensaxe conseñáu %endif% %ifreason notfound% porque nun se pudo alcontrar. Seique otru moderator yá lu desanició o lu refugó, o espiró. %endif% %ifreason moderators% porque nun yes moderador de la llista. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Nun pudisti permitir la solicitú de suscripción conseñada %endif% %ifaction obstruct% Nun pudisti torgar la solicitú de suscripción conseñada %endif% %ifreason notfound% porque nun se pudo alcontrar. Seique otru moderator yá lu permitiera o lu torgara, o espiró. %endif% %ifreason gatekeepers% porque nun yes supervisor de la llista. %endif% %endif% mlmmj/listtexts/ast/deny-post000066400000000000000000000035611502303113500166670ustar00rootroot00000000000000Subject: Mensaxe a $list$@$domain$ denegáu: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%El mensaxe de <$posteraddr$> con asuntu "$subject$" nun se pudo entregar a la llista %ifreason maxmailsize% porque pasó del tamañu máximu permitíu de mensaxe de $maxmailsize$ bytes. %endif% %ifreason tocc% porque la direición de la llista nun ta nes testeres Pa: o CC:. %endif% %ifreason access% por una regla d'accesu configurada pol alministrador de la llista. %endif% %ifreason expired% porque pasó muncho tiempu ensin que dengún moderador lu lliberara. %endif% %ifreason reject% porque un moderador refugólu. %endif% %ifreason subonlypost% porque nun yes suscriptor de la llista. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Si quies suscribite, tendrás de comunicate con un alministrador de la llista. Pa facelo pues unviar un corréu al propietariu a <$list+$owner@$domain$>. %endif% %^%%wrap%Si pienses que yá tas suscritu, ye probable que te suscribieras con una direición de corréu distinta. Pa saber la direición cola que tas suscritu, mira nel mensaxe de bienvenida a la llista, o mira na testera "Return-Path" d'un mensaxe de corréu que recibas de la llista. %endif% %ifreason maxmailsize% %^%(El principiu del mensaxe denegáu ta más abaxo.) %else% %^%(El mensaxe denegáu ta más abaxo.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/ast/digest000066400000000000000000000002251502303113500162160ustar00rootroot00000000000000Subject: Resume de $list$@$domain$ volume $digestissue$ ($digestinterval$) Asuntos (mensaxes del $digestfirst$ al $digestlast$): - %digestthreads% mlmmj/listtexts/ast/faq000066400000000000000000000001631502303113500155070ustar00rootroot00000000000000Subject: Entrugues y rempuestes frecuentes de $list$@$domain$ Sentímoslo, entá nun hai denguna FAQ disponible. mlmmj/listtexts/ast/finish000066400000000000000000000024351502303113500162240ustar00rootroot00000000000000%ifaction unsub%Subject: Despedida de $list$@$domain$%endif% %ifaction release reject%Subject: Moderáu $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Guardáu $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Unviáu a $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Gracies por confirmar que dexes de tar suscritu. %endif% %ifreason admin% Un alministrador te desanició de la llista. %else% Agora tas desaniciáu de la llista. %endif% %endif% %ifaction release% %^%%wrap%Lliberasti correutamente'l mensaxe de <$posteraddr$> con asuntu "$subject$" a la llista. %endif% %ifaction reject% %^%%wrap%Refugasti correutamente'l mensaxe de <$posteraddr$> con asuntu "$subject$". %endif% %ifaction permit% %^%%wrap%Permitisti correutamente que <$subaddr$> se xuna a la llista. %endif% %ifaction obstruct% %^%%wrap%Torgasti correutamente que <$subaddr$> se xuniera a la llista. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Gracies por confirmar %endif% %ifreason release% Un moderador lliberó %endif% %ifreason request% Gracies por %endif% el to mensaxe con asuntu "$subject$". Agora ta distribuyendose a la llista. %endif% mlmmj/listtexts/ast/finish-sub000066400000000000000000000023151502303113500170100ustar00rootroot00000000000000Subject: Bienveníu a $list$@$domain$ %text prologue% %wrap% %ifreason request% Gracies por solicitar xunite a nós. %endif% %ifreason confirm% Gracies por confirmar la to suscripción. %endif% %ifreason permit% Un supervisor te permitió xunite a nós. %endif% %ifreason switch% La to suscripción camudóse a la versión %else% %ifreason admin% Un alministrador te subscribió a la versión %else% Agora tas amestáu a la versión %endif% %endif% %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% ensin corréu %endif% de la llista. %wrap%La direición de corréu cola que tas suscritu ye <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Si nel futuru quies des-suscribite, tendrás de ponete'n contautu con un alministrador de la llista. Pa facelo pues mandar un corréu a <$list+$owner@$domain$>. %else% %^%%wrap%Si nel futuru quies des-suscribite, manda un mensaxe a <$list+$unsubscribe@$domain$> usando esta direición de corréu. L'asuntu y cuerpu del mensaxe pue ser cualesquier cosa. Darréu recibirás una confirmación o más instrucciones. %endif% %wrap%Pa más información y ayuda tocante a esta llista, unvia un mensaxe a <$list+$help@$domain$>. mlmmj/listtexts/ast/gatekeep-sub000066400000000000000000000010721502303113500173140ustar00rootroot00000000000000Subject: Solicitú de suscripción a $list$@$domain$: $subaddr$ %text prologue% %wrap%Hebo una solicitú de <$subaddr$> pa xunise a la versión %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% ensin corréu %endif% de la llista. %wrap%Pa permitilo, unvia un mensaxe a <$permitaddr$> lo que de vezu pue facese con sólo contestar a esti mensaxe. %wrap%Si nun quies facer esto, o bien pues unviar un mensaxe a <$obstructaddr$> o simplemente escaezte d'esti mensaxe. Los siguientes supervisores recibieron esti corréu: - %gatekeepers% mlmmj/listtexts/ast/help000066400000000000000000000056151502303113500156770ustar00rootroot00000000000000Subject: Información de $list$@$domain$ %text prologue% Equí hai dalguna información tocante a la llista. Pues subscribite a les siguientes versiones: - %wrap%La versión normal: Cada vegada que s'unvia un mensaxe a la llista, los suscriptores reciben una copia del mesmu. %ifcontrol closedlist closedlistsub% Pa subscribite comunicate con un alministrador de la llista. %else% Pa subscribite manda un corréu a <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%La versión resumida: Los suscriptores reciben dellos mensaxes nun únicu corréu, a intervalos regulares, o cuando s'acumulen mensaxes abondo. %ifcontrol closedlist closedlistsub% Pa subscribite comunicate con un alministrador de la llista. %else% Pa subscribite manda un corréu a <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%La versión ensin corréu: Los suscriptores nun reciben dengunu de los mensaxes de la llista. Poro, esto significa que puen espublizar nuna llista onde namái los suscriptores puen facelo, mentanto siguen la llista per un archivu web o per otra direición de corréu suscrita. %ifcontrol closedlist closedlistsub% Pa subscribite comunicate con un alministrador de la llista. %else% Pa subscribite manda un corréu a <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%La llista tien supervisores que revisarán les solicitúes de suscripción enantes de permitir nuevos miembros. %endif% %ifcontrol closedlist% %^%%wrap%Pa des-subscribite comunicate con un alministrador de la llista. %else% %^%%wrap%Pa des-subscribite manda un corréu a <$list+$unsubscribe@$domain$>. %endif% %wrap%Los mensaxes s'asoleyen mandando un corréu a <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Sicasí, namái los suscriptores puen escribir a la llista. %endif%%endif% %ifcontrol moderated% %^%%wrap%La llista tien moderadores que revisarán los mensaxes enantes de lliberalos a la llista. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%La llista tien moderadores que revisarán los mensaxes de los non-suscriptores enantes de lliberalos a la llista. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%La llista tamién tien regles d'accesu que puen afeutar a quién pue mandar mensaxes y qué mensaxes se moderen. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Toles persones %else% Los suscriptores %endif% puen rcuperar el mensaxe númberu N del archivu de la llista unviando un mensaxe a <$list+$get-N@$domain$> (camuda N pol númberu del mensaxe deseáu). %endif%%endif% %wrap%Pues recuperar el documentu d'entrugues frecuentes de la llista unviando un mensaxe a <$list+$faq@$domain$>. %wrap%Pa comunicate col propietariu de la llista, manda un mensaxe a <$list+$owner@$domain$>. mlmmj/listtexts/ast/list000066400000000000000000000006761502303113500157240ustar00rootroot00000000000000Subject: Suscriptores a $list$@$domain$ %text prologue% %wrap%Esta ye la llista de suscriptores %iftype all% (a toles versiones de la llista): %else% a la versión %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% ensin corréu %endif% de la llista: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/ast/moderate-post000066400000000000000000000027441502303113500175320ustar00rootroot00000000000000Subject: Por favor, modera $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Se recibió un mensaxe de <$posteraddr$> col asuntu "$subject$" unviáu pa espublizar. Te pedimos que lu moderes %ifreason modnonsubposts% porque'l remitente nun ye suscriptor. %endif% %ifreason moderated% porque esta ye una llista moderada. %endif% %ifreason access% por una regla d'accesu. %endif% El mensaxe ta más abaxo. %wrap%Pa lliberalu a la llista, unvia un mensaxe a <$releaseaddr$> pa lo que de vezu val con simplemente responder a esti mensaxe. %ifcontrol subonrelease% %^%%wrap%Si quies, pues simultaneamante lliberar el mensaxe y suscribir al remitente unviando un mensaxe a una de les siguientes direiciones:%nowrap% %^%- %wrap%Versión normal: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Versión resumida: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Versión ensin corréu: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Si nun quies facer denguna d'estes coses, o manda un mensaxe a <$rejectaddr$> o simplemente salta esti mensaxe. Recibieron esti corréu los siguientes moderadores: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/ast/notify000066400000000000000000000021151502303113500162470ustar00rootroot00000000000000%ifaction sub%Subject: Suscritu a $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Des-suscritu de $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%La direición <$subaddr$> suscribiose a la versión %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% ensin corréu %endif% de la llista %ifreason request% porque se recibió una solicitú pa xunise. %endif% %ifreason confirm% porque se confirmó una solicitú pa xunise. %endif% %ifreason admin% por mandatu d'un alministrador. %endif% %ifreason permit% porque lo permitió un supervisor. %endif% %endif% %ifaction unsub% %^%%wrap%La direición <$subaddr$> se des-suscribió de la llista %ifreason request% porque se recibió una solicitú pa desaniciar la suscripción. %endif% %ifreason confirm% porque se confirmó una solicitú pa desaniciar la suscripción. %endif% %ifreason admin% por mandatu d'un alministrador. %endif% %ifreason bouncing% porque tien rebotes d'hai demasiao tiempu. %endif% %endif% mlmmj/listtexts/ast/probe000066400000000000000000000004341502303113500160500ustar00rootroot00000000000000Subject: Mensaxes rebotaos de $list$@$domain$ %text prologue% Dellos mensaxes pa ti nun se pudieron entregar. Si tas viendo esti mensaxe quier dicir que les coses vuelven a ser normales, y esto ye namái pa informate. Esta ye la llista de los mensaxes rebotaos: - %bouncenumbers% mlmmj/listtexts/ast/prologue000066400000000000000000000001321502303113500165700ustar00rootroot00000000000000%wrap%Bones, esti ye'l programa Mlmmj xestionando la llista de corréu <$list$@$domain$>. mlmmj/listtexts/ast/subrelease000066400000000000000000000020071502303113500170710ustar00rootroot00000000000000%^%%wrap%Sicasí, esta ye una llista abierta. Si quies, pues al mesmu tiempu suscribite y lliberar el mensaxe unviando un corréu a <$listsubreleaseaddr$> lo que de vezu pue facese simplemente respondiendo a esti mensaxe. L'asuntu y cuerpu del mensaxe puen ser cualesquier cosa. %ifncontrol nodigestsub% %^%%wrap%O al mesmu tiempu pues suscribite a la versión resumida de la llista y lliberar el mensaxe unviando un corréu a <$digestsubreleaseaddr$> y recibirás múltiples mensaxes nun únicu corréu, a intervalos regulares, o cuando s'acumule gran cantidá de mensaxes. %endif% %ifncontrol nonomailsub% %^%%wrap%O al mesmu tiempu pues suscribite a la versión ensin corréu de la llista y lliberar el mensaxe unviando un corréu a <$nomailsubreleaseaddr$> y nun recibirás los mensaxes de la llista. Esto significa que podríes nun ver les rempuestes al to mensaxe, nun siendo que sigas la llista usando un archivu web o teas suscritu con otra direición de corréu a otra versión de la llista. %endif% mlmmj/listtexts/ast/wait-post000066400000000000000000000016571502303113500167000ustar00rootroot00000000000000Subject: Esperando lliberación a $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%El mensaxe de <$posteraddr$> col asuntu "$subject$" s'unvió a la llista. Sicasí, se pidió que los moderadores lu revisen enantes de lliberalu a la llista %ifreason moderated% porque esta ye una llista moderada. %endif% %ifreason access% por una regla d'accesu. %endif% %ifreason modnonsubposts% porque nun yes suscriptor. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (El mensaxe ta más abaxo.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/ast/wait-sub000066400000000000000000000003311502303113500164700ustar00rootroot00000000000000Subject: Esperando permisu pa xunite a $list$@$domain$ %text prologue% %wrap%Recibióse la to solicitú pa xunite a la llista. Sicasí, ta pidiéndose a los supervisores que la revisen enantes de permitite facelo. mlmmj/listtexts/cs/000077500000000000000000000000001502303113500146335ustar00rootroot00000000000000mlmmj/listtexts/cs/confirm000066400000000000000000000031501502303113500162120ustar00rootroot00000000000000%ifaction sub%Subject: Potvrzení přihlášení do $list$@$domain$%endif% %ifaction unsub%Subject: Potvrzení odhlášení z $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Správce %endif% %ifreason request% Někdo (doufáme, že vy) %endif% vyžádal přidání vaší emailové adresy <$subaddr$> %iftype normal% do konference. To znamená, že kdykoli, když někdo pošle zprávu do konference, dostanete kopii této zprávy. %endif% %iftype digest% do Digest verze konference. To znamená, že zprávy zaslané do konference budete dostávat v jedné zprávě. Buďto po uplynutí pravidelné lhůty, nebo až se naschromáždí dostatek zpráv. %endif% %iftype nomail% do No-mail verze konference. To znamená, že nebudete dostávat žádné zprávy, ale jste považován za člena konference. Takže pokud je někde přístupný archiv, můžete jej procházet a hlavně můžete do konference zasílat zprávy (a být třeba prihlášen ještě pod jinou adresou). %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Správce %endif% %ifreason request% Někdo (doufáme, že vy) %endif% požádal o vyřazení adresy <$subaddr$> z konference. %endif% %wrap%Pro potvrzení odhlášení zašlete prosím zprávu na <$confirmaddr$>, což většinou znamená jen odpovědět na tento email. Předmět a obsah mailu nehrají roli, může to být cokoli. Až tak učiníte, měl/a byste dostat zprávu potvrzující úspěch odhlášení. Pokud si akci nepřejete, prostě tento email ignorujte. mlmmj/listtexts/cs/deny000066400000000000000000000045651502303113500155270ustar00rootroot00000000000000%ifaction sub%Subject: Není možné přihlásit se do $list$@$domain$%endif% %ifaction unsub%Subject: Není možné odhlásit se z $list$@$domain$%endif% %ifaction release reject%Subject: Není možné moderovat $list$@$domain$%endif% %ifaction permit obstruct%Subject: Není možné spravovat $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Není možné přihlásit se do konference, %ifreason disabled% protože %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% verze zasílání je vypnutá. %endif% %ifreason closed% protože je zakázáno přihlásit se prostřednictvím zaslání zprávy. %endif% %ifreason subbed% protože adresa je již do konference přihlášená. %endif% %ifreason expired% protože uplynulo příliš mnoho času a nikdo neschválil žádost. %endif% %ifreason obstruct% protože žádost o přihlášení byla zamítnuta. %endif% %endif% %ifaction unsub% %^%%wrap%Není možné odhlásit se z konference, %ifreason unsubbed% protože adresa není přihlášena. %^%%wrap%Pokud si myslíte (nebo víte), že jste členem konference, jste pravděpodobně přihlášen/a s jinou emailovou adresou. Můžete ji zjistit z uvítacího emailu při přihlášení do konference, který jste odbržel/a. (Podívejte se na pole "Return-Path" v hlavičce uvítacího emailu.) %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Není možné uvolnit/rozeslat zprávu do konference, %endif% %ifaction reject% Není možné zamítnout zprávu do konference, %endif% %ifreason notfound% protože zprávu nejde nalézt. Možná ji rozeslal/zamítnul někdo jiný (jiný moderátor), nebo již požadavek vypršel. %endif% %ifreason moderators% protože nejste moderátorem konference. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Není možné schválit požadavek na přihlášení do konference, %endif% %ifaction obstruct% Není možné zamítnout požadavek na přihlášení do konference, %endif% %ifreason notfound% protože ho nejde nalézt. Možná ho rozeslal/zamítnul někdo jiný (jiný správce), nebo již požadavek vypršel. %endif% %ifreason gatekeepers% protože nejste správcem konference. %endif% %endif% mlmmj/listtexts/cs/deny-post000066400000000000000000000037761502303113500165150ustar00rootroot00000000000000Subject: Zaslat email do $list$@$domain$ není možné ($subject$) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Zprávu od <$posteraddr$> s předmětem "$subject$" není možné doručit. %ifreason maxmailsize% Zpráva je příliš velká, maximální velikost zprávy je $maxmailsize$ bajtů. %endif% %ifreason tocc% Adresa konference nebyla nalezena v poli Komu: (To:) nebo Kopie: (Cc:). %endif% %ifreason access% Zaslání bylo zamezeno přístupovými právy ke konferenci stanovenými správcem. %endif% %ifreason expired% Zpráva měla být schválena moderátorem konference, ale žádný ji delší čas neschválil. %endif% %ifreason reject% Zpráva byla zamítnuta moderátorem konference. %endif% %ifreason subonlypost% Adresa, ze které byla zpráva zaslána, není v seznamu členů konference. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Pokud si přejete být členem konference kontaktujte správce. Můžete použít emailovou adresu <$list+$owner@$domain$>. %endif% %^%%wrap%Pokud si myslíte (nebo víte), že jste členem konference, zaslal/a jste zprávu z jiné emailové adresy, než se kterou jste přihlášen/a. Můžete ji zjistit z uvítacího emailu do konference, který jste odbržel/a. (Podívejte se na pole "Return-Path" v hlavičce uvítacího emailu.) %endif% %ifreason modonlypost% protože nejste moderator konference. %endif% %ifreason maxmailsize% %^%(Začátek zprávy je uveden níže.) %else% %^%(Zpráva je uvedena níže.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/cs/digest000066400000000000000000000002301502303113500160300ustar00rootroot00000000000000Subject: Digest verze $list$@$domain$ vydání $digestissue$ ($digestinterval$) Témata (zprávy od $digestfirst$ do $digestlast$): - %digestthreads% mlmmj/listtexts/cs/faq000066400000000000000000000002201502303113500153170ustar00rootroot00000000000000Subject: Často kladené otázky a odpovědi (FAQ) pro konferenci $list$@$domain$ Omlouváme se, žádné další informace nejsou dostupné. mlmmj/listtexts/cs/finish000066400000000000000000000024701502303113500160410ustar00rootroot00000000000000%ifaction unsub%Subject: Nashledanou v $list$@$domain$%endif% %ifaction release reject%Subject: Moderovaná konference $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Chráněná konference $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Zasláno do $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Děkujeme za potvrzení odhlášení. %endif% %ifreason admin% Správce vás odhlásil z konference. %else% Byl jste odhlášen z konference. %endif% %endif% %ifaction release% %^%%wrap%Úspěšně jste zaslal zpravu od <$posteraddr$> s předmětem "$subject$" do konference. %endif% %ifaction reject% %^%%wrap%Úspěšně jste zamítnul zprávu od <$posteraddr$> s předmětem "$subject$". %endif% %ifaction permit% %^%%wrap%Úspěšně jste povolil přihlášení <$subaddr$> do konference. %endif% %ifaction obstruct% %^%%wrap%Úspěšně jste zamítnul přihlášení <$subaddr$> do konference. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Děkujeme za potvrzení %endif% %ifreason release% Moderátor umožnil zaslání %endif% %ifreason request% Děkujeme za %endif% zpráva s předmětem "$subject$". Nyní je odesílána do konference. %endif% mlmmj/listtexts/cs/finish-sub000066400000000000000000000022251502303113500166260ustar00rootroot00000000000000Subject: Vítejte v konferenci $list$@$domain$ %text prologue% %wrap% %ifreason request% Potvrzujeme přihlášení do konference. %endif% %ifreason confirm% Děkujeme za potvrzení přihlášení. %endif% %ifreason permit% Správa konference povolila přihlášení do konference. %endif% %ifreason switch% Vaše členství v konferenci bylo změněno na %else% %ifreason admin% Správce vás přihlásil k %else% Jste nyní přihlášeni k %endif% %endif% %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% verzi odebírání konference. %wrap%Emailová adresa, se kterou jste prihlášen/a je <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Pokud se chcete odhlásit musíte kontaktovat správce konference. Můžete mu zaslat email na adresu <$list+$owner@$domain$>. %else% %^%%wrap%Pokud se budete chtít odhlásit, zašlete zprávu na adresu <$list+$unsubscribe@$domain$>. Předmět a obsah zprávy může být libovolný. Následně obdržíte zprávu s dalšími instrukcemi. %endif% %wrap%Pro získání dalších informací můžete zaslat zprávu na adresu <$list+$help@$domain$>. mlmmj/listtexts/cs/gatekeep-sub000066400000000000000000000011141502303113500171270ustar00rootroot00000000000000Subject: Požadavek na přihlášení $subaddr$ do $list$@$domain$ %text prologue% %wrap%Požadavek od <$subaddr$> na přihlášení do %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% verze konference. %wrap%K potvrzení požadavku zašlete zprávu na <$permitaddr$>, což lze většinou udělat jen odpovědí na tento emailový požadavek. %wrap%Pokud požadavek nechcete potvrdit, zašlete zprávu na <$obstructaddr$>, nebo prostě jednoduše tento pozadavek ignorujte. Následující osoby dostaly tento požadavek: - %gatekeepers% mlmmj/listtexts/cs/help000066400000000000000000000053661502303113500155200ustar00rootroot00000000000000Subject: Informace pro $list$@$domain$ %text prologue% Zde jsou informace o konferenci. Je možné se přihlásit k následujícím verzím: - %wrap%Normal: Pokaždé, když je zaslána zpráva do konference dostane každý její člen kopii. %ifcontrol closedlist closedlistsub% Přihlášení se děje kontaktováním správce. %else% Přihlášení je pomocí zaslání zprávy na <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Digest: Více zpráv je zasíláno v jedné zprávě v pravidelných intervalech, nebo když se zprávy nahromadí. %ifcontrol closedlist closedlistsub% Přihlášení se děje kontaktováním správce. %else% Přihlášení je pomocí zaslání zprávy na <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%No-mail: Nejsou zasílány žádné zprávy z konference. To znamená, že je možné zprávy zasílat do konference (zejména pokud je vyžadováno členství). Zprávy je možné číst pomocí archivu konference (pokud existuje), nebo jsou zasílány na jinou adresu (adresy) přihlášené do konference. %ifcontrol closedlist closedlistsub% Přihlášení se děje kontaktováním správce. %else% Přihlášení je pomocí zaslání zprávy na <$list+$subscribe-nomail@$domain$> %endif% %endif% %ifcontrol submod% %^%%wrap%Konference má správce, který schvaluje nové požadavky na přihlášení do konference. %endif% %ifcontrol closedlist% %^%%wrap%Odhlášení je možné kontaktovaním správce. %else% %^%%wrap%Odhlášení je možné zasláním zprávy na <$list+$unsubscribe@$domain$>. %endif% %wrap%Adresa pro zasílání zpráv do konference je <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Do konference mohou zasílat zprávy jen její členové. %endif%%endif% %ifcontrol moderated% %^%%wrap%Zprávy zaslané do konference podhléhají schválení moderátorem konference. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%Zpravy zaslane nečleny konference podléhají schválení moderátorem konference. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%Konference má nastavena přístupová pravidla pro zasílání a moderování zpráv. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Kdokoli %else% Členové %endif% mohou získat zprávu číslo N z archivu konference zasláním zprávy na adresu <$list+$get-N@$domain$> (místo N zadejte požadované číslo zprávy) %endif%%endif% %wrap%Můžete si vyžádat seznam častých otázek a odpovědí (FAQ) zasláním zprávy na adresu <$list+$faq@$domain$>. %wrap%Majitele konference je možné kontaktovat na adrese <$list+$owner@$domain$>. mlmmj/listtexts/cs/list000066400000000000000000000007211502303113500155310ustar00rootroot00000000000000Subject: Přihlášení členové do $list$@$domain$ %text prologue% %wrap%Toto je seznam členů konference %iftype all% (bez rozdílů členství normal/digest/no-mail): %else% k verzi %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% této konference: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/cs/moderate-post000066400000000000000000000030421502303113500173400ustar00rootroot00000000000000Subject: Žádost o moderování $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Zpráva od <$posteraddr$> s předmětem "$subject$" byla zaslána a nastal požadavek na moderování, %ifreason modnonsubposts% protože odesílatel není členem konference. %endif% %ifreason moderated% protože jde o moderovanou konferenci. %endif% %ifreason access% protože nastalo omezení přístupovými právy. %endif% Zpráva je uvedena níže. %wrap%K potvrzení a odeslání do konference zašlete zprávu na <$releaseaddr$>, což lze většinou udělat jen odpovědí na tento emailový požadavek. %ifcontrol subonrelease% %^%%wrap%Pokud si přejete, je možné zároveň potvrdit zaslání zprávy a přihlásit odesílatele zasláním na jednu z následujících adres:%nowrap% %^%- %wrap%Normální verze: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Digest verze: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%No-mail verze: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Pokud nechcete zprávu odeslat, zašlete zprávu na <$rejectaddr$>, nebo prostě jednoduše tento email ignorujte. Následující moderátoři obrželi tento požadavek: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/cs/notify000066400000000000000000000021341502303113500160660ustar00rootroot00000000000000%ifaction sub%Subject: Přihlášení do $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Odhlášení z $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%Adresa <$subaddr$> byla přihlášena do %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% verze konference %ifreason request% z důvodu přijetí požadavku na přihlášení. %endif% %ifreason confirm% z důvodu potvrzení požadavku na přihlášení. %endif% %ifreason admin% z důvodu zadaní požadavku správcem. %endif% %ifreason permit% z důvodu povolení adminstrací listu. %endif% %endif% %ifaction unsub% %^%%wrap%Adresa <$subaddr$> byla odhlášena z konference %ifreason request% z důvodu přijetí požadavku na odhlášení. %endif% %ifreason confirm% z důvodu potvrzení požadavku na odhlášení. %endif% %ifreason admin% z důvodu zadání požadavku správcem. %endif% %ifreason bouncing% z důvodu nemožnosti odesílání po příliš dlohou dobu (bouncing). %endif% %endif% mlmmj/listtexts/cs/probe000066400000000000000000000004771502303113500156750ustar00rootroot00000000000000Subject: Vracející se zprávy z $list$@$domain$ %text prologue% Některé zprávy vám nemohly být doručeny. Pokud jste obdržel/a tuto zpravu znamená to, že se vše vrátilo k normalnímu stavu a berte celou věc jen jako informaci. Zde je seznam nedoručených zpráv, které se vracely: - %bouncenumbers% mlmmj/listtexts/cs/prologue000066400000000000000000000001221502303113500164050ustar00rootroot00000000000000%wrap%Dobrý den, zde je program Mlmmj spravující konferenci <$list$@$domain$>. mlmmj/listtexts/cs/subrelease000066400000000000000000000020511502303113500167060ustar00rootroot00000000000000%^%%wrap%Nicméně toto je otevřená konference. Pokud si přejete, můžete se zároveň přihlásit a odeslat vaši zprávu zasláním zprávy na <$listsubreleaseaddr$>. Což se dá většinou udělat tak, že dáte Odpovědět na tuto zprávu. Předmět a obsah zprávy může být jakýkoli. %ifncontrol nodigestsub% %^%%wrap%Nebo se můžete zároveň přihlásit do Digest verze a odeslat vaši zprávu zasláním zprávy na <$digestsubreleaseaddr$>. Pak budete dostávat více zpráv z konference v jedné zprávě (emailu) v nastavených intervalech, nebo až se více zpráv nahromadí. %endif% %ifncontrol nonomailsub% %^%%wrap%Nebo se můžete zároveň přihlásit do No-Mail verze a odeslat vaši zprávu zasláním zprávy na <$nomailsubreleaseaddr$>. Pak nebudete dostávat žádné zprávy z konference (ale budete přihlášen). To znamená, že ani neobdržíte žádné reakce a odpovědi na vaši zprávu, pokud nebude sledovat webový archiv konference, nebo nebudete přihlášen pod jinou emailovou adresu. %endif% mlmmj/listtexts/cs/wait-post000066400000000000000000000021171502303113500165060ustar00rootroot00000000000000Subject: Čeká se na potvrzení $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Zpráva od <$posteraddr$> s předmětem "$subject$" byla zaslána do konference. Moderátoři konference byli kontaktováni, aby tuto zprávu schválili před zasláním. %ifreason moderated% Důvodem je to, že tato konference je moderovaná. %endif% %ifreason access% Důvodem je nastavení přístupových práv ke konferenci. %endif% %ifreason modnonsubposts% Důvodem je, že nejste členem konference (nebo píšete zprávu z adresy, se kterou nejste v konferenci přihlášen). %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Zpráva je uvedena níže.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/cs/wait-sub000066400000000000000000000003461502303113500163140ustar00rootroot00000000000000Subject: Čeká se na povolení na přihlášení do $list$@$domain$ %text prologue% %wrap%Váš požadavek na přihlášení do konference byl přijat. Nyní se čeká na potvrzení schválení požadavku správci konference. mlmmj/listtexts/de/000077500000000000000000000000001502303113500146165ustar00rootroot00000000000000mlmmj/listtexts/de/confirm000066400000000000000000000034531502303113500162030ustar00rootroot00000000000000%ifaction sub%Subject: Anmeldebestätigung für Liste $list$@$domain$%endif% %ifaction unsub%Subject: Abmeldebestätigung für Liste $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Ein Listenadministrator %endif% %ifreason request% Jemand (hoffentlich Sie selbst) %endif% hat darum gebeten, Ihre Mailadresse <$subaddr$> %iftype normal% der Liste hinzuzufügen. Das heißt, dass Sie eine Kopie jeder Mail erhalten, die an die Liste geschickt wird. %endif% %iftype digest% der Liste (im Digest-Modus) hinzuzufügen. Das heißt, dass Sie die an die Liste gesandten Mails in regelmäßigen Abständen (oder nach Erreichen einer bestimmten Nachrichtenmenge) zu einer Sammelmail zusammengefasst erhalten. %endif% %iftype nomail% der Liste (im No-Mail-Modus) hinzuzufügen. Das heißt, Sie erhalten zwar keine Nachrichten von der Liste, werden jedoch als Teilnehmer geführt. So dürfen Sie z.B. Nachrichten an die Liste senden und können die Diskussionen in einem Webarchiv oder über eine zweite angemeldete Mailadresse verfolgen %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Ein Listenadministrator %endif% %ifreason request% Jemand (hoffentlich Sie selbst) %endif% hat eine Löschung der Mitgliedschaft Ihrer Mailadresse <$subaddr$> von der Liste beantragt. %endif% %wrap%Um sicher zu stellen, dass Sie das wirklich wollen, senden Sie eine Nachricht an <$confirmaddr$>, was gewöhnlich durch einfaches Antworten auf diese Mail erfolgen kann. Betreff und Text Ihrer Antwort können beliebig sein. Nach dem Absenden Ihrer Antwortmail sollten Sie eine Antwortnachricht erhalten, dass die Operation erfolgreich war. Sollten Sie das nicht wollen, können Sie diese Mail einfach ignorieren. mlmmj/listtexts/de/deny000066400000000000000000000050131502303113500154770ustar00rootroot00000000000000%ifaction sub%Subject: Liste $list$@$domain$ kann nicht abonniert werden%endif% %ifaction unsub%Subject: Abonnement von $list$@$domain$ kann nicht abbestellt werden%endif% %ifaction release reject%Subject: Kann $list$@$domain$ nicht moderieren%endif% %ifaction permit obstruct%Subject: Kann $list$@$domain$ nicht zurückweisen%endif% %text prologue% %ifaction sub% %^%%wrap%Sie konnten der Liste nicht als Abonnent hinzugefügt werden, %ifreason disabled% weil die %iftype normal% normale Version %endif% %iftype digest% Digest-Version %endif% %iftype nomail% No-Mail-Version %endif% der Liste abgeschaltet ist. %endif% %ifreason closed% weil das Abonnieren dieser Liste per Mail nicht gestattet ist. because people are not allowed to subscribe to this list by email. %endif% %ifreason subbed% weil Sie unter dieser Mailadresse bereits als Abonnent eingetragen sind. %endif% %ifreason expired% weil Ihr Antrag zu lange unbearbeitet geblieben ist. %endif% %ifreason obstruct% weil ein Moderator Ihren Antrag abgewiesen hat. %endif% %endif% %ifaction unsub% %^%%wrap%Sie konnten die Liste nicht abbestellen, %ifreason unsubbed% weil Sie (unter dieser Mailadresse) nicht als Abonnent geführt werden. %^%%wrap%Sollten Sie Nachrichten von der Liste erhalten, könnte es sein, dass Sie mit einer anderen Mailadresse eingeschrieben sind. Um herauszufinden, mit welcher Mailadresse Sie eingeschrieben sind, sehen Sie sich in den Kopfzeilen einer Listenmail die Zeile "Return-Path" an. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Sie konnten diese Nachricht nicht an die Liste durchlassen, %endif% %ifaction reject% Sie konnten diese Nachricht nicht abweisen, %endif% %ifreason notfound% weil die Nachricht nicht gefunden werden konnte. Möglicherweise hat ein anderer Moderator die Nachricht bereits bearbeitet, oder die Bearbeitungsfrist war abgelaufen. %endif% %ifreason moderators% weil sie kein Moderator dieser Liste sind. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Sie konnten den Abonnement-Antrag nicht zulassen, %endif% %ifaction obstruct% Sie konnten den Abonnement-Antrag nicht abweisen, %endif% %ifreason notfound% weil er nicht gefunden wurde. Möglicherweise hat ein anderer Moderator ihn bearbeitet, oder die Bearbeitungsfrist war abgelaufen. %endif% %ifreason gatekeepers% weil Sie kein Moderator dieser Liste sind. %endif% %endif% mlmmj/listtexts/de/deny-post000066400000000000000000000040371502303113500164670ustar00rootroot00000000000000Subject: Ihre Nachricht an $list$@$domain$ wurde abgewiesen: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Die Nachricht von <$posteraddr$> mit dem Betreff "$subject$" konnte nicht über die Liste verteilt werden, %ifreason maxmailsize% weil sie die maximal erlaubte Größe von $maxmailsize$ Bytes überschritten hat %endif% %ifreason tocc% weil die Listenadresse weder im An- noch im CC-Feld gefunden wurde %endif% %ifreason access% aufgrund der vom Listenadministrator aufgestellten Zugangsregeln. %endif% %ifreason expired% weil die Bearbeitungsfrist überschritten wurde und kein Moderator die Nachricht weitergeleitet hat. %endif% %ifreason reject% weil sie von einem Listenmoderator abgewiesen wurde. %endif% %ifreason subonlypost% weil Sie die Liste nicht abonniert haben. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Wenn Sie die Liste abonnieren möchten, kontaktieren Sie einen Listenadministrator. Senden Sie dazu eine Mail an <$list+$owner@$domain$>. %endif% %^%%wrap%Wenn Sie denken, Sie hätten die Liste abonniert, so haben Sie wahrscheinlich eine abweichende Mailadresse verwendet. Um herauszufinden, unter welcher Mailadresse Sie die Liste abnoniert haben, sehen Sie entweder in der Begrüßungsmail ("Willkommen...") oder im Feld "Return-Path" in den Kopfzeilen einer über die Liste erhaltenen Nachricht nach. %endif% %ifreason maxmailsize% %^%(Der Anfang der abgewiesenen Mail ist unten gelistet.) %else% %^%(Die abgewiesene Mail ist unten angehängt.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/de/digest000066400000000000000000000002461502303113500160220ustar00rootroot00000000000000Subject: Zusammenfassung der Liste $list$@$domain$ Ausgabe: $digestissue$ ($digestinterval$) Themen (Nachrichten $digestfirst$ bis $digestlast$): - %digestthreads% mlmmj/listtexts/de/faq000066400000000000000000000002101502303113500153010ustar00rootroot00000000000000Subject: FAQ (Häufig gestellte Fragen) zur Liste $list$@$domain$ - leider gibt es zur Zeit noch keine FAQ-Sammlung zu dieser Liste - mlmmj/listtexts/de/finish000066400000000000000000000027221502303113500160240ustar00rootroot00000000000000%ifaction unsub%Subject: Auf Wiedersehen bei $list$@$domain$%endif% %ifaction release reject%Subject: $list$@$domain$ moderiert: $subject$%endif% %ifaction permit obstruct%Subject: Abgewiesen von $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Verteilt über $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Vielen Dank für Ihre Abmeldebestätigung. %endif% %ifreason admin% Ein Administrator hat Sie von der Liste gelöscht. %else% Sie wurden von der Liste gelöscht. %endif% %endif% %ifaction release% %^%%wrap%Sie haben die Nachricht von <$posteraddr$> mit dem Betreff "$subject$" erfolgreich an die Liste weitergeleitet. %endif% %ifaction reject% %^%%wrap%Sie haben die Nachricht von <$posteraddr$> mit dem Betreff "$subject$" erfolgreich abgewiesen. %endif% %ifaction permit% %^%%wrap%Sie haben die Listenanmeldung von <$subaddr$> erfolgreich zugelassen. %endif% %ifaction obstruct% %^%%wrap%Sie haben die Listenanmeldung von <$subaddr$> erfolgreich abgewiesen. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Vielen Dank für die Bestätigung Ihrer %endif% %ifreason release% Ein Moderator hat Ihre %endif% %ifreason request% Danke für Ihre %endif% Nachricht mit dem Betreff %ifreason release% "$subject$" weitergeleitet. %else% "$subject$". %endif% Sie wird nun über die Liste verteilt. %endif% mlmmj/listtexts/de/finish-sub000066400000000000000000000023501502303113500166100ustar00rootroot00000000000000Subject: Herzlich Willkommen bei $list$@$domain$ %text prologue% %wrap% %ifreason request% Vielen Dank für Ihre Anmeldung. %endif% %ifreason confirm% Vielen Dank für Ihre Anmeldebestätigung. %endif% %ifreason permit% Ein Listenmoderator hat Ihre Anmeldung akzeptiert. %endif% %ifreason switch% Ihr Listenabonnement wurde umgestellt auf die %else% %ifreason admin% Ein Administrator hat Sie angemeldet bei der %else% Sie wurden hinzugefügt zur %endif% %endif% %iftype normal% Normalversion %endif% %iftype digest% Digest-Version %endif% %iftype nomail% No-Mail-Version %endif% der Liste. %wrap%Ihre Abonnement-Adresse lautet <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Zum Abmelden kontaktieren Sie bitte den Listenadministrator. Senden Sie dazu eine Mail an <$list+$owner@$domain$>. %else% %^%%wrap%Zum Abmelden senden Sie eine Mail an <$list+$unsubscribe@$domain$> Bitte achten Sie darauf die oben genannte Absender-Adresse zu benutzen. Betreff und Inhalt der Nachricht sind unerheblich. Sie erhalten eine Abmeldebestätigungsaufforderung oder eine Mail mit weiteren Instruktionen. %endif% %wrap%Um Hilfe und weitere Informationen zu dieser Liste zu erhalten, Senden Sie eine Mail an <$list+$help@$domain$>. mlmmj/listtexts/de/gatekeep-sub000066400000000000000000000011401502303113500171110ustar00rootroot00000000000000Subject: Anmeldeantrag für $list$@$domain$: $subaddr$ %text prologue% %wrap%Ein Antrag von <$subaddr$> zur Anmeldung bei der %iftype normal% Normalversion %endif% %iftype digest% Digest-Version %endif% %iftype nomail% No-Mail-Version %endif% der Liste ist eingegangen. %wrap%Um die Anmeldung zu erlauben, senden Sie eine mail an <$permitaddr$>\ - ein einfaches Antworten auf diese Mail sollte in der Regel genügen. %wrap%Um die Anmeldung abzulehnen, Senden Sie eine Mail an <$obstructaddr$> oder ignorieren Sie diese Nachricht einfach. Folgende Moderatoren haben diese Mail erhalten: - %gatekeepers% mlmmj/listtexts/de/help000066400000000000000000000057441502303113500155030ustar00rootroot00000000000000Subject: Informationen für die Liste $list$@$domain$ %text prologue% Mit dieser Mail erhalten Sie ein paar Informationen zur Mailingliste. Sie können folgende Listenverionen abonnieren: - %wrap%Die Normalversion: Von jeder Nachricht, die an die Liste gesandt wird, wird eine Kopie an die Abonennten verteilt. %ifcontrol closedlist closedlistsub% Zum Anmelden kontaktieren Sie bitte den Listenadministrator. %else% Zum Anmelden senden Sie eine Mail an <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Die Digest-Version: Hierbei erhalten die Abonnenten mehrere Nachrichten in einer einzigen Mail verpackt, entweder in regelmäßigen Abständen, oder wenn sich genügend Nachrichten angesammelt haben. %ifcontrol closedlist closedlistsub% Zum Anmelden kontaktieren Sie bitte den Listenadministrator. %else% Zum Anmelden senden Sie eine Mail an <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Die No-Mail-Version: Abonnenten erhalten keine Mails von der Liste. Das heißt, sie dürfen an eine Liste schreiben, an welche nur Abonnenten schreiben dürfen, verfolgen die Listendiskussionen jedoch über ein Webarchiv oder eine andere angemeldete Mailadresse. %ifcontrol closedlist closedlistsub% Zum Anmelden kontaktieren Sie bitte den Listenadministrator. %else% Zum Anmelden senden Sie eine Mail an <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%Anmeldeanträge an die Liste werden durch Moderatoren bearbeitet. %endif% %ifcontrol closedlist% %^%%wrap%Zum Abmelden kontaktieren Sie einen Listenadministrator. %else% %^%%wrap%Zum Abmelden senden Sie eine Mail an <$list+$unsubscribe@$domain$>. %endif% %wrap%Zum Schreiben an die Liste senden Sie eine Mail an <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Es werden jedoch nur Mails von angemeldeten Teilnehmern verteilt. %endif%%endif% %ifcontrol moderated% %^%%wrap%Alle Mails an die Liste werden durch Moderatoren geprüft, bevor sie an die Liste weitergeleitet werden. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%Die Listenmoderatoren prüfen alle Mails von Nicht-Abonnenten, bevor sie sie an die Liste weiterleiten. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%Für die Liste sind Zugangsregeln vorhanden, mit denen gesteuert wird, wer an die Liste schreiben darf und wessen Mails moderiert werden. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Alle %else% Abonnenten %endif% können eine Nachricht Nummer N aus dem Listenarchiv nachbestellen, indem sie eine Mail an <$list+$get-N@$domain$> schicken (ersetzen Sie N mit der Nummer der gewünschten Nachricht). %endif%%endif% %wrap%Sie können die FAQ (Liste der häufigen Fragen) durch eine Mail an <$list+$faq@$domain$> anfordern. %wrap%Zum Kontaktieren des Listeneigentümers senden Sie eine Mail an <$list+$owner@$domain$>. mlmmj/listtexts/de/list000066400000000000000000000006751502303113500155240ustar00rootroot00000000000000Subject: Abonnenten der Liste $list$@$domain$ %text prologue% %wrap%Liste der Abonnenten %iftype all% (für alle Versionen der Liste): %else% für die %iftype normal% Normalversion %endif% %iftype digest% Digest-Version %endif% %iftype nomail% No-Mail-Version %endif% der Liste: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/de/moderate-post000066400000000000000000000030361502303113500173260ustar00rootroot00000000000000Subject: Bitte moderieren Sie $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Eine Nachricht von <$posteraddr$> mit dem Betreff "$subject$" wurde an die Liste geschickt. Sie sollten die Nachricht moderieren, %ifreason modnonsubposts% da der Absender kein Abonnent ist. %endif% %ifreason moderated% da die Liste moderiert ist. %endif% %ifreason access% wegen einer Zugangsregel. %endif% Die Nachricht befindet sich unten. %wrap%Um die Nachricht an die Liste durchzulassen, senden Sie eine Mail an <$releaseaddr$>. In der Regel genügt hierzu ein einfaches Antworten auf diese Nachricht. %ifcontrol subonrelease% %^%%wrap%Sie können die Nachricht durchlassen und gleichzeitig den Absender bei der Liste anmelden, indem Sie eine Mail an folgende Adressen senden:%nowrap% %^%- %wrap%Normalversion: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Digest-Version: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%No-Mail-Version: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Wenn Sie nichts davon ausführen möchten, Senden Sie eine Mail an <$rejectaddr$> oder ignorieren Sie einfach diese Mail. Folgende Moderatoren haben diese Mail erhalten: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/de/notify000066400000000000000000000021301502303113500160450ustar00rootroot00000000000000%ifaction sub%Subject: Angemeldet bei $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Abgemeldet von $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%Die Adresse <$subaddr$> wurde bei der %iftype normal% Normalversion %endif% %iftype digest% Digest-Version %endif% %iftype nomail% No-Mail-Version %endif% der Liste angemeldet %ifreason request% da ein Anmeldeantrag vorlag. %endif% %ifreason confirm% da ein Anmeldeantrag bestätigt wurde. %endif% %ifreason admin% da ein Administrator die Anmeldung durchgeführt hat. %endif% %ifreason permit% da die Anmeldung von einem Moderator zugelassen wurde. %endif% %endif% %ifaction unsub% %^%%wrap%Die Adresse <$subaddr$> wurde von der Liste abgemeldet, %ifreason request% da ein Abmeldeantrag vorlag. %endif% %ifreason confirm% da eine Abmeldebestätigung vorlag. %endif% %ifreason admin% da sie durch einen Administrator durchgeführt wurde. %endif% %ifreason bouncing% da Zustellversuche an diese Adresse zu lange erfolglos blieben. %endif% %endif% mlmmj/listtexts/de/probe000066400000000000000000000005151502303113500156510ustar00rootroot00000000000000Subject: Erfolglose Nachrichtenzustellung von $list$@$domain$ %text prologue% Einige Mails an Sie konnten nicht zugestellt werden. Wenn Sie diese Nachricht erhalten, scheint die Störung beseitigt zu sein, und diese Nachricht dient lediglich Ihrer Information. Es folgt eine Liste der abgewiesenen Nachrichten: - %bouncenumbers% mlmmj/listtexts/de/prologue000066400000000000000000000001401502303113500163700ustar00rootroot00000000000000%wrap%Hallo, hier ist das Programm Mlmmj, welches die Mailingliste <$list$@$domain$> verwaltet. mlmmj/listtexts/de/subrelease000066400000000000000000000020661502303113500166770ustar00rootroot00000000000000%wrap%Dies ist eine offene Liste. Wenn Sie möchten, können Sie sich gleichzeitig anmelden und eine Nachricht an die Liste senden, indem Sie eine Mail an <$listsubreleaseaddr$> senden, was in der Regel durch einfaches Antworten an diese Mail erfolgen kann. Betreff und Nachrichtentext können Sie frei wählen. %ifncontrol nodigestsub% %^%%wrap%Oder Sie können sich gleichzeitig bei der Digest-Version dieser Liste anmelden und eine Nachricht an die Liste senden, indem sie eine Mail an <$digestsubreleaseaddr$> senden. Sie erhalten dann mehrere Listennachrichten zusammegefasst in einer Mail - entweder in regelmäßigen Zeitabständen oder wenn sich ein Menge Nachrichten angehäuft hat. %endif% %ifncontrol nonomailsub% %^%%wrap%Oder Sie können sich gleichzeitig bei der No-Mail-Version dieser Liste anmelden und eine Nachricht an die Liste senden, indem sie eine Mail an <$nomailsubreleaseaddr$> senden. Sie erhalten dann keine Listennachrichten zugesandt, können diese aber in Webarchiven oder über eine andere angemeldete Adresse lesen. %endif% mlmmj/listtexts/de/wait-post000066400000000000000000000017261502303113500164760ustar00rootroot00000000000000Subject: Warte auf Moderation für $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Die Mail von <$posteraddr$> mit dem Betreff "$subject$" wurde an die Liste eingereicht. Jedoch ist vor der Weiterleitung eine Moderation erforderlich, %ifreason moderated% da es sich um eine moderierte Liste handelt. %endif% %ifreason access% da eine Zugangsregel dies erfordert. %endif% %ifreason modnonsubposts% weil Sie nicht auf der Liste eingeschrieben sind. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Die ist unten angefügt.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/de/wait-sub000066400000000000000000000003331502303113500162730ustar00rootroot00000000000000Subject: Warte auf Zulassung zur Anmeldung bei $list$@$domain$ %text prologue% %wrap%Ihr Anmeldeantrag ist angekommen, jedoch muss er noch von einem Moderator bewertet werden, bevor die Anmeldung durchgeführt wird. mlmmj/listtexts/en/000077500000000000000000000000001502303113500146305ustar00rootroot00000000000000mlmmj/listtexts/en/confirm000066400000000000000000000031511502303113500162100ustar00rootroot00000000000000%ifaction sub%Subject: Confirm subscription to $list$@$domain$%endif% %ifaction unsub%Subject: Confirm unsubscribe from $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% An administrator %endif% %ifreason request% Somebody (and we hope it was you) %endif% has requested that your email address <$subaddr$> be added %iftype normal% to the list. This means every time a post is sent to the list, you will receive a copy of it. %endif% %iftype digest% to the list, to receive digests. This means you will receive multiple posts in a single mail message, at regular intervals, or when a lot of posts have accumulated. %endif% %iftype nomail% to the list, without mail delivery. This means you will not receive any posts to the list, but you are considered a member. This means, for instance, you are able to post to a list which only subscribers may post to, while you follow the list using a web archive or another subscribed email address. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% An administrator %endif% %ifreason request% Somebody (and we hope it was you) %endif% has requested that the email address <$subaddr$> be removed from the list. %endif% %wrap%To confirm you want to do this, please send a message to <$confirmaddr$> which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. mlmmj/listtexts/en/deny000066400000000000000000000044141502303113500155150ustar00rootroot00000000000000%ifaction sub%Subject: Unable to subscribe to $list$@$domain$%endif% %ifaction unsub%Subject: Unable to unsubscribe from $list$@$domain$%endif% %ifaction release reject%Subject: Unable to moderate $list$@$domain$%endif% %ifaction permit obstruct%Subject: Unable to gatekeep $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%You were unable to be subscribed to the list %ifreason disabled% because the %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% version of the list is turned off. %endif% %ifreason closed% because people are not allowed to subscribe to this list by email. %endif% %ifreason subbed% because you are already subscribed. %endif% %ifreason expired% because too much time passed without a gatekeeper permitting your entry. %endif% %ifreason obstruct% because a gatekeeper obstructed your entry. %endif% %endif% %ifaction unsub% %^%%wrap%You were unable to be unsubscribed from the list %ifreason unsubbed% because you are not subscribed. %^%%wrap%If you are receiving messages, perhaps a different email address is subscribed. To find out which address you are subscribed with, refer to the message welcoming you to the list, or look at the envelope "Return-Path" header of a message you receive from the list. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% You were unable to release the specified post to the list %endif% %ifaction reject% You were unable to reject the specified post %endif% %ifreason notfound% because it could not be found. Perhaps another moderator already released or rejected it, or it expired. %endif% %ifreason moderators% because you are not a moderator for the list. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% You were unable to permit the specified subscription request %endif% %ifaction obstruct% You were unable to obstruct the specified subscription request %endif% %ifreason notfound% because it could not be found. Perhaps another gatekeeper already permitted or obstructed it, or it expired. %endif% %ifreason gatekeepers% because you are not a gatekeeper for the list. %endif% %endif% mlmmj/listtexts/en/deny-post000066400000000000000000000036641502303113500165060ustar00rootroot00000000000000Subject: Post to $list$@$domain$ denied: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%The message from <$posteraddr$> with subject "$subject$" was unable to be delivered to the list %ifreason maxmailsize% because it exceeded the maximum allowed message size of $maxmailsize$ bytes. %endif% %ifreason tocc% because the list address was not found in either the To: or CC: header. %endif% %ifreason access% because of an access rule set up by the list administrator. %endif% %ifreason expired% because too much time passed without any moderator releasing it. %endif% %ifreason reject% because a moderator rejected it. %endif% %ifreason subonlypost% because you are not a list subscriber. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%If you wish to become a subscriber, you will need to contact a list administrator. You can email <$list+$owner@$domain$> to contact the list owner. %endif% %^%%wrap%If you believe you are a subscriber, you are probably subscribed with a different email address. To find out which address you are subscribed with, refer to the message welcoming you to the list, or look at the envelope "Return-Path" header of a message you receive from the list. %endif% %ifreason modonlypost% because you are not a list moderator. %endif% %ifreason maxmailsize% %^%(The beginning of the denied message is below.) %else% %^%(The denied message is below.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/en/digest000066400000000000000000000002241502303113500160300ustar00rootroot00000000000000Subject: Digest of $list$@$domain$ issue $digestissue$ ($digestinterval$) Topics (messages $digestfirst$ through $digestlast$): - %digestthreads% mlmmj/listtexts/en/faq000066400000000000000000000001261502303113500153210ustar00rootroot00000000000000Subject: Frequently asked questions of $list$@$domain$ Sorry, no FAQ available yet. mlmmj/listtexts/en/finish000066400000000000000000000025101502303113500160310ustar00rootroot00000000000000%ifaction unsub%Subject: Goodbye from $list$@$domain$%endif% %ifaction release reject%Subject: Moderated $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Guarded $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Posted to $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Thank you for confirming your unsubscribe. %endif% %ifreason admin% An administrator has removed you from the list. %else% You have now been removed from the list. %endif% %endif% %ifaction release% %^%%wrap%You have successfully released the message from <$posteraddr$> with subject "$subject$" to the list. %endif% %ifaction reject% %^%%wrap%You have successfully rejected the message from <$posteraddr$> with subject "$subject$". %endif% %ifaction permit% %^%%wrap%You have successfully permitted <$subaddr$> to join the list. %endif% %ifaction obstruct% %^%%wrap%You have successfully obstructed <$subaddr$> from joining the list. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Thank you for confirming %endif% %ifreason release% A moderator has released %endif% %ifreason request% Thank you for %endif% your post with subject "$subject$". It is now being distributed to the list. %endif% mlmmj/listtexts/en/finish-sub000066400000000000000000000022451502303113500166250ustar00rootroot00000000000000Subject: Welcome to $list$@$domain$ %text prologue% %wrap% %ifreason request% Thank you for your request to join us. %endif% %ifreason confirm% Thank you for confirming your subscription. %endif% %ifreason permit% A gatekeeper has permitted you to join us. %endif% %ifreason switch% Your subscription has been switched to the %else% %ifreason admin% An administrator has subscribed you to the %else% You have now been added to the %endif% %endif% %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% version of the list. %wrap%The email address you are subscribed with is <$subaddr$>. %ifcontrol closedlist% %^%%wrap%If you ever wish to unsubscribe, you will need to contact a list administrator. You can email <$list+$owner@$domain$> to contact the list owner. %else% %^%%wrap%If you ever wish to unsubscribe, send a message to <$list+$unsubscribe@$domain$> using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. %endif% %wrap%For other information and help about this list, send a message to <$list+$help@$domain$>. mlmmj/listtexts/en/gatekeep-sub000066400000000000000000000010571502303113500171320ustar00rootroot00000000000000Subject: Subscription request for $list$@$domain$: $subaddr$ %text prologue% %wrap%There has been a request from <$subaddr$> to join the %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% version of the list. %wrap%To permit this, please send a message to <$permitaddr$> which can usually be done simply by replying to this message. %wrap%If you do not want to do this, either send a message to <$obstructaddr$> or simply ignore this message. The following gatekeepers have received this mail: - %gatekeepers% mlmmj/listtexts/en/help000066400000000000000000000051561502303113500155120ustar00rootroot00000000000000Subject: Information for $list$@$domain$ %text prologue% Here is some information about the list. You can subscribe to the following versions: - %wrap%The normal version: Every time a post is sent to the list, subscribers receive a copy of it. %ifcontrol closedlist closedlistsub% Subscribe by contacting a list administrator. %else% Subscribe by emailing <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%The digest version: Subscribers receive multiple posts in a single mail message, at regular intervals, or when a lot of posts have accumulated. %ifcontrol closedlist closedlistsub% Subscribe by contacting a list administrator. %else% Subscribe by emailing <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%The no-mail version: Subscribers do not receive any posts to the list. This means, though, they are able to post to a list which only subscribers may post to, while they follow the list using a web archive or another subscribed email address. %ifcontrol closedlist closedlistsub% Subscribe by contacting a list administrator. %else% Subscribe by emailing <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%The list has gatekeepers who will review subscription requests before permitting new members. %endif% %ifcontrol closedlist% %^%%wrap%Unsubscribe by contacting a list administrator. %else% %^%%wrap%Unsubscribe by emailing <$list+$unsubscribe@$domain$>. %endif% %wrap%Posts are made by emailing <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%However, only subscribers may post to the list. %endif%%endif% %ifcontrol moderated% %^%%wrap%The list has moderators who will review all posts before releasing them to the list. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%The list has moderators who will review posts from non-subscribers before releasing them to the list. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%The list also has access rules which may affect who can post and which posts are moderated. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Anyone %else% Subscribers %endif% can retrieve message number N from the list's archive by sending a message to <$list+$get-N@$domain$> (change the N to the number of the desired message). %endif%%endif% %wrap%You can retrieve the frequently asked questions document for the list by sending a message to <$list+$faq@$domain$>. %wrap%To contact the list owner, send a message to <$list+$owner@$domain$>. mlmmj/listtexts/en/list000066400000000000000000000006611502303113500155310ustar00rootroot00000000000000Subject: Subscribers to $list$@$domain$ %text prologue% %wrap%Here is the list of subscribers %iftype all% (to all versions of the list): %else% to the %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% version of the list: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/en/moderate-post000066400000000000000000000027421502303113500173430ustar00rootroot00000000000000Subject: Please moderate $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%A message from <$posteraddr$> with subject "$subject$" has been submitted for posting. You are being asked to moderate %ifreason modnonsubposts% because the requester is not a subscriber. %endif% %ifreason moderated% because this is a moderated list. %endif% %ifreason access% because of an access rule. %endif% The message is below. %wrap%To release it to the list, please send a message to <$releaseaddr$> which can usually be done simply by replying to this message. %ifcontrol subonrelease% %^%%wrap%If you wish, you can simultaneously release the post and subscribe the poster by sending a message to one of the following addresses:%nowrap% %^%- %wrap%Normal version: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Digest version: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%No-mail version: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%If you do not want to do any of this, either send a message to <$rejectaddr$> or simply ignore this message. The following moderators have received this mail: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/en/notify000066400000000000000000000020671502303113500160700ustar00rootroot00000000000000%ifaction sub%Subject: Subscribed to $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Unsubscribed from $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%The address <$subaddr$> has been subscribed to the %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% version of the list %ifreason request% because a request to join was received. %endif% %ifreason confirm% because a request to join was confirmed. %endif% %ifreason admin% because an administrator commanded it. %endif% %ifreason permit% because a gatekeeper permitted it. %endif% %endif% %ifaction unsub% %^%%wrap%The address <$subaddr$> has been unsubscribed from the list %ifreason request% because a request to unsubscribe was received. %endif% %ifreason confirm% because a request to unsubscribe was confirmed. %endif% %ifreason admin% because an administrator commanded it. %endif% %ifreason bouncing% because it has been bouncing for too long. %endif% %endif% mlmmj/listtexts/en/probe000066400000000000000000000004251502303113500156630ustar00rootroot00000000000000Subject: Bouncing messages from $list$@$domain$ %text prologue% Some messages to you could not be delivered. If you're seeing this message it means things are back to normal, and it's merely for your information. Here is the list of the bounced messages: - %bouncenumbers% mlmmj/listtexts/en/prologue000066400000000000000000000001211502303113500164010ustar00rootroot00000000000000%wrap%Hi, this is the Mlmmj program managing the <$list$@$domain$> mailing list. mlmmj/listtexts/en/subrelease000066400000000000000000000017711502303113500167130ustar00rootroot00000000000000%^%%wrap%However, this is an open list. If you wish, you can simultaneously subscribe and release your post by sending a message to <$listsubreleaseaddr$> which can usually be done simply by replying to this message. The subject and the body of the message can be anything. %ifncontrol nodigestsub% %^%%wrap%Or you can simultaneously subscribe to the digest version of the list and release your post by sending a message to <$digestsubreleaseaddr$> and you will receive multiple posts in a single message, at regular intervals, or when a lot of posts have accumulated. %endif% %ifncontrol nonomailsub% %^%%wrap%Or you can simultaneously subscribe to the no-mail version of the list and release your post by sending a message to <$nomailsubreleaseaddr$> and you will not receive posts sent to the list. This means you potentially will not see replies to your message, unless you follow the list using a web archive or have another email address subscribed to another version of the list. %endif% mlmmj/listtexts/en/wait-post000066400000000000000000000016771502303113500165150ustar00rootroot00000000000000Subject: Awaiting release to $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%The message from <$posteraddr$> with subject "$subject$" has been submitted to the list. However, the moderators are being asked to review it before releasing it to the list %ifreason moderated% because this is a moderated list. %endif% %ifreason access% because of an access rule. %endif% %ifreason modnonsubposts% because you are not a subscriber. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (The message is below.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/en/wait-sub000066400000000000000000000003241502303113500163050ustar00rootroot00000000000000Subject: Awaiting permission to join $list$@$domain$ %text prologue% %wrap%Your request to join the list has been received. However, the gatekeepers are being asked to review it before permitting you to join. mlmmj/listtexts/fi/000077500000000000000000000000001502303113500146245ustar00rootroot00000000000000mlmmj/listtexts/fi/confirm000066400000000000000000000035671502303113500162170ustar00rootroot00000000000000%ifaction sub%Subject: Vahvista liittyminen listalle $list$@$domain$%endif% %ifaction unsub%Subject: Vahvista eroaminen listalta $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Ylläpitäjä %endif% %ifreason request% Joku (toivottavasti sinä) %endif% on pyytänyt, että sähköpostiosoitteesi <$subaddr$> lisättäisiin %iftype normal% postituslistan vastaanottajaksi. Aina kun postituslistalle lähetetään viesti, siitä lähetetään kopio sähköpostiisi. %endif% %iftype digest% postituslistan viestikoosteiden vastaanottajaksi. Sähköpostiisi lähetetään kooste postituslistalle lähetetyistä viesteistä säännöllisin väliajoin tai silloin, kun postituslistalle on kertynyt riittävän monta viestiä. %endif% %iftype nomail% postituslistalle ilman viestien välitystä. Sinulle ei lähetetä postituslistan viestejä, mutta oikeutesi postituslistan käyttöön ovat muuten samat kuin postituslistan normaaleilla tilaajilla. Voit esimerkiksi lähettää viestejä listalle, jolle lähetysoikeus on vain listan tilaajilla. Tämä on käytännöllistä silloin, kun seuraat listan viestejä www-arkiston tai toiseen sähköpostiosoitteeseen tilattujen viestien kautta. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Ylläpitäjä %endif% %ifreason request% Joku (toivottavasti sinä) %endif% on pyytänyt, että sähköpostiosoite <$subaddr$> poistettaisiin postituslistan. %endif% %wrap%Vahvistaaksesi toimenpiteen lähetä viesti osoitteeseen <$confirmaddr$> esimerkiksi vastaamalla tähän sähköpostiviestiin. Viestin otsikolla ja sisällöllä ei ole merkitystä. Kun olet lähettänyt viestin, saat vastauksen, jossa vahvistetaan toimenpide suoritetuksi. Jos et halua vahvistaa toimenpidettä, sinun ei tarvitse tehdä mitään. mlmmj/listtexts/fi/deny000066400000000000000000000051071502303113500155110ustar00rootroot00000000000000%ifaction sub%Subject: Listalle $list$@$domain$ liittyminen epäonnistui%endif% %ifaction unsub%Subject: Listalta $list$@$domain$ poistuminen epäonnistui%endif% %ifaction release reject%Subject: Listan $list$@$domain$ viestin hyväksyntä epäonnistui%endif% %ifaction permit obstruct%Subject: Listan $list$@$domain$ tilauksen hallinta epäonnistui%endif% %text prologue% %ifaction sub% %^%%wrap%Sinua ei voitu liittää postituslistalle, %ifreason disabled% koska listan %iftype normal% tavallinen versio %endif% %iftype digest% viestikoosteversio %endif% %iftype nomail% ei postia -versio %endif% ei ole käytössä. %endif% %ifreason closed% koska tälle listalle ei voi liittyä omatoimisesti sähköpostiviestillä. %endif% %ifreason subbed% koska olet jo aiemmin liittynyt listalle. %endif% %ifreason expired% koska liittymistäsi ei hyväksytty riittävässä ajassa. %endif% %ifreason obstruct% koska postituslistan jäsenistä vastaava henkilö esti liittymisesi listalle. %endif% %endif% %ifaction unsub% %^%%wrap%Jäsenyyttäsi postituslistalla ei voitu lopettaa, %ifreason unsubbed% koska et ole listan tilaaja. %^%%wrap%Jos tästä huolimatta saat postituslistalta viestejä, olet ehkä liittynyt listalle jollain toisella sähköpostiosoitteella. Voit selvittää listalle liitetyn osoitteen viestistä, jossa sinut toivotetaan tervetulleeksi listalle. Jos se ei ole enää tallessa, katso "Return-Path"-otsikkotieto viimeisimmästä viestistä, jonka olet saanut postituslistalta. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Viestin hyväksyminen postituslistalle välitettäväksi ei onnistunut, %endif% %ifaction reject% Viestin hylkääminen postituslistalta ei onnistunut, %endif% %ifreason notfound% koska sitä ei löytynyt. Ehkäpä toinen moderaattori on jo hyväksynyt tai hylännyt sen, tai viesti on vanhentunut. %endif% %ifreason moderators% koska et ole tämän postituslistan moderaattori. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Postituslistan liittymispyynnön hyväksyminen ei onnistunut, %endif% %ifaction obstruct% Postituslistan liittymispyynnön hylkääminen ei onnistunut, %endif% %ifreason notfound% koska sitä ei löytynyt. Ehkäpä toinen listan jäsenistä vastaava on jo hyväksynyt tai hylännyt sen, tai liittymispyyntö on vanhentunut. %endif% %ifreason gatekeepers% koska sinulla ei ole oikeutta hyväksyä postituslistan jäseniä. %endif% %endif% mlmmj/listtexts/fi/deny-post000066400000000000000000000041711502303113500164740ustar00rootroot00000000000000Subject: Viesti listalle $list$@$domain$ hylättiin: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Viestiä osoitteesta <$posteraddr$> otsikolla "$subject$" ei voitu välittää postituslistalle, %ifreason maxmailsize% koska sen koko on suurempi kuin suurin sallittu koko $maxmailsize$ tavua. %endif% %ifreason tocc% koska postituslistan osoite ei ollut To- eikä CC-vastaanottajissa. %endif% %ifreason access% koska listan ylläpitäjän asettamat postitusoikeudet eivät sallineet kyseisen viestin lähetystä. %endif% %ifreason expired% koska kukaan postituslistan moderaattoreista ei hyväksynyt viestiä riittävän ajan kuluessa. %endif% %ifreason reject% koska postituslistan moderaattori esti viestin lähettämisen. %endif% %ifreason subonlypost% koska et ole postituslistan tilaaja. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Jos haluta liittyä postituslistalle, ota yhteyttä listan ylläpitäjään. Ylläpitäjään saat yhteyden lähettämällä sähköpostia osoitteeseen <$list+$owner@$domain$>. %endif% %^%%wrap%Jos tiedät olevasi tämän postituslistan tilaaja, olet todennäköisesti tilannut sen jollakin toisella sähköpostiosoitteella. Voit selvittää listalle liitetyn osoitteen viestistä, jossa sinut toivotetaan tervetulleeksi listalle. Jos se ei ole enää tallessa, katso "Return-Path"-otsikkotieto viimeisimmästä viestistä, jonka olet saanut postituslistalta. %endif% %ifreason maxmailsize% %^%(Alkuosa viestistä, jota ei lähetetty listalle, on alla.) %else% %^%(Viesti, jota ei lähetetty listalle, on luettavissa alla.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/fi/digest000066400000000000000000000002341502303113500160250ustar00rootroot00000000000000Subject: Viestikooste $digestissue$ postituslistalta $list$@$domain$ ($digestinterval$) Aiheet (viestit $digestfirst$ - $digestlast$): - %digestthreads% mlmmj/listtexts/fi/faq000066400000000000000000000002011502303113500153070ustar00rootroot00000000000000Subject: Listan $list$@$domain$ usein kysytyt kysymykset Valitettavasti usein kysyttyjä kysymyksiä ei vielä ole saatavilla. mlmmj/listtexts/fi/finish000066400000000000000000000027031502303113500160310ustar00rootroot00000000000000%ifaction unsub%Subject: Vahvistus postituslistalta $list$@$domain$ poistumisesta%endif% %ifaction release reject%Subject: Moderoitu $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Listalle $list$@$domain$ liittyminen käsitelty: $subaddr$%endif% %ifaction post%Subject: Lähetetty listalle $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Kiitos, että vahvistit postituslistalta poistumisesi. %endif% %ifreason admin% Ylläpitäjä on poistanut sinut postituslistalta. %else% Sähköpostiosoitteesi on nyt poistettu postituslistalta. %endif% %endif% %ifaction release% %^%%wrap%Osoitteesta <$posteraddr$> lähetetty viesti "$subject$" on onnistuneesti hyväksytty välitettäväksi postituslistalle. %endif% %ifaction reject% %^%%wrap%Osoitteesta <$posteraddr$> lähetetyn viestin "$subject$" välittäminen postituslistalle on estetty. %endif% %ifaction permit% %^%%wrap%Osoite <$subaddr$> on liitetty postituslistalle. %endif% %ifaction obstruct% %^%%wrap%Osoitteen <$subaddr$> liittäminen postituslistalle on estetty. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Kiitos, että vahvistit viestisi %endif% %ifreason release% Moderaattori on hyväksynyt viestisi %endif% %ifreason request% Kiitos viestistäsi %endif% otsikolla "$subject$". Se välitetään postituslistan tilaajille. %endif% mlmmj/listtexts/fi/finish-sub000066400000000000000000000027141502303113500166220ustar00rootroot00000000000000Subject: Tervetuloa postituslistalle $list$@$domain$ %text prologue% %wrap% %ifreason request% Kiitos, että haluat liittyä tälle postituslistalle. %endif% %ifreason confirm% Kiitos, että vahvistit postituslistalle liittymisen. %endif% %ifreason permit% Pyyntösi liittyä tälle postituslistalle on hyväksytty. %endif% %ifreason switch% Postituslistasi tilaus on muutettu %else% %ifreason admin% Postituslistan ylläpitäjä on liittänyt sinut %else% Sinut on lisätty %endif% %endif% %iftype normal% postituslistan normaaliksi tilaajaksi. %endif% %iftype digest% postituslistan viestikoosteiden tilaajaksi. %endif% %iftype nomail% postituslistan jäseneksi ilman viestien jakelua. %endif% %wrap%Osoite, joka postituslistalle on liitetty, on <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Jos haluat lopettaa postituslistan tilauksen, ota yhteyttä listan ylläpitäjään. Yhteydenotto onnistuu lähettämällä sähköpostia osoitteeseen <$list+$owner@$domain$>. %else% %^%%wrap%Jos haluat lopettaa postituslistan tilauksen, lähetä viesti osoitteeseen <$list+$unsubscribe@$domain$> samasta osoitteesta, joka listalle on liitetty. Viestin otsikolla ja sisällöllä ei ole merkitystä. Tehtyäsi tämän sinulle lähetetään vahvistus tai lisäohjeita postituslistan tilauksen lopettamisesta. %endif% %wrap%Lisätietoa ja ohjeita tämän postituslistan käytöstä saa lähettämällä viestin osoitteeseen <$list+$help@$domain$>. mlmmj/listtexts/fi/gatekeep-sub000066400000000000000000000012561502303113500171270ustar00rootroot00000000000000Subject: Pyyntö liittyä listalle $list$@$domain$: $subaddr$ %text prologue% %wrap%Sähköpostiosoitteesta <$subaddr$> on lähetetty pyyntö liittyä postituslistalle %iftype normal% normaalina %endif% %iftype digest% viestikoosteiden %endif% %iftype nomail% ei jakelua -version %endif% tilaajana. %wrap%Salliaksesi liittymisen lähetä viesti osoitteeseen <$permitaddr$>. Tämä onnistuu tavallisesti vastaamalla tähän viestiin. %wrap%Jos et halua sallia listalle liittymistä, lähetä viesti osoitteeseen <$obstructaddr$> tai jätä tämä pyyntö kokonaan huomioimatta. Seuraavat postituslistan jäsenistä vastaavat henkilöt ovat saaneet tämän viestin: - %gatekeepers% mlmmj/listtexts/fi/help000066400000000000000000000064021502303113500155010ustar00rootroot00000000000000Subject: Tietoja postituslistasta $list$@$domain$ %text prologue% Tässä joitakin tietoja tästä postituslistasta. Voit tilata postituslistasta jonkin seuraavista versioista: - %wrap%Tavallinen jakelu: Aina kun postituslistalle lähetetään viesti, saat tilaajana siitä kopion sähköpostiisi. %ifcontrol closedlist closedlistsub% Liity ottamalla yhteyttä postituslistan ylläpitäjään. %else% Liity lähettämällä viesti osoitteeseen <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Viestikoosteiden jakelu: Saat koosteen postituslistalle lähetetyistä viesteistä yhtenä viestinä säännöllisin väliajoin tai silloin, kun listalle on kertynyt riittävä määrä viestejä. %ifcontrol closedlist closedlistsub% Liity ottamalla yhteyttä postituslistan ylläpitäjään. %else% Liity lähettämällä viesti osoitteeseen <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Ei jakelua -jäsenyys: Osoitteeseesi ei välitetä lainkaan listalle tulevia viestejä. Voit kuitenkin lähettää viestejä listalle kuten listan tavanomaiset tilaajat. Tällainen liittyminen on järkevää, jos seuraat postituslistaa listan www-arkiston kautta tai olet tilannut viestit toiseen sähköpostiosoitteeseen. %ifcontrol closedlist closedlistsub% Liity ottamalla yhteyttä postituslistan ylläpitäjään. %else% Liity lähettämällä viesti osoitteeseen <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%Tälle listalle liittyminen edellyttää, että liittymispyynnön hyväksyy joku listan jäsenyyksiä hallinnoiva henkilö. %endif% %ifcontrol closedlist% %^%%wrap%Listalta voi poistua ottamalla yhteyttä listan ylläpitäjään. %else% %^%%wrap%Listalta voi poistua lähettämällä postia osoitteeseen <$list+$unsubscribe@$domain$>. %endif% %wrap%Listalle lähetetään postia lähettämällä viesti osoitteeseen <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Huomaa kuitenkin, että vain listan tilaajat voivat lähettää viestejä tälle listalle. %endif%%endif% %ifcontrol moderated% %^%%wrap%Tällä listalla on moderaattori, joka tarkastaa kaikki listalle lähetetyt viestit ennen niiden välittämistä listalle. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%Tällä listalla on moderaattori, joka tarkastaa muiden kuin listan tilaajien lähettämät viestit ennen niiden välittämistä listalle. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%Tällä listalla on myös käyttöoikeussääntöjä, jotka voivat vaikuttaa viestien lähetysoikeuteen sekä siihen, mitkä viestit vaativat moderaattorin hyväksynnän. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Kuka tahansa voi %else% Listan tilaajat voivat %endif% hakea viestin numero N listan arkistosta lähettämällä viestin osoitteeseen <$list+$get-N@$domain$> (korvaa N halutulla viestin numerolla). %endif%%endif% %wrap%Listan usein kysytyt kysymykset vastauksineen voi hakea lähettämällä viestin osoitteeseen <$list+$faq@$domain$>. %wrap%Listan ylläpitäjään saa yhteyden lähettämällä postia osoitteeseen <$list+$owner@$domain$>. mlmmj/listtexts/fi/list000066400000000000000000000007321502303113500155240ustar00rootroot00000000000000Subject: Postituslistan $list$@$domain$ tilaajat %text prologue% %wrap%Tässä on lista postituslistan %iftype all% kaikista tilaajista: %else% %iftype normal% tavallisista tilaajista: %endif% %iftype digest% viestikoosteiden tilaajista: %endif% %iftype nomail% jäsenistä, joille ei välitetä postia: %endif% %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/fi/moderate-post000066400000000000000000000032411502303113500173320ustar00rootroot00000000000000Subject: Viesti listalle $list$@$domain$ odottaa hyväksyntää: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Viesti osoitteesta <$posteraddr$> otsikolla "$subject$" on lähetetty listalle välitettäväksi. Sinua pyydetään moderoimaan viesti, koska %ifreason modnonsubposts% viestin lähettäjä ei ole listan tilaaja. %endif% %ifreason moderated% tämän listan kaikki viestit moderoidaan. %endif% %ifreason access% tämän listan välityssäännöt vaativat niin. %endif% Viesti on luettavissa alla. %wrap%Salliaksesi viestin välittämisen listalle lähetä viesti osoitteeseen <$releaseaddr$>. Tämän voi tavallisesti tehdä vastaamalla tähän viestiin. %ifcontrol subonrelease% %^%%wrap%Halutessasi voit viestin hyväksymisen lisäksi liittää lähettäjän postituslistalle. Tämä onnistuu lähettämällä viesti yhteen seuraavista osoitteista:%nowrap% %^%- %wrap%Tavallinen tilaus: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Viestikoosteiden tilaus: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Tilaus ilman viestien välitystä: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Jos et halua viestiä hyväksyttävän, lähetä viesti osoitteeseen <$rejectaddr$> tai jätä tämä viesti kokonaan huomioimatta. Seuraavat moderaattorit ovat saaneet tämän viestin: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/fi/notify000066400000000000000000000023351502303113500160620ustar00rootroot00000000000000%ifaction sub%Subject: Liitetty listalle $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Poistettu listalta $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%Osoite <$subaddr$> on liitetty postituslistan %iftype normal% tavalliseen versioon, %endif% %iftype digest% viestikoosteita vastaanottavaan versioon, %endif% %iftype nomail% ei viestien jakelua -versioon, %endif% %ifreason request% koska tilaaja pyysi saada liittyä listalle. %endif% %ifreason confirm% koska tilaaja vahvisti pyyntönsä liittyä listalle. %endif% %ifreason admin% koska listan ylläpitäjä liitti osoitteen listalle. %endif% %ifreason permit% koska listan jäsenyyksistä vastaava henkilö hyväksyi liittymisen. %endif% %endif% %ifaction unsub% %^%%wrap%Osoite <$subaddr$> on poistettu postituslistan %ifreason request% koska tilaaja pyysi tilauksensa lopettamista. %endif% %ifreason confirm% koska tilaaja vahvisti pyyntönsä tilauksensa lopettamisesta. %endif% %ifreason admin% koska listan ylläpitäjä poisti osoitteen listalta. %endif% %ifreason bouncing% koska viestien lähettäminen osoitteeseen on epäonnistunut toistuvasti. %endif% %endif% mlmmj/listtexts/fi/probe000066400000000000000000000007061502303113500156610ustar00rootroot00000000000000Subject: Välittämättä jääneitä viestejä listalta $list$@$domain$ %text prologue% Sinulle on yritetty lähettää viestejä postituslistalta, mutta ne eivät ole menneet perille. Jos saat tämän viestin, toimii viestien välitys jälleen, ja asiat ovat nyt kunnossa. Tämä viesti on vain tiedonanto siitä, että joitakin viestejä on jäänyt saapumatta. Tässä on lista viesteistä, joita sinulle ei saatu lähetettyä: - %bouncenumbers% mlmmj/listtexts/fi/prologue000066400000000000000000000001251502303113500164010ustar00rootroot00000000000000%wrap%Hei, tämä on Mlmmj-ohjelma, joka hallinnoi <$list$@$domain$>-postituslistaa. mlmmj/listtexts/fi/subrelease000066400000000000000000000020661502303113500167050ustar00rootroot00000000000000%^%%wrap%Koska tämä on avoin lista, voit halutessasi liittyä listalle ja samalla hyväksyä lähettämäsi viestin jakeluun. Tämä onnistuu lähettämällä viesti osoitteeseen <$listsubreleaseaddr$>, siis käytännössä vastaamalla tähän viestiin. Viestin otsikolla ja sisällöllä ei ole merkitystä. %ifncontrol nodigestsub% %^%%wrap%Tai voit tilata listan viestikoosteversion ja samalla hyväksyä viestisi jakeluun. Tämä onnistuu lähettämällä viesti osoitteeseen <$digestsubreleaseaddr$>. Saat listalle tulevat viestit koottuna laajemmiksi koosteiksi, jotka sisältävät yhtenä pakettina tietyllä ajanjaksolla tai tietyn määrän listalle lähetettyjä viestejä. %endif% %ifncontrol nonomailsub% %^%%wrap%Tai voit liittyä listalle ilman viestien jakelua ja samalla hyväksyä viestisi jakeluun. Tämä onnistuu lähettämällä viesti osoitteeseen <$nomailsubreleaseaddr$>. Huomaa, että tällöin et ehkä saa viestiisi vastauksia, ellet seuraa postituslistaa www-arkiston tai toisen sähköpostiosoitteen välityksellä. %endif% mlmmj/listtexts/fi/wait-post000066400000000000000000000020101502303113500164670ustar00rootroot00000000000000Subject: Viesti odottaa hyväksymistä listalle $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Viesti osoitteesta <$posteraddr$> otsikolla "$subject$" on lähetetty postituslistalle. Ennen kuin viesti päätyy postituslistalle, moderaattorin on hyväksyttävä se, %ifreason moderated% koska tämä on moderoitu postituslista. %endif% %ifreason access% koska tämän postituslistan käyttösäännöt edellyttävät sitä. %endif% %ifreason modnonsubposts% koska et ole postituslistan tilaaja. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Lähetetty viesti on alla.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/fi/wait-sub000066400000000000000000000004171502303113500163040ustar00rootroot00000000000000Subject: Liittyminen listalle $list$@$domain$ odottaa hyväksyntää %text prologue% %wrap%Pyyntösi liittyä postituslistalle on vastaanotettu. Ennen kuin osoitteesi liitetään postituslistalle, on listan jäsenyyksistä vastaavan henkilön hyväksyttävä pyyntö. mlmmj/listtexts/fr/000077500000000000000000000000001502303113500146355ustar00rootroot00000000000000mlmmj/listtexts/fr/confirm000066400000000000000000000034101502303113500162130ustar00rootroot00000000000000%ifaction sub%Subject: Confirmer votre abonnement à $list$@$domain$%endif% %ifaction unsub%Subject: Confirmer votre désabonnement de $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Un administrateur %endif% %ifreason request% Quelqu'un (et nous espérons que c'est vous) %endif% a demandé que votre adresse e-mail <$subaddr$> soit ajoutée %iftype normal% à la liste. Cela signifie que chaque fois qu'un message sera envoyé à la liste, vous en recevrez une copie %endif% %iftype digest% à la liste afin d'en recevoir un résumé. Cela signifie que vous recevrez plusieurs messages dans un seul e-mail, à des intervalles réguliers, ou lorsque beaucoup de messages ont été accumulés. %endif% %iftype nomail% à la liste, sans envoi des e-mails. Cela signifie que vous ne recevrez aucun e-mail envoyé à la liste. Par exemple, vous pouvez envoyer un message à une liste à laquelle seuls les inscrits peuvent poster, alors que vous suivez la liste en utilisant une archive web ou une autre adresse e-mail inscrite. %endif% %endif% %ifaction unsub% %wrap% %ifreason admin% Un administrateur %endif% %ifreason request% Quelqu'un (et nous espérons que c'est vous) %endif% a demandé à ce que l'adresse e-mail <$subaddr$> soit supprimée de la liste. %endif% %wrap%Pour confirmer que vous voulez faire cela, veuillez envoyer un message à <$confirmaddr$> ce qui peut, habituellement, être fait facilement en répondant à ce message. Le sujet et le corps du message peuvent contenir n'importe quoi. Après cela, vous devriez recevoir un réponse vous informant du succès de l'opération. Si vous ne souhaitez pas faire cela, ignorez simplement ce message. mlmmj/listtexts/fr/deny000066400000000000000000000046451502303113500155300ustar00rootroot00000000000000%ifaction sub%Subject: Abonnement à $list$@$domain$%endif% impossible %ifaction unsub%Subject: Désabonnement de $list$@$domain$%endif% impossible %ifaction release reject%Subject: Impossible de modérer $list$@$domain$%endif% %ifaction permit obstruct%Subject: Impossible d'accepter / refuser $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Il n'a pas été possible de vous inscrire à la liste %ifreason disabled% parce que la version %iftype normal% normale %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% de la liste a été désactivée. %endif% %ifreason closed% parce qu'il n'est pas possible de s'inscrire à cette liste par e-mail. %endif% %ifreason subbed% parce que vous êtes déjà inscrit. %endif% %ifreason expired% parce qu'il s'est écoulé trop de temps avant qu'un modérateur autorise votre accès. %endif% %ifreason obstruct% parce qu'un modérateur n'a pas autorisé votre accès. %endif% %endif% %ifaction unsub% %^%%wrap%Il n'a pas été possible de vous désinscrire de la liste %ifreason unsubbed% parce que vous n'êtes pas inscrit. %^%%wrap%Si vous recevez des messages, peut-être qu'une adresse différente est inscrite. Pour connaître l'adresse avec laquelle vous êtes inscrit, référez-vous au message de bienvenue à la liste, ou examinez l'en-tête "Adresse de retour" du message que vous avez reçu de la liste. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Vous n'avez pu délivrer le message indiqué à la liste %endif% %ifaction reject% Vous n'avez pu rejeter le message spécifié %endif% %ifreason notfound% parce qu'il n'a pu être trouvé. Peut être qu'un autre modérateur l'a déjà délivré ou rejeté ou bien a-t-il expiré. %endif% %ifreason moderators% parce que vous n'êtes pas un modérateur de la liste. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Vous n'avez pu autoriser cette demande d'inscription %endif% %ifaction obstruct% Vous n'avez pu rejeter cette demande d'inscription %endif% %ifreason notfound% parce qu'elle n'a pu être trouvée. Peut être qu'un autre modérateur l'a déjà acceptée ou rejetée ou bien a-t-elle expirée. %endif% %ifreason gatekeepers% parce que vous n'êtes pas un modérateur de la liste. %endif% %endif% mlmmj/listtexts/fr/deny-post000066400000000000000000000037141502303113500165070ustar00rootroot00000000000000Subject: Message à $list$@$domain$ refusé : $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Le message de <$posteraddr$> ayant pour sujet "$subject$" n'a pas pu être délivré à la liste %ifreason maxmailsize% parce qu'il dépassait la taille maximale autorisée de $maxmailsize$ octets. %endif% %ifreason tocc% parce que l'adresse de la liste n'a été trouvée ni dans l'entête Pour: ni Copie à:. %endif% %ifreason access% en raison d'une règle d'accès définie par l'administrateur. %endif% %ifreason expired% parce qu'il s'est écoulé trop de temps avant qu'un modérateur ne le délivre. %endif% %ifreason reject% parce qu'un modérateur l'a rejeté. %endif% %ifreason subonlypost% parce que vous n'êtes pas un inscrit de la liste. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Si vous souhaitez vous inscrire, vous devez contacter un administrateur de la liste. Vous pouvez envoyer un e-mail à <$list+$owner@$domain$> pour contacter le propriétaire de la liste. %endif% %^%%wrap%Si vous pensez être inscrit, vous l'êtes probablement avec une adresse e-mail différente. Pour savoir avec quelle adresse vous êtes inscrit, référez-vous au message de bienvenue à la liste ou examinez l'en-tête "Adresse de retour" du message reçu de la liste. %endif% %ifreason maxmailsize% %^%(Le début du message rejeté est ci-dessous) %else% %^%(Le message rejeté figure ci-dessous.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/fr/digest000066400000000000000000000002211502303113500160320ustar00rootroot00000000000000Subject: Digest de $list$@$domain$ numéro $digestissue$ ($digestinterval$) Sujets (messages $digestfirst$ de $digestlast$): - %digestthreads% mlmmj/listtexts/fr/faq000066400000000000000000000001511502303113500153240ustar00rootroot00000000000000Subject: Foire aux questions de $list$@$domain$ Désolé, il n'y a pas de FAQ disponible actuellement. mlmmj/listtexts/fr/finish000066400000000000000000000025371502303113500160470ustar00rootroot00000000000000%ifaction unsub%Subject: Au revoir de $list$@$domain$%endif% %ifaction release reject%Subject: $list$@$domain$ modérée : $subject$%endif% %ifaction permit obstruct%Subject: $list$@$domain$ à accès restreint : $subaddr$%endif% %ifaction post%Subject: Envoyé à $list$@$domain$ : $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Merci d'avoir confirmé votre désinscription. %endif% %ifreason admin% Un administrateur vous a retiré de la liste. %else% Vous avez maintenant été retiré de la liste. %endif% %endif% %ifaction release% %^%%wrap%Vous avez délivré avec succès le message de <$posteraddr$> ayant pour sujet "$subject$" à la liste. %endif% %ifaction reject% %^%%wrap%Vous avez rejeté avec succès le message de <$posteraddr$> ayant pour sujet "$subject$". %endif% %ifaction permit% %^%%wrap%Vous avez permis à <$subaddr$> de rejoindre la liste. %endif% %ifaction obstruct% %^%%wrap%Vous avez empêché <$subaddr$> de rejoindre la liste. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Merci de votre confirmation %endif% %ifreason release% Un modérateur a délivré %endif% %ifreason request% Merci pour %endif% votre message ayant pour sujet "$subject$". Il a maintenant été distribué à la liste. %endif% mlmmj/listtexts/fr/finish-sub000066400000000000000000000024771502303113500166410ustar00rootroot00000000000000Subject: Bienvenue à $list$@$domain$ %text prologue% %wrap% %ifreason request% Merci de votre demande pour nous rejoindre. %endif% %ifreason confirm% Merci de confirmer votre inscription. %endif% %ifreason permit% Un modérateur vous a permis de nous rejoindre. %endif% %ifreason switch% Votre inscription a été transférée sur la version %else% %ifreason admin% Un administrateur vous a inscrit à la version %else% Vous avez maintenant été ajouté à la version %endif% %endif% %iftype normal% normale %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% de la liste. %wrap%L'adresse e-mail avec laquelle vous avez été inscrit est <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Si vous souhaitez vous désinscrire, vous devez contacter un administrateur de la liste. Vous pouvez envoyer un mail à <$list+$owner@$domain$> pour contacter le propriétaire de la liste. %else% %^%%wrap%Si vous souhaitez vous désinscrire, envoyez un message à <$list+$unsubscribe@$domain$> en utilisant cette adresse e-mail. Le sujet et le corps du message peuvent contenir n'importe quoi. Vous recevrez ensuite une confirmation ou des instructions complémentaires. %endif% %wrap%Pour d'autres informations ou de l'aide à propos de cette liste, envoyez un message à <$list+$help@$domain$>. mlmmj/listtexts/fr/gatekeep-sub000066400000000000000000000011271502303113500171350ustar00rootroot00000000000000Subject: Demande d'inscription pour $list$@$domain$ : $subaddr$ %text prologue% %wrap%Il y a eu une demande de la part de <$subaddr$> pour rejoindre la version %iftype normal% normale %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% de la liste. %wrap%Pour l'autoriser, veuillez envoyer un message à <$permitaddr$> ce qui peut être fait habituellement simplement en répondant à ce message. %wrap%Si vous ne souhaitez pas faire cela, envoyez un message à <$obstructaddr$> ou ignorez simplement ce message. Le modérateur suivant à reçu le message : - %gatekeepers% mlmmj/listtexts/fr/help000066400000000000000000000060041502303113500155100ustar00rootroot00000000000000Subject: Information pour $list$@$domain$ %text prologue% Vous trouverez ci-après des informations à propos de la liste Vous pouvez vous inscrire aux versions suivantes : - %wrap%la version normale\ : à chaque fois qu'un message est envoyé à la liste, les inscrits reçoivent une copie de celui-ci. %ifcontrol closedlist closedlistsub% Inscrivez-vous en contactant un administrateur de la liste. %else% Inscrivez-vous en envoyant un e-mail à <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%La version digest\ : les inscrits reçoivent des messages multiples dans un seul e-mail, à des intervalles réguliers, ou lorsque plusieurs messages se sont accumulés. %ifcontrol closedlist closedlistsub% Inscrivez-vous en contactant un administrateur de la liste. %else% Inscrivez-vous en envoyant un e-mail à <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%La version no-mail\ : les inscrits ne reçoivent aucun message de la liste. Cela signifie qu'alors qu'ils peuvent poster des messages à la liste que seuls les inscrits peuvent envoyer, ils suivent la liste en utilisant une archive web ou via une autre adresse e-mail inscrite. %ifcontrol closedlist closedlistsub% Inscrivez-vous en contactant un administrateur de la liste. %else% Inscrivez-vous en envoyant un e-mail à <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%La liste a un modérateur qui vérifiera les demandes d'inscription avant d'autoriser les nouveaux membres. %endif% %ifcontrol closedlist% %^%%wrap%Désinscrivez-vous en contactant un administrateur de la liste. %else% %^%%wrap%Désinscrivez-vous en envoyant un e-mail à <$list+$unsubscribe@$domain$>. %endif% %wrap%Les messages sont envoyés à <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Cependant, seuls les inscrits peuvent poster sur la liste. %endif%%endif% %ifcontrol moderated% %^%%wrap%La liste a des modérateurs qui vérifieront tous les messages avant de les délivrer à la liste. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%La liste a des modérateurs qui vérifieront tous les messages des non-incrits avant de les délivrer à la liste. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%La liste a également des règles d'accès qui peuvent concerner ceux qui peuvent poster et les messages qui sont modérés. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Tous %else% Les inscrits %endif% peuvent retirer le message numéro N des archives de la liste en envoyant un message à <$list+$get-N@$domain$> (remplacez le N par le numéro du message souhaité). %endif%%endif% %wrap%Vous pouvez obtenir le document contenant les questions fréquemment posées pour la liste en envoyant un message à <$list+$faq@$domain$>. %wrap%Pour contacter le propriétaire de la liste envoyé un message à <$list+$owner@$domain$>. mlmmj/listtexts/fr/list000066400000000000000000000006631502303113500155400ustar00rootroot00000000000000Subject: Inscrits à $list$@$domain$ %text prologue% %wrap%Voici la liste des inscrits %iftype all% (à toutes les versions de la liste): %else% à la version %iftype normal% normale %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% de la liste\ : %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/fr/moderate-post000066400000000000000000000031101502303113500173360ustar00rootroot00000000000000Subject: Veuillez modérer $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Un message de <$posteraddr$> ayant pour sujet "$subject$" a été soumis pour envoi. Il vous est demandé de le modérer %ifreason modnonsubposts% parce que le demandeur n'est pas inscrit. %endif% %ifreason moderated% parce que c'est une liste modérée. %endif% %ifreason access% en raison d'une règle d'accès. %endif% Le message est ci-dessous. %wrap%Pour le délivrer à la liste, veuillez envoyer un message à <$releaseaddr$> ce qui peut habituellement être fait simplement en répondant à ce message. %ifcontrol subonrelease% %^%%wrap%Si vous le souhaitez, vous pouvez simultanément délivrer le message et inscrire le demandeur à la liste en envoyant un message à l'une des adresses suivantes\ :%nowrap% %^%- %wrap%Version normale\ : <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Version digest\ : <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Version no-mail\ : <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Si vous ne souhaitez faire aucune de ces actions, vous pouvez envoyer un message à <$rejectaddr$> ou simplement ignorer ce message. Les modérateurs suivants ont reçu ce mail : - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/fr/notify000066400000000000000000000021561502303113500160740ustar00rootroot00000000000000%ifaction sub%Subject: Inscrit à $list$@$domain$ : $subaddr$%endif% %ifaction unsub%Subject: Désinscrit de $list$@$domain$ : $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%L'adresse' <$subaddr$> a été inscrite à la version %iftype normal% normale %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% de la liste %ifreason request% parce qu'une demande pour la rejoindre a été reçue. %endif% %ifreason confirm% parce qu'une demande pour la rejoindre a été confirmée. %endif% %ifreason admin% parce qu'un administrateur l'a demandé. %endif% %ifreason permit% parce qu'un modérateur l'a permis. %endif% %endif% %ifaction unsub% %^%%wrap%L'adresse <$subaddr$> a été désinscrite de la liste %ifreason request% parce qu'une demande de désinscription a été reçue. %endif% %ifreason confirm% parce qu'une demande de désinscription a été confirmée. %endif% %ifreason admin% parce qu'un administrateur l'a demandé. %endif% %ifreason bouncing% parce qu'il a été rejeté pendant trop longtemps. %endif% %endif% mlmmj/listtexts/fr/probe000066400000000000000000000005121502303113500156650ustar00rootroot00000000000000Subject: Messages rejetés de $list$@$domain$ %text prologue% Certains messages ne peuvent pas vous être délivrés. Si vous voyez ce message, cela signifie que les choses sont revenues à la normal et c'est principalement pour votre information. Veuillez trouver ci-après la liste des messages rejetés : - %bouncenumbers% mlmmj/listtexts/fr/prologue000066400000000000000000000001071502303113500164120ustar00rootroot00000000000000%wrap%Hi, c'est le programme Mlmmj gérant la liste <$list$@$domain$>. mlmmj/listtexts/fr/subrelease000066400000000000000000000022221502303113500167100ustar00rootroot00000000000000%^%%wrap%Cependant, c'est une liste ouverte. Si vous le souhaitez vous pouvez simultanément vous inscrire et délivrer votre message en envoyant un message à <$listsubreleaseaddr$> ce qui peut habituellement être fait simplement en répondant à ce message. Le sujet et le corps du message peuvent contenir n'importe quoi. %ifncontrol nodigestsub% %^%%wrap%Ou vous pouvez simultanément vous inscrire à la version digest de la liste et délivrer votre message en envoyant un message à <$digestsubreleaseaddr$> et vous recevrez des messages multiples groupés en un seul message, à intervalles réguliers ou lorsque plusieurs messages se sont accumulés. %endif% %ifncontrol nonomailsub% %^%%wrap%Ou vous pouvez simultanément vous inscrire à la version no-mail de la liste et délivrer votre message en envoyant un message à <$nomailsubreleaseaddr$> et vous ne recevrez pas les messages envoyés à la liste. Cela signifie que vous ne verrez pas les réponses à votre message à moins que vous ne suiviez la liste en utilisant une archive web ou que vous n'inscriviez une autre adresse e-mail à une autre version de la liste. %endif% mlmmj/listtexts/fr/wait-post000066400000000000000000000017451502303113500165160ustar00rootroot00000000000000Subject: En attente de réponse à $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Le message de <$posteraddr$> ayant pour sujet "$subject$" a été soumis à la liste. Cependant il a été demandé aux modérateurs de le contrôler avant de le délivrer à la liste %ifreason moderated% parce que c'est une liste modérée. %endif% %ifreason access% en raison d'une règle d'accès. %endif% %ifreason modnonsubposts% parce que vous n'êtes pas inscrit. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Le message apparaît ci-dessous.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/fr/wait-sub000066400000000000000000000003671502303113500163210ustar00rootroot00000000000000Subject: En attente d'autorisation pour joindre la liste $list$@$domain$ %text prologue% %wrap%Votre requête pour joindre la liste a été reçue. Cependant, les modérateurs doivent la vérifier avant de vous autoriser à rejoindre la liste. mlmmj/listtexts/gr/000077500000000000000000000000001502303113500146365ustar00rootroot00000000000000mlmmj/listtexts/gr/confirm000066400000000000000000000061701502303113500162220ustar00rootroot00000000000000%ifaction sub%Subject: Επιβεβαίωση εγγραφής στη $list$@$domain$%endif% %ifaction unsub%Subject: Επιβεβαίωση διαγραφής από τη $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Ένας από τους διαχειριστές %endif% %ifreason request% Κάποιος (και ελπίζουμε πως είστε εσείς) %endif% ζήτησε την καταχώρηση της email διεύθυνσης <$subaddr$> %iftype normal% στους παραλήπτες των μηνυμάτων αυτής της λίστας ταχυδρομείου. Αυτό σημαίνει πως κάθε μήνυμα που θα δημοσιεύεται στη λίστα, θα αποστέλλεται με email και στη δική σας διεύθυνση. %endif% %iftype digest% στους παραλήπτες των συγκεντρωτικών ενημερώσεων της λίστας ταχυδρομείου. Αυτό σημαίνει πως ανά τακτά χρονικά διαστήματα, θα παραλαμβάνετε ένα συγκεντρωτικό μήνυμα με τα τελευταία μηνύματα που δημοσιεύτηκαν στη λίστα αυτή. %endif% %iftype nomail% στους συνδρομητές της λίστας ταχυδρομείου, χωρίς ενημέρωσή σας για τα μηνύματα των άλλων χρηστών. (no-mail subscription). Η ιδιαιτερότητα αυτής της κατηγορίας συνδρομητών είναι πως έχετε τη δυνατότητα να χρησιμοποιείτε αυτήν την ηλεκτρονική διεύθυνση για να δημοσιεύετε κάποιο μήνυμα στη λίστα, χρησιμοποιώντας ενδεχομένως κάποια άλλη ηλεκτρονική διεύθυνση για να παρακολουθείτε τα μηνύματα των άλλων μελών ή ακόμα παρακολουθώντας τα νέα μηνύματα από το αρχείο της λίστας (web archive). %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Ένας από τους διαχειριστές %endif% %ifreason request% Κάποιος (και ελπίζουμε πως είστε εσείς) %endif% κατέθεσε αίτημα για τη διαγραφή της email διεύθυνσης <$subaddr$> από τη λίστα ταχυδρομείου. %endif% %wrap%Για να επιβεβαιώσετε το παραπάνω αίτημα απλά απαντήστε στέλνοντας email στο <$confirmaddr$> γράφοντας οτιδήποτε στο θέμα. Αν όλα πάνε καλά, θα σας αποσταλεί μήνυμα επιβεβαίωσης. Αν το αρχικό αίτημα πραγματοποιήθηκε κατά λάθος ή δεν πραγματοποιήθηκε από εσάς, τότε απλά αγνοήστε τις παραπάνω οδηγίες! mlmmj/listtexts/gr/deny000066400000000000000000000073431502303113500155270ustar00rootroot00000000000000%ifaction sub%Subject: Αδυναμία εγγραφής στη $list$@$domain$%endif% %ifaction unsub%Subject: Αδυναμία διαγραφής από $list$@$domain$%endif% %ifaction release reject%Subject: Αδυναμία διαχείρισης της $list$@$domain$%endif% %ifaction permit obstruct%Subject: Αδυναμία ελέγχου της $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Δεν μπορέσατε να εγγραφείτε σε αυτην τη λίστα ταχυδρομείου %ifreason disabled% καθώς %iftype normal% η κανονική συνδρομή %endif% %iftype digest% η συνδρομή με λήψη συγκεντρωτικών μηνυμάτων %endif% %iftype nomail% η συνδρομή χωρίς λήψη μηνυμάτων %endif% δεν είναι ενεργοποιημένη. %endif% %ifreason closed% καθώς η λίστα αυτή δεν δέχεται εγγραφές με χρήση email. %endif% %ifreason subbed% γιατί είστε ήδη εγγεγραμμένος/η. %endif% %ifreason expired% και ο λόγος είναι πως για μεγάλο χρονικό διάστημα η αίτηση σας δεν διεκπεραιώθηκε από κάποιον διαχειριστή. %endif% %ifreason obstruct% και ο λόγος είναι πως κάποιος από τους διαχειριστές εμπόδισε την αποδοχή της αίτησής σας. %endif% %endif% %ifaction unsub% %^%%wrap% Δεν μπορέσατε να διαγραφείτε από αυτήν τη λίστα ταχυδρομείου %ifreason unsubbed% καθώς δεν είστε μέλος. %^%%wrap%Αν λαμβάνετε μηνύματα, ενδεχομένως αυτό συμβαίνει γιατί έχετε εγγραφεί χρησιμοποιώντας κάποιον άλλο λογαριασμό email. Για να εντοπίσετε το λογσριασμό με τον οποίο έχετε εγγραφει, αναζητήστε το πρώτο μήνυμα καλωσορίσματος που παραλάβατε με την εγγραφή σας. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Δεν έγινε εφικτή η αποδοχή του μηνύματος στη λίστα ταχυδρομείου %endif% %ifaction reject% Δεν έγινε εφικτή η απόρριψη του μηνύματος %endif% %ifreason notfound% και ο λόγος είναι πως αυτό δεν βρέθηκε. Ενδεχομένως, η ανάρτηση να είναι παρωχημένη, ή ακόμα κάποιος άλλος διαχειριστής να το έχει ήδη διεκπεραιώσει. %endif% %ifreason moderators% καθώς δεν έχετε δικαιώματα διαχειριστή. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Δεν έχετε δικαίωμα έγκρισης του αιτήματος εγγραφής στη λίστα %endif% %ifaction obstruct% Δεν μπορείτε να εμποδίσετε το αίτημα εγγραφής στη λίστα %endif% %ifreason notfound% καθώς δεν βρέθηκε σχετικό αίτημα. Ενδεχομένως το αίτημα να είναι παρωχημένο ή κάποιος άλλος διαχειριστής να έχει ήδη διεκπεραιώσει το αίτημα αυτό. %endif% %ifreason gatekeepers% καθώς δεν είστε διαχειριστής για αυτήν την λίστα. %endif% %endif% mlmmj/listtexts/gr/deny-post000066400000000000000000000056031502303113500165070ustar00rootroot00000000000000Subject: Το μήνυμα με θέμα $subject$ απορρίφθηκε απο τη $list$@$domain$: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Το μήνυμα με διεύθυνση αποστολέα <$posteraddr$> και θέμα "$subject$" δεν παραλήφθηκε από τη λίστα ταχυδρομείου %ifreason maxmailsize% καθώς ξεπερνά το μέγιστο επιτρεπτό μέγεθος των $maxmailsize$ bytes. %endif% %ifreason tocc% καθώς η διεύθυνση της λίστας ταχυδρομείου δεν βρέθηκε στα πεδία To: ή CC:. %endif% %ifreason access% λόγω ενός περιορισμού πρόσβασης που έχει επιβληθεί από τον/τους διαχειριστές της λίστας. %endif% %ifreason expired% καθώς έχει παρέλθει μεγάλο χρονικό διάστημα χωρίς κάποιος διαχειριστής να το έχει διεκπεραιώσει. %endif% %ifreason reject% καθώς κάποιος από τους διαχειριστές της λίστας το απέρριψε. %endif% %ifreason subonlypost% καθώς δεν είστε εγγεγραμμένος στη λίστα. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Αν επιθυμείτε να εγγραφείτε στη λίστα ταχυδρομείου, αρκεί να ενημερώσετε κάποιον απο τους διαχειριστές της, στέλλοντας email στη διεύθυνση <$list+$owner@$domain$>. %endif% %^%%wrap%Αν νομίζετε πως είστε ήδη εγγεγραμμένος τότε επιβεβαιώστε πως αποστείλατε το αρχικό μήνυμά σας από τη διεύθυνση που είχατε χρησιμοποιήσει για την εγγραφή σας. Για την επιβεβαίωση της διεύθυνσης Θα σας βοηθήσει αν αναζητήσετε το αρχικό μήνυμα καλωσορίσματος στη λίστα ταχυδρομείου. %endif% %ifreason maxmailsize% %^%(Παρακάτω ακολουθεί ένα μέρος από το μήνυμα που απορρίφθηκε) %else% %^%(Παρακάτω ακολουθεί το μήνυμα που απορρίφθηκε) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/gr/digest000066400000000000000000000004001502303113500160320ustar00rootroot00000000000000Subject: Συγκεντρωτική ενημέρωση της λίστας ταχυδρομείου $list$@$domain$ τεύχος $digestissue$ ($digestinterval$) Θέματα (μηνύματα από $digestfirst$ έως $digestlast$): - %digestthreads% mlmmj/listtexts/gr/faq000066400000000000000000000003001502303113500153210ustar00rootroot00000000000000Subject: Συχνές ερωτήσεις σχετικές με τη $list$@$domain$ Δυστυχώς, οι συχνές ερωτήσεις δεν είναι ακόμα διαθέσιμες. mlmmj/listtexts/gr/finish000066400000000000000000000044351502303113500160470ustar00rootroot00000000000000%ifaction unsub%Subject: Αποχαιρετισμός από τη $list$@$domain$%endif% %ifaction release reject%Subject: Διαχείριση $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Προστασία $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Εμφάνιση μύνηματος στη $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Ευχαριστούμε για την επιβεβαίωση της διαγραφής σας από τη λίστα ταχυδρομείου. %endif% %ifreason admin% Ένας από τους διαχειριστές σας διέγραψε από τους παραλήπτες τη λίστα ταχυδρομείου. %else% Έχετε επιτυχώς διαγράφει από τους παραλήπτες της λίστας ταχυδρομείου. %endif% %endif% %ifaction release% %^%%wrap%Η ανάρτηση του μηνύματος που υποβλήθηκε από τη <$posteraddr$> με θέμα "$subject$" έχει επιτυχώς διεκπεραιωθεί. %endif% %ifaction reject% %^%%wrap%Η απόρριψη του μηνύματος που υποβλήθηκε από τη <$posteraddr$> με θέμα "$subject$" έχει ολοκληρωθεί. %endif% %ifaction permit% %^%%wrap%Η αποδοχή της αίτησης του/της <$subaddr$> για συμμετοχή στη λίστα ταχυδρομείου πραγματοποιήθηκε επιτυχώς. %endif% %ifaction obstruct% %^%%wrap%Έχετε επιτυχώς εμποδίσει την αίτηση του <$subaddr$> για συμμετοχή στη λίστα ταχυδρομείου. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Ευχαριστούμε για την επιβεβαίωση του μηνύματος %endif% %ifreason release% Ένας από τους διαχειριστές αποδέχθηκε το μήνυμα %endif% %ifreason request% Ευχαριστούμε για το μήνυμα %endif% με θέμα "$subject$" το οποίο έχει γίνει ήδη διαθέσιμο στα υπόλοιπα μέλη της λίστας. %endif% mlmmj/listtexts/gr/finish-sub000066400000000000000000000045501502303113500166340ustar00rootroot00000000000000Subject: Καλωσορίσατε στη $list$@$domain$ %text prologue% %wrap% %ifreason request% Ευχαριστούμε για την επιλογή σας να γίνετε μέλος στη λίστα μας. %endif% %ifreason confirm% Ευχαριστούμε για την επιβεβαίωση της εγγραφής σας. %endif% %ifreason permit% Η αίτησή σας για εγγραφή στη λίστα έγινε αποδεκτή από τους διαχειριστές της. %endif% %ifreason switch% Η εγγραφή σας άλλαξε σε %else% %ifreason admin% Έχετε εγγραφεί από κάποιον διαχειριστή ως %else% Έχετε εγγραφεί ως %endif% %endif% %iftype normal% κανονικό μέλος (δυνατότητα αποστολής μηνυμάτων και λήψη όλων των μηνυμάτων, μεμονωμένα). %endif% %iftype digest% μέλος με λήψη συνοπτικών περιλήψεων των νέων μηνυμάτων. %endif% %iftype nomail% μέλος χωρίς λήψη των μηνυμάτων άλλων χρηστών (no-mail subscription). %endif% %wrap%Η διεύθυνση email με την οποία έχετε εγγραφεί είναι η <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Για διαγραφή από τη λίστα αρκεί να ενημερώσετε κάποιον από τους διαχειριστές της λίστας. Για επικοινωνία με τον ιδιοκτήτη της λίστας αρκεί ένα μήνυμα στη <$list+$owner@$domain$>. %else% %^%%wrap%Για τη διαγραφή σας από τη λίστα αρκεί να στείλετε ένα μήνυμα στη <$list+$unsubscribe@$domain$>. Το θέμα και το περιεχόμενο του μηνύματος μπορεί να είναι οτιδήποτε, φυσικά μπορεί να είναι και κενό! Μετά τη αποστολή του μηνύματος θα λάβετε επιβεβαίωση ή περαιτέρω οδηγίες. %endif% %wrap%Για περισσότερες πληροφορίες και γενικότερη βοήθεια σχετικά με τη λίστα αυτή, αρκεί να στείλετε ένα μήνυμα στο <$list+$help@$domain$>. mlmmj/listtexts/gr/gatekeep-sub000066400000000000000000000021611502303113500171350ustar00rootroot00000000000000Subject: Αίτηση εγγραφής στη λίστα ταχυδρομείου $list$@$domain$: $subaddr$ %text prologue% %wrap%Παραλάβαμε αίτημα από τη διεύθυνση <$subaddr$> για %iftype normal% κανονική εγγραφή %endif% %iftype digest% εγγραφή με λήψη συγκεντρωτικών περιλήψεων των νέων μηνυμάτων %endif% %iftype nomail% εγγραφή χωρίς λήψη των μηνυμάτων άλλων χρηστών %endif% στη λίστα αυτή. %wrap%Για να αποδεχθείτε την αίτηση αυτή, αρκεί να στείλετε ένα μήνυμα στην <$permitaddr$>. Λογικά αυτό θα συμβεί επιλέγοντας "Απάντηση" στο μήνυμα αυτό. %wrap%Αν δεν επιθυμείτε κάτι τέτοιο τότε στείλτε ένα μήνυμα στη διεύθυνση <$obstructaddr$> ή απλά αγνοήστε το παρόν μήνυμα. Το μήνυμα αυτό απεστάλη στους παρακάτω διαχειριστές: - %gatekeepers% mlmmj/listtexts/gr/help000066400000000000000000000117111502303113500155120ustar00rootroot00000000000000Subject: Πληροφορίες για τη λίστα $list$@$domain$ %text prologue% Παρακάτω ακολουθούν χρήσιμες πληροφορίες για αυτήν τη λίστα ταχυδρομείου. Τρόποι εγγραφής στη λίστα : - %wrap%Κανονικό μέλος\ : Λήψη αντιγράφου από όλα τα μηνύματα που δημοσιεύονται στη λίστα. %ifcontrol closedlist closedlistsub% Η εγγραφή είναι δυνατή ύστερα από επικοινωνία με κάποιον από τους διαχειριστές της λίστας. %else% Για την εγγραφή στη λίστα αρκεί η αποστολή ενός email στη διεύθυνση <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Μέλος που λαμβάνει συγκεντρωτικές αναφορές\ : Λήψη των νέων μηνυμάτων σε ένα συγκεντρωτικό μήνυμα που αποστέλλεται σε κανονικά διαστήματα ή όταν συσσωρεύονται πολλά νέα μηνύματα. %ifcontrol closedlist closedlistsub% Η εγγραφή είναι δυνατή ύστερα από επικοινωνία με κάποιον από τους διαχειριστές της λίστας. %else% Για την εγγραφή στη λίστα αρκεί η αποστολή email στη διεύθυνση <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Μέλος χωρίς ενημέρωση για τα νέα μηνύματα\ : Μη λήψη των νέων μηνυμάτων, με παράλληλη δυνατότητα αποστολής και ανάρτησης ενός μηνύματος. Η παρακολούθηση της λίστας μπορεί να γίνει είτε μέσω του αρχείου της λίστας είτε μέσω κάποιας άλλης εγγεγραμμένης διεύθυνσης email. %ifcontrol closedlist closedlistsub% Εγγραφή με επικοινωνία με κάποιον από τους διαχειριστές της λίστας. %else% Για την εγγραφή στη λίστα αρκεί η αποστολή email στη διεύθυνση <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%Οι διαχειριστές της λίστας επιβλέπουν και εγκρίνουν τις αιτήσεις εγγραφής σε αυτήν. %endif% %ifcontrol closedlist% %^%%wrap%Για τη διαγραφή από τη λίστα ταχυδρομείου αρκεί η αποστολή σχετικού μηνύματος σε κάποιον από τους διαχειριστές της. %else% %^%%wrap%Για τη διαγραφή αρκεί η αποστολή email στο <$list+$unsubscribe@$domain$>. %endif% %wrap%Για τη δημοσίευση ενός μηνύματος αρκεί η αποστολή του στο <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Ωστόσο, μόνο εγγεγραμμένα μέλη έχουν δυνατότητα δημοσίευσης μηνυμάτων στη λίστα. %endif%%endif% %ifcontrol moderated% %^%%wrap%Οι διαχειριστές της λίστας επιβλέπουν και εγκρίνουν όλες τα μηνύματα που αποστέλλονται σε αυτήν. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%Οι διαχειριστές της λίστας ταχυδρομείου επιβλέπουν (και εγκρίνουν ή απορρίπτουν) τα μηνύματα από μη μέλη της λίστας. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%Οι κανόνες λειτουργίας της λίστας ταχυδρομείου καθορίζουν τα μηνύματα που ανακοινώνονται χωρίς έλεγχο και όσα πρέπει να ελεγχθούν πριν τη δημοσίευσή τους. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Ο κάθε ένας %else% Κάθε εγγεγραμμένος χρήστης %endif% μπορεί να αναζητήσει το μήνυμα που βρίσκεται στη θέση N στο αρχείο της λίστας, στέλνοντας ένα μήνυμα στη διεύθυνση <$list+$get-N@$domain$> (όπου N θα μπει η θέση του μυνήματος). %endif%%endif% %wrap%Για να δείτε τις συχνές ερωτήσεις αρκεί η αποστολή ενός μηνύματος στο <$list+$faq@$domain$>. %wrap%Για επικοινωνία με τον ιδιοκτήτη της λίστας αρκεί ένα email στο <$list+$owner@$domain$>. mlmmj/listtexts/gr/list000066400000000000000000000013021502303113500155300ustar00rootroot00000000000000Subject: Εγγεγραμμένα μέλη στη λίστα ταχυδρομείου $list$@$domain$ %text prologue% %wrap%Μέλη της λίστας ταχυδρομείου %iftype all% (σε όλες τις κατηγορίες συμμετοχής): %else% %iftype normal% με κανονική συμμετοχή\ : %endif% %iftype digest% που λαμβάνουν συγκεντρωτικές ενημερώσεις\ : %endif% %iftype nomail% χωρίς αποστολή ενημερώτικών email (no-mail subscription): %endif% %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/gr/moderate-post000066400000000000000000000044361502303113500173530ustar00rootroot00000000000000Subject: Παρακαλώ διαχειριστείτε $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Το μήνυμα με αποστολέα <$posteraddr$> και θέμα "$subject$" πρέπει να ελεγχθεί πριν τη δημοσίευσή του %ifreason modnonsubposts% καθώς ο αποστολέας του μηνύματος δεν είναι εγγεγραμμένος στη λίστα. %endif% %ifreason moderated% καθώς αυτή είναι μία λίστα με ελεγχόμενη δημοσίευση. %endif% %ifreason access% καθώς αυτό επιβάλλεται από τις ρυθμίσεις ασφαλείας. %endif% Ακολουθεί το μήνυμα. %wrap%Για να αποδεχθείτε το μήνυμα αυτό, αρκεί η αποστολή ενός μηνύματος στη διεύθυνση <$releaseaddr$>, επιλέγοντας "Απάντηση". %ifcontrol subonrelease% %^%%wrap%Για να εγγράψετε παράλληλα τον αποστολέα ως μέλος στη λίστα με την παράλληλη αποδοχή του μηνύματος αρκεί ένα μήνυμα στις παρακάτω διευθύνσεις\ :%nowrap% %^%- %wrap%Κανονική εγγραφή\ : <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Εγγραφή με λήψη συγκεντρωτικών μηνυμάτων (digest version): <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Εγγραφή χωρίς λήψη μηνυμάτων. (no-mail version): <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Αν δεν επιθυμείτε να κάνετε τίποτα από τα παραπάνω τότε στείλτε ένα μήνυμα στο <$rejectaddr$> ή απλά αγνοήστε το μήνυμα αυτό. Το μήνυμα αυτό απεστάλη στους παρακάτω διαχειριστές : - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/gr/notify000066400000000000000000000033321502303113500160720ustar00rootroot00000000000000%ifaction sub%Subject: Εγγραφή στη λίστα $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Διαγραφή από τη λίστα $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%Η διεύθυνση <$subaddr$> χρησιμοποιήθηκε για εγγραφή %iftype normal% κανονικού μέλος %endif% %iftype digest% μέλους με συγκεντρωτική ενημέρωση %endif% %iftype nomail% μέλους χωρίς ενημέρωση %endif% στη λίστα %ifreason request% ύστερα από ανάλογη αίτηση που παραλάβαμε. %endif% %ifreason confirm% ύστερα από ανάλογη αίτηση που επιβεβαιώθηκε. %endif% %ifreason admin% ύστερα απο αίτημα ενός από τους διαχειριστές. %endif% %ifreason permit% ύστερα από άδεια ενός από τους διαχειριστές. %endif% %endif% %ifaction unsub% %^%%wrap%Η διεύθυνση <$subaddr$> διαγράφηκε από τους παραλήπτες της λίστας ταχυδρομείου %ifreason request% ύστερα από ανάλογη αίτηση διαγραφής που παραλάβαμε. %endif% %ifreason confirm% ύστερα από ανάλογη αίτηση διαγραφής που επιβεβαιώθηκε. %endif% %ifreason admin% ύστερα απο αίτημα ενός από τους διαχειριστές. %endif% %ifreason bouncing% καθώς εκκρεμούσε το αίτημα χωρίς αποδοχή για μεγάλο χρονικό διάστημα. %endif% %endif% mlmmj/listtexts/gr/probe000066400000000000000000000012061502303113500156670ustar00rootroot00000000000000Subject: Μηνύματα με καθυστέρηση ή αδυναμία παράδοσης στη λίστα ταχυδρομείου $list$@$domain$ %text prologue% Κάποια μηνύματα σας δεν παραδόθηκαν επιτυχώς. Αν διαβάζετε αυτές τις γραμμές, τότε το πρόβλημα έχει ήδη διορθωθεί και το μήνυμα αποσκοπεί απλά στην ενημέρωσή σας. Παρακάτω ακολουθεί ένας κατάλογος με τα μηνύματα που καθυστέρησαν ή δεν παραδόθηκαν. - %bouncenumbers% mlmmj/listtexts/gr/prologue000066400000000000000000000002401502303113500164110ustar00rootroot00000000000000%wrap%Γειά, αυτό είναι το Mlmmj πρόγραμμα που διαχειρίζεται τη λίστα ταχυδρομείου <$list$@$domain$>. mlmmj/listtexts/gr/subrelease000066400000000000000000000026441502303113500167210ustar00rootroot00000000000000%^%%wrap%Ωστόσο, αυτή είναι μία ανοικτή λίστα. Για την εγγραφή στους παραλήπτες μαζί με την ανάρτηση του μηνύματος αρκεί η αποστολή email στη διεύθυνση <$listsubreleaseaddr$>, κάτι που μάλλον θα συμβεί επιλέγοντας "Απάντηση". Το θέμα και το περιεχόμενο του μυνήματος μπορεί να είναι οτιδήποτε. %ifncontrol nodigestsub% %^%%wrap%Ενναλακτικά, υπάρχει η επιλογή της εγγραφής στη λίστα συγκεντρωτικής ενημέρωσης με παράλληλη ανάρτηση της ανακοίνωσης στέλνοντας email στη διεύθυνση <$digestsubreleaseaddr$>. %endif% %ifncontrol nonomailsub% %^%%wrap%Τέλος, μπορείτε να εγγραφείτε στη λίστα χωρίς να λαμβάνετε ενημέρωση για τις αναρτήσεις των άλλων χρηστών, στέλνοντας email στη διεύθυνση <$nomailsubreleaseaddr$>. Εγγραφείτε με τον τρόπο αυτό αν θέλετε να παρακολουθείτε τη λίστα από την ιστοσελίδα της ή ακόμα αν έχετε εγγραφεί και με κάποια άλλη διεύθυνση. %endif% mlmmj/listtexts/gr/wait-post000066400000000000000000000025321502303113500165120ustar00rootroot00000000000000Subject: Μήνυμα που εκκρεμεί για τη λίστα ταχυδρομείου $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Ένα μήνυμα με αποστολέα <$posteraddr$> και θέμα "$subject$" έχει υποβληθεί για δημοσίευση στη λίστα. Για να εμφανιστεί πρέπει πρώτα να διαβαστεί και να επιβεβαιωθεί από κάποιον διαχειριστή %ifreason moderated% καθώς αυτή είναι μία ελεγχόμενη λίστα. %endif% %ifreason access% καθώς αυτό επιβάλλεται από τους κανόνες πρόσβασης της λίστας. %endif% %ifreason modnonsubposts% καθώς δεν είστε εγγεγραμμένος χρήστης. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Παρακάτω ακολουθεί το μήνυμα.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/gr/wait-sub000066400000000000000000000006621502303113500163200ustar00rootroot00000000000000Subject: Αναμονή για έγκριση της συμμετοχής σας στη λίστα ταχυδρομείου $list$@$domain$ %text prologue% %wrap%Η αίτησή σας για συμμετοχή στη λίστα ταχυδρομείου παραλήφθηκε. Αναμένεται ο έλεγχος και η αποδοχή ή απόρριψή της από τους διαχειριστές της λίστας. mlmmj/listtexts/it/000077500000000000000000000000001502303113500146425ustar00rootroot00000000000000mlmmj/listtexts/it/confirm000066400000000000000000000032521502303113500162240ustar00rootroot00000000000000%ifaction sub%Subject: Conferma iscrizione a $list$@$domain$%endif% %ifaction unsub%Subject: Conferma rimozione da $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Un amministratore %endif% %ifreason request% Qualcuno (che speriamo sia tu) %endif% ha richiesto l'aggiunta del tuo indirizzo di posta elettronica <$subaddr$> %iftype normal% alla lista. Ciò significa che ogni volta che un messaggio viene inviato alla lista, tu ne riceverai una copia. %endif% %iftype digest% alla lista, per ricevere digest. Ciò significa che riceverai più messaggi in un unico messaggio di posta, a intervalli regolari, o quando se ne sono accumulati un po'. %endif% %iftype nomail% alla lista, senza invio della posta. Ciò significa che non riceverai alcun messaggio relativo alla lista, ma ne sei sempre considerato/a un membro. Per esempio, puoi inviare messaggi alla lista, cui solo gli iscritti possono scrivere, ma la segui tramite un archivio web o un altro indirizzo di posta con cui sei iscritto/a. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Un amministratore %endif% %ifreason request% Qualcuno (che speriamo sia tu) %endif% ha richiesto la rimozione dell'indirizzo di posta elettronica <$subaddr$> dalla lista. %endif% %wrap%Per confermare l'azione, invia un messaggio a <$confirmaddr$>, tale azione può essere eseguita semplicemente rispondendo al messaggio. L'oggetto e il corpo del messaggio possono essere vuoti. Dopo tale operazione riceverai una risposta che ti informerà della sua riuscita. Se non vuoi confermare l'azione, ignora questo messaggio. mlmmj/listtexts/it/deny000066400000000000000000000045771502303113500155410ustar00rootroot00000000000000%ifaction sub%Subject: Impossibile effettuare l'iscrizione a $list$@$domain$%endif% %ifaction unsub%Subject: Impossibile rimuovere l'iscrizione da $list$@$domain$%endif% %ifaction release reject%Subject: Impossibile moderare $list$@$domain$%endif% %ifaction permit obstruct%Subject: Impossibile eseguire il gatekeeping su $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Non sei in grado di iscriverti alla lista %ifreason disabled% perché la versione %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% della lista è disattivata. %endif% %ifreason closed% perché agli utenti non è consentito iscriversi a questa lista tramite e-mail. %endif% %ifreason subbed% perché sei già iscritto/a. %endif% %ifreason expired% perché è trascorso troppo tempo senza che un controllore permettesse il tuo ingresso. %endif% %ifreason obstruct% perché un controllore ha bloccato il tuo ingresso. %endif% %endif% %ifaction unsub% %^%%wrap%Non sei in grado di rimuovere l'iscrizione dalla lista %ifreason unsubbed% perché non sei iscritto/a. %^%%wrap%Se stai ricevendo messaggi, probabilmente sei iscritto/a con un altro indirizzo e-mail. Per vedere l'indirizzo di iscrizione, fai riferimento al messaggio di benvenuto ricevuto dalla lista, o controlla l'intestazione "Return-Path" di un messaggio ricevuto dalla lista. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Non hai potuto rilasciare il messaggio specificato nella lista %endif% %ifaction reject% Non hai potuto rifiutare il messaggio specificato %endif% %ifreason notfound% perché non è stato possibile trovarlo. Forse un altro moderatore lo ha già rilasciato o rifiutato, o esso è scaduto. %endif% %ifreason moderators% perché non sei un moderatore della lista. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Non hai potuto consentire la specifica richiesta di iscrizione %endif% %ifaction obstruct% Non hai potuto bloccare la specifica richiesta di iscrizione %endif% %ifreason notfound% perché è stato impossibile trovarla. Forse un altro gatekeeper l'ha già permessa o bloccata, o essa è scaduta. %endif% %ifreason gatekeepers% perché non sei un gatekeeper della lista. %endif% %endif% mlmmj/listtexts/it/deny-post000066400000000000000000000036351502303113500165160ustar00rootroot00000000000000Subject: Messaggio a $list$@$domain$ negato: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Non è stato possibile consegnare alla lista il messaggio da <$posteraddr$> con oggetto "$subject$" %ifreason maxmailsize% perché ha superato la dimensione massima consentita di $maxmailsize$ byte. %endif% %ifreason tocc% perché l'indirizzo della lista non è stato trovato nella intestazione A: o CC:. %endif% %ifreason access% a causa di una regola di accesso impostata dall'amministratore della lista. %endif% %ifreason expired% perché è trascorso troppo tempo senza che alcun moderatore lo confermasse. %endif% %ifreason reject% perché un moderatore lo ha rifiutato. %endif% %ifreason subonlypost% perché non sei iscritto/a alla lista. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Se desideri iscriverti, devi contattare l'amministratore della lista. Puoi scrivere a <$list+$owner@$domain$> per contattarlo. %endif% %^%%wrap%Se sai di essere iscritto/a, probabilmente lo sei con un indirizzo di posta diverso. Per vedere con quale indirizzo ti sei iscritto/a, fai riferimento al messaggio di benvenuto ricevuto dalla lista, o controlla l'intestazione "Return-Path" di un messaggio ricevuto dalla lista. %endif% %ifreason maxmailsize% %^%(L'inizio del messaggio rifiutato è riportato sotto.) %else% %^%(Il messaggio rifiutato è riportato sotto.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/it/digest000066400000000000000000000002361502303113500160450ustar00rootroot00000000000000Subject: Digest di $list$@$domain$ emissione $digestissue$ ($digestinterval$) Argomenti (messaggi $digestfirst$ attraverso $digestlast$): - %digestthreads% mlmmj/listtexts/it/faq000066400000000000000000000001501502303113500153300ustar00rootroot00000000000000Subject: Domande ricorrenti (FAQ) di $list$@$domain$ Ci dispiace, le FAQ non sono ancora disponibili. mlmmj/listtexts/it/finish000066400000000000000000000025131502303113500160460ustar00rootroot00000000000000%ifaction unsub%Subject: Arrivederci da $list$@$domain$%endif% %ifaction release reject%Subject: $list$@$domain$ moderata: $subject$%endif% %ifaction permit obstruct%Subject: $list$@$domain$ controllata: $subaddr$%endif% %ifaction post%Subject: Inviato a $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Grazie per aver confermato la rimozione della tua iscrizione. %endif% %ifreason admin% Un amministratore ti ha rimosso dalla lista. %else% Ora sei stato/a rimosso/a dalla lista. %endif% %endif% %ifaction release% %^%%wrap%Hai rilasciato correttamente il messaggio alla lista da <$posteraddr$> con oggetto "$subject$". %endif% %ifaction reject% %^%%wrap%Hai rifiutato correttamente il messaggio da <$posteraddr$> con oggetto "$subject$". %endif% %ifaction permit% %^%%wrap%Hai permesso correttamente a <$subaddr$> di unirsi alla lista. %endif% %ifaction obstruct% %^%%wrap%Hai bloccato correttamente l'ingresso alla lista di <$subaddr$>. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Grazie per la conferma %endif% %ifreason release% Un moderatore ha rilasciato %endif% %ifreason request% Grazie per %endif% il tuo messaggio con oggetto "$subject$". Ora verrà distribuito alla lista. %endif% mlmmj/listtexts/it/finish-sub000066400000000000000000000023411502303113500166340ustar00rootroot00000000000000Subject: Benvenuto/a in $list$@$domain$ %text prologue% %wrap% %ifreason request% Grazie per esserti unito/a a noi. %endif% %ifreason confirm% Grazie per aver confermato la tua iscrizione. %endif% %ifreason permit% Un controllore ti ha permesso di unirti a noi. %endif% %ifreason switch% La tua iscrizione è stata cambiata nella versione %else% %ifreason admin% Un amministratore ti ha iscritto alla versione %else% Sei stato/a ora aggiunto/a alla versione %endif% %endif% %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% della lista. %wrap%L'indirizzo di posta elettronica con cui ti sei iscritto/a è <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Se desideri ancora rimuovere l'iscrizione, dovrai contattare un amministratore della lista. Invia un messaggio a <$list+$owner@$domain$> per contattarlo. %else% %^%%wrap%Se desideri ancora rimuovere l'iscrizione, invia un messaggio a <$list+$unsubscribe@$domain$> usando questo indirizzo di posta. L'oggetto e il corpo del messaggio possono essere vuoti. Riceverai una conferma o ulteriori istruzioni. %endif% %wrap%Per ulteriori informazioni e aiuto su questa lista, invia un messaggio a <$list+$help@$domain$>. mlmmj/listtexts/it/gatekeep-sub000066400000000000000000000011261502303113500171410ustar00rootroot00000000000000Subject: Richiesta di iscrizione per $list$@$domain$: $subaddr$ %text prologue% %wrap%C'è stata una richiesta da parte di <$subaddr$> per unirsi alla versione %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% della lista. %wrap%Per completare la procedura, invia un messaggio a <$permitaddr$>, che viene in genere fatto semplicemente rispondendo a questo messaggio. %wrap%Per annullare la procedura, invia un messaggio a <$obstructaddr$> oppure ignora questo messaggio. Questo messaggio è stato ricevuto dai seguenti controllori: - %gatekeepers% mlmmj/listtexts/it/help000066400000000000000000000057201502303113500155210ustar00rootroot00000000000000Subject: Istruzioni per $list$@$domain$ %text prologue% Di seguito, alcune informazioni sulla lista. Puoi iscriverti alle seguenti versioni: - %wrap%Versione normal: ogni volta che un messaggio viene inviato alla lista, gli iscritti ne ricevono una copia. %ifcontrol closedlist closedlistsub% Iscriviti contattando un amministratore della lista. %else% Iscriviti inviando una e-mail a <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Versione digest: gli iscritti ricevono più messaggi in un unico messaggio, a intervalli regolari o quando si sono accumulati molti messaggi. %ifcontrol closedlist closedlistsub% Iscriviti contattando un amministratore della lista. %else% Iscriviti inviando una e-mail a <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Versione no-mail: gli iscritti non ricevono alcun messaggio diretto alla lista. Essi sono comunque in grado di inviare messaggi alla lista, a cui è consentito ricevere messaggi solo dagli iscritti, mentre possono seguire la lista tramite un archivio web o un altro indirizzo di posta elettronica col quale sono iscritti. %ifcontrol closedlist closedlistsub% Iscriviti contattando un amministratore della lista. %else% Iscriviti inviando una e-mail a <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%La lista ha controllori (gatekeeper) che verificano le richieste di iscrizione prima di consentire l'ingresso di nuovi membri. %endif% %ifcontrol closedlist% %^%%wrap%Rimuovi l'iscrizione contattando un amministratore della lista. %else% %^%%wrap%Rimuovi l'iscrizione inviando una e-mail a <$list+$unsubscribe@$domain$>. %endif% %wrap%I messaggi alla lista vanno inviati tramite e-mail a <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Solo gli iscritti, tuttavia, possono inviare messaggi alla lista. %endif%%endif% %ifcontrol moderated% %^%%wrap%La lista ha moderatori che controllano previamente tutti i messaggi diretti alla lista. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%La lista ha moderatori che controllano previamente i messaggi diretti alla lista inviati da non iscritti. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%La lista possiede anche regole di accesso che possono coinvolgere chi invia e quali messaggi debbano essere moderati. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Tutti %else% Gli iscritti %endif% possono ricevere un numero di messaggi N dall'archivio della lista, inviando un messaggio a <$list+$get-N@$domain$> (cambiare la lettera N nel numero di messaggi che si desidera ricevere). %endif%%endif% %^%%wrap%Per ottenere il documento delle domande ricorrenti (FAQ) relative alla lista, invia un messaggio a <$list+$faq@$domain$>. %^%%wrap%Per contattare il responsabile della lista, invia un messaggio a <$list+$owner@$domain$>. mlmmj/listtexts/it/list000066400000000000000000000006631502303113500155450ustar00rootroot00000000000000Subject: Iscritti a $list$@$domain$ %text prologue% %wrap%Di seguito l'elenco degli iscritti %iftype all% (a tutte le versioni della lista): %else% alla versione %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% della lista: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/it/moderate-post000066400000000000000000000030171502303113500173510ustar00rootroot00000000000000Subject: Moderazione di $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%È stato inviato un messaggio da <$posteraddr$> con oggetto "$subject$". Ti è stato richiesto di moderarlo %ifreason modnonsubposts% perché il/la richiedente non è un/a iscritto/a. %endif% %ifreason moderated% perché questa è una lista moderata. %endif% %ifreason access% a causa di una regola di accesso. %endif% Il messaggio è riportato sotto. %wrap%Per rilasciarlo alla lista, invia un messaggio a <$releaseaddr$>, che in genere si esegue semplicemente rispondendo al questo messaggio. %ifcontrol subonrelease% %^%%wrap%Se lo desideri, puoi contemporaneamente rilasciare il messaggio e iscrivere il mittente inviando un messaggio a uno dei seguenti indirizzi:%nowrap% %^%- %wrap%Versione normale: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Versione digest: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Versione no-mail: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Se non vuoi eseguire nulla di tutto ciò, invia un messaggio a <$rejectaddr$> oppure ignora questo messaggio. Questo messaggio è stato ricevuto dai seguenti moderatori: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/it/notify000066400000000000000000000022021502303113500160710ustar00rootroot00000000000000%ifaction sub%Subject: Iscrizione a $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Rimozione iscrizione da $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%L'indirizzo <$subaddr$> è stato iscritto alla versione %iftype normal% normal %endif% %iftype digest% digest %endif% %iftype nomail% no-mail %endif% della lista %ifreason request% perché è stata ricevuta una richiesta di iscrizione. %endif% %ifreason confirm% perché è stata confermata una richiesta di iscrizione. %endif% %ifreason admin% dietro ordine impartito da un amministratore. %endif% %ifreason permit% perché lo ha permesso un controllore. %endif% %endif% %ifaction unsub% %^%%wrap%L'indirizzo <$subaddr$> è stato rimosso della lista %ifreason request% perché è stata ricevuta una richiesta di rimozione. %endif% %ifreason confirm% perché è stata confermata una richiesta di rimozione. %endif% %ifreason admin% dietro ordine impartito da un amministratore. %endif% %ifreason bouncing% perché i messaggi sono tornati indietro per troppo tempo. %endif% %endif% mlmmj/listtexts/it/probe000066400000000000000000000004731502303113500157000ustar00rootroot00000000000000Subject: Messaggi in restituzione (bouncing) da $list$@$domain$ %text prologue% Alcuni messaggi a te indirizzati potrebbero non esserti stati consegnati. Questo messaggio è a puro scopo informativo, dato che le cose sono tornate alla normalità. Di seguito, l'elenco dei messaggi restituiti: - %bouncenumbers% mlmmj/listtexts/it/prologue000066400000000000000000000001311502303113500164140ustar00rootroot00000000000000%wrap%Ciao, questo è il programma Mlmmj che gestisce la mailing list <$list$@$domain$>. mlmmj/listtexts/it/subrelease000066400000000000000000000020471502303113500167220ustar00rootroot00000000000000%^%%wrap%Questa è, comunque, una lista aperta. Se vuoi, puoi iscriverti e contemporaneamente rilasciare il tuo messaggio inviandone uno a <$listsubreleaseaddr$>, azione in genere eseguita semplicemente rispondendo a questo messaggio. L'oggetto e il corpo del messaggio possono essere vuoti. %ifncontrol nodigestsub% %^%%wrap%O puoi iscriverti alla versione digest della lista e contemporaneamente rilasciare il tuo messaggio inviandone uno a <$digestsubreleaseaddr$>; riceverai così più messaggi in un singolo messaggio, a intervalli regolari o quando se ne sono accumulati un po'. %endif% %ifncontrol nonomailsub% %^%%wrap%O puoi iscriverti alla versione no-mail della lista e contemporaneamente rilasciare il tuo messaggio inviandone uno a <$nomailsubreleaseaddr$>, così da non ricevere i messaggi diretti alla lista. Ciò comporta il fatto che non vedrai le risposte al tuo messaggio, a meno che tu non segua la lista tramite un archivio web o un altro indirizzo di posta con cui sei iscritto a un'altra versione della lista. %endif% mlmmj/listtexts/it/wait-post000066400000000000000000000017121502303113500165150ustar00rootroot00000000000000Subject: In attesa di rilascio a $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Il messaggio da <$posteraddr$> con oggetto "$subject$" è stato inviato alla lista. Tuttavia, ai moderatori è stato richiesto di controllarlo prima di rilasciarlo, %ifreason moderated% perché questa è una lista moderata. %endif% %ifreason access% a causa di una regola di accesso. %endif% %ifreason modnonsubposts% perché non sei iscritto/a. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Il messaggio è riportato sotto.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/it/wait-sub000066400000000000000000000003761502303113500163260ustar00rootroot00000000000000Subject: In attesa di permesso per l'ammissione a $list$@$domain$ %text prologue% %wrap%La tua richiesta di iscrizione alla lista è stata ricevuta. Tuttavia, la tua richiesta di ammissione è stata prima sottoposta al controllo degli amministratori. mlmmj/listtexts/pt/000077500000000000000000000000001502303113500146515ustar00rootroot00000000000000mlmmj/listtexts/pt/confirm000066400000000000000000000034021502303113500162300ustar00rootroot00000000000000%ifaction sub%Subject: Confirmação de subscrição em $list$@$domain$%endif% %ifaction unsub%Subject: Confirmação de cancelamento da subscrição em $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Um administrador %endif% %ifreason request% Alguém (esperamos que você) %endif% solicitou que o endereço eletrónico <$subaddr$> fosse adicionado %iftype normal% à lista de correio normal. Isto significa que, de cada vez que uma mensagem for enviada para a lista, você receberá uma cópia. %endif% %iftype digest% à lista de correio resumida. Isto significa que você receberá diversas mensagens numa única mensagem, em intervalos periódicos, ou quando se acumularem um determinado conjunto de mensagens. %endif% %iftype nomail% à lista de correio no-mail. Isto significa que você não receberá quaisquer mensagens, mas é considerado como membro. Isto significa que, por exemplo você poderá enviar mensagens para a lista na qual só os subscritores podem enviar, enquanto segue as mensagens através de um arquivo web ou através de outro endereço eletrónico. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Um administrador %endif% %ifreason request% Alguém (esperamos que você) %endif% solicitou que o endereço eletrónico <$subaddr$> fosse removido da lista de correio. %endif% %wrap%Para confirmar a operação, envie uma mensagem para <$confirmaddr$> bastando, para o efeito, responder a esta mensagem. O assunto e o texto da mensagem pode estar vazio. Após o envio da mensagem, deve receber uma mensagem a confirmar que a operação foi councluída com sucesso. Se não solicitou esta operação, ignore esta mensagem. mlmmj/listtexts/pt/deny000066400000000000000000000047001502303113500155340ustar00rootroot00000000000000%ifaction sub%Subject: Não foi possível subscrever em $list$@$domain$%endif% %ifaction unsub%Subject: Não foi possível cancelar a subscrição em $list$@$domain$%endif% %ifaction release reject%Subject: Não foi possível moderar $list$@$domain$%endif% %ifaction permit obstruct%Subject: Não foi possível comunicar com o administrador de $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Não foi possível concluir a subscrição à lista %ifreason disabled% porque a versão %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% no-mail %endif% da lista está inativa. %endif% %ifreason closed% porque os utilizadores não podem subscrever a esta lista por correio eletrónico. %endif% %ifreason subbed% porque você já subscreveu esta lista. %endif% %ifreason expired% porque o administrador da lista levou muito tempo a responder ao seu pedido. %endif% %ifreason obstruct% porque o administrador da lista bloqueou a sua subscrição. %endif% %endif% %ifaction unsub% %^%%wrap%Não foi possível cancelar a sua subscrição da lista %ifreason unsubbed% porque você não faz parte da lista. %^%%wrap%Se você está a receber muitas mensagens, é possível que já tenha subscrito à lista com outro endereço eletrónico. Para descobrir com que endereço subscreveu, consulte a mensagem de boas vindas da lista ou procure no cabeçalho "Return-Path" de uma mensagem que tenha recebido. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Você não consegue publicar a mensagem na lista %endif% %ifaction reject% Você não consegue rejeitar a mensagem da lista %endif% %ifreason notfound% porque ela não foi encontrada. É possível que outro moderador já a tenha publicado, rejeitado ou que tenha expirado. %endif% %ifreason moderators% porque você não é um moderador da lista. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Você não consegue aceitar o pedido de subscrição %endif% %ifaction obstruct% Você não consegue cancelar o pedido de subscrição %endif% %ifreason notfound% porque ele não foi encontrado. É possível que outro administrador da lista já o tenha aceite, rejeitado ou que tenha expirado. %endif% %ifreason gatekeepers% porque você não é um administrador desta lista. %endif% %endif% mlmmj/listtexts/pt/deny-post000066400000000000000000000035311502303113500165200ustar00rootroot00000000000000Subject: Mensagem para $list$@$domain$ recusada: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%A mensagem de <$posteraddr$> com o assunto "$subject$" não foi entregue na lista %ifreason maxmailsize% porque excedia o tamanho máximo permitido de $maxmailsize$ bytes. %endif% %ifreason tocc% porque o endereço da lista não foi encontrado no cabeçalho Para: ou CC:. %endif% %ifreason access% porque causa de uma regra criada por um administrador. %endif% %ifreason expired% porque já passou muito tempo sem que um moderador a publicasse. %endif% %ifreason reject% porque um moderador a rejeitou. %endif% %ifreason subonlypost% porque você não faz parte da lista. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Se pretender subscrever a lista, tem que contactar um administrador. Envie uma mensagem para <$list+$owner@$domain$> para contactar o administrador. %endif% %^%%wrap%Se você acha que já subscreveu à lista, é possível que tenha indicado um endereço eletrónico diferente. Para descobrir com que endereço subscreveu, consulte a mensagem de boas vindas da lista ou procure no cabeçalho "Return-Path" de uma mensagem que tenha recebido. %endif% %ifreason maxmailsize% %^%(O início da mensagem recusada está em baixo.) %else% %^%(A mensagem recusada está em baixo.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/pt/digest000066400000000000000000000002231502303113500160500ustar00rootroot00000000000000Subject: Resumo de $list$@$domain$ assunto $digestissue$ ($digestinterval$) Tópicos (mensagens $digestfirst$ a $digestlast$): - %digestthreads% mlmmj/listtexts/pt/faq000066400000000000000000000001441502303113500153420ustar00rootroot00000000000000Subject: Perguntas frequentes de $list$@$domain$ Desculpe, mas não existem perguntas frequentes. mlmmj/listtexts/pt/finish000066400000000000000000000024711502303113500160600ustar00rootroot00000000000000%ifaction unsub%Subject: Cancelamento da subscrição em $list$@$domain$%endif% %ifaction release reject%Subject: Moderação em $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Rejeição em $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Publicação em $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Agradecemos a confirmação do cancelamento da subscrição. %endif% %ifreason admin% Um administrador removeu-o da lista. %else% Você foi removido da lista. %endif% %endif% %ifaction release% %^%%wrap%Você publicou a mensagem de <$posteraddr$> com o assunto "$subject$". %endif% %ifaction reject% %^%%wrap%Você rejeitou a mensagem de <$posteraddr$> com o assunto "$subject$". %endif% %ifaction permit% %^%%wrap%Você permitiu que <$subaddr$> fosse integrado na lista. %endif% %ifaction obstruct% %^%%wrap%Você não permitiu que <$subaddr$> fosse integrado na lista. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Agradecemos a confirmação da %endif% %ifreason release% O moderador publicou a %endif% %ifreason request% Agradecemos a %endif% sua mensagem com o assunto "$subject$". Está, neste momento, a ser publicada na lista. %endif% mlmmj/listtexts/pt/finish-sub000066400000000000000000000024361502303113500166500ustar00rootroot00000000000000Subject: Bem vindo a $list$@$domain$ %text prologue% %wrap% %ifreason request% Agradecemos o seu pedido de integração na lista. %endif% %ifreason confirm% Agradecemos a confirmação da subscrição. %endif% %ifreason permit% Um administrador permitiu a sua integração na lista. %endif% %ifreason switch% A sua subscrição foi alterada para a versão %else% %ifreason admin% Um administrador permitiu a sua subscrição na versão %else% Você foi adicionado(a) à versão %endif% %endif% %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% no-mail %endif% da lista. %wrap%O endereço eletrónico da sua subscrição na lista é <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Caso pretenda cancelar a subscrição, tem que contactar um administrador da lista. Para o efeito, basta enviar uma mensagem eletrónica para <$list+$owner@$domain$>. %else% %^%%wrap%Caso pretenda cancelar a subscrição, envie uma mensagem eletrónica para <$list+$unsubscribe@$domain$>, utilizando este endereço eletrónico. O assunto e o texto da mensagem pode estar vazio. Posteriormente, receberá uma mensagem com as informações a seguir. %endif% %wrap%Para mais informações sobre a lista, envie uma mensagem eletrónica para <$list+$help@$domain$>. mlmmj/listtexts/pt/gatekeep-sub000066400000000000000000000011471502303113500171530ustar00rootroot00000000000000Subject: Pedido de subscrição em $list$@$domain$: $subaddr$ %text prologue% %wrap%Foi solicitado um pedido de <$subaddr$> para receber a versão %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% no-mail %endif% da lista. %wrap%Para confirmar a operação, envie uma mensagem para <$permitaddr$> bastando, para o efeito, responder a esta mensagem. O assunto e o texto da mensagem pode estar vazio. %wrap%Se não pretende confirmar a operação, envie uma mensagem para <$obstructaddr$> ou ignore esta mensagem. Os seguintes administradores receberam a mensagem: - %gatekeepers% mlmmj/listtexts/pt/help000066400000000000000000000057531502303113500155360ustar00rootroot00000000000000Subject: Informações de $list$@$domain$ %text prologue% Abaixo são exibidas algumas informações sobre a lista. Pode subscrever às seguintes versões da lista: - %wrap%Versão normal: cada vez que uma mensagem seja enviada para a lista, os subscritores recebem uma cópia. %ifcontrol closedlist closedlistsub% Subscrever enviando uma mensagem para o administrador da lista. %else% Subscrever enviando uma mensagem para <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Versão resumida: os subscritores recebem diversas mensagens numa única mensagem, em intervalos periódicos, ou quando se acumularem um deteminado conjunto de mensagens. %ifcontrol closedlist closedlistsub% Subscrever enviando uma mensagem para o administrador da lista. %else% Subscrever enviando uma mensagem para <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Versão no-mail: os subscritores não recebem quaisquer mensagens, mas são considerado como membros da lista. Isto significa que, por exemplo, você pode enviar mensagens para a lista na qual só os subscritores podem enviar, enquanto segue as mensagens através de um arquivo web ou através de outro endereço eletrónico. %ifcontrol closedlist closedlistsub% Subscrever enviando uma mensagem para o administrador da lista. %else% Subscrever enviando uma mensagem para <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%A lista tem administradores que fazem a revisão dos pedidos de subscrição antes de permitir a entrada a novos membros. %endif% %ifcontrol closedlist% %^%%wrap%Cancele a subscrição contactando o admnistrador da lista. %else% %^%%wrap%Cancele a subscrição enviando uma mensagem para <$list+$unsubscribe@$domain$>. %endif% %wrap%As mensagens são colocadas através de <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%No entanto, só subscritores podem enviar mensagens para a lista. %endif%%endif% %ifcontrol moderated% %^%%wrap%A lista tem moderadores que fazem a revisão das mensagens dos subscritores antes de as publicarem na lista. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%A lista tem moderadores que fazem a revisão das mensagens dos não subscritores antes de as publicarem na lista. %endif%%endif% %endif% %ifcontrol access% %^%%wrap%A lista também tem regras que podem afetar o envio e moderação das mensagens. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Todos %else% Os subscritores %endif% podem obter a mensagem número X da lista, enviando uma mensagem para <$list+$get-N@$domain$> (altere o X para o número da mensagem que pretende). %endif%%endif% %wrap%Você pode aceder às perguntas frequentes da lista enviando uma mensagem para <$list+$faq@$domain$>. %wrap%Para contactar o proprietário da lista, envie uma mensagem para <$list+$owner@$domain$>. mlmmj/listtexts/pt/list000066400000000000000000000006531502303113500155530ustar00rootroot00000000000000Subject: Subscritores de $list$@$domain$ %text prologue% %wrap%Esta é lista de subscritores %iftype all% de todas as versões da lista: %else% da versão %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% no-mail %endif% da lista: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/pt/moderate-post000066400000000000000000000027261502303113500173660ustar00rootroot00000000000000Subject: Moderação em $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%A mensagem de <$posteraddr$> com o assunto "$subject$" foi enviada para publicação. Esta mensagem requer moderação %ifreason modnonsubposts% porque o remetente não é um subscritor. %endif% %ifreason moderated% porque esta é uma lista moderada. %endif% %ifreason access% em virtude de uma regra. %endif% Mensagem segue em baixo. %wrap%Para a publicar na lista, envie uma mensagem para <$releaseaddr$> bastando, para o efeito, responder a esta mensagem. %ifcontrol subonrelease% %^%%wrap%Se quiser, pode publicar a mensagem e simultaneamente adicionar o remetente à lista, enviando uma mensagem para um dos seguintes endereços eletrónicos:%nowrap% %^%- %wrap%Normal version: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Digest version: <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%No-mail version: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Se não o quiser fazer, envie uma mensagem para <$rejectaddr$> ou ignore esta mensagem. Os seguintes moderadores receberam esta mensagem: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/pt/notify000066400000000000000000000021151502303113500161030ustar00rootroot00000000000000%ifaction sub%Subject: Subscrição em $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Cancelamento da subscrição em $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%O endereço <$subaddr$> foi adicionado à versão %iftype normal% normal %endif% %iftype digest% resumida %endif% %iftype nomail% no-mail %endif% da lista %ifreason request% porque foi recebido o pedido de subscrição. %endif% %ifreason confirm% porque o pedido de subscrição foi aceite. %endif% %ifreason admin% porque o administrador assim o decidiu. %endif% %ifreason permit% porque o administrador o permitiu. %endif% %endif% %ifaction unsub% %^%%wrap%O endereço <$subaddr$> foi removido da lista %ifreason request% porque foi recebido o pedido de cancelamento de subscrição. %endif% %ifreason confirm% porque o pedido de cancelamento de subscrição foi aceite. %endif% %ifreason admin% porque o administrador assim o decidiu. %endif% %ifreason bouncing% porque o administrador o permitiu. %endif% %endif% mlmmj/listtexts/pt/probe000066400000000000000000000004141502303113500157020ustar00rootroot00000000000000Subject: Mensagens pendentes de $list$@$domain$ %text prologue% Algumas mensagens não foram entregues. Se recebeu esta mensagem, os problemas já foram resolvidos e esta mensagem é meramente informativa. Esta é a lista de mensagens pendentes: - %bouncenumbers% mlmmj/listtexts/pt/prologue000066400000000000000000000001411502303113500164240ustar00rootroot00000000000000%wrap%Este é o Mlmmj, a aplicação que faz a gestão das mensagens da lista <$list$@$domain$>. mlmmj/listtexts/pt/subrelease000066400000000000000000000016541502303113500167340ustar00rootroot00000000000000%^%%wrap%No entanto, esta é uma lista aberta. Se quiser, pode subscrever a lista e simultaneamente publicar a mensagem, enviando uma mensagem para <$listsubreleaseaddr$> bastando, para o efeito, responder a esta mensagem. O assunto e o texto podem ser qualquer coisa. %ifncontrol nodigestsub% %^%%wrap%Pode também subscrever à versão resumida da lista e publicar a mensagem, enviando uma mensagem para <$digestsubreleaseaddr$> e passará a receber diversas mensagens numa única mensagem, em intervalos periódicos, ou quando se acumularem um determinado conjunto de mensagens. %endif% %ifncontrol nonomailsub% %^%%wrap%Pode também subscrever à versão no-mail da lista e publicar a mensagem, enviando uma mensagem para <$nomailsubreleaseaddr$>. Isto significa que você não receberá quaisquer mensagens, enquanto segue as mensagens através de um arquivo web ou através de outro endereço eletrónico. %endif% mlmmj/listtexts/pt/wait-post000066400000000000000000000017241502303113500165270ustar00rootroot00000000000000Subject: Mensagem à espera de publicação em $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%A mensagem de <$posteraddr$> com o assunto "$subject$" foi enviada para a lista. Contudo, os moderadores ainda não a publicaram pois está em lista de espera para revisão %ifreason moderated% porque esta é uma lista moderada. %endif% %ifreason access% em virtude de uma regra. %endif% %ifreason modnonsubposts% porque você não é um subscritor. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Mensagem segue em baixo.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/pt/wait-sub000066400000000000000000000003561502303113500163330ustar00rootroot00000000000000Subject: A aguardar a permissão para integrar $list$@$domain$ %text prologue% %wrap%O seu pedido para integrar a lista foi recebido. No entanto, os administradores ainda teem que rever a mensagem antes de permitir a sua integração. mlmmj/listtexts/sk/000077500000000000000000000000001502303113500146435ustar00rootroot00000000000000mlmmj/listtexts/sk/confirm000066400000000000000000000032221502303113500162220ustar00rootroot00000000000000%ifaction sub%Subject: Potvrdenie prihlásenia do $list$@$domain$%endif% %ifaction unsub%Subject: Potvrdenie odhlásenia z $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% Administrátor %endif% %ifreason request% Niekto (veríme, že Vy) %endif% požiadal, aby Vaša emailová adresa <$subaddr$> bola pridaná %iftype normal% do mailovej diskusie. To znamená, že zakaždým, keď do diskusie bude poslaná správa, dostanete jej kópiu. %endif% %iftype digest% do mailovej diskusie, aby ste prijímali súhrnné správy. To znamená, že budete dostávať viacero správ naraz v pravidelných intervaloch, alebo keď sa zozbiera dostatočný počet správ. %endif% %iftype nomail% do mailovej diskusie, bez posielania mailov. To znamená, že mailom nebudete dostávať žiadne správy, ale budete považovaný/považovaná za člena. Budete teda mať pávo posielať správy do diskusie, určenej len pre členov, pričom zaslané správy budete môcť čítať v archíve diskusie alebo na inej mailovej adrese. %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% Administrátor %endif% %ifreason request% Niekto (veríme, že Vy) %endif% požiadal, aby Vaša emailová adresa <$subaddr$> bola odstránená z mailovej diskusie. %endif% %wrap%Tento úmysel môžete potvrdiť poslaním správy na <$confirmaddr$>, čo jednoducho spravíte odpoveďou na tento mail. Na predmete a obsahu správy nezáleží. Následne dostanete správu s informáciou o úspešnom vykonaní operácie. Ak sa odhlásiť nechcete, túto správu ignorujte. mlmmj/listtexts/sk/deny000066400000000000000000000044741502303113500155360ustar00rootroot00000000000000%ifaction sub%Subject: Neúspešné prihlásenie do $list$@$domain$%endif% %ifaction unsub%Subject: Neúspešné odhlásenie z $list$@$domain$%endif% %ifaction release reject%Subject: Neúspešné moderovanie $list$@$domain$%endif% %ifaction permit obstruct%Subject: Neúspešné spravovanie $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap%Vaše prihlásenie bolo neúspešné, lebo %ifreason disabled% %iftype normal% normálna verzia diskusie %endif% %iftype digest% diskusia s prijímaním súhrnných správ %endif% %iftype nomail% diskusia bez posielania správ %endif% je vypnutá. %endif% %ifreason closed% prihlasovanie mailom nie je povolené. %endif% %ifreason subbed% ste už prihlásený/prihlásená. %endif% %ifreason expired% uplynulo príliš veľa času bez toho, aby ho správca povolil. %endif% %ifreason obstruct% lebo ho správca nepovolil. %endif% %endif% %ifaction unsub% %^%%wrap%Vaše odhlásenie z mailovej diskusie bolo neúspešné, %ifreason unsubbed% lebo nie ste prihlásený/prihlásená. %^%%wrap%Tento mail ste dostali preto, lebo ste možno prihlásený/prihlásená s inou adresou. Vašu prihlasovaciu adresu nájdete v privítacej správe, ktorú ste z tejto diskusie dostali, alebo sa pozrite do hlavičky správ, ktoré z tejto diskusie dostávate. %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% Vaše povolenie správy na zverejnenie nebolo úspešné %endif% %ifaction reject% Vaše odmietnutie správy na zverejnenie nebolo úspešné %endif% %ifreason notfound% lebo sa ju nepodarilo nájsť. Iný moderátor ju už asi povolil alebo odmietol, alebo expirovala. %endif% %ifreason moderators% lebo nie ste moderátorom tejto diskusie. %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% Vami zaslané povolenie požiadavky na prihlásenie do mailovej diskusie zlyhalo, %endif% %ifaction obstruct% Vami zaslané odmietnutie požiadavky na prihlásenie do mailovej diskusie zlyhalo, %endif% %ifreason notfound% lebo sa ju nepodarilo nájsť. Iný správca ju už asi povolil alebo odmietol, alebo expirovala. %endif% %ifreason gatekeepers% lebo nie ste správcom tejto diskusie. %endif% %endif% mlmmj/listtexts/sk/deny-post000066400000000000000000000035311502303113500165120ustar00rootroot00000000000000Subject: Odmietnutie príspevku $subject$ do $list$@$domain$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Správu od <$posteraddr$> s predmetom "$subject$" nebolo možné doručiť do mailovej diskusie %ifreason maxmailsize% lebo prekročila maximálnu veľkosť $maxmailsize$ bytov. %endif% %ifreason tocc% lebo adresa diskusie nebola v poliach hlavičky Komu: ani Kópia: nájdená. %endif% %ifreason access% z dôvodu administrátorom nastavených prístupových pravidiel. %endif% %ifreason expired % lebo uplynula príliš dlhá doba bez toho, aby ju povolil moderátor. %endif% %ifreason reject% lebo ju moderátor nepovolil. %endif% %ifreason subonlypost% lebo nie ste abonentom diskusie. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%Ak sa chcete stať abonentom, kontaktujte administrátora diskusie tak, že pošlete mail na <$list+$owner@$domain$>. %endif% %^%%wrap%Ak si myslíte, že ste abonentom diskusie, tak ste zrejme prihlásený/prihlásená s inou mailovou adresou. Vašu prihlasovaciu adresu nájdete v privítacej správe, ktorú ste z tejto diskusie dostali, alebo sa pozrite do hlavičky správ, ktoré z tejto diskusie dostávate. %endif% %ifreason maxmailsize% %^%(Úvod odmietnutej správy je uvedený nižšie.) %else% %^%(Odmietnutá správa je uvedená nižšie.) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/sk/digest000066400000000000000000000002371502303113500160470ustar00rootroot00000000000000Subject: Súhrn mailovej diskusie $list$@$domain$ vydanie $digestissue$ ($digestinterval$) Témy (správy $digestfirst$ až $digestlast$): - %digestthreads% mlmmj/listtexts/sk/faq000066400000000000000000000001521502303113500153330ustar00rootroot00000000000000Subject: Často kladené otázky k mailovej diskusii $list$@$domain$ Ľutujeme, FAQ zatiaľ neexistuje. mlmmj/listtexts/sk/finish000066400000000000000000000026011502303113500160450ustar00rootroot00000000000000%ifaction unsub%Subject: Dovidenia z $list$@$domain$%endif% %ifaction release reject%Subject: Moderovanie $list$@$domain$: $subject$%endif% %ifaction permit obstruct%Subject: Odmietnutie $list$@$domain$: $subaddr$%endif% %ifaction post%Subject: Zverejnenie v $list$@$domain$: $subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% Ďakujeme za potvrdenie požiadavky na odhlásenie. %endif% %ifreason admin% Administrátor Vás odhlásil z mailovej diskusie. %else% Boli ste odhlásený/odhlásená z mailovej diskusie. %endif% %endif% %ifaction release% %^%%wrap%Správu "$subject$" na zverejnenie v diskusii od <$posteraddr$> ste úspešne povolili. %endif% %ifaction reject% %^%%wrap%Správu "$subject$" na zverejnenie v diskusii od <$posteraddr$> ste úspešne odmietli. %endif% %ifaction permit% %^%%wrap%Úspešne ste povolili prihlásenie <$subaddr$> do diskusie. %endif% %ifaction obstruct% %^%%wrap%Úspešne ste zakázali prihlásenie <$subaddr$> do diskusie. %endif% %ifaction post% %^%%wrap% %ifreason confirm% Ďakujeme za potvrdenie Vášho príspevku %endif% %ifreason release% Moderátor uvoľnil na zverejnenie príspevok %endif% %ifreason request% Ďakujeme za príspevok %endif% s predmetom "$subject$". Príspevok bude odoslaný do mailovej diskusie. %endif% mlmmj/listtexts/sk/finish-sub000066400000000000000000000030121502303113500166310ustar00rootroot00000000000000Subject: Vitajte v $list$@$domain$ %text prologue% %wrap% %ifreason request% Ďakujeme Vám za záujem o spoluprácu. %endif% %ifreason confirm% Ďakujeme Vám za potvrdenie prihlásenia. %endif% %ifreason permit% Správca odsúhlasil Vašu žiadosť o zapojenie do mailovej diskusie. %endif% %ifreason switch% Typ Vášho prihlásenia bol zmenený na %iftype normal% štandardnú verziu mailovej diskusie.%endif% %iftype digest% mailovú diskusiu s prijímaním súhrnných správ.%endif% %iftype nomail% mailovú diskusiu bez posielania správ.%endif% %else% %ifreason admin% Administrátor Vás prihlásil do %else% Boli ste pridaný/pridaná do %endif% %iftype normal% štandardnej verzie mailovej diskusie.%endif% %iftype digest% mailovej diskusie s prijímaním súhrnných správ.%endif% %iftype nomail% mailovej diskusie bez posielania správ.%endif% %endif% %wrap%Ste prihlásený/prihlásená s mailovou adresou <$subaddr$>. %ifcontrol closedlist% %^%%wrap%Ak sa v budúcnosti budete chcieť odhlásiť, bude potrebné kontaktovať administrátora. Zaslaním mailu na adresu <$list+$owner@$domain$> sa skontaktujete so správcom tejto diskusie. %else% %^%%wrap%Ak sa v budúcnosti budete chcieť odhlásiť, pošlite mail na adresu <$list+$unsubscribe@$domain$>. Na predmete a obsahu správy nezáleží. Následne dostanete potvrdenie s ďalšími inštrukciami. %endif% %wrap%Pre ďalšie informácie a pomoc s touto mailovou diskusiou napíšte na adresu <$list+$help@$domain$>. mlmmj/listtexts/sk/gatekeep-sub000066400000000000000000000012151502303113500171410ustar00rootroot00000000000000Subject: Požiadavka na prihlásenie do $list$@$domain$: $subaddr$ %text prologue% %wrap%Z adresy <$subaddr$> prišla prihláška do %iftype normal% normálnej verzie mailovej diskusie.%endif% %iftype digest% mailovej diskusie so zasielaním súhrnných správ.%endif% %iftype nomail% mailovej diskusie bez zasielania správ.%endif% %wrap%Ak chcete prihlášku povoliť, pošlite správu na adresu <$permitaddr$>. Spravíte tak odoslaním odpovede na tento mail. %wrap%%Ak nechcete prihlášku povoliť, pošlite správu na adresu <$obstructaddr$> alebo túto správu ignorujte. Túto správu dostali nasledujúci administrátori: - %gatekeepers% mlmmj/listtexts/sk/help000066400000000000000000000062741502303113500155270ustar00rootroot00000000000000Subject: Informácie o $list$@$domain$ %text prologue% Informácie o používaní mailovej diskusie. Prihlásiť sa môžete do nasledujúcich verzií: - %wrap%Normálna verzia: Zakaždým, keď sa do diskusie pošle príspevok, abonenti dostanú jeho kópiu v samostatnej mailovej správe. %ifcontrol closedlist closedlistsub% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu administrátorovi. %else% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu na <$list+$subscribe@$domain$>. %endif% %ifncontrol nodigestsub% %^%- %wrap%Verzia s prijímaním súhrnných správ (digest): Abonenti dostávajú viaceré príspevky naraz v jednej mailovej správe buď v pravidelných intervaloch, alebo keď sa zozbiera dostatočný počet správ. %ifcontrol closedlist closedlistsub% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu administrátorovi. %else% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu na <$list+$subscribe-digest@$domain$>. %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%Verzia bez posielania mailových správ: Abonenti nedostávajú mailom žiadne správy. To znamená, že do diskusie môžu posielať príspevky tak, ako ostatní abonenti, pričom príspevky diskusie sledujú v archíve diskusie alebo na inej mailovej adrese, ktorou sú do diskusie už prihlásení. %ifcontrol closedlist closedlistsub% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu administrátorovi. %else% Do tejto verzie diskusie sa možno prihlásiť poslaním mailu na <$list+$subscribe-nomail@$domain$>. %endif% %endif% %ifcontrol submod% %^%%wrap%Diskusia má administrátorov, ktorí každú žiadosť o pripojenie musia odsúhlasiť. %endif% %ifcontrol closedlist% %^%%wrap%Z diskusie sa možno ohlásiť poslaním mailu administrátorovi. %else% %^%%wrap%Z diskusie sa možno ohlásiť poslaním mailu na <$list+$unsubscribe@$domain$>. %endif% %wrap%Príspevky sa posielajú na adresu <$list$@$domain$>. %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%Príspevky do diskusie môžu posielať len jej abonenti. %endif%%endif% %ifcontrol moderated% %^%%wrap%Diskusia je moderovaná. To znamená, že každý príspevok je pred jeho zverejnením preverený moderátorom. %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%Diskusia má moderátorov, ktorí pred jeho zverejnením preveria každý príspevok od neprihláseného odosielateľa %endif%%endif% %endif% %ifcontrol access% %^%%wrap%Mailová diskusia má definované prístupové pravidlá, ktoré určujú, kto môže zasielať príspevky a ktoré príspevky sú moderované. %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% Ktokoľvek si môže %else% Abonenti si môžu %endif% vyžiadať zaslanie správy N z archívu konferencie zaslaním mailu na <$list+$get-N@$domain$> (N treba zmeniť na číslo správy). %endif%%endif% %wrap%Odpovede na často kladené otázky (FAQ) si môžete vyžiadať zaslaním mailu na <$list+$faq@$domain$>. %wrap%Správcu mailovej diskusie môžete kontaktovať na adrese <$list+$owner@$domain$>. mlmmj/listtexts/sk/list000066400000000000000000000007671502303113500155530ustar00rootroot00000000000000Subject: Zoznam abonentov $list$@$domain$ %text prologue% %wrap%Zoznam abonentov %iftype all% (všetkých verzií mailovej diskusie): %else% %iftype normal% normálnej verzie mailovej diskusie:%endif% %iftype digest% mailovej diskusie so zasielaním súhrnných správ:%endif% %iftype nomail% mailovej diskusie bez zasielania správ:%endif% %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/sk/moderate-post000066400000000000000000000031361502303113500173540ustar00rootroot00000000000000Subject: Prosba o moderovanie $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Od <$posteraddr$> bola na zverejnenie doručená správa s predmetom "$subject$". Žiadame Vás o jej preverenie, %ifreason modnonsubposts% lebo jej odosielateľ nie je abonentom diskusie. %endif% %ifreason moderated% lebo táto mailová diskusia je moderovaná. %endif% %ifreason access% lebo to vyžaduje nastavenie prístupových pravidiel. %endif% Správa je pripojená nižšie. %wrap%Ak chcete povoliť zverejnenie správy, pošlite mail na adresu <$releaseaddr$>, čo možno spraviť odpovedaním na tento mail. %ifcontrol subonrelease% %^%%wrap%Ak chcete, môžete súčasne so zverejnením správy jej odosielateľa prihlásiť do diskusie. Spravíte to tak, že pošlete mail na jednu z nasledujúcich adries:%nowrap% %^%- %wrap%Normálna verzia: <$listsubreleaseaddr$>%nowrap% %^%- %wrap%Súhrnné správy (digest): <$digestsubreleaseaddr$>%nowrap% %^%- %wrap%Verzia bez zasielania mailov: <$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%Ak nechcete vykonať žiadnu z týchto akcií, pošlite mail na <$rejectaddr$> alebo jednoducho túto správu ignorujte. Túto správu dostali nasledujúci moderátori: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/sk/notify000066400000000000000000000022271502303113500161010ustar00rootroot00000000000000%ifaction sub%Subject: Prihlásenie do $list$@$domain$: $subaddr$%endif% %ifaction unsub%Subject: Odhlásenie z $list$@$domain$: $subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap%Adresa <$subaddr$> bola zaradená do zoznamu abonentov %iftype normal% normálnej verzie mailovej diskusie, %endif% %iftype digest% mailovej diskusie s prijímaním súhrnných správ (digest) %endif% %iftype nomail% mailovej diskusie bez zasielania správ, %endif% %ifreason request% lebo sme obdržali požiadavku na prihlásenie. %endif% %ifreason confirm% lebo požiadavka na prihlásenie bola odsúhlasená. %endif% %ifreason admin% lebo tak rozhodol administrátor. %endif% %ifreason permit% lebo tak rozhodol správca. %endif% %endif% %ifaction unsub% %^%%wrap%Adresa <$subaddr$> bola vyradená do zoznamu abonentov %ifreason request% lebo sme obdržali požiadavku na odhlásenie. %endif% %ifreason confirm% lebo požiadavka na prihlásenie bola potvrdená. %endif% %ifreason admin% lebo tak rozhodol administrátor. %endif% %ifreason bouncing% lebo jej overovanie trvalo príliš dlho. %endif% %endif% mlmmj/listtexts/sk/probe000066400000000000000000000004361502303113500157000ustar00rootroot00000000000000Subject: Nedoručené správy z $list$@$domain$ %text prologue% Nepodarilo sa Vám doručiť viaceré správy. Ak čítate tento mail, tak situácia sa už vrátila do normálneho stavu a jeho obsah slúži len pre Vašu informáciu. Zoznam nedoručených správ: - %bouncenumbers% mlmmj/listtexts/sk/prologue000066400000000000000000000001301502303113500164140ustar00rootroot00000000000000%wrap%Ahoj, toto je program Mlmmj, ktorý spravuje mailovú diskusiu <$list$@$domain$>. mlmmj/listtexts/sk/subrelease000066400000000000000000000021201502303113500167130ustar00rootroot00000000000000%^%%wrap%Toto je však otvorená mailová diskusia. Ak chcete, môžete sa súčasne prihlásiť a zverejniť svoj príspevok zaslaním mailu na <$listsubreleaseaddr$>, čo sa obvykle jednoducho dá spraviť odpoveďou na túto správu. Na predmete a obsahu správy nezáleží. %ifncontrol nodigestsub% %^%%wrap%Alebo, zaslaním svojho príspevku na adresu <$digestsubreleaseaddr$> sa súčasne s jeho zverejnením prihlásite na prijímanie súhrnných správ. Následne budete dostávať viaceré príspevky naraz v jednej mailovej správe buď v pravidelných intervaloch, alebo keď sa zozbiera dostatočný počet správ. %endif% %ifncontrol nonomailsub% %^%%wrap%Alebo, zaslaním svojho príspevku na adresu <$nomailsubreleaseaddr$> sa súčasne s jeho zverejnením prihlásite v režime bez budúceho prijímania správ. To znamená, že do diskusie budete môcť posielať príspevky tak, ako ostatní abonenti, pričom príspevky diskusie môžte sledovať v archíve diskusie alebo na inej mailovej adrese, ktorou ste do diskusie už prihlásená/prihlásený. %endif% mlmmj/listtexts/sk/wait-post000066400000000000000000000017171502303113500165230ustar00rootroot00000000000000Subject: čaká sa na zverejnenie do $list$@$domain$: $subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%Z adresy <$posteraddr$> bola do mailovej diskusie zaslaná správa s predmetom "$subject$". Pred jej zverejnením boli moderátori požiadaní o jej odsúhlasenie, lebo %ifreason moderated% ide o moderovanú mailovú diskusiu. %endif% %ifreason access% to vyžadujú prístupové pravidlá diskusie. %endif% %ifreason modnonsubposts% nie ste jej abonentom. %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (Správa je pripojená.) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/sk/wait-sub000066400000000000000000000003741502303113500163250ustar00rootroot00000000000000Subject: čaká sa na povolenie prístupu do $list$@$domain$ %text prologue% %wrap%Vaša žiadosť na povolenie prístupu do mailovej diskusie bola prijatá. Správcovia diskusie boli požiadaní o preverenie Vašej žiadosti pred jej akceptáciou. mlmmj/listtexts/zh-cn/000077500000000000000000000000001502303113500152455ustar00rootroot00000000000000mlmmj/listtexts/zh-cn/confirm000066400000000000000000000027261502303113500166340ustar00rootroot00000000000000%ifaction sub%Subject: 确认订阅 $list$@$domain$%endif% %ifaction unsub%Subject: 确认取消订阅 $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason admin% 一位管理员 %endif% %ifreason request% 有人(\=但愿是您\=) %endif% 请求将您的电子邮箱地址 <$subaddr$> 添加到 %iftype normal% 此列表\=。这意味着每当有人向该列表发邮件\=,您都会收到邮件的副本\=。 %endif% %iftype digest% 此列表\=,收取讨论汇总\=。这意味着您将在单封邮件中收到多条消息\=,间隔 一定时间\=,或达到一定数量时发送\=。 %endif% %iftype nomail% 此列表\=,但不收取邮件\=。这意味着您将不会接收到任何发往列表的邮件\=, 但仍保持成员身份\=。也就是说\=,例如\=,您可以在只有订阅者能发送消息的 列表中发言\=,但通过网页存档或其他电邮跟踪进展\=。 %endif% %endif% %ifaction unsub% %^%%wrap% %ifreason admin% 一位管理员 %endif% %ifreason request% 有人(\=但愿是您\=) %endif% 请求将您的电子邮箱地址 <$subaddr$> 从列表移除\=。 %endif% %wrap%要确认是您的请求\=,请发邮件到 <$confirmaddr$> (\=通常可直接回复本邮 件\=)\=。邮件主题与正文任意\=。 完成后\=,您应该会收到确认操作成功的回复\=。 如果您不打算取消订阅\=,可直接忽略本邮件\=。 mlmmj/listtexts/zh-cn/deny000066400000000000000000000040061502303113500161270ustar00rootroot00000000000000%ifaction sub%Subject: 无法订阅 $list$@$domain$%endif% %ifaction unsub%Subject: 无法退订 $list$@$domain$%endif% %ifaction release reject%Subject: 无法管理 $list$@$domain$%endif% %ifaction permit obstruct%Subject: 无法看管 $list$@$domain$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason disabled% 由于本列表的 %iftype normal%常规%endif% %iftype digest%汇总%endif% %iftype nomail%无邮件%endif% 版本已经关闭\=, %endif% %ifreason closed% 由于本列表不允许通过邮件订阅\=, %endif% %ifreason subbed% 由于您已经订阅\=, %endif% %ifreason expired% 由于掌门人过久没有通过您的加入请求\=, %endif% %ifreason obstruct% 由于掌门人否决了您的加入请求\=, %endif% 您无法订阅本列表\=。 %endif% %ifaction unsub% %^%%wrap% 您无法从本列表退订\=, %ifreason unsubbed% 因为您尚未订阅本列表\=。 %^%%wrap%如果您仍然收到邮件\=,可能通过其他邮箱地址订阅了\=。要查明您订 阅的地址\=,请参考欢迎您加入列表的邮件\=,或查看您收到的列表邮件的 "Return-Path“\/头\=。 %endif% %endif% %ifaction release reject% %^%%wrap% %ifaction release% 您无法将指定帖子通过到列表 %endif% %ifaction reject% 您无法否决指定帖子 %endif% %ifreason notfound% 因为找不到该帖子\=。可能其他版主已经通过或否决\=,也可能已经过期\=。 %endif% %ifreason moderators% 因为您不是本列表的版主\=。 %endif% %endif% %ifaction permit obstruct% %^%%wrap% %ifaction permit% 您无法批准指定的订阅请求 %endif% %ifaction obstruct% 您无法否决指定的订阅请求 %endif% %ifreason notfound% 因为找不到该请求\=。可能其他掌门人已经批准或否决\=,或者该请求已经过 期\=。 %endif% %ifreason gatekeepers% 因为您不是本列表的掌门人\=。 %endif% %endif% mlmmj/listtexts/zh-cn/deny-post000066400000000000000000000033621502303113500171160ustar00rootroot00000000000000Subject: 发往 $list$@$domain$ 的邮件被拒绝:$subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%来自 <$posteraddr$> 题为《\=$subject$\=》的邮件无法投递到列表\=, %ifreason maxmailsize% 因为超出了所允许的最大邮件尺寸 $maxmailsize$ 字节\=。 %endif% %ifreason tocc% 因为列表地址未出现在 To: 或 CC: 头部字段\=。 %endif% %ifreason access% 因为管理员设置了权限规则\=。 %endif% %ifreason expired% 因为过久没有版主通过\=。 %endif% %ifreason reject% 因为有版主否决了该邮件\=。 %endif% %ifreason subonlypost% 因为您不是列表订户\=。 %ifncontrol closedlist%%ifncontrol closedlistsub% %text subrelease% %endif%%endif% %ifcontrol closedlist closedlistsub% %^%%wrap%如果您打算成为订户\=,需要联系列表管理员\=。您可以发送邮件 到 <$list+$owner@$domain$> 联系列表所有者\=。 %endif% %^%%wrap%如果您确信自己是订户\=,可能通过不同的电子邮箱地址订阅了\=。要查 明您订阅的地址\=,请参考欢迎您加入列表的邮件\=,或查阅您所收到的列表邮件 的\/“Return-Path”\/头\=。 %endif% %ifreason maxmailsize% %^%(\=被回绝的邮件开头如下\=。\=) %else% %^%(\=被回绝的邮件如下\=。\=) %endif% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %ifreason maxmailsize% %^%%originalmail 300% %else% %^%%originalmail% %endif% --=_$random0$$random1$_=-- mlmmj/listtexts/zh-cn/digest000066400000000000000000000002771502303113500164550ustar00rootroot00000000000000Subject: $list$@$domain$ 讨论汇总 第 $digestissue$ 期 (\=$digestinterval$\=) %charwrap%%wide% 话题 (\=第 $digestfirst$ 至 $digestlast$ 封邮件\=)\=: - %digestthreads% mlmmj/listtexts/zh-cn/faq000066400000000000000000000001421502303113500157340ustar00rootroot00000000000000Subject: $list$@$domain$ 的常见问题 %charwrap%%wide% 抱歉\=,尚无常见问题\=。 mlmmj/listtexts/zh-cn/finish000066400000000000000000000024011502303113500164450ustar00rootroot00000000000000%ifaction unsub%Subject: $list$@$domain$ 的道别%endif% %ifaction release reject%Subject: 已通过 $list$@$domain$:$subject$%endif% %ifaction permit obstruct%Subject: 已处理 $list$@$domain$:$subaddr$%endif% %ifaction post%Subject: 已发布到 $list$@$domain$:$subject$%endif% %text prologue% %ifaction unsub% %^%%wrap% %ifreason request% %endif% %ifreason confirm% 感谢确认您的退订\=。 %endif% %ifreason admin% 一位版主已将您移出本列表\=。 %else% 您已经退出本列表\=。 %endif% %endif% %ifaction release% %^%%wrap%您已成功通过 <$posteraddr$> 发布到本列表的题为《\=$subject$\=》 的邮件\=。 %endif% %ifaction reject% %^%%wrap%您已成功否决 <$posteraddr$> 发送的题为《\=$subject$\=》的邮 件\=。 %endif% %ifaction permit% %^%%wrap%您已成功批准 <$subaddr$> 加入本列表\=。 %endif% %ifaction obstruct% %^%%wrap%您已成功阻止 <$subaddr$> 加入本列表\=。 %endif% %ifaction post% %^%%wrap% %ifreason confirm% 感谢您确认 %endif% %ifreason release% 一位版主已经通过您 %endif% %ifreason request% 感谢您发布 %endif% 题为《\=$subject$\=》的邮件\=。该邮件已分发到本列表\=。 %endif% mlmmj/listtexts/zh-cn/finish-sub000066400000000000000000000021141502303113500172350ustar00rootroot00000000000000Subject: 欢迎加入 $list$@$domain$ %text prologue% %wrap% %ifreason request% 感谢您申请加入我们\=。 %endif% %ifreason confirm% 感谢您确认订阅\=。 %endif% %ifreason permit% 一位掌门人已批准您的加入\=。 %endif% %ifreason switch% 您的订阅已切换为 %else% %ifreason admin% 一位管理员已将您加入本列表的 %else% 您已被加入本列表的 %endif% %endif% %iftype normal%常规%endif% %iftype digest%汇总%endif% %iftype nomail%无邮件%endif% 版本\=。 %wrap%您订阅所用的电子邮箱地址为 <$subaddr$>\=。 %ifcontrol closedlist% %^%%wrap%如果您打算取消订阅\=,需要联系一位管理员\=。您可以发电子邮件 到 <$list+$owner@$domain$> 联系列表所有者\=。 %else% %^%%wrap%如果您打算取消订阅\=,请使用本电子邮箱地址发邮件 到 <$list+$unsubscribe@$domain$>\=。邮件主题与正文任意\=。随后您将收到确 认或进一步说明\=。 %endif% %wrap%要获取关于本列表的其他信息及帮助\=,请发邮件 到 <$list+$help@$domain$>。 mlmmj/listtexts/zh-cn/gatekeep-sub000066400000000000000000000010031502303113500175360ustar00rootroot00000000000000Subject: 请求订阅 $list$@$domain$:$subaddr$ %text prologue% %wrap%来自 <$subaddr$> 的地址请求订阅本列表的 %iftype normal%常规%endif% %iftype digest%汇总%endif% %iftype nomail%无邮件%endif% 版本\=。 %wrap%要批准该请求\=,请发送邮件到 <$permitaddr$> (\=通常可以通过直接回复 本邮件完成\=)\=。 %wrap%如果您不打算批准\=,请发送邮件到 <$obstructaddr$> 或直接忽略本邮 件\=。 下述掌门人已收到本邮件\=: - %gatekeepers% mlmmj/listtexts/zh-cn/help000066400000000000000000000047271502303113500161320ustar00rootroot00000000000000Subject: $list$@$domain$ 信息 %text prologue% 以下是关于本列表的一些信息\=。 您可以订阅下述版本\=: - %wrap%常规版本\=:每当有邮件发到列表\=,订户都将收到一份副本\=。 %ifcontrol closedlist closedlistsub% 请联系列表管理员订阅\=。 %else% 请发邮件到该地址订阅\=:<$list+$subscribe@$domain$>。 %endif% %ifncontrol nodigestsub% %^%- %wrap%汇总版本\=:订户定期或累积到一定数量时在单封邮件中收到多条帖 子\=。 %ifcontrol closedlist closedlistsub% 请联系列表管理员订阅\=。 %else% 请发邮件到该地址订阅\=:<$list+$subscribe-digest@$domain$>。 %endif% %endif% %ifncontrol nonomailsub% %^%- %wrap%无邮件版本\=:订户不会收到发往列表的任何帖子\=。这意味着\=,尽 管他们能在只有订户能发帖的列表中发帖\=,但他们可以通过 web 存档或订阅该列 表的其他电子邮箱地址跟踪回应\=。 %ifcontrol closedlist closedlistsub% 请联系列表管理员订阅\=。 %else% 请发邮件到该地址订阅\=:<$list+$subscribe-nomail@$domain$>。 %endif% %endif% %ifcontrol submod% %^%%wrap%列表掌门人会审阅订阅请求再批准新成员\=。 %endif% %ifcontrol closedlist% %^%%wrap%请联系列表管理员取消订阅\=。 %else% %^%%wrap%请发邮件到该地址取消订阅\=:<$list+$unsubscribe@$domain$>。 %endif% %^%%wrap%发帖请寄往 <$list$@$domain$>。 %ifcontrol subonlypost%%ifncontrol modnonsubposts% %^%%wrap%然而\=,只有订户能在列表中发帖\=。 %endif%%endif% %ifcontrol moderated% %^%%wrap%本列表版主将审阅所有帖子\=,再通过到列表\=。 %else% %ifcontrol subonlypost%%ifcontrol modnonsubposts% %^%%wrap%本列表版主将审阅所有非订户的帖子\=,再通过到列表\=。 %endif%%endif% %endif% %ifcontrol access% %^%%wrap%本列表还设有权限规则\=,可能影响用户能否发帖\=,以及哪些帖子需要 审核\=。 %endif% %ifncontrol noget%%ifncontrol noarchive% %^%%wrap% %ifcontrol subonlyget% 任何人 %else% 订户 %endif% 可以通过发邮件到 <$list+$get-N@$domain$> (\=将 N 换成所需邮件的序号\=) 从列表存档提取邮件序号为 N 的邮件\=。 %endif%%endif% %^%%wrap%您可以发邮件到 <$list+$faq@$domain$> 了解本列表的常见问题文档\=。 %^%%wrap%如需联系列表所有者\=,请发邮件到 <$list+$owner@$domain$>。 mlmmj/listtexts/zh-cn/list000066400000000000000000000007021502303113500161420ustar00rootroot00000000000000Subject: $list$@$domain$ 的订阅者列表 %text prologue% %wrap%以下为订阅者列表 %iftype all% (\=本列表所有版本的订阅者\=)\=: %else% 本列表 %iftype normal%常规%endif% %iftype digest%汇总%endif% %iftype nomail%无邮件%endif% 版本的订阅者\=: %endif% %iftype all normal% %^%- %listsubs% %endif% %iftype all digest% %^%- %digestsubs% %endif% %iftype all nomail% %^%- %nomailsubs% %endif% mlmmj/listtexts/zh-cn/moderate-post000066400000000000000000000025721502303113500177610ustar00rootroot00000000000000Subject: 请审核 $list$@$domain$:$subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%来自 <$posteraddr$> 题为《\=$subject$\=》的邮件已提交发布\=。 %ifreason modnonsubposts% 由于请求者不是订户\=, %endif% %ifreason moderated% 由于本列表为受限列表\=, %endif% %ifreason access% 由于权限规则\=, %endif% 您需要处理这封邮件\=。邮件内容如下\=。 %wrap%要通过该邮件的发布\=,请发邮件到 <$releaseaddr$> (\=通常可直接回复本 邮件完成\=)\=。 %ifcontrol subonrelease% %^%%wrap%如果您愿意\=,可以通过发送邮件到下述地址来同时通过帖子并订阅发布 者\=: %^%- %wrap%常规版本\=:<$listsubreleaseaddr$>%nowrap% %^%- %wrap%汇总版本\=:<$digestsubreleaseaddr$>%nowrap% %^%- %wrap%无邮件版本\=:<$nomailsubreleaseaddr$>%nowrap% %endif% %wrap%如果您不打算通过\=,请发邮件到 <$rejectaddr$> 或直接忽略本邮件\=。 本邮件已发给下述版主\=: - %moderators% --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/zh-cn/notify000066400000000000000000000017161502303113500165050ustar00rootroot00000000000000%ifaction sub%Subject: 订阅 $list$@$domain$:$subaddr$%endif% %ifaction unsub%Subject: 取消订阅 $list$@$domain$:$subaddr$%endif% %text prologue% %ifaction sub% %^%%wrap% %ifreason request% 由于收到加入请求\=, %endif% %ifreason confirm% 由于加入请求得到确认\=, %endif% %ifreason admin% 由于管理员命令\=, %endif% %ifreason permit% 由于掌门人批准\=, %endif% 地址 <$subaddr$> 已成功订阅本列表的 %iftype normal%常规%endif% %iftype digest%汇总%endif% %iftype nomail%无邮件%endif% 版本\=。 %endif% %ifaction unsub% %^%%wrap% %ifreason request% 由于收到了取消订阅的请求\=, %endif% %ifreason confirm% 由于取消订阅请求得到确认\=, %endif% %ifreason admin% 由于管理员命令\=, %endif% %ifreason bouncing% 由于退回过久\=, %endif% 地址 <$subaddr$> 已成功从本列表退订\=。 %endif% mlmmj/listtexts/zh-cn/probe000066400000000000000000000003401502303113500162740ustar00rootroot00000000000000Subject: $list$@$domain$ 被退回的邮件 %text prologue% 您的部分邮件无法投递\=。如果您看到本邮件\=,说明已经恢复正常\=,仅供参 考\=。 已退回的邮件列表\=: - %bouncenumbers% mlmmj/listtexts/zh-cn/prologue000066400000000000000000000001401502303113500170170ustar00rootroot00000000000000%charwrap%%wide% %wrap%嗨\=,我是管理 <$list$@$domain$> 邮件列表的 Mlmmj 程序\=。 mlmmj/listtexts/zh-cn/subrelease000066400000000000000000000014251502303113500173240ustar00rootroot00000000000000%^%%wrap%然而\=,这是开放列表\=。如果您愿意\=,可以发邮件 到 <$listsubreleaseaddr$> 同时订阅与发表帖子\=,通常回复本邮件即可\=。邮件 主题与正文任意\=。 %ifncontrol nodigestsub% %^%%wrap%或者您可以发邮件到 <$digestsubreleaseaddr$> 同时订阅本列表的汇总 版本与发表帖子\=,这样您将定期或累积一定数量后在单封邮件中收到多条帖 子\=。 %endif% %ifncontrol nonomailsub% %^%%wrap%或者您可以发邮件到 <$nomailsubreleaseaddr$> 同时订阅本列表的无邮 件版与发表帖子\=,这样您将不会收到发往本列表的邮件\=。这意味着您可能看不 到回复内容\=,除非您通过网页存档或用其他邮箱订阅了列表的其他版本\=。 %endif% mlmmj/listtexts/zh-cn/wait-post000066400000000000000000000016701502303113500171230ustar00rootroot00000000000000Subject: 等待发布到 $list$@$domain$:$subject$ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_$random0$$random1$_=" Content-Transfer-Encoding: 8bit --=_$random0$$random1$_= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit %text prologue% %wrap%来自 <$posteraddr$> 题为《\=$subject$\=》的邮件已提交至列表\=。然 而\=, %ifreason moderated% 因为这是先审列表\=, %endif% %ifreason access% 由于访问规则\=, %endif% %ifreason modnonsubposts% 因为您不是订阅者\=, %endif% 需要版主审核后才能发布到该列表\=。 %ifreason modnonsubposts% %ifncontrol closedlist%%ifncontrol closedlistsub% %^%%text subrelease% %endif%%endif% %endif% (\=下为邮件\=。\=) --=_$random0$$random1$_= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" %originalmail% --=_$random0$$random1$_=-- mlmmj/listtexts/zh-cn/wait-sub000066400000000000000000000002601502303113500167210ustar00rootroot00000000000000Subject: 等待批准加入 $list$@$domain$ %text prologue% %wrap%您加入该列表的请求已收到\=。然而\=,掌门人需要审核后才能批准您加 入\=。 mlmmj/man/000077500000000000000000000000001502303113500127365ustar00rootroot00000000000000mlmmj/man/mlmmj-bounce.1000066400000000000000000000027761502303113500154210ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-bounce 1 .Os .Sh NAME .Nm mlmmj-bounce .Nd bounce handling utility for mlmmj .Sh SYNOPSIS .Nm .Fl -L Ar /path/to/list .Op Fl a Ar john=doe.org | Fl d .Op Fl n Ar num | Fl p .Sh DESCRIPTION .Bl -tag -width pathXXX .It Fl a Address string that bounces .It Fl d Parse the mail to extract the address via the DSN .Pq RFC1891 .It Fl h Print help .It Fl L Ar path Full path to list directory .It Fl n Message number in the archive that bounced .It Fl p Send out a probe .It Fl V Print version .El .Pp .Nm is used to handle mails that are bouncing. When a mail arrives to the system, mlmmj-bounce will register in .Pa /bounce/ info about which number that bounced at what time. An example of such a line could be: .Bd -literal -offset indent 109:1094409801 # Sun Sep 5 20:43:21 2004 .Ed .Pp The above shows that message number 109 bounced 1094409801 seconds after epoch which is in human date stamps is Sunday September 5th 20:43:21 2004. .Pp The last bounce mail received to the address is saved in .Pa /bounce/.lastmsg . .Pp When the .Fl p option is used it sends out a probe email including info that it's a bounce probe and a list of the bounced message numbers. The existence of a .Pa /bounce/.probe file indicates that a probe have been sent out. .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org (based on html2man output) .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-list.1000066400000000000000000000012011502303113500150770ustar00rootroot00000000000000.Dd April 17, 2023 .Dt mlmmj-list "1" .Os .Sh NAME .Nm mlmmj-list .Nd list people / subscribers associated with a list .Sh SYNOPSIS .Nm .Fl L Ar /path/to/listdir .Op Fl cdhmosV .Sh DESCRIPTION .Bl -tag -width pathXXX .It Fl c Count the emailaddresses .It Fl d Print the digesters list .It Fl L Ar path Full path of the list directory .It Fl m Print moderators for list .It Fl -n Print for nomail version of list .It Fl o Print the owner(s) of the list .It Fl s Print normail subscribers (default) .It Fl V Print version .El .Sh AUTHORS This manual page was written by the following person: .Pp .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-maintd.1000066400000000000000000000030101502303113500154000ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-maintd 1 .Os .Sh NAME .Nm mlmmj-maintd .Nd maintenance for mlmmj maintained lists .Sh SYNOPSIS .Nm .Op Fl F .Op Fl d Ar /path/to/dir | Fl L Ar /path/to/dir .Sh DESCRIPTION .Bl -tag -width pathXXXXX .It Fl d Ar Full path to directory with lists .It Fl L Ar Full path to list directory .It Fl F Don't fork, performing one maintenance run only. .El .Pp This is the program doing the maintenance for an mlmmj based mailing list. It will unsubscribe people who have bounced for long enough, send out bounce probes, resend mails that couldn't be delivered to relayhost, clean out stale requests for e.g. subscription, resend list mails and clean up leftover files etc. .Pp If a directory containing several lists exists, the .Fl d can be used to specify this, making mlmmj-maintd perform a maintenance run in every listdir below the specified one. .Pp Only either .Fl d or .Fl L can be specified at the same time. .Pp It will run as a daemon, unless the .Fl F switch is specified, in which case it just runs once. The .Fl F option should be used when one wants to avoid running another daemon, and use e.g. cron to control it instead. In case cron is used, .Nm should be run every 2 hours or so. An example crontab entry: .Bd -literal -offset indent 0 */2 * * * /usr/bin/mlmmj-maintd \-F \-L /path/to/list .Ed .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-make-ml.1000066400000000000000000000017111502303113500154550ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-make-ml 1 .Os .Sh NAME .Nm mlmmj-make-ml .Nd create a mailing list for mlmmj .Sh SYNOPSIS .Nm .Op Fl h .Op Fl L Ar listname .Op Fl s Ar spooldir .Op Fl a .Op Fl user .Op Fl z .Sh DESCRIPTION .Bl -tag -width pathXXXXXXX .It Fl h Display help .It Fl L Ar listname The name of the mailing list .It Fl s Ar spooldir Your spool directory .Po default .Pa /var/spool/mlmmj .Pc .It Fl a Create the needed entries in your .Pa /etc/aliases file .It Fl c User to chown the spool directory to .Pq default not to chown at all .It Fl z Do nothing for now .El .Pp This is an interactive script which creates the mailing list directory and thus the list itself for being run by mlmmj. .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk .Sh BUGS It's not possible to create a list entirely on the command line. mlmmj/man/mlmmj-process.1000066400000000000000000000037311502303113500156140ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-process 1 .Os .Sh NAME .Nm mlmmj-process .Nd process mail for an mlmmj managed mailinglist .Sh SYNOPSIS .Nm .Fl Ar /path/to/list .Fl m /path/to/mail .Op Fl h .Op Fl P .Op Fl V .Sh DESCRIPTION .Bl -tag -width pathXXX .It Fl h Print help .It Fl L Ar path Full path to list directory .It Fl m Ar mail Full path to mail file .It Fl P Don't execute mlmmj-send .Pq debugging only .It Fl V Print version .El .Pp This is the binary which processes a mail. Examples of what such processing is: .Bl -tag -width 6n .It Access control Using the access rules specified in .Pa /control/access to perform access control to the list. This is done before headers are stripped, so one can create allow rules based on headers that are later stripped. .It Header stripping Headers specified in .Pa /control/delheaders are deleted from the mail. .It Header addition Headers specified in .Pa /control/customheaders are added to the mail. This could be headers like .Qq List-ID: or .Qq Reply-To: .It List control In case there's a mail with a recipient delimiter it's not a regular list mail. Processing of these happens in mlmmj-receive as well. .Pp Examples of such are: subscription requests, mails to owner etc. .Pp It will base it's recipient delimiter detection on the .Qq Delivered-To: header if present. If not, the .Qq To: header is used. .It Moderation If the list is moderated, it will happen in mlmmj-process. .El .Pp When processing is done, it will invoke the needed binary according to whatever mail it is. If it's a subscription request it will invoke mlmmj-sub, if it's a regular list mail it will invoke .Xr mlmmj-send 1 . .Sh SEE ALSO The file TUNABLES from the mlmmj source distribution or in the documentation directory of the operating system distribution. .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-receive.1000066400000000000000000000027301502303113500155560ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-receive 1 .Os .Sh NAME .Nm mlmmj-receive .Nd receive mails for an mlmmj managed mailinglist .Sh SYNOPSIS .Nm .Fl L Ar /path/to/listdir .Op Fl h .Op Fl V .Op Fl P .Op Fl F .Sh DESCRIPTION .Bl -tag -width pathXXXXX .It Fl h Print help .It Fl F Don't fork in the background .Qq debugging only .It Fl L Ar path Full path to list directory .It Fl P Don't execute .Xr mlmmj-process 1 .Qq debugging only .It Fl V Print version .El .Pp The mlmmj-receive binary is the one specified in the mailserver configuration file .Pq aliases file , which writes the mail to the .Pa /incoming directory and invokes .Xr mlmmj-process 1 unless the .Fl P option is specified. On systems using mailservers supporting the .Pa /etc/aliases file, a line to activate an mlmmj managed mailinglist would look like this: .Bd -literal -offset indent list: "|/usr/bin/mlmmj-receive \-L /var/spool/mlmmj/list/" .Ed .Pp It's very important to specify the full path to the binary, or the mailinglist will not function. .Pp When the .Fl F option is used, it will not fork in the background. The reason it forks is that if delivery of a mail takes longer time than the mail server will allow a command to be idle before presumed dead, the mail server would kill it. .Sh SEE ALSO .Xr mlmmj-process 1 .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-send.1000066400000000000000000000034311502303113500150640ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-send 1 .Os .Sh NAME .Nm mlmmj-send .Nd send mail to a mailinglist or similar .Sh SYNOPSIS .Nm .Op Fl L Ar /path/to/list | Fl l Ar listctrl .Fl m Ar mail .Op Fl aDFhorsTV .Sh DESCRIPTION .Bl -tag -width pathXXXXX .It Fl a Don't archive the mail .It Fl D Don't delete the mail after it's sent .It Fl F What to use as MAIL FROM: .It Fl h Print help .It Fl l List control variable. .It Fl L path Full path to list directory .It Fl m Full path to mail file .It Fl o Address to omit from distribution .Pq normal mail only .It Fl r Relayhost IP address .Pq defaults to 127.0.0.1 .It Fl R What to use as .Qq Reply-To: header .It Fl s Subscribers file name .It Fl T What to use as RCPT TO: .It Fl V Print version .El .Pp This binary is used to send all kinds of mail to mlmmj managed mailinglists, but can potentially be used standalone for sending mails. .Pp The only option that is not self explanatory is the .Fl l list control option: .Bl -tag -width 1 -offset indent .It Ar 1 send a single mail. .Pp This is used together with \fB\-F\fR and \fB\-T\fR to send one mail to one recipient. .It Ar 2 mail to moderators. .Pp Used for sending mails to the moderators of a list. .It Ar 3 resend failed list mail .It Ar 4 send to file with recipients .It Ar 5 bounceprobe .It Ar 6 single listmail to single recipient .El .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk .Sh BUGS This manual page is very scarce documentation of the mlmmj-send binary. The reason for this is that it's really not supposed to be used by any human, but only supposed to be invoked from other mlmmj binaries. So in case more documentation is needed, please read the source. mlmmj/man/mlmmj-sub.1000066400000000000000000000060271502303113500147300ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-sub 1 .Os .Sh NAME .Nm mlmmj-sub .Nd subscribe address to a mailinglist run by mlmmj .Sh SYNOPSIS .Nm .Fl L Ar /path/to/list .Op Fl a Ar john@doe.org | Fl m Ar str .Op Fl cCdnfhqrRsUV .Sh DESCRIPTION .Bl -tag -width pathXXX .It Fl a Ar email Email address to subscribe .It Fl c Send welcome mail .Pq unless requesting confirmation .It Fl C Request mail confirmation .Pq unless switching versions .It Fl d Subscribe to digest version of the list .It Fl f Force subscription .Pq do not moderate .It Fl h Print help .It Fl L Ar path Full path to list directory .It Fl m Ar str Moderation string .It Fl n Subscribe to nomail version of the list .It Fl q Be quiet .Pq don't notify owner about the subscription .It Fl r Behave as if request arrived via email .Pq internal use .It Fl R Behave as if confirmation arrived via email .Pq internal use .It Fl s Don't send a mail to the subscriber if already subscribed .It Fl U Don't switch to the user id of the listdir owner .It Fl V Print version .El .Pp This utility is used to subscribe people to the specified mailinglist. It will write the email address in a file with the name of the beginning letter of the email address getting subscribed in the .Pa /subscribers.d/ directory. .Pp The digest version of the list is a list version where people receive postings to the list periodically .Pq e.g. once a day or when a large number of posts have accumulated. Digest subscribers are in the .Pa /digesters.d/ directory. .Pp The nomail version of the list is a list version where people are subscribed like usual, but they won't receive any postings to the list. This is useful for people who read the mailinglist through a news gateway, but want to be able to post to the list. Nomail subscribers are in the .Pa /nomailsubs.d/ directory. .Pp Unless the .Fl U switch is used it will switch its user id to the user id owning the list directory. This is done to make sure that new files created are having correct permissions. .Pp If the given address is already subscribed to the list, but to a different version, the subscription is switched to that version, and confirmation and moderation are bypassed. If the address is already subscribed to the version requested, a mail is sent to the subscriber, unless the .Fl s switch is used. .Pp Subscription may be moderated .Po if .Pa /control/submod exists .Pc unless the .Fl f switch is given. When a subscription is permitted by a gatekeeper, welcome messages are sent to the subscriber as usual, regardless of options given now. .Pp To ensure subscription is silent from the point of view of the subscriber, use .Fl f , but neither .Fl c nor .Fl C . To inhibit notification of the owner, use .Fl q . Use of .Fl s is recommended to ensure you don't spam already-subscribed addresses by accident. .Sh "SEE ALSO" .Xr mlmmj-unsub 1 , .Xr setuid 2 .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/man/mlmmj-unsub.1000066400000000000000000000041551502303113500152730ustar00rootroot00000000000000.Dd September 1, 2004 .Dt mlmmj-unsub 1 .Os .Sh NAME .Nm mlmmj-unsub .Nd unsubscribe address from a mailinglist run by mlmmj .Sh SYNOPSIS .Nm .Fl L Ar /path/to/list .Fl a Ar john@doe.org .Op Fl cCdnNhqrRsUV .Sh DESCRIPTION .Bl -tag -width pathXXX .It Fl a Ar email Email address to unsubscribe .It Fl c Send goodbye mail .It Fl C Request mail confirmation .It Fl d Unsubscribe from the digest version of the list .It Fl h Print help .It Fl L Ar path Full path to list directory .It Fl n Unsubscribe from the nomail version of the list .It Fl N Unsubscribe from the normal version of the list .It Fl q Be quiet .Pq don't notify owner about the unsubscribe .It Fl r Behave as if request arrived via email .Pq internal use .It Fl R Behave as if confirmation arrived via email .Pq internal use .It Fl s Don't send a mail to the address if not subscribed .It Fl U Don't switch to the user id of the listdir owner .It Fl V Print version .El .Pp This utility is used to unsubscribe people from the specified mailinglist. It will remove the specified email address from every file in the .Pa /subscribers.d/ , .Pa /digesters.d/ and .Pa /nomailsubs.d/ directories .Po or if the .Fl d , .Fl n or .Fl N switch is given, only the one relevant directory .Pc . .Pp Unless the .Fl U switch is used it will switch its user id to the user id owning the list directory. This is done to make sure that new files created are having correct permissions. .Pp Normally a mail is sent to the person being unsubscribed if the address is not subscribed to the list. If the .Fl s switch is used such a mail will not be sent. .Pp When neither .Fl c nor .Fl C is specified, unsubscription happens silently from the point of view of the subscriber. When .Fl q is specified, unsubscription happens silently from the point of view of the list owner. Use of .Fl s is recommended to ensure you don't spam unsubscribed addresses by accident. .Sh SEE ALSO .Xr mlmmj-sub 1 .Sh AUTHORS This manual page was written by the following persons: .An S\[/o]ren Boll Overgaard Aq Mt boll@debian.org .Pq based on html2man output .An Mads Martin J\[/o]rgensen Aq Mt mmj@mmj.dk mlmmj/src/000077500000000000000000000000001502303113500127525ustar00rootroot00000000000000mlmmj/src/Makefile.am000066400000000000000000000026171502303113500150140ustar00rootroot00000000000000# bin_PROGRAMS = mlmmj-send mlmmj-receive mlmmj-process mlmmj-sub \ mlmmj-unsub mlmmj-bounce mlmmj-maintd mlmmj-list noinst_LIBRARIES = libmlmmj.a bin_SCRIPTS = mlmmj-make-ml EXTRA_DIST = mlmmj-make-ml libmlmmj_a_SOURCES= access.c mail-functions.c chomp.c incindexfile.c \ checkwait_smtpreply.c init_sockfd.c strgen.c \ random-int.c print-version.c log_error.c mygetline.c \ getaddrsfromfile.c readn.c \ subscriberfuncs.c find_email_adr.c dumpfd2fd.c \ listcontrol.c send_help.c prepstdreply.c \ do_all_the_voodoo_here.c log_oper.c send_list.c \ unistr.c gethdrline.c send_digest.c \ strgen.c statctrl.c \ ctrlvalue.c readn.c getlistdelim.c ctrlvalues.c \ utils.c mlmmj.c send_mail.c mlmmj_send_SOURCES = mlmmj-send.c mlmmj_send_LDADD= libmlmmj.a mlmmj_receive_SOURCES = mlmmj-receive.c mlmmj_receive_LDADD= libmlmmj.a mlmmj_process_SOURCES = mlmmj-process.c mlmmj_process_LDADD= libmlmmj.a mlmmj_sub_SOURCES = mlmmj-sub.c mlmmj_sub_LDADD= libmlmmj.a mlmmj_unsub_SOURCES = mlmmj-unsub.c mlmmj_unsub_LDADD = libmlmmj.a mlmmj_bounce_SOURCES = mlmmj-bounce.c mlmmj_bounce_LDADD = libmlmmj.a mlmmj_maintd_SOURCES = mlmmj-maintd.c mlmmj_maintd_LDADD = libmlmmj.a mlmmj_list_SOURCES = mlmmj-list.c mlmmj_list_LDADD = libmlmmj.a install-exec-hook: ln -f -s mlmmj-receive $(DESTDIR)$(bindir)/mlmmj-recieve ln -f -s mlmmj-make-ml $(DESTDIR)$(bindir)/mlmmj-make-ml.sh mlmmj/src/access.c000066400000000000000000000112261502303113500143610ustar00rootroot00000000000000/* * Copyright (C) 2024 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include "mlmmj.h" #include "xmalloc.h" static char *action_strs[] = { "allowed", "sent", "denied", "moderated", "discarded" }; actions_t do_access(strlist *rules, strlist *headers, const char *from, char **msg, char **qualifier) { unsigned int match; char *rule_ptr; char errbuf[128]; int err; actions_t act; unsigned int not; regex_t regexp; char *hdr; size_t i = 0; if (msg != NULL) *msg = NULL; if (qualifier != NULL) *qualifier = NULL; if (rules == NULL) return (ACT_ALLOW); tll_foreach(*rules, it) { rule_ptr = it->item; if (strncmp(rule_ptr, "allow", 5) == 0) { rule_ptr += 5; act = ACT_ALLOW; } else if (strncmp(rule_ptr, "send", 4) == 0) { rule_ptr += 4; act = ACT_SEND; } else if (strncmp(rule_ptr, "deny", 4) == 0) { rule_ptr += 4; act = ACT_DENY; } else if (strncmp(rule_ptr, "moderate", 8) == 0) { rule_ptr += 8; act = ACT_MODERATE; } else if (strncmp(rule_ptr, "discard", 7) == 0) { rule_ptr += 7; act = ACT_DISCARD; } else { errno = 0; if (msg != NULL) xasprintf(msg, "Unable to parse rule #%d \"%s\":" " Missing action keyword. Denying post from \"%s\"", i, it->item, from); return ACT_DENY; } if (*rule_ptr == ' ') { rule_ptr++; } else if (*rule_ptr == '-') { rule_ptr++; const char *qual = rule_ptr; while (*rule_ptr != ' ' && *rule_ptr != '\0') rule_ptr++; if (rule_ptr - qual != 0 && qualifier != NULL) *qualifier = xstrndup(qual, rule_ptr - qual); rule_ptr++; } else if (*rule_ptr == '\0') { /* the rule is a keyword and no regexp */ if (msg != NULL) xasprintf(msg, "access -" " A mail from \"%s\" was %s by rule #%d \"%s\"", from, action_strs[act], i, it->item); return act; } else { /* we must have space or end of string */ errno = 0; if (msg != NULL) xasprintf(msg, "Unable to parse rule #%d \"%s\":" " Invalid character after action keyword." " Denying post from \"%s\"", i, it->item, from); return ACT_DENY; } if (*rule_ptr == '!') { rule_ptr++; not = 1; } else { not = 0; } /* remove unanchored ".*" from beginning of regexp to stop the * regexp matching to loop so long time it seems like it's * hanging */ if (strncmp(rule_ptr, "^.*", 3) == 0) { rule_ptr += 3; } while (strncmp(rule_ptr, ".*", 2) == 0) { rule_ptr += 2; } if ((err = regcomp(®exp, rule_ptr, REG_EXTENDED | REG_NOSUB | REG_ICASE))) { regerror(err, ®exp, errbuf, sizeof(errbuf)); regfree(®exp); errno = 0; if (msg != NULL) xasprintf(msg, "regcomp() failed for rule #%d \"%s\"" " (message: '%s') (expression: '%s')" " Denying post from \"%s\"", i, it->item, errbuf, rule_ptr, from); return ACT_DENY; } match = 0; tll_foreach(*headers, header) { if (regexec(®exp, header->item, 0, NULL, 0) == 0) { match = 1; hdr = header->item; break; } } regfree(®exp); if (match != not) { if (match) { if (msg != NULL) xasprintf(msg, "access -" " A mail from \"%s\" with header \"%s\" was %s by" " rule #%d \"%s\"", from, hdr, action_strs[act], i, it->item); } else { if (msg != NULL) xasprintf(msg, "access -" " A mail from \"%s\" was %s by rule #%d \"%s\"" " because no header matched.", from, action_strs[act], i, it->item); } return act; } i++; } xasprintf(msg, "access -" " A mail from \"%s\" didn't match any rules, and" " was denied by default.", from); return ACT_DENY; } mlmmj/src/checkwait_smtpreply.c000066400000000000000000000060051502303113500172000ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include "xmalloc.h" #include "checkwait_smtpreply.h" #include "config.h" #include "mygetline.h" char *checkwait_smtpreply(int sockfd, int replytype) { char *smtpreply = NULL; if(replytype == MLMMJ_EHLO) { /* Consume all 8BITMIME 250- reply */ do { free(smtpreply); smtpreply = mygetline(sockfd); } while (strncmp(smtpreply, "250-", 4) == 0); } else { smtpreply = mygetline(sockfd); } if(smtpreply == NULL) { /* This will never be a valid SMTP response so will always be returned, * but is more descriptive than an empty string. */ smtpreply = xstrdup("none / error / closed connection"); } #if 0 printf("replytype = [%d], smtpreply = [%s]\n", replytype, smtpreply); fprintf(stderr, "%s", smtpreply); #endif /* This case might seem like (and is ATM) total overkill. But it's * easy for us to extend it later on if needed. */ switch(replytype) { case MLMMJ_CONNECT: if(smtpreply[0] != '2' || smtpreply[1] != '2') return smtpreply; break; case MLMMJ_EHLO: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_HELO: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_FROM: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_RCPTTO: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_DATA: if(smtpreply[0] != '3' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_DOT: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; case MLMMJ_QUIT: if(smtpreply[0] != '2' || smtpreply[1] != '2') return smtpreply; break; case MLMMJ_RSET: if(smtpreply[0] != '2' || smtpreply[1] != '5') return smtpreply; break; default: break; } free(smtpreply); return NULL; } mlmmj/src/chomp.c000066400000000000000000000026671502303113500142370ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include "chomp.h" char *chomp(char *str) { size_t i; if(str == NULL) return NULL; if(*str == '\0' || *str == '\n' || *str == '\r') { *str = '\0'; return str; } i = strlen(str) - 1; while((str[i] == '\n') || (str[i] == '\r')) { str[i] = 0; i--; } return str; } mlmmj/src/ctrlvalue.c000066400000000000000000000062001502303113500151150ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include "ctrlvalue.h" #include "chomp.h" #include "utils.h" #include "log_error.h" #include "xmalloc.h" static char * ctrlval(int ctrlfd, const char *ctrlstr, int oneline) { int fd; if(ctrlfd < 0) return NULL; fd = openat(ctrlfd, ctrlstr, O_RDONLY|O_CLOEXEC); if (fd == -1) return (NULL); return (readlf(fd, oneline)); } char * ctrlvalue(int ctrlfd, const char *ctrlstr) { return (ctrlval(ctrlfd, ctrlstr, true)); } char * ctrlcontent(int ctrlfd, const char *ctrlstr) { return (ctrlval(ctrlfd, ctrlstr, false)); } char * textcontent(int listfd, const char *ctrlstr) { int fd = openat(listfd, "text", O_DIRECTORY|O_CLOEXEC); char *ret = ctrlval(fd, ctrlstr, false); close(fd); return (ret); } intmax_t ctrlim(int ctrlfd, const char *ctrlstr, intmax_t min, intmax_t max, intmax_t fallback) { const char *errstr; char *val = ctrlval(ctrlfd, ctrlstr, true); intmax_t ret; if (val == NULL) return (fallback); ret = strtoim(val, min, max, &errstr); if (errstr != NULL) { log_error(LOG_ARGS, "Invalid value for '%s': %s", ctrlstr, errstr); ret = fallback; } free(val); return (ret); } uintmax_t ctrluim(int ctrlfd, const char *ctrlstr, uintmax_t min, uintmax_t max, uintmax_t fallback) { const char *errstr; char *val = ctrlval(ctrlfd, ctrlstr, true); uintmax_t ret; if (val == NULL) return (fallback); ret = strtouim(val, min, max, &errstr); if (errstr != NULL) { log_error(LOG_ARGS, "Invalid value for '%s': %s", ctrlstr, errstr); ret = fallback; } free(val); return (ret); } time_t ctrltimet(int dfd, const char *ctrlstr, time_t fallback) { const char *errstr; char *val = ctrlval(dfd, ctrlstr, true); time_t ret; if (val == NULL) return (fallback); ret = strtotimet(val, &errstr); if (errstr != NULL) { log_error(LOG_ARGS, "Invalid value for '%s': %s", ctrlstr, errstr); ret = fallback; } free(val); return (ret); } mlmmj/src/ctrlvalues.c000066400000000000000000000045371502303113500153130ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include "xmalloc.h" #include "ctrlvalues.h" #include "chomp.h" #include "mlmmj.h" typedef int (cmpf)(const char *s1, const char *s2); strlist *ctrlvalues(int ctrlfd, const char *ctrlstr) { char *line = NULL; size_t linecap = 0; FILE *f; int fd; strlist *ret; fd = openat(ctrlfd, ctrlstr, O_RDONLY|O_CLOEXEC); if (fd == -1 || (f = fdopen(fd, "r")) == NULL) return (NULL); ret = xcalloc(1, sizeof(*ret)); while (getline(&line, &linecap, f) > 0) { chomp(line); /* Ignore empty lines */ if (*line == '\0') continue; tll_push_back(*ret, xstrdup(line)); } free(line); fclose(f); return ret; } bool ctrlvalues_contains(int ctrlfd, const char *ctrlstr, const char *comp, bool casesensitive) { char *line = NULL; size_t linecap = 0; FILE *f; int fd; cmpf *cmp; cmp = casesensitive ? strcmp : strcasecmp; fd = openat(ctrlfd, ctrlstr, O_RDONLY|O_CLOEXEC); if (fd == -1 || (f = fdopen(fd, "r")) == NULL) return (false); while (getline(&line, &linecap, f) > 0) { chomp(line); if (*line == '\0') continue; if (cmp(comp, line) == 0) { free(line); fclose(f); return (true); } } free(line); fclose(f); return (false); } mlmmj/src/do_all_the_voodoo_here.c000066400000000000000000000136351502303113500176100ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2025 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "gethdrline.h" #include "strgen.h" #include "ctrlvalue.h" #include "do_all_the_voodoo_here.h" #include "log_error.h" #include "wrappers.h" #include "find_email_adr.h" bool findit(const char *line, const strlist *headers) { size_t len; tll_foreach(*headers, it) { len = strlen(it->item); if(strncasecmp(line, it->item, len) == 0) return true; } return false; } /* read line and populate a struct to save a list important header see mlmmj-process.c:254 and mlmmj.h:97 */ void getinfo(const char *line, struct mailhdr *readhdrs) { int i = 0; size_t tokenlen; while(readhdrs[i].token) { tokenlen = strlen(readhdrs[i].token); if(strncasecmp(line, readhdrs[i].token, tokenlen) == 0) { readhdrs[i].valuecount++; readhdrs[i].values = (char **)xrealloc(readhdrs[i].values, readhdrs[i].valuecount * sizeof(char *)); readhdrs[i].values[readhdrs[i].valuecount - 1] = xstrdup(line + tokenlen); } i++; } } void scan_headers(FILE *f, struct mailhdr *readhdrs, strlist *allhdrs, strlist *allunfoldeds) { char *hdrline, *unfolded; /* scan all headers and populate readhdrs , allhdrs , allunfoldeds */ for (;;) { /* hdrline contains the header in one line and unfolded contains the original data */ hdrline = gethdrline(f, &unfolded); /* end of headers */ if(hdrline == NULL) { break; } /* Do we want info from hdrs? Get it before it's gone */ if(readhdrs) getinfo(hdrline, readhdrs); if (allhdrs != NULL) { /* Snatch a copy of the header */ tll_push_back(*allhdrs, xstrdup(hdrline)); } if (allunfoldeds != NULL) { /* Snatch a copy of unfolded */ tll_push_back(*allunfoldeds, xstrdup(unfolded)); } free(hdrline); free(unfolded); } } int do_all_the_voodoo_here(int infd, int outfd, int hdrfd, int footfd, const strlist *delhdrs, struct mailhdr *readhdrs, strlist *allhdrs, const char *prefix, int replyto) { char *hdrline, *unfolded, *unqp; strlist allunfoldeds = tll_init(); char *posteraddr = NULL; bool hdrsadded = false; bool subject_present = false; FILE *f = fdopen(dup(infd), "r"); scan_headers(f, readhdrs, allhdrs, &allunfoldeds); /* if we have custom headers , extract posteraddr from current header */ if(hdrfd >= 0) { strlist fromemails = tll_init(); if ( readhdrs[0].valuecount == 1 ) { find_email_adr(readhdrs[0].values[0], &fromemails); posteraddr = tll_front(fromemails); } } /* scan all headers from allhdrs , and do the real things */ tll_foreach(*allhdrs, a_header ) { /* hdrline contains the unfolded value of the header and unfolded contains the original data */ hdrline=a_header->item ; unfolded=tll_pop_front(allunfoldeds) ; /* add extra headers before MIME* headers, or after all headers */ if(!hdrsadded && ( strncasecmp(hdrline, "mime", 4) == 0)) { if(hdrfd >= 0) { if(process_headers_fd(hdrfd,outfd,posteraddr) < 0) { log_error(LOG_ARGS, "Could not " "add extra headers"); tll_free_and_free(allunfoldeds, free); return -1; } fsync(outfd); } hdrsadded = true; } /* Add Subject: prefix if wanted */ if(prefix) { if(strncasecmp(hdrline, "Subject:", 8) == 0) { subject_present = 1; unqp = decode_qp(hdrline + 8, false); if(strstr(hdrline + 8, prefix) == NULL && strstr(unqp, prefix) == NULL) { dprintf(outfd, "Subject: %s%s\n", prefix, hdrline + 8); free(unqp); continue; } free(unqp); } } /* Should it be stripped? */ if(!delhdrs || !findit(hdrline, delhdrs)) dprintf(outfd, "%s", unfolded); /* Should Reply-To be added? */ if(replyto) { if(strncasecmp(hdrline, "From:", 5) == 0) { dprintf(outfd, "Reply-To:%s\n", hdrline + 5); } } } if(!hdrsadded ) { if(hdrfd >= 0) { if(process_headers_fd(hdrfd,outfd,posteraddr) < 0) { log_error(LOG_ARGS, "Could not " "add extra headers"); tll_free_and_free(allunfoldeds, free); return -1; } fsync(outfd); } } if (prefix && !subject_present) { dprintf(outfd, "Subject: %s\n", prefix); subject_present = true; } /* write LF */ if(dprintf(outfd, "\n") < 0) { tll_free_and_free(allunfoldeds, free); log_error(LOG_ARGS, "Error writing hdrs."); return -1; } tll_free_and_free(allunfoldeds, free); lseek(infd, ftello(f), SEEK_SET); /* Just print the rest of the mail */ if(dumpfd2fd(infd, outfd) < 0) { log_error(LOG_ARGS, "Error when dumping rest of mail"); return -1; } fclose(f); /* No more, let's add the footer if one */ if(footfd >= 0) if(dumpfd2fd(footfd, outfd) < 0) { log_error(LOG_ARGS, "Error when adding footer"); return -1; } fsync(outfd); return 0; } mlmmj/src/dumpfd2fd.c000066400000000000000000000055641502303113500150030ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023-2025 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include "config.h" #include "log_error.h" #include "xmalloc.h" #include "mygetline.h" #define DUMPBUF 4096 int copy_file(int from, int to, size_t bufsiz) { char buf[bufsiz]; ssize_t r, wresid, w = 0; char *bufp; r = read(from, buf, bufsiz); if (r < 0) return (r); for (bufp = buf, wresid = r; ; bufp += w, wresid -= w) { w = write(to, bufp, wresid); if (w <= 0) break; if (w >= (ssize_t) wresid) break; } return (w < 0 ? w : r); } int dumpfd2fd(int from, int to) { #ifdef HAVE_COPY_FILE_RANGE bool cfr = true; #endif int r; do { #ifdef HAVE_COPY_FILE_RANGE if (cfr) { r = copy_file_range(from, NULL, to, NULL, SSIZE_MAX, 0); if (r < 0 && (errno == EINVAL || errno == EXDEV)) { /* probably a non seekable FD */ cfr = false; } } if (!cfr) { #endif r = copy_file(from, to, DUMPBUF); #ifdef HAVE_COPY_FILE_RANGE } #endif } while (r > 0); return (r); } int process_headers_fd(int infd, int outfd,const char *from) { char *line; int r; while((line = mygetline(infd))) { /* skip empty lines */ while (isspace(*line)) line++; if (line[0] == '\0') continue; char *to_be_subst ; char *new_line ; to_be_subst = strstr(line,"$posteraddr$") ; if ( to_be_subst != NULL) { *to_be_subst = '\0' ; to_be_subst = to_be_subst + 12 ; xasprintf(&new_line, "%s%s%s", line, from , to_be_subst ) ; free(line); line=new_line ; } if( (r=dprintf(outfd, "%s", line)) < 0) { log_error(LOG_ARGS, "Could not write headers"); return r ; } free(line); } return 0 ; } mlmmj/src/find_email_adr.c000066400000000000000000000122461502303113500160400ustar00rootroot00000000000000/* Some crap from BSD mail to parse email addresses. * * Neale Pickett stole these functions from FreeBSD * ports, and reformatted them to use mlmmj's coding style. The * original functions (skip_comment and skin) had the following * copyright notice: */ /* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include "mlmmj.h" #include "find_email_adr.h" #include "xmalloc.h" /* * Start of a "comment". * Ignore it. */ static char * skip_comment(char *cp) { int nesting = 1; for (; nesting > 0 && *cp; cp++) { switch (*cp) { case '\\': if (cp[1]) cp++; break; case '(': nesting++; break; case ')': nesting--; break; } } return (cp); } /* * Skin an arpa net address according to the RFC 822 interpretation * of "host-phrase." */ static char *skin(char *name) { char *nbuf, *bufend, *cp, *cp2; int c, gotlt, lastsp; if (name == NULL) return (NULL); /* We assume that length(input) <= length(output) */ if (strchr(name, '(') == NULL && strchr(name, '<') == NULL && strchr(name, ' ') == NULL) { return (xstrdup(name)); } nbuf = xmalloc(strlen(name) +1); gotlt = 0; lastsp = 0; bufend = nbuf; for (cp = name, cp2 = bufend; (c = *cp++) != '\0'; ) { switch (c) { case '(': cp = skip_comment(cp); lastsp = 0; break; case '"': /* * Start of a "quoted-string". * Copy it in its entirety. */ while ((c = *cp) != '\0') { cp++; if (c == '"') break; if (c != '\\') *cp2++ = c; else if ((c = *cp) != '\0') { *cp2++ = c; cp++; } } lastsp = 0; break; case ' ': if (cp[0] == 'a' && cp[1] == 't' && cp[2] == ' ') cp += 3, *cp2++ = '@'; else if (cp[0] == '@' && cp[1] == ' ') cp += 2, *cp2++ = '@'; else lastsp = 1; break; case '<': cp2 = bufend; gotlt++; lastsp = 0; break; case '>': if (gotlt) { gotlt = 0; while ((c = *cp) != '\0' && c != ',') { cp++; if (c == '(') cp = skip_comment(cp); else if (c == '"') while ((c = *cp) != '\0') { cp++; if (c == '"') break; if (c == '\\' && *cp != '\0') cp++; } } lastsp = 0; break; } /* FALLTHROUGH */ default: if (lastsp) { lastsp = 0; *cp2++ = ' '; } *cp2++ = c; if (c == ',' && *cp == ' ' && !gotlt) { *cp2++ = ' '; while (*++cp == ' ') ; lastsp = 0; bufend = cp2; } } } *cp2 = '\0'; nbuf = (char *)xrealloc(nbuf, strlen(nbuf) + 1); return (nbuf); } strlist * find_email_adr(const char *str, strlist *retstruct) { char *c1 = NULL, *c2 = NULL; char *p; char *s; s = xstrdup(str); p = s; while(p) { char *adr; char *cur; cur = p; oncemore: p = strchr(p, ','); if (p) { /* If there's a comma, replace it with a NUL, so * cur will only have one address in it. Except * it's not in ""s */ c1 = strchr(cur, '"'); if(c1) { c2 = strchr(c1+1, '"'); } if(c2) { if(*(c2-1) == '\\') { *c2 = ' '; c2 = NULL; goto oncemore; } } if((c1 == NULL) || (c1 > p) || (c2 && c2 < p)) { *p = '\0'; p += 1; } else { *p = ' '; goto oncemore; } } while(cur && isspace(*cur)) { cur += 1; } if ('\0' == *cur) { continue; } adr = skin(cur); if (adr) tll_push_back(*retstruct, adr); } free(s); return retstruct; } mlmmj/src/getaddrsfromfile.c000066400000000000000000000010341502303113500164350ustar00rootroot00000000000000#include #include "tllist.h" #include "xmalloc.h" #include "mlmmj.h" #include "getaddrsfromfile.h" #include "chomp.h" int getaddrsfromfile(strlist *slist, FILE *f, size_t max) { char *line = NULL; size_t linecap = 0; if (max == 0) return -1; if (f == NULL) return -1; if (feof(f)) return (-1); while (getline(&line, &linecap, f) > 0) { chomp(line); if (*line == '\0') continue; tll_push_back(*slist, xstrdup(line)); if (tll_length(*slist) >= max) break; } if (feof(f)) return (0); return (1); } mlmmj/src/gethdrline.c000066400000000000000000000046721502303113500152540ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2006 Morten K. Poulsen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include "xmalloc.h" #include "gethdrline.h" #include "strgen.h" #include "wrappers.h" #include "log_error.h" #include "chomp.h" char *gethdrline(FILE *f, char **unfolded) { char *line = NULL, *retstr = NULL, *oldretstr = NULL, *oldunfolded = NULL; int ch; size_t linecap = 0; if (getline(&line, &linecap, f) <= 0) { if (unfolded != NULL) *unfolded = NULL; return NULL; } if (unfolded != NULL) *unfolded = xstrdup(line); chomp(line); /* end-of-headers */ if (*line == '\0') { if (unfolded != NULL) { free(*unfolded); *unfolded = NULL; } free(line); return NULL; } retstr = xstrdup(line); for(;;) { /* look ahead one char to determine if we need to fold */ ch = fgetc(f); if (ch == EOF) goto out; ungetc(ch, f); if ((ch != '\t') && (ch != ' ')) /* no more folding */ goto out; if (getline(&line, &linecap, f) <= 0) goto out; if (unfolded != NULL) { oldunfolded = *unfolded; xasprintf(unfolded, "%s%s", oldunfolded != NULL ? oldunfolded : "", line); free(oldunfolded); } chomp(line); oldretstr = retstr; xasprintf(&retstr, "%s%s", oldretstr != NULL ? oldretstr : "", line); free(oldretstr); } out: free(line); return (retstr); } mlmmj/src/getlistdelim.c000066400000000000000000000027431502303113500156120ustar00rootroot00000000000000/* * Copyright 2005 Joel Aelwyn * Copyright 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include "xmalloc.h" #include "mlmmj.h" #include "getlistdelim.h" #include "ctrlvalue.h" char *getlistdelim(int ctrlfd) { char *delimstr; delimstr = ctrlvalue(ctrlfd, "delimiter"); if (delimstr == NULL || *delimstr == '\0') { free(delimstr); return (xstrdup(DEFAULT_RECIPDELIM)); } return (delimstr); } mlmmj/src/incindexfile.c000066400000000000000000000044771502303113500155730ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include "incindexfile.h" #include "log_error.h" #include "xmalloc.h" #include "utils.h" int incindexfile(int listfd) { int fd, index = 0; FILE *fp; char *line = NULL; size_t linecap = 0; const char *errstr; fd = openat(listfd, "index", O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); if(fd == -1 && !lock(fd, true)) { log_error(LOG_ARGS, "Error opening index file"); return 0; } fp = fdopen(fd, "r+"); if (fp == NULL) { log_error(LOG_ARGS, "Error fdopening index file"); close(fd); return (0); } index = 0; if (getline(&line, &linecap, fp) > 0) { /* eliminate everything which is not a number */ line[strspn(line, "0123456789")] = '\0'; index = strtoim(line, 0, INT_MAX, &errstr); if (errstr != NULL) { log_error(LOG_ARGS, "Error reading index file: invalid " "line: %s", line); free(line); return (0); } free(line); } index++; rewind(fp); fprintf(fp, "%d", index); fclose(fp); /* Lock is also released */ return index; } mlmmj/src/init_sockfd.c000066400000000000000000000045411502303113500154160ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include "init_sockfd.h" #include "log_error.h" void init_sockfd(int *sockfd, const char *relayhost, unsigned short port) { int on, sd = -1; struct addrinfo *ai = NULL, *curai, hints = { 0 }; char srv[NI_MAXSERV]; *sockfd = -1; hints.ai_socktype = SOCK_STREAM; hints.ai_family = PF_UNSPEC; snprintf(srv, sizeof(srv), "%d", port); if (getaddrinfo(relayhost, srv, &hints, &ai) != 0) { log_error(LOG_ARGS, "Unable to lookup for relayhost %s:%s", relayhost, srv); return; } for (curai = ai; curai != NULL; curai = curai->ai_next) { if ((sd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) { continue; } if (connect(sd, ai->ai_addr, ai->ai_addrlen) != 0) { close(sd); sd = -1; continue; } break; } freeaddrinfo(ai); if (sd == -1) { log_error(LOG_ARGS, "Could not connect to %s", relayhost); return; } *sockfd = sd; on = 1; if(setsockopt(*sockfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof(on)) < 0) log_error(LOG_ARGS, "Could not set SO_KEEPALIVE"); } mlmmj/src/listcontrol.c000066400000000000000000000447671502303113500155140ustar00rootroot00000000000000/* * Copyright (C) 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "listcontrol.h" #include "prepstdreply.h" #include "send_help.h" #include "send_list.h" #include "send_mail.h" #include "log_error.h" #include "statctrl.h" #include "chomp.h" #include "log_oper.h" #include "ctrlvalues.h" #include "ctrlvalue.h" #include "subscriberfuncs.h" #include "utils.h" /* Must match the enum. CAREFUL when using commands that are substrings * of other commands. In that case the longest one have to be listed * first to match correctly. */ /* A closed list doesn't allow subscribtion and unsubscription A closed list "sub" only dissallows subscription, not unsub. */ static struct ctrl_command ctrl_commands[] = { { "subscribe-digest", false, false, false, CTRL_SUBSCRIBE_DIGEST }, { "subscribe-nomail", false, false, false, CTRL_SUBSCRIBE_NOMAIL }, { "subscribe-both", false, false, false, CTRL_SUBSCRIBE_BOTH }, { "subscribe", false, false, false, CTRL_SUBSCRIBE }, { "confsub-digest", true , false, true , CTRL_CONFSUB_DIGEST }, { "confsub-nomail", true , false, true , CTRL_CONFSUB_NOMAIL }, { "confsub-both", true , false, true , CTRL_CONFSUB_BOTH }, { "confsub", true , false, true , CTRL_CONFSUB }, { "unsubscribe-digest", false, false, true , CTRL_UNSUBSCRIBE_DIGEST }, { "unsubscribe-nomail", false, false, true , CTRL_UNSUBSCRIBE_NOMAIL }, { "unsubscribe", false, false, true , CTRL_UNSUBSCRIBE }, { "confunsub-digest", true , false, true , CTRL_CONFUNSUB_DIGEST }, { "confunsub-nomail", true , false, true , CTRL_CONFUNSUB_NOMAIL }, { "confunsub", true , false, true , CTRL_CONFUNSUB }, { "bounces", true , true , true , CTRL_BOUNCES }, { "release", true , true , true , CTRL_RELEASE }, { "reject", true , true , true , CTRL_REJECT }, { "permit", true , true , true , CTRL_PERMIT }, { "obstruct", true , true , true , CTRL_OBSTRUCT }, { "moderate", true , true , true , CTRL_MODERATE }, { "help", false, true , true , CTRL_HELP }, { "faq", false, true , true , CTRL_FAQ }, { "get", true , true , true , CTRL_GET }, { "list", false, true , true , CTRL_LIST } }; struct listcontrol { const char *fromemail; const char *mlmmjsend; bool subconfirm; }; struct sub { const char *typereq; const char *ctrlstr; const char *type; const char *typedeny; enum subtype typesub; }; static bool is_valid_email(const char *email, const char *log) { if (strchr(email, '@') == NULL) { errno = 0; log_error(LOG_ARGS, "%s request was " " sent with an invalid From: header." " Ignoring mail", log); return (false); } return (true); } __dead2 static void lc_sub(struct listcontrol *lc, struct ml *ml, struct sub *sub) { if (!is_valid_email(lc->fromemail, sub->typereq)) exit(EXIT_FAILURE); if (sub->ctrlstr != NULL && statctrl(ml->ctrlfd, sub->ctrlstr)) { char *queuefilename; text *txt; errno = 0; log_error(LOG_ARGS, "%s request was denied", sub->typereq); txt = open_text(ml->fd, "deny", "sub", "disabled", sub->type, sub->typedeny); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", lc->fromemail); queuefilename = prepstdreply(txt, ml, "$listowner$", lc->fromemail, NULL); MY_ASSERT(queuefilename); close_text(txt); send_help(ml, queuefilename, lc->fromemail); } log_oper(ml->fd, OPLOGFNAME, "mlmmj-sub: request for %s" " subscription from %s", sub->type, lc->fromemail); struct subscription subc = { 0 }; subc.subconfirm = lc->subconfirm; subc.send_welcome_email = true; subc.reasonsub = SUB_REQUEST; subc.typesub = sub->typesub; subc.gensubscribed = true; exit(do_subscribe(ml, &subc, lc->fromemail) ? EXIT_SUCCESS : EXIT_FAILURE); } struct ctrl_command * get_ctrl_command(const char *controlstr, char **param) { size_t cmdlen; unsigned int ctrl; for (ctrl=0; ctrl < NELEM(ctrl_commands); ctrl++) { cmdlen = strlen(ctrl_commands[ctrl].command); if (strncmp(controlstr, ctrl_commands[ctrl].command, cmdlen) != 0) continue; if (ctrl_commands[ctrl].accepts_parameter) { if (controlstr[cmdlen] != '-') { errno = 0; log_error(LOG_ARGS, "Command \"%s\"" " requires a parameter, but no" " parameter was given." " Ignoring mail", ctrl_commands[ctrl].command); return (NULL); } if (strchr(controlstr + cmdlen + 1, '/')) { errno = 0; log_error(LOG_ARGS, "Slash (/) in" " list control request," " discarding mail"); return (NULL); } *param = xstrdup(controlstr + cmdlen + 1); } else { if (controlstr[cmdlen] != '\0') { errno = 0; log_error(LOG_ARGS, "Command \"%s\"" " does not accept a parameter," " but a parameter was given." " Ignoring mail", ctrl_commands[ctrl].command); return (NULL); } *param = NULL; } return (&ctrl_commands[ctrl]); } return (NULL); } int listcontrol(strlist *fromemails, struct ml *ml, const char *controlstr, const char *mlmmjsend, const char *mailname) { char *bouncenr, *tmpstr; char *param = NULL, *moderatefilename, *gatekeepfilename; char *omitfilename; char *omit = NULL; char *c, *archivefilename, *sendfilename, *tosend; text *txt; char *queuefilename; enum subtype ts = SUB_NONE; const char *subtypename = NULL; bounce_t bret; struct ctrl_command *cc; struct listcontrol lc = { 0 }; struct sub sub = { 0 }; struct subscription subc = { 0 }; lc.subconfirm = !statctrl(ml->ctrlfd, "nosubconfirm"); #if 0 log_error(LOG_ARGS, "controlstr = [%s]\n", controlstr); log_error(LOG_ARGS, "tll_front(*fromemails) = [%s]\n", tll_front(*fromemails)); #endif cc = get_ctrl_command(controlstr, ¶m); if (cc == NULL) return (-1); if(tll_length(*fromemails) != 1 && cc->type != CTRL_BOUNCES) { errno = 0; log_error(LOG_ARGS, "Ignoring mail with invalid From: " "which was not a bounce: %d", tll_length(*fromemails)); return -1; } if (tll_length(*fromemails) >= 1) lc.fromemail = tll_front(*fromemails); lc.mlmmjsend = mlmmjsend; /* We only need the control mail when bouncing, to save bounced msg */ if (cc->type != CTRL_BOUNCES) unlink(mailname); if (statctrl(ml->ctrlfd, "closedlist") && !cc->valid_when_closed_list) { errno = 0; log_error(LOG_ARGS, "A %s request was sent to a closed list. " "Ignoring mail", cc->command); return -1; } if (statctrl(ml->ctrlfd, "closedlistsub") && !cc->valid_when_closed_sub) { errno = 0; log_error(LOG_ARGS, "A %s request was sent to a subscription " "closed list. Ignoring mail", cc->command); return -1; } switch (cc->type) { /* listname+subscribe-digest@domain.tld */ case CTRL_SUBSCRIBE_DIGEST: sub.typereq = "A subscribe-digest"; sub.ctrlstr = "nodigestsub"; sub.type = "digest"; sub.typesub = SUB_DIGEST; sub.typedeny = "sub-deny-digest"; __attribute__ ((fallthrough)); /* listname+subscribe-nomail@domain.tld */ case CTRL_SUBSCRIBE_NOMAIL: if (sub.typereq == NULL) { sub.typereq = "A subscribe-nomail"; sub.ctrlstr = "nomailsub"; sub.typesub = SUB_NOMAIL; sub.type = "nomail"; sub.typedeny = "sub-deny-nomail"; } __attribute__ ((fallthrough)); /* listname+subscribe-both@domain.tld */ case CTRL_SUBSCRIBE_BOTH: if (sub.typereq == NULL) { sub.typereq = "A subscribe-both"; sub.ctrlstr = "nodigestsub"; sub.typesub = SUB_BOTH; sub.type = "both"; sub.typedeny = "sub-deny-digest"; } __attribute__ ((fallthrough)); /* listname+subscribe@domain.tld */ case CTRL_SUBSCRIBE: if (sub.typereq == NULL) { sub.typereq = "A subscribe"; sub.ctrlstr = NULL; sub.type = "regular"; sub.typesub = SUB_NORMAL; } lc_sub(&lc, ml, &sub); break; /* listname+subconf-digest-COOKIE@domain.tld */ case CTRL_CONFSUB_DIGEST: subc.typesub = SUB_DIGEST; subtypename = "digest"; __attribute__ ((fallthrough)); /* listname+subconf-nomail-COOKIE@domain.tld */ case CTRL_CONFSUB_NOMAIL: if (subtypename == NULL) { subc.typesub = SUB_NOMAIL; subtypename = "nomail"; } __attribute__ ((fallthrough)); /* listname+subconf-both-COOKIE@domain.tld */ case CTRL_CONFSUB_BOTH: if (subtypename == NULL) { subc.typesub = SUB_BOTH; subtypename = "both"; } __attribute__ ((fallthrough)); /* listname+subconf-COOKIE@domain.tld */ case CTRL_CONFSUB: if (subtypename == NULL) { subc.typesub = SUB_NORMAL; subtypename = "regular list"; } tmpstr = get_subcookie_content(ml->fd, false, param); if (tmpstr == NULL) { /* invalid COOKIE */ errno = 0; log_error(LOG_ARGS, "A subconf request was" " sent with a mismatching cookie." " Ignoring mail"); return -1; } subc.send_welcome_email = true; subc.reasonsub = SUB_CONFIRM; subc.gensubscribed = true; subc.mlmmjsend = lc.mlmmjsend; log_oper(ml->fd, OPLOGFNAME, "mlmmj-sub: %s confirmed" " subscription to %s", tmpstr, subtypename); exit(do_subscribe(ml, &subc, tmpstr) ? EXIT_SUCCESS : EXIT_FAILURE); /* DEPRECATED: listname+unsubscribe-digest@domain.tld */ case CTRL_UNSUBSCRIBE_DIGEST: /* DEPRECATED: listname+unsubscribe-nomail@domain.tld */ case CTRL_UNSUBSCRIBE_NOMAIL: /* listname+unsubscribe@domain.tld */ case CTRL_UNSUBSCRIBE: if (!is_valid_email(lc.fromemail, "An unsubscribe")) return -1; log_oper(ml->fd, OPLOGFNAME, "mlmmj-unsub: %s requests" " unsubscribe", lc.fromemail); do_unsubscribe(ml, lc.fromemail, SUB_ALL, SUB_REQUEST, false, lc.subconfirm, false, lc.subconfirm); exit(EXIT_SUCCESS); break; /* listname+unsubconf-digest-COOKIE@domain.tld */ case CTRL_CONFUNSUB_DIGEST: ts = SUB_DIGEST; subtypename = "-digest"; __attribute__ ((fallthrough)); /* listname+unsubconf-nomail-COOKIE@domain.tld */ case CTRL_CONFUNSUB_NOMAIL: if (ts == SUB_NONE) { ts = SUB_NOMAIL; subtypename = "-nomail"; } __attribute__ ((fallthrough)); /* listname+unsubconf-COOKIE@domain.tld */ case CTRL_CONFUNSUB: if (ts == SUB_NONE) { ts = SUB_ALL; subtypename = ""; } tmpstr = get_subcookie_content(ml->fd, true, param); if (tmpstr == NULL) { /* invalid COOKIE */ errno = 0; log_error(LOG_ARGS, "An unsubconf%s request was" " sent with a mismatching cookie." " Ignoring mail", subtypename); return -1; } do_unsubscribe(ml, tmpstr, ts, SUB_CONFIRM, false, false, false, true); exit(EXIT_SUCCESS); break; /* listname+bounces-INDEX-user=example.tld@domain.tld */ case CTRL_BOUNCES: bouncenr = param; c = strchr(param, '-'); if (!c) { /* Exec with dsn parsing, since the addr is missing */ c = dsnparseaddr(mailname); if (c == NULL) exit(EXIT_SUCCESS); char *tmp = strrchr(c, '@'); MY_ASSERT(tmp); *tmp = '='; } else { *c++ = '\0'; } bret = bouncemail(ml->fd, lowercase(c), bouncenr); if (bret == BOUNCE_DONE) save_lastbouncedmsg(ml->fd, c, mailname); if (bret == BOUNCE_FAIL) exit(EXIT_FAILURE); unlink(mailname); exit(EXIT_SUCCESS); break; /* listname+release-COOKIE@domain.tld */ case CTRL_RELEASE: /* DEPRECATED: listname+moderate-COOKIE@domain.tld */ /* DEPRECATED: listname+moderate-subscribeCOOKIE@domain.tld */ case CTRL_MODERATE: /* Subscriber moderation; DEPRECATED */ if(strncmp(param, "subscribe", 9) == 0) { tmpstr = xstrdup(param + 9); free(param); param = tmpstr; goto permit; } xasprintf(&moderatefilename, "moderation/%s", param); xasprintf(&sendfilename, "%s.sending", moderatefilename); /* Rename it to avoid mail being sent twice */ if(renameat(ml->fd, moderatefilename, ml->fd, sendfilename) != 0) { if (errno == ENOENT) { errno = 0; log_error(LOG_ARGS, "A release request was" " sent with a mismatching cookie." " Ignoring mail"); } else { log_error(LOG_ARGS, "Could not rename to .sending"); } free(sendfilename); free(moderatefilename); return (-1); } xasprintf(&omitfilename, "%s.omit", moderatefilename); errno = 0; omit = ctrlvalue(ml->fd, omitfilename); if (omit != NULL || errno != ENOENT) unlinkat(ml->fd, omitfilename, 0); free(omitfilename); free(moderatefilename); log_oper(ml->fd, OPLOGFNAME, "%s released %s", lc.fromemail, param); xasprintf(&tosend, "%s/%s", ml->dir, sendfilename); if (omit != NULL) exec_or_die(mlmmjsend, "-L", ml->dir, "-o", omit, "-m", tosend, NULL); exec_or_die(mlmmjsend, "-L", ml->dir, "-m", tosend, NULL); break; /* listname+reject-COOKIE@domain.tld */ case CTRL_REJECT: xasprintf(&moderatefilename, "moderation/%s", param); if (unlinkat(ml->fd, moderatefilename, 0) != 0) { if (errno == ENOENT) { errno = 0; log_error(LOG_ARGS, "A reject request was" " sent with a mismatching cookie." " Ignoring mail"); } else { log_error(LOG_ARGS, "Could not unlink %s", moderatefilename); } free(moderatefilename); return -1; } log_oper(ml->fd, OPLOGFNAME, "%s rejected %s", lc.fromemail, param); free(moderatefilename); xasprintf(&moderatefilename, "moderation/%s.omit", param); unlinkat(ml->fd, moderatefilename, 0); free(moderatefilename); free(param); break; /* listname+permit-COOKIE@domain.tld */ case CTRL_PERMIT: permit: xasprintf(&gatekeepfilename, "moderation/subscribe%s", param); if (faccessat(ml->fd, gatekeepfilename, F_OK, 0) < 0) { free(gatekeepfilename); /* no mail to moderate */ errno = 0; log_error(LOG_ARGS, "A permit request was" " sent with a mismatching cookie." " Ignoring mail"); return -1; } log_oper(ml->fd, OPLOGFNAME, "%s permitted %s", lc.fromemail, param); subc.modstr = param; subc.send_welcome_email = true; subc.gensubscribed = true; subc.reasonsub = SUB_PERMIT; subc.mlmmjsend = lc.mlmmjsend; exit(do_subscribe(ml, &subc, NULL) ? EXIT_SUCCESS : EXIT_FAILURE); break; /* listname+obstruct-COOKIE@domain.tld */ case CTRL_OBSTRUCT: xasprintf(&gatekeepfilename, "moderation/subscribe%s", param); if (unlinkat(ml->fd, gatekeepfilename, 0) != 0) { if (errno == ENOENT) { errno = 0; log_error(LOG_ARGS, "An obstruct request was" " sent with a mismatching cookie." " Ignoring mail"); } else { log_error(LOG_ARGS, "Could not unlink %s/%s", ml->dir, gatekeepfilename); } free(param); free(gatekeepfilename); return -1; } log_oper(ml->fd, OPLOGFNAME, "%s obstructed %s", tll_front(*fromemails), param); free(param); free(gatekeepfilename); break; /* listname+help@domain.tld */ case CTRL_HELP: if (!is_valid_email(tll_front(*fromemails), "A help")) return -1; log_oper(ml->fd, OPLOGFNAME, "%s requested help", tll_front(*fromemails)); txt = open_text(ml->fd, "help", NULL, NULL, NULL, "listhelp"); MY_ASSERT(txt); register_default_unformatted(txt, ml); queuefilename = prepstdreply(txt, ml, "$listowner$", tll_front(*fromemails), NULL); MY_ASSERT(queuefilename); close_text(txt); send_help(ml, queuefilename, tll_front(*fromemails)); break; /* listname+faq@domain.tld */ case CTRL_FAQ: if (!is_valid_email(tll_front(*fromemails), "A faq")) return -1; log_oper(ml->fd, OPLOGFNAME, "%s requested faq", tll_front(*fromemails)); txt = open_text(ml->fd, "faq", NULL, NULL, NULL, "listfaq"); MY_ASSERT(txt); register_default_unformatted(txt, ml); queuefilename = prepstdreply(txt, ml, "$listowner$", tll_front(*fromemails), NULL); MY_ASSERT(queuefilename); close_text(txt); send_help(ml, queuefilename, tll_front(*fromemails)); break; /* listname+get-INDEX@domain.tld */ case CTRL_GET: if (statctrl(ml->ctrlfd, "noget")) { errno = 0; log_error(LOG_ARGS, "A get request was sent to a list" " with the noget option set. Ignoring mail"); return -1; } if (statctrl(ml->ctrlfd, "subonlyget")) { if(is_subbed(ml->fd, tll_front(*fromemails), 0) == SUB_NONE) { errno = 0; log_error(LOG_ARGS, "A get request was sent" " from a non-subscribed address to a" " list with the subonlyget option set." " Ignoring mail"); return -1; } } /* sanity check--is it all digits? */ if (param[strspn(param, "0123456789")] != '\0') { errno = 0; log_error(LOG_ARGS, "The get request contained" " non-digits in index. Ignoring mail"); return -1; } int index = strtoim(param, 0, INT_MAX, NULL); xasprintf(&archivefilename, "archive/%d", index); int fd = openat(ml->fd, archivefilename, O_RDONLY|O_CLOEXEC); if (fd == -1) { log_error(LOG_ARGS, "Unable to open archive file"); free(archivefilename); return -1; } struct mail mail = { 0 }; mail.to = tll_front(*fromemails); mail.from = get_bounce_from_adr(mail.to, ml, index); mail.fp = fdopen(fd, "r"); log_oper(ml->fd, OPLOGFNAME, "%s got archive/%s", tll_front(*fromemails), param); if (!send_single_mail(&mail, ml, true)) { /* TODO: save to queue */ return (-1); } break; /* listname+list@domain.tld */ case CTRL_LIST: if(statctrl(ml->ctrlfd, "nolistsubsemail")) return -1; const char *owner = tll_front(*fromemails); if (!ctrlvalues_contains(ml->ctrlfd, "owner", owner, false)) { errno = 0; log_error(LOG_ARGS, "A list request was sent to the" " list from a non-owner address." " Ignoring mail"); return -1; } send_list(ml, owner); break; /* listname+???@domain.tld */ default: errno = 0; log_error(LOG_ARGS, "Unknown command \"%s\". Ignoring mail", controlstr); return -1; } return 0; } mlmmj/src/log_error.c000066400000000000000000000060451502303113500151150ustar00rootroot00000000000000/* * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include "xmalloc.h" #include "log_error.h" #include "config.h" #ifdef HAVE_SYSLOG_H #include #endif static char *log_name = NULL; static bool syslog_is_open = false; #ifdef HAVE_SYSLOG static int syslog_logopt = LOG_PID|LOG_CONS; #endif static void _openlog(bool reopen) { #ifdef HAVE_SYSLOG if (!reopen) { if (syslog_is_open) return; } else { if (!syslog_is_open) closelog(); } openlog(log_name, syslog_logopt, LOG_MAIL); syslog_is_open = true; #endif } void log_set_name(const char* name) { free(log_name); log_name = xstrdup(name); _openlog(true); } void log_activate_stderr(void) { #ifdef HAVE_SYSLOG syslog_logopt |= LOG_PERROR; _openlog(true); #endif } void log_set_namef(const char *fmt, ...) { char *buf; va_list ap; int i; va_start(ap, fmt); i = vasprintf(&buf, fmt, ap); va_end(ap); if (i < 0 || buf == NULL) abort(); free(log_name); log_name = buf; _openlog(true); } void log_free_name(void) { free(log_name); } void log_err(const char *fmt, ...) { va_list ap; va_start(ap, fmt); #ifdef HAVE_SYSLOG _openlog(false); vsyslog(LOG_ERR, fmt, ap); #else char *buf; i = vasprintf(&buf, fmt, ap); fprintf(stderr, "%s[%d]: %s\n", log_name, (int) getpid(), buf); free(buf); #endif va_end(ap); } void log_error(const char *file, int line, const char *errstr, const char *fmt, ...) { char *buf; va_list ap; int i; va_start(ap, fmt); i = vasprintf(&buf, fmt, ap); va_end(ap); if (i < 0 || buf == NULL) abort(); if (!log_name) log_name = "mlmmj-UNKNOWN"; #ifdef HAVE_SYSLOG _openlog(true); syslog(LOG_ERR, "%s:%d: %s: %s", file, line, buf, errstr); #else fprintf(stderr, "%s[%d]: %s:%d: %s: %s\n", log_name, (int)getpid(), file, line, buf, errstr); #endif free(buf); } mlmmj/src/log_oper.c000066400000000000000000000051771502303113500147360ustar00rootroot00000000000000/* Copyright (C) 2005 Mads Martin Joergensen < mmj AT mmj DOT dk > * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "log_error.h" #include "log_oper.h" #include "wrappers.h" #include "utils.h" int log_oper(int listfd, const char *basename, const char *fmt, ...) { int fd, statres; char ct[26], *tmp; struct stat st; time_t t; va_list ap; statres = fstatat(listfd, basename, &st, AT_SYMLINK_NOFOLLOW); if(statres < 0 && errno != ENOENT) { log_error(LOG_ARGS, "Could not stat logfile %s", basename); return -1; } if(statres >= 0 && st.st_size > (off_t)OPLOGSIZE) { xasprintf(&tmp, "%s.rotated", basename); if(renameat(listfd, basename, listfd, tmp) < 0) { log_error(LOG_ARGS, "Could not rename %s,%s", basename, tmp); } free(tmp); } fd = openat(listfd, basename, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR); if(fd < 0 && !lock(fd, true)) { log_error(LOG_ARGS, "Could not open %s", basename); return -1; } if((time(&t) == (time_t)-1) || (ctime_r(&t, ct) == NULL)) strncpy(ct, "Unknown time", sizeof(ct)); else ct[24] = '\0'; va_start(ap, fmt); if (dprintf(fd, "%s ", ct) < 0) log_error(LOG_ARGS, "Could not write to %s", basename); if (vdprintf(fd, fmt, ap) <0) log_error(LOG_ARGS, "Could not write to %s", basename); if (dprintf(fd, "\n") < 0) log_error(LOG_ARGS, "Could not write to %s", basename); va_end(ap); close(fd); return 0; } mlmmj/src/mail-functions.c000066400000000000000000000075541502303113500160610ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mail-functions.h" #include "wrappers.h" #include "log_error.h" static int write_sock(int sockfd, const char *errstr, const char *fmt, ...) { int bytes_written; va_list ap; va_start(ap, fmt); bytes_written = vdprintf(sockfd, fmt, ap); va_end(ap); if(bytes_written < 0) { log_error(LOG_ARGS, "Could not write %s", errstr); return -1; } return 0; } int write_ehlo(int sockfd, const char *hostname) { return (write_sock(sockfd, "EHLO", "EHLO %s\r\n", hostname)); } int write_helo(int sockfd, const char *hostname) { return (write_sock(sockfd, "HELO", "HELO %s\r\n", hostname)); } int write_mail_from(int sockfd, const char *from_addr, const char *extra) { if(extra && extra[0] != '\0') { if(extra[0] == ' ') extra++; return (write_sock(sockfd, "FROM", "MAIL FROM:<%s> %s\r\n", from_addr, extra)); } else return (write_sock(sockfd, "FROM", "MAIL FROM:<%s>\r\n", from_addr)); } int write_rcpt_to(int sockfd, const char *rcpt_addr) { return (write_sock(sockfd, "TO", "RCPT TO:<%s>\r\n", rcpt_addr)); } void write_mailbody(int sockfd, FILE *fp, const char *tohdr) { int c, next; bool addhdr = true; while ((c = fgetc(fp)) != EOF) { if (c != '\n') { dprintf(sockfd, "%c", c); continue; } next = fgetc(fp); dprintf(sockfd, "\r\n"); if (next == '.') { /* * o Before sending a line of mail text, the SMTP client checks the * first character of the line. If it is a period, one additional * period is inserted at the beginning of the line. * * o When a line of mail text is received by the SMTP server, it checks * the line. If the line is composed of a single period, it is * treated as the end of mail indicator. If the first character is a * period and there are other characters on the line, the first * character is deleted. */ c = fgetc(fp); dprintf(sockfd, "."); ungetc(c, fp); } if (addhdr && tohdr != NULL && next == '\n') { dprintf(sockfd, "To: %s\r\n", tohdr); addhdr = false; } ungetc(next, fp); } } int write_dot(int sockfd) { return write_sock(sockfd, "", "\r\n.\r\n"); } int write_replyto(int sockfd, const char *replyaddr) { return write_sock(sockfd, "Reply-To header", "Reply-To: %s\r\n", replyaddr); } int write_data(int sockfd) { return write_sock(sockfd, "DATA", "DATA\r\n"); } int write_quit(int sockfd) { return write_sock(sockfd, "QUIT", "QUIT\r\n"); } int write_rset(int sockfd) { return write_sock(sockfd, "RSET", "RSET\r\n"); } mlmmj/src/mlmmj-bounce.c000066400000000000000000000101611502303113500155020ustar00rootroot00000000000000/* * Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "chomp.h" #include "mlmmj.h" #include "strgen.h" #include "wrappers.h" #include "log_error.h" #include "subscriberfuncs.h" #include "prepstdreply.h" #include "xmalloc.h" #include "find_email_adr.h" #include "utils.h" #include "send_mail.h" void do_probe(struct ml *ml, const char *addr) { if (send_probe(ml, addr)) exit(EXIT_SUCCESS); exit(EXIT_FAILURE); } static void print_help(const char *prg) { printf("Usage: %s -L /path/to/list\n" " [-a john=doe.org | -d] [-n num | -p]\n" " -a: Address string that bounces\n" " -h: This help\n" " -L: Full path to list directory\n" " -n: Message number in the archive\n" " -d: Attempt to parse DSN to determine address\n" " -p: Send out a probe\n" " -V: Print version\n", prg); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { int opt, dsnbounce = 0; char *address = NULL, *number = NULL; const char *thisaddr = NULL; char *a; const char *mailname = NULL; bool probe = false; bounce_t bret; struct ml ml; log_set_name(argv[0]); ml_init(&ml); while ((opt = getopt(argc, argv, "hdVL:a:n:m:p")) != -1) { switch(opt) { case 'L': ml.dir = optarg; break; case 'a': thisaddr = optarg; break; case 'd': dsnbounce = 1; break; case 'm': mailname = optarg; break; case 'n': number = optarg; break; case 'p': probe = true; break; case 'h': print_help(argv[0]); break; case 'V': print_version(argv[0]); exit(0); } } if(ml.dir == NULL || (thisaddr == NULL && dsnbounce == 0) || (number == NULL && !probe)) { errx(EXIT_FAILURE, "You have to specify -L, -a or -d and -n or -p\n" "%s -h for help", argv[0]); } if (!ml_open(&ml, true)) exit(EXIT_FAILURE); if(dsnbounce) { address = dsnparseaddr(mailname); /* Delete the mailfile, no need for it anymore */ if(mailname) unlink(mailname); if(address == NULL) exit(EXIT_SUCCESS); a = strrchr(address, '@'); MY_ASSERT(a); *a = '='; thisaddr = address; } if(number != NULL && probe) { errx(EXIT_FAILURE, "You can only specify one of -n or -p\n" "%s -h for help", argv[0]); } if (probe) { /* send out a probe */ do_probe(&ml, thisaddr); /* do_probe() will never return */ exit(EXIT_FAILURE); } #if 0 log_error(LOG_ARGS, "listdir = [%s] address = [%s] number = [%s]", listdir, address, number); #endif bret = bouncemail(ml.fd, thisaddr, number); if (bret == BOUNCE_DONE && mailname != NULL) save_lastbouncedmsg(ml.fd, thisaddr, mailname); free(address); if (bret == BOUNCE_OK && mailname != NULL) unlink(mailname); return (bret == BOUNCE_FAIL ? EXIT_FAILURE : EXIT_SUCCESS); } mlmmj/src/mlmmj-list.c000066400000000000000000000100141502303113500151770ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "chomp.h" static void print_help(const char *prg) { printf("Usage: %s -L /path/to/listdir\n" " [-c] [-d] [-h] [-m] [-n] [-o] [-s] [-V]\n" " -L: Full path to list directory\n" " -c: Print subscriber count\n" " -d: Print for digesters list\n" " -h: This help\n" " -m: Print moderators for list\n" " -n: Print for nomail version of list\n" " -o: Print owner(s) of list\n" " -s: Print normal subscribers (default) \n" " -V: Print version\n", prg); exit(EXIT_SUCCESS); } static int dumpcount(int fd, size_t *count) { FILE *f; char *line = NULL; size_t linecap = 0; struct stat fst; f = fdopen(fd, "r"); if (f == NULL) return (-1); if (fstat(fd, &fst) == 0) { if (S_ISDIR(fst.st_mode)) { return(-1); } } while (getline(&line, &linecap, f) > 0) { chomp(line); if (count) (*count)++; else printf("%s\n", line); } free(line); fclose(f); return 0; } int main(int argc, char **argv) { int opt; size_t count = 0; bool docount = false; const char *listdir = NULL; const char *subfile = NULL; const char *subdir; DIR *dirp; struct dirent *dp; enum subtype typesub = SUB_NORMAL; int subdirfd = -1, listfd, fd; while ((opt = getopt(argc, argv, "cdhmnosVL:")) != -1) { switch(opt) { case 'c': docount = 1; break; case 'd': typesub = SUB_DIGEST; break; case 'h': print_help(argv[0]); break; case 'L': listdir = optarg; break; case 'm': typesub = SUB_FILE; subfile = "control/moderators"; break; case 'n': typesub = SUB_NOMAIL; break; case 'o': typesub = SUB_FILE; subfile = "control/owner"; break; case 'V': print_version(argv[0]); exit(EXIT_SUCCESS); default: case 's': typesub = SUB_NORMAL; break; } } if(listdir == NULL) { errx(EXIT_FAILURE, "You have to specify -L\n" "%s -h for help", argv[0]); } listfd = open_listdir(listdir, false); if (listfd == -1) exit(EXIT_FAILURE); subdirfd = open_subscriber_directory(listfd, typesub, &subdir); if (subdirfd == -1 && subdir != NULL) err(EXIT_FAILURE, "Unable to open(%s/%s)", listdir, subdir); if(subdirfd != -1) { dirp = fdopendir(subdirfd); if(dirp == NULL) errx(EXIT_FAILURE, "Could not opendir(%s);", subdir); while((dp = readdir(dirp)) != NULL) { if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; fd = openat(subdirfd, dp->d_name, O_RDONLY|O_CLOEXEC); dumpcount(fd, docount ? &count : NULL); } closedir(dirp); } else { fd = openat(listfd, subfile, O_RDONLY|O_CLOEXEC); dumpcount(fd, docount ? &count : NULL); } if (docount) printf("%zu\n", count); return 0; } mlmmj/src/mlmmj-maintd.c000066400000000000000000000476101502303113500155140ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "strgen.h" #include "chomp.h" #include "log_error.h" #include "mygetline.h" #include "wrappers.h" #include "xmalloc.h" #include "ctrlvalue.h" #include "statctrl.h" #include "send_digest.h" #include "log_oper.h" #include "utils.h" #include "send_mail.h" #define log(...) dprintf(logfd, __VA_ARGS__); #define opendirat(_dirfd, _fd, _dirent, _path) \ do { \ _fd = openat(_dirfd, _path, O_DIRECTORY|O_CLOEXEC|O_RDONLY); \ if (_fd == -1 || (_dirent = fdopendir(_fd)) == NULL) { \ log(" - Could not open '%s': %s\n", _path, \ strerror(errno)); \ return (false); \ } \ } while (0); static void print_help(const char *prg) { printf("Usage: %s [-L | -d] /path/to/dir [-F]\n" " -d: Full path to directory with listdirs\n" " Use this to run maintenance on all list directories\n" " in that directory.\n" " -L: Full path to one list directory\n" " -F: Don't fork, performing one maintenance run only.\n" " This option should be used when one wants to\n" " avoid running another daemon, and use e.g. " "cron to control it instead.\n", prg); exit(EXIT_SUCCESS); } static int mydaemon(void) { if (daemon(1, 0) != 0) { log_error(LOG_ARGS, "Unable to become a daemon"); err(EXIT_FAILURE, "Unable to become a daemon"); } return 0; } static bool delolder(int dfd, const char *dirname, time_t than, int logfd) { DIR *dir; struct dirent *dp; struct stat st; time_t t; int fd; bool ret = true; opendirat(dfd, fd, dir, dirname); while((dp = readdir(dir)) != NULL) { if(fstatat(fd, dp->d_name, &st, 0) < 0) { log(" - Could not stat(%s/%s): %s\n", dirname, dp->d_name, strerror(errno)); ret = false; continue; } if(!S_ISREG(st.st_mode)) continue; t = time(NULL); if(t - st.st_mtime > than) { if (unlinkat(fd, dp->d_name, 0) == -1) { log("- Could not remove ('%s/%s'): %s\n", dirname, dp->d_name, strerror(errno)); ret = false; } } } closedir(dir); return (ret); } static bool clean_moderation(int dfd, int ctrlfd, int logfd) { time_t modreqlife; modreqlife = ctrltimet(ctrlfd, "modreqlife", MODREQLIFE); return (delolder(dfd, "moderation", modreqlife, logfd)); } static bool clean_discarded(int dfd, int logfd) { return (delolder(dfd, "queue/discarded", DISCARDEDLIFE, logfd)); } static bool clean_subconf(int dfd, int logfd) { return (delolder(dfd, "subconf", CONFIRMLIFE, logfd)); } static bool clean_unsubconf(int dfd, int logfd) { return (delolder(dfd, "unsubconf", CONFIRMLIFE, logfd)); } static bool resend_queue(struct ml *ml, int logfd) { DIR *queuedir; struct dirent *dp; char *fromname, *toname, *reptoname, *from, *to, *repto; char *ch; struct stat st; int errn = 0, qfd; time_t t, bouncelife; bool ret = true; struct mail mail; opendirat(ml->fd, qfd, queuedir, "queue"); while((dp = readdir(queuedir)) != NULL) { /* we might have deleted some files like the "mail.*" */ if(fstatat(qfd, dp->d_name, &st, 0) < 0) continue; if(!S_ISREG(st.st_mode)) continue; if(strchr(dp->d_name, '.')) { char *mailname = xstrdup(dp->d_name); ch = strrchr(mailname, '.'); MY_ASSERT(ch); *ch = '\0'; /* delete orphaned sidecar files */ if(faccessat(qfd, mailname, F_OK, 0) < 0) { if(errno == ENOENT) { *ch = '.'; if (unlinkat(qfd, mailname, 0) == -1) { log(" - Could not remove %s: %s\n", mailname, strerror(errno)); ret = false; } } } free(mailname); continue; } xasprintf(&fromname, "%s.mailfrom", dp->d_name); xasprintf(&toname, "%s.reciptto", dp->d_name); xasprintf(&reptoname, "%s.reply-to", dp->d_name); errn = 0; from = ctrlvalue(qfd, fromname); if (from == NULL) errn = errno; to = ctrlvalue(qfd, toname); if((from == NULL && errn == ENOENT) || (to == NULL && errno == ENOENT)) { /* only delete old files to avoid deleting mail currently being sent */ t = time(NULL); if(fstatat(qfd, dp->d_name, &st, 0) == 0) { if(t - (time_t)36000 > st.st_mtime) { unlinkat(qfd, dp->d_name, 0); /* avoid leaving orphans */ unlinkat(qfd, fromname, 0); unlinkat(qfd, toname, 0); unlinkat(qfd, reptoname, 0); } } free(reptoname); free(fromname); free(toname); continue; } repto = ctrlvalue(qfd, reptoname); /* before we try again, check and see if it's old */ bouncelife = ctrltimet(ml->ctrlfd, "bouncelife", BOUNCELIFE); t = time(NULL); if(t - bouncelife > st.st_mtime ) { if (unlinkat(qfd, dp->d_name, 0) == -1) { log(" - Could not remove queue/%s: %s\n", dp->d_name, strerror(errno)); ret = false; } /* avoid leaving orphans */ unlinkat(qfd, fromname, 0); unlinkat(qfd, toname, 0); unlinkat(qfd, reptoname, 0); free(from); free(to); free(repto); continue; } memset(&mail, 0, sizeof(mail)); mail.to = to; mail.from = from; mail.replyto = repto; int mailfd = openat(qfd, dp->d_name, O_RDONLY); mail.fp = fdopen(mailfd, "r"); if (mail.fp == NULL) err(1, "merde"); if (send_single_mail(&mail, ml, false)) { unlinkat(qfd, dp->d_name, 0); unlinkat(qfd, fromname, 0); unlinkat(qfd, toname, 0); unlinkat(qfd, reptoname, 0); } free(reptoname); free(fromname); free(toname); fclose(mail.fp); } closedir(queuedir); return (ret); } static bool resend_requeue(struct ml *ml, const char *mlmmjsend, int logfd) { DIR *queuedir; struct dirent *dp; char *archivefilename, *subnewname; struct stat st; time_t t; bool fromrequeuedir; int fd; bool ret = true; opendirat(ml->fd, fd, queuedir, "requeue"); while((dp = readdir(queuedir)) != NULL) { if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; if(fstatat(fd, dp->d_name, &st, 0) < 0) { log(" - Could not stat(requeue/%s): %s\n", dp->d_name, strerror(errno)); continue; } if(!S_ISDIR(st.st_mode)) continue; /* Remove old empty directories */ t = time(NULL); if(t - (time_t)3600 > st.st_mtime && unlinkat(fd, dp->d_name, AT_REMOVEDIR) == 0) continue; int requeuefd = openat(fd, dp->d_name, O_DIRECTORY); xasprintf(&archivefilename, "archive/%s", dp->d_name); int archivefd = openat(ml->fd, archivefilename, O_RDONLY); free(archivefilename); /* Explicitly initialize for each mail we examine */ fromrequeuedir = false; if (archivefd == -1) { /* If the list is set not to archive we want to look * in /requeue/ for a mailfile */ archivefd = openat(requeuefd, "mailfile", O_RDONLY); if (archivefd == -1) { close(requeuefd); continue; } fromrequeuedir = true; } int subfd = openat(requeuefd, "subscribers", O_RDONLY); if (subfd == -1) { if (fromrequeuedir && unlinkat(requeuefd, "mailfile", 0) == -1) { log(" - Cound not remove requeue/%s/mailfile: %s\n", dp->d_name, strerror(errno)); ret = false; } close(requeuefd); continue; } unlinkat(requeuefd, "subscribers", 0); xasprintf(&subnewname, "%d", subfd); xasprintf(&archivefilename, "%d", archivefd); exec_and_wait(mlmmjsend, "-l", "3", "-L", ml->dir, "-m", archivefilename, "-s", subnewname, "-a", "-D", NULL); free(subnewname); free(archivefilename); if (fromrequeuedir) unlinkat(requeuefd, "mailfile", 0); close(subfd); close(requeuefd); unlinkat(fd, dp->d_name, AT_REMOVEDIR); } closedir(queuedir); return ret; } static bool clean_nolongerbouncing(int dfd, int logfd) { DIR *bouncedir; char *filename, *s; time_t probetime, t; struct dirent *dp; int fd; bool ret = true; opendirat(dfd, fd, bouncedir, "bounce"); while((dp = readdir(bouncedir)) != NULL) { if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; filename = xstrdup(dp->d_name); s = strrchr(filename, '-'); if(s && (strcmp(s, "-probe") == 0)) { if (faccessat(fd, filename, F_OK, 0) < 0) { log(" - Could not access(bounce/%s)", filename); free(filename); ret = false; continue; } probetime = ctrltimet(fd, filename, (time_t)-1); if (probetime == (time_t)-1) { free(filename); continue; } t = time(NULL); if(t - probetime > WAITPROBE) { if (unlinkat(fd, filename, 0) == -1) { log(" - Could not remove bounce/%s: " "%s\n", filename, strerror(errno)); ret = false; } /* remove -probe onwards from filename */ *s = '\0'; unlinkat(fd, filename, 0); xasprintf(&s, "%s.lastmsg", filename); unlinkat(fd, s, 0); free(s); } } free(filename); } closedir(bouncedir); return (ret); } static bool probe_bouncers(struct ml *ml, const char *mlmmjbounce, int logfd) { DIR *bouncedir; char *probefile, *s; struct dirent *dp; int fd; bool ret = true; opendirat(ml->fd, fd, bouncedir, "bounce"); while((dp = readdir(bouncedir)) != NULL) { if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; s = strrchr(dp->d_name, '-'); if(s && (strcmp(s, "-probe") == 0)) continue; s = strrchr(dp->d_name, '.'); if(s && (strcmp(s, ".lastmsg") == 0)) continue; if(faccessat(fd, dp->d_name, F_OK, 0) < 0) { log(" - Could not stat(bounce/%s): %s\n", dp->d_name, strerror(errno)); ret = false; continue; } xasprintf(&probefile, "%s-probe", dp->d_name); /* Skip files which already have a probe out */ if(faccessat(fd, probefile, F_OK, 0) == 0) { free(probefile); continue; } free(probefile); exec_and_wait(mlmmjbounce, "-L", ml->dir, "-a", dp->d_name, "-p", NULL); } closedir(bouncedir); return (ret); } static bool unsub_bouncers(int dfd, int ctrlfd, int logfd) { DIR *bouncedir; char *probefile, *address, *a, *firstbounce; struct dirent *dp; int bfd; time_t bouncetime, t, bouncelife; const char *errstr; bool ret = true; opendirat(dfd, bfd, bouncedir, "bounce"); bouncelife = ctrltimet(ctrlfd, "bouncelife", BOUNCELIFE); while((dp = readdir(bouncedir)) != NULL) { if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; a = strrchr(dp->d_name, '-'); if(a && (strcmp(a, "-probe") == 0)) continue; a = strrchr(dp->d_name, '.'); if(a && (strcmp(a, ".lastmsg") == 0)) continue; if(faccessat(bfd, dp->d_name, F_OK, 0) < 0) { log(" - Could not stat(bounce/%s): %s\n", dp->d_name, strerror(errno)); ret = false; continue; } xasprintf(&probefile, "%s-probe", dp->d_name); /* Skip files which already have a probe out */ if(faccessat(bfd, probefile, F_OK, 0) == 0) { free(probefile); continue; } free(probefile); /* Get the first line of the bounce file to check if it's * been bouncing for long enough */ int fd = openat(bfd, dp->d_name, O_RDONLY|O_CLOEXEC); if(fd == -1) { log(" - Could not open bounce/%s: %s\n", dp->d_name, strerror(errno)); ret = false; continue; } firstbounce = readlf(fd, true); if(firstbounce == NULL) continue; bouncetime = extract_bouncetime(firstbounce, &errstr); free(firstbounce); if (errstr != NULL) { log(" - Error parsing the first line of bounce/%s: %s\n", dp->d_name, errstr); ret = false; continue; } t = time(NULL); if(t - bouncetime < bouncelife + WAITPROBE) continue; /* ok, don't unsub this one */ /* Ok, go ahead and unsubscribe the address */ address = xstrdup(dp->d_name); a = strchr(address, '='); if(a == NULL) { /* skip malformed */ free(address); continue; } *a = '@'; if (!unsubscribe(dfd, address, SUB_ALL)) { log(" - Some errors during unsubscription of %s\n", address); free(address); ret = false; continue; } unlinkat(bfd, dp->d_name, 0); xasprintf(&a, "%s.lastmsg", dp->d_name); unlinkat(bfd, a, 0); free(a); free(address); } closedir(bouncedir); return (ret); } static bool run_digests(struct ml *ml, const char *mlmmjsend, int logfd) { char *s1, *s2; time_t digestinterval, t, lasttime; long digestmaxmails, lastindex, index, lastissue; int fd, indexfd; const char *errstr = NULL; bool ret = false; if (statctrl(ml->ctrlfd, "noarchive")) { log(" - noarchive tunable: skipping digest\n"); return (true); } if (faccessat(ml->fd, "index", R_OK, 0) == -1) { log(" - No readable index file: no digest\n"); return (true); } digestinterval = ctrltimet(ml->ctrlfd, "digestinterval", DIGESTINTERVAL); digestmaxmails = ctrllong(ml->ctrlfd, "digestmaxmail", DIGESTMAXMAILS); fd = openat(ml->fd, "lastdigest", O_RDWR|O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0 && !lock(fd, true)) { log(" - Could not open or create 'lastdigest': %s\n", strerror(errno)); return (false); } s1 = mygetline(fd); /* Syntax is lastindex:lasttime or lastindex:lasttime:lastissue */ if (!parse_lastdigest(s1, &lastindex, &lasttime, &lastissue, &errstr)) { log(" - malformerd lastdigest '%s': %s", s1, errstr); return (false); } indexfd = openat(ml->fd, "index", O_RDONLY); if (indexfd < 0) { log("Could not open'index': %s", strerror(errno)); free(s1); close(fd); return (false); } s2 = readlf(indexfd, true); if (!s2) { /* If we don't have an index, no mails have been sent to the * list, and therefore we don't need to send a digest */ free(s1); close(fd); return (true); } index = strtoim(s2, 0, LONG_MAX, &errstr); if (errstr != NULL) { log(" - Invalid index content '%s': %s\n", s2, errstr); free(s1); free(s2); close(fd); return (false); } t = time(NULL); if ((t - lasttime >= digestinterval) || (index - lastindex >= digestmaxmails)) { if (index > lastindex+digestmaxmails) index = lastindex+digestmaxmails; if (index > lastindex) { lastissue++; send_digest(ml, lastindex+1, index, lastissue, NULL, mlmmjsend); } if (lseek(fd, 0, SEEK_SET) < 0) { log(" - Could not seek 'lastdigest': %s\n", strerror(errno)); goto out; } else { if (dprintf(fd, "%ld:%ld:%ld\n", index, (long)t, lastissue) < 0 ) { log("Could not write new 'lastdigest': %s\n", strerror(errno)); goto out; } } } ret = true; out: free(s1); free(s2); close(fd); return (ret); } void do_maintenance(struct ml *ml, const char *mlmmjsend, const char *mlmmjbounce) { char *random, *logname; char timenow[64]; int logfd; time_t t; random = random_str(); xasprintf(&logname, "maintdlog-%s", random); free(random); logfd = openat(ml->fd, logname, O_WRONLY|O_EXCL|O_CREAT, S_IRUSR|S_IWUSR); if(logfd == -1) { log_err("Could not open %s: %s", logname, strerror(errno)); free(logname); return; } t = time(NULL); if(ctime_r(&t, timenow)) log("Starting maintenance run at %s\n", timenow); log("clean_moderation\n"); if (!clean_moderation(ml->fd, ml->ctrlfd, logfd)) log_err("An error occurred while cleaning moderation, see %s", MAINTD_LOGFILE); log("clean_discarded\n"); if (!clean_discarded(ml->fd, logfd)) log_err("An error occurred while cleaning discarded mails, see " "%s", MAINTD_LOGFILE); log("clean_subconf\n"); if (!clean_subconf(ml->fd, logfd)) log_err("An error occurred while cleaning subscribtion " "confirmations, mails, see %s", MAINTD_LOGFILE); log("clean_unsubconf\n"); if (!clean_unsubconf(ml->fd, logfd)) log_err("An error occurred while cleaning unsubscribtion " "confirmations, mails, see %s", MAINTD_LOGFILE); log("resend_queue\n"); if (!resend_queue(ml, logfd)) log_err("An error occurred while resending queued mails, see %s", MAINTD_LOGFILE); log("resend_requeue\n"); if (!resend_requeue(ml, mlmmjsend, logfd)) log_err("An error occurred while resending requeued mails, see " "%s", MAINTD_LOGFILE); log("clean_nolongerbouncing\n"); if (!clean_nolongerbouncing(ml->fd, logfd)) log_err("An error occurred while cleaning no longer bouncing " "traces, see %s", MAINTD_LOGFILE); log("unsub_bouncers\n"); if (!unsub_bouncers(ml->fd, ml->ctrlfd, logfd)) log_err("An error occurred while unsubscribing bouncing emails, " "see %s", MAINTD_LOGFILE); log("probe_bouncers\n"); if (!probe_bouncers(ml, mlmmjbounce, logfd)) log_err("An error occurred while sending probes for bouncers, " "see %s", MAINTD_LOGFILE); log("run_digests\n"); if (!run_digests(ml, mlmmjsend, logfd)) log_err("An error occurred while running digests, see %s", MAINTD_LOGFILE); close(logfd); if (renameat(ml->fd, logname, ml->fd, MAINTD_LOGFILE) < 0) log_error(LOG_ARGS, "Could not rename(%s,%s)", logname, MAINTD_LOGFILE); free(logname); } int main(int argc, char **argv) { int opt; char *bindir, *listdir = NULL, *mlmmjsend, *mlmmjbounce; char *dirlists = NULL; struct dirent *dp; DIR *dirp; bool daemonize = true; CHECKFULLPATH(argv[0]); log_set_name(argv[0]); while ((opt = getopt(argc, argv, "hFVL:d:")) != -1) { switch(opt) { case 'd': dirlists = optarg; break; case 'F': daemonize = false; break; case 'L': listdir = optarg; break; case 'h': print_help(argv[0]); break; case 'V': print_version(argv[0]); exit(EXIT_SUCCESS); } } if(listdir == NULL && dirlists == NULL) { errx(EXIT_FAILURE, "You have to specify -d or -L\n" "%s -h for help", argv[0]); } if(listdir && dirlists) { errx(EXIT_FAILURE, "You have to specify either -d or -L\n" "%s -h for help", argv[0]); } bindir = mydirname(argv[0]); xasprintf(&mlmmjsend, "%s/mlmmj-send", bindir); xasprintf(&mlmmjbounce, "%s/mlmmj-bounce", bindir); free(bindir); if(daemonize && mydaemon() < 0) { log_error(LOG_ARGS, "Could not daemonize. Only one " "maintenance run will be done."); daemonize = false; } if (!daemonize) log_activate_stderr(); while(1) { if(listdir) { struct ml ml; ml_init(&ml); ml.dir = listdir; log_set_namef("%s(%s)", argv[0], listdir); if (!ml_open(&ml, true)) goto mainsleep; do_maintenance(&ml, mlmmjsend, mlmmjbounce); ml_close(&ml); goto mainsleep; } int dfd = open(dirlists, O_DIRECTORY|O_RDONLY); if (dfd == -1 || (dirp = fdopendir(dfd)) == NULL) { log_err("Could not open the directory containing " "mailing lists (%s): %s", dirlists, strerror(errno)); free(mlmmjbounce); free(mlmmjsend); exit(EXIT_FAILURE); } while((dp = readdir(dirp)) != NULL) { char *l; if((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; xasprintf(&l, "%s/%s", dirlists, dp->d_name); log_set_namef("%s(%s)", argv[0], l); struct ml ml; ml_init(&ml); ml.dir = l; if (!ml_open(&ml, true)) continue; do_maintenance(&ml, mlmmjsend, mlmmjbounce); ml_close(&ml); free(l); } closedir(dirp); mainsleep: if(!daemonize) break; else sleep(MAINTD_SLEEP); } free(mlmmjbounce); free(mlmmjsend); log_free_name(); exit(EXIT_SUCCESS); } mlmmj/src/mlmmj-make-ml.in000077500000000000000000000122141502303113500157420ustar00rootroot00000000000000#!/bin/sh # # mlmmj-make-ml - henne@hennevogel.de # VERSION="0.2" ALIASFILE=/etc/aliases CRONTAB=/etc/crontab TEXTLIBDIR="@textlibdir@" USAGE="mlmmj-make-ml $VERSION $0 options: -L listname: the name of the mailing list -a: create the needed entries in your $ALIASFILE file -b: add needed entry to $CRONTAB -c user: user to chown the spool directory to -d fqdn: fully qualified domain name of the mailing list -f answerfile: use answerfile to create mailing list non-interactively -h: display this help text -n answerfile: Do nothing. Instead, create answer file for later non-interactive use with -f -s spooldir: mlmmj spool directory -t lang: list text directory relative to $TEXTLIBDIR for given language " while getopts ":L:abc:d:f:hn:s:t:" Option do case "$Option" in L ) LISTNAME="$OPTARG" ;; a ) ADDALIAS="y" ;; b ) ADDCRON="y" ;; c ) DO_CHOWN="y" CHOWN="$OPTARG" ;; d ) FQDN="$OPTARG" ;; f ) ANSWERFILEIN="$OPTARG" ;; h ) echo "$USAGE" exit 0 ;; n ) ANSWERFILEOUT="$OPTARG" ;; s ) SPOOLDIR="$OPTARG" ;; t ) TEXTLANG="$OPTARG" ;; * ) echo "$0: invalid option" echo "Try $0 -h for more information." exit 1 esac done SHIFTVAL=$((OPTIND-1)) shift $SHIFTVAL if [ -r "$ANSWERFILEIN" ]; then # shellcheck source=/dev/null . "$ANSWERFILEIN" fi if [ -z "$SPOOLDIR" ]; then SPOOLDIRDEF=/var/spool/mlmmj printf 'mlmmj spool directory under which to create new mailing list [%s] : ' "$SPOOLDIRDEF" read -r SPOOLDIR if [ ! -d "$SPOOLDIR" ]; then SPOOLDIR="$SPOOLDIRDEF" fi fi if [ -z "$LISTNAME" ]; then LISTNAMEDEF="mlmmj-test" printf 'What should the name of the Mailinglist be? [%s] : ' "$LISTNAMEDEF" read -r LISTNAME if [ -z "$LISTNAME" ]; then LISTNAME="$LISTNAMEDEF" fi fi LISTDIR="$SPOOLDIR/$LISTNAME" if [ -z "$FQDN" ]; then printf 'The Fully Qualified Domain Name (FQDN) for the List? [] : ' read -r FQDN if [ -z "$FQDN" ]; then FQDN="$(domainname -f)" fi fi if [ -z "$OWNER" ]; then OWNERDEF="postmaster" printf 'The emailaddress of the list owner? [%s] : ' "$OWNERDEF" read -r OWNER if [ -z "$OWNER" ]; then OWNER="$OWNERDEF" fi fi if [ -d "$TEXTLIBDIR" ]; then if [ -z "$TEXTLANG" ]; then cat </dev/null) if [ -z "$MLMMJRECEIVE" ]; then MLMMJRECEIVE="/path/to/mlmmj-receive" fi MLMMJMAINTD=$(which mlmmj-maintd 2>/dev/null) if [ -z "$MLMMJMAINTD" ]; then MLMMJMAINTD="/path/to/mlmmj-maintd" fi ALIAS="$LISTNAME: \"|$MLMMJRECEIVE -L $LISTDIR/\"" CRONENTRY="0 */2 * * * $MLMMJMAINTD -F -L $LISTDIR/" if [ -z "$ADDALIAS" ]; then cat < "$ANSWERFILEOUT" < "$LISTDIR/control/owner" echo "$LISTADDRESS" > "$LISTDIR/control/listaddress" if [ -d "$TEXTPATH" ]; then cp "$TEXTPATH"/* "$LISTDIR/text" else echo "WARNING: List text language '$TEXTLANG' not found." echo "Proceeding without copying list texts." fi case "$ADDALIAS" in y|Y) echo "$ALIAS" >> $ALIASFILE esac case "$DO_CHOWN" in y|Y) if [ -n "$CHOWN" ]; then chown -R "$CHOWN" "$LISTDIR" fi esac case "$ADDCRON" in y|Y) echo "$CRONENTRY" >> $CRONTAB esac echo echo "Mailing list $LISTDIR was created successfully." fi cat < * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "wrappers.h" #include "find_email_adr.h" #include "incindexfile.h" #include "listcontrol.h" #include "strgen.h" #include "do_all_the_voodoo_here.h" #include "log_error.h" #include "statctrl.h" #include "ctrlvalue.h" #include "ctrlvalues.h" #include "prepstdreply.h" #include "subscriberfuncs.h" #include "log_oper.h" #include "unistr.h" #include "chomp.h" #include "mlmmj-process.h" #include "utils.h" #include "xstring.h" #include "send_help.h" #include "send_mail.h" enum modreason { MODNONSUBPOSTS, MODNONMODPOSTS, ACCESS, MODERATED }; static char *modreason_strs[] = { "modnonsubposts", "modnonmodposts", "access", "moderated" }; static bool is_moderator(int listfd, const char *address, char **moderators) { char *line = NULL; size_t linecap = 0; int moderatorsfd, foundaddr = 0; xstring *str = NULL; FILE *fp; if((moderatorsfd = openat(listfd, "control/moderators", O_RDONLY)) < 0) { log_error(LOG_ARGS, "Could not open 'control/moderators'"); exit(EXIT_FAILURE); } fp = fdopen(moderatorsfd, "r"); while (getline(&line, &linecap, fp) > 0) { chomp(line); if(address && strcasecmp(line, address) == 0) { foundaddr = true; if (moderators == NULL) goto out; } if (moderators) { if (str == NULL) str = xstring_new(); fprintf(str->fp, "%s\n", line); } } if (moderators) *moderators = xstring_get(str); out: free(line); fclose(fp); return foundaddr; } static void newmoderated(struct ml *ml, const char *mailfilename, const char *mlmmjsend, const char *efromsender, const char *subject, const char *posteraddr, enum modreason modreason) { char *from, *moderators = NULL; char *replyto, *reject, *to; text *txt; memory_lines_state *mls; char *queuefilename = NULL; const char *efromismod = NULL; const char *mailbasename = mybasename(mailfilename); int notifymod = 0; struct mail mail; #if 0 printf("mailfilename = [%s], mailbasename = [%s]\n", mailfilename, mailbasename); #endif if(statctrl(ml->ctrlfd, "ifmodsendonlymodmoderate")) efromismod = efromsender; if(!is_moderator(ml->fd, efromismod, &moderators)) efromismod = NULL; if(efromismod) mls = init_memory_lines(efromismod); else mls = init_memory_lines(moderators); free(moderators); gen_addr_cookie(replyto, ml, "release-", mailbasename); gen_addr_cookie(reject, ml, "reject-", mailbasename); gen_addr(from, ml, "owner"); xasprintf(&to, "%s-moderators@%s", ml->name, ml->fqdn); txt = open_text(ml->fd, "moderate", "post", modreason_strs[modreason], NULL, "moderation"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", posteraddr); register_unformatted(txt, "releaseaddr", replyto); register_unformatted(txt, "rejectaddr", reject); register_formatted(txt, "moderators", rewind_memory_lines, get_memory_line, mls); register_originalmail(txt, mailfilename); queuefilename = prepstdreply(txt, ml, "$listowner$", to, replyto); MY_ASSERT(queuefilename); close_text(txt); /* we might need to exec more than one mlmmj-send */ notifymod = !efromismod && statctrl(ml->ctrlfd,"notifymod"); if (notifymod) { char *qfname; /* send mail to poster that the list is moderated */ txt = open_text(ml->fd, "wait", "post", modreason_strs[modreason], NULL, "moderation-poster"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", posteraddr); register_formatted(txt, "moderators", rewind_memory_lines, get_memory_line, mls); register_originalmail(txt, mailfilename); qfname = prepstdreply(txt, ml, "$listowner$", efromsender, NULL); MY_ASSERT(qfname); close_text(txt); finish_memory_lines(mls); memset(&mail, 0, sizeof(mail)); mail.from = from; mail.to = efromsender; mail.fp = fopen(qfname, "r"); if (send_single_mail(&mail, ml, false)) unlink(qfname); fclose(mail.fp); } if (efromismod) { memset(&mail, 0, sizeof(mail)); mail.from = from; mail.to = efromsender; mail.fp = fopen(queuefilename, "r"); if (send_single_mail(&mail, ml, false)) unlink(queuefilename); fclose(mail.fp); exit(EXIT_SUCCESS); } exec_or_die(mlmmjsend, "-l", "2", "-L", ml->dir, "-F", from, "-m", queuefilename, NULL); } static void print_help(const char *prg) { printf("Usage: %s -L /path/to/list\n" " -m /path/to/mail [-h] [-P] [-V]\n" " -h: This help\n" " -L: Full path to list directory\n" " -m: Full path to mail file\n" " -P: Don't execute mlmmj-send\n" " -V: Print version\n", prg); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { int i, opt, moderated = 0, send = 0; enum modreason modreason; int hdrfd, footfd, rawmailfd, donemailfd, omitfd; bool addr_in_to_or_cc, notmetoo, replyto; bool findaddress = false, intocc = false, noprocess = false; int maxmailsize = 0; bool subonlypost, modonlypost, modnonsubposts, foundaddr = false; char *mailfile = NULL, *donemailname = NULL; char *randomstr = NULL, *mqueuename, *omitfilename; char *mlmmjsend; char *bindir, *subjectprefix, *discardname; text *txt; char *queuefilename, *recipextra = NULL, *owner = NULL; char *subject = NULL, *posteraddr = NULL; char *envstr; const char *efrom = ""; struct stat st; strlist fromemails = tll_init(); strlist originalfromemails = tll_init(); strlist toemails = tll_init(); strlist ccemails = tll_init(); strlist rpemails = tll_init(); strlist dtemails = tll_init(); strlist *testfrom = NULL; strlist *access_rules = NULL; strlist *list_rules = NULL; strlist *delheaders = NULL; strlist allheaders = tll_init(); strlist *listaddrs = NULL; struct mailhdr readhdrs[] = { { "From:", 0, NULL }, { "To:", 0, NULL }, { "Cc:", 0, NULL }, { "Return-Path:", 0, NULL }, { "Delivered-To:", 0, NULL }, { "Subject:", 0, NULL }, { "X-Original-From:", 0, NULL }, { NULL, 0, NULL } }; struct ml ml; CHECKFULLPATH(argv[0]); ml_init(&ml); log_set_name(argv[0]); bindir = mydirname(argv[0]); xasprintf(&mlmmjsend, "%s/mlmmj-send", bindir); free(bindir); while ((opt = getopt(argc, argv, "hVPm:L:")) != -1) { switch(opt) { case 'L': ml.dir = optarg; break; case 'm': mailfile = optarg; break; case 'h': print_help(argv[0]); break; case 'P': noprocess = true; break; case 'V': print_version(argv[0]); exit(EXIT_SUCCESS); } } if(ml.dir == NULL || mailfile == NULL) { errx(EXIT_FAILURE, "You have to specify -L and -m\n" "%s -h for help", argv[0]); } if (!ml_open(&ml, true)) exit(EXIT_FAILURE); do { free(donemailname); free(randomstr); randomstr = random_str(); xasprintf(&donemailname, "%s/queue/%s", ml.dir, randomstr); donemailfd = open(donemailname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while ((donemailfd < 0) && (errno == EEXIST)); if(donemailfd < 0) { log_error(LOG_ARGS, "could not create %s", donemailname); free(donemailname); exit(EXIT_FAILURE); } #if 0 log_error(LOG_ARGS, "donemailname = [%s]\n", donemailname); #endif if((rawmailfd = open(mailfile, O_RDONLY)) < 0) { unlink(donemailname); free(donemailname); log_error(LOG_ARGS, "could not open() input mail file"); exit(EXIT_FAILURE); } /* hdrfd is checked in do_all_the_voodoo_here(), because the * customheaders file might not exist */ hdrfd = openat(ml.ctrlfd, "customheaders", O_RDONLY); /* footfd is checked in do_all_the_voodoo_here(), see above */ footfd = openat(ml.ctrlfd, "footer", O_RDONLY); delheaders = ctrlvalues(ml.ctrlfd, "delheaders"); if(delheaders == NULL) delheaders = xcalloc(1, sizeof(*delheaders)); tll_push_back(*delheaders, xstrdup("From ")); tll_push_back(*delheaders, xstrdup("Return-Path:")); subjectprefix = ctrlvalue(ml.ctrlfd, "prefix"); replyto = statctrl(ml.ctrlfd, "replyto"); if(do_all_the_voodoo_here(rawmailfd, donemailfd, hdrfd, footfd, delheaders, readhdrs, &allheaders, subjectprefix, replyto) < 0) { log_error(LOG_ARGS, "Error in do_all_the_voodoo_here"); exit(EXIT_FAILURE); } tll_free_and_free(*delheaders, free); close(rawmailfd); close(donemailfd); if(hdrfd >= 0) close(hdrfd); if(footfd >= 0) close(footfd); /* To: addresses */ for(i = 0; i < readhdrs[1].valuecount; i++) { find_email_adr(readhdrs[1].values[i], &toemails); } /* Cc: addresses */ for(i = 0; i < readhdrs[2].valuecount; i++) { find_email_adr(readhdrs[2].values[i], &ccemails); } /* Delivered-To: addresses */ for(i = 0; i < readhdrs[4].valuecount; i++) { find_email_adr(readhdrs[4].values[i], &dtemails); } recipextra = get_recipextra_from_env(ml.ctrlfd); if (recipextra == NULL) { findaddress = true; } addr_in_to_or_cc = !statctrl(ml.ctrlfd, "tocc"); if(addr_in_to_or_cc || findaddress) { listaddrs = ctrlvalues(ml.ctrlfd, "listaddress"); if (listaddrs == NULL) { log_error(LOG_ARGS, "list address is not defined"); err(EXIT_FAILURE, "list address is not defined"); } findaddress = !find_email(&dtemails, listaddrs, ml.delim, recipextra != NULL ? NULL : &recipextra); } if(addr_in_to_or_cc || findaddress) { intocc = find_email(&toemails, listaddrs, ml.delim, recipextra != NULL ? NULL : &recipextra); if (!intocc) intocc = find_email(&ccemails, listaddrs, ml.delim, recipextra != NULL ? NULL : &recipextra); } if (listaddrs) tll_free_and_free(*listaddrs, free); free(listaddrs); if (recipextra && *recipextra == '\0') { free(recipextra); recipextra = NULL; } /* From: addresses */ for(i = 0; i < readhdrs[0].valuecount; i++) { find_email_adr(readhdrs[0].values[i], &fromemails); } /* X-Original-From: addresses */ for(i = 0; i < readhdrs[6].valuecount; i++) { find_email_adr(readhdrs[6].values[i], &originalfromemails); } /* discard malformed mail with invalid From: unless it's a bounce */ if(tll_length(fromemails) != 1 && (recipextra == NULL || strncmp(recipextra, "bounces", 7) != 0)) { tll_foreach(fromemails, it) printf("fromemails.emaillist[] = %s\n", it->item); xasprintf(&discardname, "%s/queue/discarded/%s", ml.dir, randomstr); log_error(LOG_ARGS, "Discarding %s due to invalid From:", mailfile); tll_foreach(fromemails, it) log_error(LOG_ARGS, "fromemails.emaillist[] = %s\n", it->item); rename(mailfile, discardname); unlink(donemailname); free(donemailname); free(discardname); free(randomstr); /* TODO: free emailstructs */ exit(EXIT_SUCCESS); } /* The only time posteraddr will remain unset is when the mail is a * bounce, so the mail will be processed by listcontrol() and the * program will terminate before posteraddr is used. */ if (tll_length(fromemails) > 0) posteraddr = tll_front(fromemails); /* Return-Path: addresses */ for(i = 0; i < readhdrs[3].valuecount; i++) { find_email_adr(readhdrs[3].values[i], &rpemails); } /* envelope from */ if((envstr = getenv("SENDER")) != NULL) { /* qmail, postfix, exim */ efrom = envstr; } else if(tll_length(rpemails) >= 1) { /* the (first) Return-Path: header */ efrom = tll_front(rpemails); } /* Subject: */ if (readhdrs[5].valuecount) subject = unistr_header_to_utf8(readhdrs[5].values[0]); if (!subject) subject = xstrdup(""); if(recipextra) { int ownfd = openat(ml.ctrlfd, "owner", O_RDONLY); xasprintf(&owner, "%d", ownfd); if(strcmp(recipextra, "owner") == 0) { /* Why is this here, and not in listcontrol() ? * -- mortenp 20060409 */ /* strip envelope from before resending */ tll_push_back(*delheaders, xstrdup("From ")); tll_push_back(*delheaders, xstrdup("Return-Path:")); if((rawmailfd = open(mailfile, O_RDONLY)) < 0) { log_error(LOG_ARGS, "could not open() " "input mail file"); exit(EXIT_FAILURE); } if((donemailfd = open(donemailname, O_WRONLY|O_TRUNC)) < 0) { log_error(LOG_ARGS, "could not open() " "output mail file"); exit(EXIT_FAILURE); } if(do_all_the_voodoo_here(rawmailfd, donemailfd, -1, -1, delheaders, NULL, &allheaders, NULL, 0) < 0) { log_error(LOG_ARGS, "do_all_the_voodoo_here"); exit(EXIT_FAILURE); } tll_free_and_free(*delheaders, free); close(rawmailfd); close(donemailfd); unlink(mailfile); log_oper(ml.fd, OPLOGFNAME, "mlmmj-process: sending" " mail from %s to owner", efrom); exec_or_die(mlmmjsend, "-l", "4", "-L", ml.dir, "-F", efrom, "-s", owner, "-a", "-m", donemailname, NULL); } unlink(mailfile); if (tll_length(originalfromemails) > 0) testfrom = &originalfromemails; else testfrom = &fromemails; listcontrol(testfrom, &ml, recipextra, mlmmjsend, donemailname); return EXIT_SUCCESS; } /* checking incoming mail's size */ errno = 0; maxmailsize = ctrlsizet(ml.ctrlfd, "maxmailsize", 0); if(errno != ENOENT) { if(stat(donemailname, &st) < 0) { log_error(LOG_ARGS, "stat(%s,..) failed", donemailname); exit(EXIT_FAILURE); } if(st.st_size > maxmailsize) { char *maxmailsizestr; if (statctrl(ml.ctrlfd, "nomaxmailsizedenymails")) { errno = 0; log_error(LOG_ARGS, "Discarding %s due to" " size limit (%d bytes too big)", donemailname, (st.st_size - maxmailsize)); unlink(donemailname); unlink(mailfile); free(donemailname); exit(EXIT_SUCCESS); } txt = open_text(ml.fd, "deny", "post", "maxmailsize", NULL, "maxmailsize"); MY_ASSERT(txt); register_default_unformatted(txt, &ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", posteraddr); xasprintf(&maxmailsizestr, "%d", maxmailsize); register_unformatted(txt, "maxmailsize", maxmailsizestr); register_originalmail(txt, donemailname); queuefilename = prepstdreply(txt, &ml, "$listowner$", posteraddr, NULL); MY_ASSERT(queuefilename); close_text(txt); unlink(donemailname); unlink(mailfile); free(donemailname); free(maxmailsizestr); send_help(&ml, queuefilename, posteraddr); } } free(delheaders); if(*efrom == '\0') { /* don't send mails with <> in From to the list */ xasprintf(&discardname, "%s/queue/discarded/%s", ml.dir, randomstr); errno = 0; log_error(LOG_ARGS, "Discarding %s due to missing envelope" " from address", mailfile); rename(mailfile, discardname); unlink(donemailname); free(donemailname); free(discardname); free(randomstr); /* TODO: free emailstructs */ exit(EXIT_FAILURE); } unlink(mailfile); if(addr_in_to_or_cc && !intocc) { /* Don't send a mail about denial to the list, but silently * discard and exit. Also don't in case of it being turned off */ if ((strcasecmp(ml.addr, posteraddr) == 0) || statctrl(ml.ctrlfd, "notoccdenymails")) { log_error(LOG_ARGS, "Discarding %s because list" " address was not in To: or Cc:," " and From: was the list or" " notoccdenymails was set", mailfile); unlink(donemailname); free(donemailname); exit(EXIT_SUCCESS); } txt = open_text(ml.fd, "deny", "post", "tocc", NULL, "notintocc"); MY_ASSERT(txt); register_default_unformatted(txt, &ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", posteraddr); register_originalmail(txt, donemailname); queuefilename = prepstdreply(txt, &ml, "$listowner$", posteraddr, NULL); MY_ASSERT(queuefilename) close_text(txt); unlink(donemailname); free(donemailname); send_help(&ml, queuefilename, posteraddr); } access_rules = ctrlvalues(ml.ctrlfd, "access"); if (access_rules != NULL) { actions_t accret; char *error = NULL; char *qualifier = NULL; /* Don't send a mail about denial to the list, but silently * discard and exit. Also do this in case it's turned off */ accret = do_access(access_rules, &allheaders, posteraddr, &error, &qualifier); if (error != NULL) { log_oper(ml.fd, OPLOGFNAME, "%s", error); free(error); } if (accret == ACT_DENY) { if ((strcasecmp(ml.addr, posteraddr) == 0) || statctrl(ml.ctrlfd, "noaccessdenymails")) { log_error(LOG_ARGS, "Discarding %s because" " it was denied by an access" " rule, and From: was the list" " address or noaccessdenymails" " was set", mailfile); unlink(donemailname); free(donemailname); exit(EXIT_SUCCESS); } txt = open_text(ml.fd, "deny", "post", "access", qualifier, "access"); MY_ASSERT(txt); register_default_unformatted(txt, &ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", posteraddr); register_originalmail(txt, donemailname); queuefilename = prepstdreply(txt, &ml, "$listowner$", posteraddr, NULL); MY_ASSERT(queuefilename) close_text(txt); unlink(donemailname); free(donemailname); free(randomstr); send_help(&ml, queuefilename, posteraddr); } else if (accret == ACT_MODERATE) { moderated = 1; modreason = ACCESS; } else if (accret == ACT_DISCARD) { xasprintf(&discardname, "%s/queue/discarded/%s", ml.dir, randomstr); free(randomstr); if(rename(donemailname, discardname) < 0) { log_error(LOG_ARGS, "could not rename(%s,%s)", donemailname, discardname); free(donemailname); free(discardname); exit(EXIT_FAILURE); } free(donemailname); free(discardname); exit(EXIT_SUCCESS); } else if (accret == ACT_SEND) { send = 1; } else if (accret == ACT_ALLOW) { /* continue processing as normal */ } free(qualifier); } list_rules = ctrlvalues(ml.ctrlfd, "send"); if (list_rules != NULL) { tll_foreach(*list_rules, lr) { if (strcasecmp(posteraddr, lr->item) == 0) { send = 1; break; } } } subonlypost = statctrl(ml.ctrlfd, "subonlypost"); modonlypost = statctrl(ml.ctrlfd, "modonlypost"); modnonsubposts = statctrl(ml.ctrlfd, "modnonsubposts"); /* modnonsubposts implies subonlypost if modonlypost is not set */ if (modnonsubposts && !modonlypost) subonlypost = 1; if(!send && (subonlypost || modonlypost || modnonsubposts)) { /* Don't send a mail about denial to the list, but silently * discard and exit. */ char *testaddr = posteraddr; if (tll_length(originalfromemails) > 0) testaddr = tll_front(originalfromemails); if (strcasecmp(ml.addr, testaddr) == 0) { log_error(LOG_ARGS, "Discarding %s because" " there are sender restrictions but" " From: was the list address", mailfile); unlink(donemailname); free(donemailname); exit(EXIT_SUCCESS); } if(subonlypost) { foundaddr = (is_subbed(ml.fd, testaddr, 0) != SUB_NONE); } else if (modonlypost) { foundaddr = is_moderator(ml.fd, testaddr, NULL); } if(!foundaddr) { if(modnonsubposts) { moderated = 1; if (subonlypost) modreason = MODNONSUBPOSTS; else if (modonlypost) modreason = MODNONMODPOSTS; } else { if((subonlypost && statctrl(ml.ctrlfd, "nosubonlydenymails")) || (modonlypost && statctrl(ml.ctrlfd, "nomodonlydenymails"))) { log_error(LOG_ARGS, "Discarding %s because" " no{sub|mod}onlydenymails was set", mailfile); unlink(donemailname); free(donemailname); exit(EXIT_SUCCESS); } if (subonlypost) { txt = open_text(ml.fd, "deny", "post", "subonlypost", NULL, "subonlypost"); } else if (modonlypost) { txt = open_text(ml.fd, "deny", "post", "modonlypost", NULL, NULL); } MY_ASSERT(txt); register_default_unformatted(txt, &ml); register_unformatted(txt, "subject", subject); register_unformatted(txt, "posteraddr", testaddr); register_originalmail(txt, donemailname); queuefilename = prepstdreply(txt, &ml, "$listowner$", testaddr, NULL); MY_ASSERT(queuefilename) close_text(txt); unlink(donemailname); free(donemailname); send_help(&ml, queuefilename, testaddr); } } } if(!send && !moderated) { if(statctrl(ml.ctrlfd, "moderated")) { moderated = 1; modreason = MODERATED; } } notmetoo = statctrl(ml.ctrlfd, "notmetoo"); if(moderated) { xasprintf(&mqueuename, "%s/moderation/%s", ml.dir, randomstr); free(randomstr); if(rename(donemailname, mqueuename) < 0) { log_error(LOG_ARGS, "could not rename(%s,%s)", donemailname, mqueuename); free(donemailname); free(mqueuename); exit(EXIT_FAILURE); } free(donemailname); if (notmetoo) { xasprintf(&omitfilename, "%s.omit", mqueuename); omitfd = open(omitfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); if (omitfd < 0) { log_error(LOG_ARGS, "could not open %s", omitfilename); free(mqueuename); free(omitfilename); exit(EXIT_FAILURE); } free(omitfilename); if(dprintf(omitfd, "%s", posteraddr) < 0) { log_error(LOG_ARGS, "could not write omit file"); free(mqueuename); exit(EXIT_FAILURE); } fsync(omitfd); close(omitfd); } newmoderated(&ml, mqueuename, mlmmjsend, efrom, subject, posteraddr, modreason); return EXIT_SUCCESS; } free(randomstr); if(noprocess) { free(donemailname); /* XXX: toemails and ccemails etc. have to be free() */ exit(EXIT_SUCCESS); } if (notmetoo) exec_or_die(mlmmjsend, "-L", ml.dir, "-o", posteraddr, "-m", donemailname, NULL); exec_or_die(mlmmjsend, "-L", ml.dir, "-m", donemailname, NULL); } mlmmj/src/mlmmj-receive.c000066400000000000000000000100351502303113500156510ustar00rootroot00000000000000/* * Copyright (C) 2002, 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "wrappers.h" #include "strgen.h" #include "log_error.h" #include "utils.h" #include "xmalloc.h" extern char *optarg; static void print_help(const char *prg) { printf("Usage: %s -L /path/to/listdir\n" " [-s sender@example.org] [-e extension] [-h] [-V] [-P] [-F]\n" " -h: This help\n" " -F: Don't fork in the background\n" " -L: Full path to list directory\n" " -s: Specify sender address\n" " -e: The foo part of user+foo@example.org\n" " -P: Don't execute mlmmj-process\n" " -V: Print version\n", prg); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { char *infilename = NULL, *listdir = NULL; char *randomstr = NULL; char *mlmmjprocess, *bindir; int fd, opt, noprocess = 0, nofork = 0; int incfd, listfd; CHECKFULLPATH(argv[0]); log_set_name(argv[0]); bindir = mydirname(argv[0]); xasprintf(&mlmmjprocess, "%s/mlmmj-process", bindir); free(bindir); while ((opt = getopt(argc, argv, "hPVL:s:e:F")) != -1) { switch(opt) { case 'h': print_help(argv[0]); break; case 'L': listdir = optarg; break; case 's': setenv("SENDER", optarg, 1); break; case 'e': setenv("EXTENSION", optarg, 1); break; case 'P': noprocess = 1; break; case 'F': nofork = 1; break; case 'V': print_version(argv[0]); exit(0); } } if(listdir == NULL) { errx(EXIT_FAILURE, "You have to specify -L\n" "%s -h for help", argv[0]); } listfd = open_listdir(listdir, true); incfd = openat(listfd, "incoming", O_DIRECTORY|O_CLOEXEC); if (incfd == -1) err(EXIT_FAILURE, "Cannot open(%s/incoming)", listdir); do { free(randomstr); randomstr = random_str(); fd = openat(incfd, randomstr, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while(fd < 0 && errno == EEXIST); xasprintf(&infilename, "%s/incoming/%s", listdir, randomstr); free(randomstr); if(fd < 0) { log_error(LOG_ARGS, "could not create mail file in " "%s/incoming directory", listdir); free(infilename); exit(EXIT_FAILURE); } if(dumpfd2fd(STDIN_FILENO, fd) != 0) { log_error(LOG_ARGS, "Could not receive mail"); exit(EXIT_FAILURE); } #if 0 log_oper(listdir, OPLOGFNAME, "mlmmj-receive got %s", infilename); #endif fsync(fd); close(fd); if(noprocess) { free(infilename); exit(EXIT_SUCCESS); } /* * Now we fork so we can exit with success since it could potentially * take a long time for mlmmj-send to finish delivering the mails and * returning, making it susceptible to getting a SIGKILL from the * mailserver invoking mlmmj-receive. */ if (!nofork) daemon(1, 0); exec_or_die(mlmmjprocess, "-L", listdir, "-m", infilename, NULL); } mlmmj/src/mlmmj-send.c000066400000000000000000000411661502303113500151710ustar00rootroot00000000000000/* * Copyright (C) 2004, 2003, 2004 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "mlmmj-send.h" #include "mail-functions.h" #include "incindexfile.h" #include "chomp.h" #include "checkwait_smtpreply.h" #include "init_sockfd.h" #include "strgen.h" #include "log_error.h" #include "wrappers.h" #include "statctrl.h" #include "ctrlvalue.h" #include "stdbool.h" #include "getaddrsfromfile.h" #include "utils.h" #include "send_mail.h" static size_t maxverprecips = MAXVERPRECIPS; static int gotsigterm = 0; void catch_sig_term(int sig __unused) { gotsigterm = 1; } int send_mail_verp(int sockfd, strlist *addrs, struct mail *mail, const char *verpextra) { int retval; char *reply, *reply2; if(sockfd == -1) return EBADF; retval = write_mail_from(sockfd, mail->from, verpextra); if(retval) { log_error(LOG_ARGS, "Could not write MAIL FROM\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_FROM); if(reply) { log_error(LOG_ARGS, "Error in MAIL FROM. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_FROM; } tll_foreach(*addrs, it) { if(gotsigterm) { log_error(LOG_ARGS, "TERM signal received, " "shutting down."); return -1; } if(strchr(it->item, '@') == NULL) { errno = 0; log_error(LOG_ARGS, "No @ in address, ignoring %s", it->item); continue; } retval = write_rcpt_to(sockfd, it->item); if(retval) { log_error(LOG_ARGS, "Could not write RCPT TO:\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_RCPTTO); if(reply) { log_error(LOG_ARGS, "Error in RCPT TO. Reply = [%s]", reply); free(reply); return MLMMJ_RCPTTO; } } retval = write_data(sockfd); if(retval) { log_error(LOG_ARGS, "Could not write DATA\b"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_DATA); if(reply) { log_error(LOG_ARGS, "Error with DATA. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_DATA; } rewind(mail->fp); write_mailbody(sockfd, mail->fp, NULL); retval = write_dot(sockfd); if(retval) { log_error(LOG_ARGS, "Could not write .\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_DOT); if(reply) { log_error(LOG_ARGS, "Mailserver did not ack end of mail.\n" ". was written, to no" "avail. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_DOT; } return 0; } int send_mail_many_fd(int sockfd, struct mail *mail, struct ml *ml, int subfd, const char *archivefilename) { int res, ret; strlist stl = tll_init(); FILE *f = fdopen(subfd, "r"); do { res = getaddrsfromfile(&stl, f, maxverprecips); if(tll_length(stl) == maxverprecips) { ret = send_mail_many_list(sockfd, mail, ml, &stl, archivefilename); tll_free_and_free(stl, free); if(ret < 0) return ret; } } while(res > 0); fclose(f); if(tll_length(stl)) { ret = send_mail_many_list(sockfd, mail, ml, &stl, archivefilename); tll_free_and_free(stl, free); return ret; } return 0; } int send_mail_many_list(int sockfd, struct mail *mail, struct ml *ml, strlist *addrs, const char *archivefilename) { int res = 0, status, index; char *bounceaddr, *addr; while (tll_length(*addrs) > 0) { addr = tll_pop_front(*addrs); bounceaddr = NULL; if(strchr(addr, '@') == NULL) { errno = 0; log_error(LOG_ARGS, "No @ in address, ignoring %s", addr); free(addr); continue; } if(gotsigterm && archivefilename) { /* we got SIGTERM, so save the addresses and bail */ log_error(LOG_ARGS, "TERM signal received, " "shutting down."); index = get_index_from_filename(archivefilename); status = requeuemail(ml->fd, index, addrs, addr); free(addr); return status; } if (mail->from == NULL) { int i = get_index_from_filename(archivefilename); bounceaddr = get_bounce_from_adr(addr, ml, i); mail->from = bounceaddr; } mail->to = addr; res = send_mail(sockfd, mail, ml->fd, ml->ctrlfd, bounceaddr != NULL); if (bounceaddr != NULL) { free(bounceaddr); mail->from = NULL; } if(res && archivefilename) { /* we failed, so save the addresses and bail */ index = get_index_from_filename(archivefilename); status = requeuemail(ml->fd, index, addrs, addr); free(addr); return status; } free(addr); } return 0; } static void print_help(const char *prg) { printf("Usage: %s [-L /path/to/list -m /path/to/mail | -l listctrl]\n" " [-a] [-D] [-F sender@example.org] [-h] [-o address@example.org]\n" " [-r 127.0.0.1] [-R reply@example.org] [-s /path/to/subscribers]\n" " [-T recipient@example.org] [-V]\n" " -a: Don't archive the mail\n" " -D: Don't delete the mail after it's sent\n" " -F: What to use as MAIL FROM:\n" " -h: This help\n" " -l: List control variable:\n", prg); printf(" '1' means 'send a single mail'\n" " '2' means 'mail to moderators'\n" " '3' means 'resend failed list mail'\n" " '4' means 'send to file with recipients'\n" " '5' means 'bounceprobe'\n" " '6' means 'single listmail to single recipient'\n" " '7' means 'digest'\n"); printf(" -L: Full path to list directory\n" " -m: Full path to mail file\n" " -o: Address to omit from distribution (normal mail only)\n" " -r: Relayhost IP address (defaults to 127.0.0.1)\n" " -R: What to use as Reply-To: header\n" " -s: Subscribers file name\n" " -T: What to use as RCPT TO:\n" " -V: Print version\n"); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { int sockfd = -1, opt, mindex = 0, subfd = 0; int deletewhensent = 1, sendres = 0, digest = 0; bool archive = true, ctrlarchive = true; int res; char *mailfilename = NULL, *subfilename = NULL, *omit = NULL; char *bounceaddr = NULL; char *relayhost = NULL, *archivefilename = NULL; const char *subddirname = NULL; char listctrl = 0; char *verp = NULL; char *verpfrom; char *reply, *requeuefilename; DIR *subddir; struct dirent *dp; struct stat st; strlist stl = tll_init(); struct sigaction sigact; struct mail mail = { 0 }; struct ml ml; int subdirfd, mailfd; const char *errp; log_set_name(argv[0]); ml_init(&ml); /* install signal handler for SIGTERM */ sigact.sa_handler = catch_sig_term; sigemptyset(&sigact.sa_mask); sigact.sa_flags = 0; if(sigaction(SIGTERM, &sigact, NULL) < 0) log_error(LOG_ARGS, "Could not install SIGTERM handler!"); while ((opt = getopt(argc, argv, "aVDhm:l:L:R:F:T:r:s:o:")) != -1){ switch(opt) { case 'a': archive = false; break; case 'D': deletewhensent = 0; break; case 'F': bounceaddr = optarg; break; case 'h': print_help(argv[0]); break; case 'l': if (*optarg <= '0' || *optarg > '7') errx(EXIT_FAILURE, "-l only accept the " "following arguments: 1, 2, 3, 4, 5, 6 or" " 7"); listctrl = *optarg; archive = false; break; case 'L': ml.dir = optarg; break; case 'm': mailfilename = optarg; break; case 'o': omit = optarg; break; case 'r': relayhost = optarg; break; case 'R': mail.replyto = optarg; break; case 's': subfilename = optarg; break; case 'T': mail.to = optarg; break; case 'V': print_version(argv[0]); exit(EXIT_SUCCESS); } } if(mailfilename == NULL || (ml.dir == NULL && listctrl == '0')) { errx(EXIT_FAILURE, "You have to specify -m and -L or -l\n" "%s -h for help", argv[0]); } if (ml.dir != NULL) { if (!ml_open(&ml, false)) exit(EXIT_FAILURE); } if (listctrl == '1' || listctrl == '5' || listctrl == '6') errx(EXIT_FAILURE, "-l %c is not supported anymore", listctrl); if((listctrl == '2' && (ml.dir == NULL || bounceaddr == NULL))) { errx(EXIT_FAILURE, "With -l 2 you need -L and -F"); } if((listctrl == '7' && ml.dir == NULL)) { errx(EXIT_FAILURE, "With -l 7 you need -L"); } if (ml.dir) { verp = ctrlvalue(ml.ctrlfd, "verp"); if(verp == NULL) if(statctrl(ml.ctrlfd, "verp") == 1) verp = xstrdup(""); if(verp && statctrl(ml.ctrlfd, "maxverprecips")) maxverprecips = ctrlsizet(ml.ctrlfd, "maxverprecips", MAXVERPRECIPS); } /* initialize file with mail to send */ mailfd = strtoim(mailfilename, 0, INT_MAX, &errp); if (errp == NULL) { /* cannot delete a mail sent from file descriptor */ deletewhensent = false; } if (errp != NULL && ((mailfd = open(mailfilename, O_RDWR)) == -1 || !lock(mailfd, true))) { if (ml.dir != NULL && mailfd == -1) { if ((mailfd = openat(ml.fd, mailfilename, O_RDWR)) == -1 || !lock(mailfd, true)) { log_error(LOG_ARGS, "Could not open '%s'", mailfilename); exit(EXIT_FAILURE); } } else { log_error(LOG_ARGS, "Could not open '%s'", mailfilename); exit(EXIT_FAILURE); } } mail.fp = fdopen(mailfd, "r"); if (ml.dir) ctrlarchive = statctrl(ml.ctrlfd, "noarchive"); switch(listctrl) { case '2': /* Moderators */ if((subfd = openat(ml.ctrlfd, "moderators", O_RDONLY)) < 0) { log_error(LOG_ARGS, "Could not open '%s':", subfilename); /* No moderators is no error. Could be the sysadmin * likes to do it manually. */ exit(EXIT_SUCCESS); } break; case '3': mail.addtohdr = statctrl(ml.ctrlfd, "addtohdr"); /* FALLTHROUGH */ case '4': /* sending mails to subfile */ subfd = strtoim(subfilename, 0, INT_MAX, &errp); if (errp != NULL && (subfd = open(subfilename, O_RDONLY)) < 0) { log_error(LOG_ARGS, "Could not open '%s':", subfilename); exit(EXIT_FAILURE); } break; default: /* normal list mail -- now handled when forking */ mail.addtohdr = statctrl(ml.ctrlfd, "addtohdr"); break; } /* initialize the archive filename */ if(archive) { mindex = incindexfile(ml.fd); xasprintf(&archivefilename, "%s/archive/%d", ml.dir, mindex); } switch(listctrl) { case '2': /* Moderators */ sockfd = newsmtp(&ml, relayhost); mail.from = bounceaddr; mail.replyto = NULL; if(send_mail_many_fd(sockfd, &mail, &ml, subfd, NULL)) { close(sockfd); sockfd = -1; } else { endsmtp(&sockfd); } break; case '3': /* resending earlier failed mails */ sockfd = newsmtp(&ml, relayhost); mail.from = NULL; mail.replyto = NULL; if(send_mail_many_fd(sockfd, &mail, &ml, subfd, mailfilename)) { close(sockfd); sockfd = -1; } else { endsmtp(&sockfd); } unlink(subfilename); break; case '4': /* send mails to owner */ sockfd = newsmtp(&ml, relayhost); mail.from = bounceaddr; mail.replyto = NULL; if(send_mail_many_fd(sockfd, &mail, &ml, subfd, mailfilename)) { close(sockfd); sockfd = -1; } else { endsmtp(&sockfd); } break; case '7': digest = 1; mail.addtohdr = true; archivefilename = "digest"; /* fall through */ default: /* normal list mail */ if (!digest) { subddirname = "subscribers.d"; } else { subddirname = "digesters.d"; } subdirfd = openat(ml.fd, subddirname, O_DIRECTORY|O_CLOEXEC|O_RDONLY); if (subdirfd == -1 || (subddir = fdopendir(subdirfd)) == NULL) { log_error(LOG_ARGS, "Could not opendir(%s/%s)", ml.dir, subddirname); exit(EXIT_FAILURE); } xasprintf(&verpfrom, "%s%sbounces-%d@%s", ml.name, ml.delim, mindex, ml.fqdn); if(digest) verp = NULL; if(verp && (strcmp(verp, "postfix") == 0)) { free(verp); verp = xstrdup("XVERP=-="); } if(mail.addtohdr && verp) { log_error(LOG_ARGS, "Cannot use VERP and add " "To: header. Not sending with " "VERP."); verp = NULL; } if(verp) { sockfd = newsmtp(&ml, relayhost); if(sockfd > -1) { if(write_mail_from(sockfd, verpfrom, verp)) { log_error(LOG_ARGS, "Could not write VERP MAIL FROM. " "Not sending with VERP."); verp = NULL; } else { reply = checkwait_smtpreply(sockfd, MLMMJ_FROM); if(reply) { log_error(LOG_ARGS, "Mailserver did not " "accept VERP MAIL FROM. " "Not sending with VERP."); free(reply); verp = NULL; } } /* We can't be in SMTP DATA state or anything like * that, so should be able to safely QUIT. */ endsmtp(&sockfd); } else { log_error(LOG_ARGS, "Could not connect to " "write VERP MAIL FROM. " "Not sending with VERP."); verp = NULL; } } while((dp = readdir(subddir)) != NULL) { int fd; FILE *f; if(!strcmp(dp->d_name, ".")) continue; if(!strcmp(dp->d_name, "..")) continue; fd = openat(subdirfd, dp->d_name, O_RDONLY); if (fd == -1 || (f = fdopen(fd, "r")) == NULL) { log_error(LOG_ARGS, "Could not open '%s/%s/%s'", ml.dir, subddirname, dp->d_name); continue; } do { res = getaddrsfromfile(&stl, f, maxverprecips); if(omit != NULL) { tll_foreach(stl, it) if (strcmp(it->item, omit) == 0) tll_remove_and_free(stl, it, free); } if(tll_length(stl) == maxverprecips) { sockfd = newsmtp(&ml, relayhost); if(verp) { mail.from = verpfrom; mail.replyto = NULL; sendres = send_mail_verp( sockfd, &stl, &mail, verp); if(sendres) requeuemail(ml.fd, mindex, &stl, NULL); } else { mail.from = NULL; mail.replyto = NULL; sendres = send_mail_many_list( sockfd, &mail, &ml, &stl, archivefilename); } if (sendres) { close(sockfd); sockfd = -1; } else { endsmtp(&sockfd); } tll_free_and_free(stl, free); } } while(res > 0); fclose(f); } if(tll_length(stl)) { sockfd = newsmtp(&ml, relayhost); if(verp) { mail.from = verpfrom; mail.replyto = NULL; sendres = send_mail_verp(sockfd, &stl, &mail, verp); if(sendres) requeuemail(ml.fd, mindex, &stl, NULL); } else { mail.from = NULL; mail.replyto = NULL; sendres = send_mail_many_list(sockfd, &mail, &ml, &stl, archivefilename); } if (sendres) { close(sockfd); sockfd = -1; } else { endsmtp(&sockfd); } tll_free_and_free(stl, free); } free(verpfrom); closedir(subddir); break; } free(verp); if(archive) { if(!ctrlarchive) { if(rename(mailfilename, archivefilename) < 0) { log_error(LOG_ARGS, "Could not rename(%s,%s);", mailfilename, archivefilename); } } else { xasprintf(&requeuefilename, "%s/requeue/%d", ml.dir, mindex); if(stat(requeuefilename, &st) < 0) { /* Nothing was requeued and we don't keep * mail for a noarchive list. */ unlink(mailfilename); } else { free(requeuefilename); xasprintf(&requeuefilename, "%s/requeue/%d/mailfile", ml.dir, mindex); if (rename(mailfilename, requeuefilename) < 0) { log_error(LOG_ARGS, "Could not rename(%s,%s);", mailfilename, requeuefilename); } } free(requeuefilename); } free(archivefilename); } else if(deletewhensent) unlink(mailfilename); return EXIT_SUCCESS; } mlmmj/src/mlmmj-sub.c000066400000000000000000000124471502303113500150310ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "mlmmj-sub.h" #include "wrappers.h" #include "strgen.h" #include "subscriberfuncs.h" #include "log_error.h" #include "statctrl.h" #include "prepstdreply.h" #include "ctrlvalues.h" #include "chomp.h" #include "utils.h" #include "send_help.h" #include "xstring.h" extern char *subtypes[]; static void print_help(const char *prg) { printf("Usage: %s -L /path/to/list {-a john@doe.org | -m str}\n" " [-c] [-C] [-f] [-h] [-L] [-d | -n] [-q] [-r | -R] [-s] [-U] [-V]\n" " -a: Email address to subscribe \n" " -c: Send welcome mail (unless requesting confirmation)\n" " -C: Request mail confirmation (unless switching versions)\n" " -d: Subscribe to digest of list\n" " -f: Force subscription (do not moderate)\n" " -h: This help\n" " -L: Full path to list directory\n" " -m: moderation string\n" " -n: Subscribe to no mail version of list\n", prg); printf(" -q: Be quiet (don't notify owner about the subscription)\n" " -r: Behave as if request arrived via email (internal use)\n" " -R: Behave as if confirmation arrived via email (internal use)\n" " -s: Don't send a mail to subscriber if already subscribed\n" " -U: Don't switch to the user id of the listdir owner\n" " -V: Print version\n" "To ensure a silent subscription, use -f -q -s\n"); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { char *mlmmjsend, *bindir; char *address = NULL; struct subscription sub = { 0 }; int opt; bool changeuid = true, digest = false, nomail = false, both = false; struct stat st; uid_t uid; struct ml ml; ml_init(&ml); CHECKFULLPATH(argv[0]); log_set_name(argv[0]); bindir = mydirname(argv[0]); xasprintf(&mlmmjsend, "%s/mlmmj-send", bindir); free(bindir); sub.reasonsub = SUB_ADMIN; sub.typesub = SUB_NORMAL; sub.gensubscribed = true; sub.mlmmjsend = mlmmjsend; while ((opt = getopt(argc, argv, "hbcCdfm:nsVUL:a:qrR")) != -1) { switch(opt) { case 'a': if (strchr(optarg, '@') == NULL) errx(EXIT_FAILURE, "No '@' in the provided email address '%s'", optarg); address = optarg; break; case 'b': both = true; break; case 'c': sub.send_welcome_email = true; break; case 'C': sub.subconfirm = true; break; case 'd': digest = true; break; case 'f': sub.force = true; break; case 'h': print_help(argv[0]); break; case 'L': ml.dir = optarg; break; case 'm': sub.modstr = optarg; break; case 'n': nomail = true; break; case 'q': sub.quiet = true; break; case 'r': sub.reasonsub = SUB_REQUEST; break; case 'R': sub.reasonsub = SUB_CONFIRM; break; case 's': sub.gensubscribed = false; break; case 'U': changeuid = false; break; case 'V': print_version(argv[0]); exit(0); } } if(ml.dir == NULL) { errx(EXIT_FAILURE, "You have to specify -L\n" "%s -h for help", argv[0]); } if (!ml_open(&ml, false)) exit(EXIT_FAILURE); if(address == NULL && sub.modstr == NULL) { errx(EXIT_FAILURE, "You have to specify -a or -m\n" "%s -h for help", argv[0]); } if(both + digest + nomail > 1) { errx(EXIT_FAILURE, "Specify at most one of -b, -d and -n\n" "%s -h for help", argv[0]); } if(digest) sub.typesub = SUB_DIGEST; if(nomail) sub.typesub = SUB_NOMAIL; if(both) sub.typesub = SUB_BOTH; if(sub.reasonsub == SUB_CONFIRM && sub.subconfirm) { errx(EXIT_FAILURE, "Cannot specify both -C and -R\n" "%s -h for help", argv[0]); } if(changeuid) { uid = getuid(); if(!uid && fstat(ml.fd, &st) == 0 && uid != st.st_uid) { printf("Changing to uid %d, owner of %s.\n", (int)st.st_uid, ml.dir); if(setuid(st.st_uid) < 0) { perror("setuid"); fprintf(stderr, "Continuing as uid %d\n", (int)uid); } } } if (do_subscribe(&ml, &sub, address)) exit(EXIT_SUCCESS); exit(EXIT_FAILURE); } mlmmj/src/mlmmj-unsub.c000066400000000000000000000117161502303113500153720ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "wrappers.h" #include "subscriberfuncs.h" #include "strgen.h" #include "log_error.h" #include "statctrl.h" #include "prepstdreply.h" #include "utils.h" static void print_help(const char *prg) { printf("Usage: %s -L /path/to/list -a john@doe.org\n" " [-c | -C] [-h] [-L] [-d | -n | -N] [-q] [-r | -R] [-s] [-V]\n" " -a: Email address to unsubscribe \n" " -c: Send goodbye mail\n" " -C: Request mail confirmation\n" " -d: Unsubscribe from digest of list\n" " -h: This help\n" " -L: Full path to list directory\n" " -n: Unsubscribe from no mail version of list\n" " -N: Unsubscribe from normal version of list\n", prg); printf(" -q: Be quiet (don't notify owner about the subscription)\n" " -r: Behave as if request arrived via email (internal use)\n" " -R: Behave as if confirmation arrived via email (internal use)\n" " -s: Don't send a mail to the address if not subscribed\n" " -U: Don't switch to the user id of the listdir owner\n" " -V: Print version\n" "To ensure a silent unsubscription, use -q -s\n"); exit(EXIT_SUCCESS); } int main(int argc, char **argv) { int opt; bool normal = false, digest = false, nomail = false; bool unsubconfirm = false; bool changeuid = true, quiet = false; bool inform_not_subscribed = true; bool send_goodbye_mail = false; char *address = NULL; enum subtype typesub = SUB_ALL; enum subreason reasonsub = SUB_ADMIN; uid_t uid; struct stat st; struct ml ml; ml_init(&ml); log_set_name(argv[0]); while ((opt = getopt(argc, argv, "hcCdenNVUL:a:sqrR")) != -1) { switch(opt) { case 'L': ml.dir = optarg; break; case 'a': if (strchr(optarg, '@') == NULL) errx(EXIT_FAILURE, "No '@' in the provided email address '%s'", optarg); address = optarg; break; case 'c': send_goodbye_mail = true; break; case 'C': unsubconfirm = true; break; case 'd': digest = true; break; case 'h': print_help(argv[0]); break; case 'n': nomail = true; break; case 'N': normal = true; break; case 'q': quiet = true; break; case 'r': reasonsub = SUB_REQUEST; break; case 'R': reasonsub = SUB_CONFIRM; break; case 's': inform_not_subscribed = false; break; case 'U': changeuid = false; break; case 'V': print_version(argv[0]); exit(0); } } if(ml.dir == NULL || address == NULL) { errx(EXIT_FAILURE, "You have to specify -L and -a\n" "%s -h for help", argv[0]); } if (!ml_open(&ml, false)) exit(EXIT_FAILURE); if(digest + nomail + normal > 1) { errx(EXIT_FAILURE, "Specify at most one of -d, -n and -N\n" "%s -h for help", argv[0]); } if(digest) typesub = SUB_DIGEST; if(nomail) typesub = SUB_NOMAIL; if(normal) typesub = SUB_NORMAL; if(send_goodbye_mail && unsubconfirm) { errx(EXIT_FAILURE, "Cannot specify both -C and -c\n" "%s -h for help", argv[0]); } if(reasonsub == SUB_CONFIRM && unsubconfirm) { errx(EXIT_FAILURE, "Cannot specify both -C and -R\n" "%s -h for help", argv[0]); } if(changeuid) { uid = getuid(); if(!uid && fstat(ml.fd, &st) == 0 && uid != st.st_uid) { printf("Changing to uid %d, owner of %s.\n", (int)st.st_uid, ml.dir); if(setuid(st.st_uid) < 0) { perror("setuid"); fprintf(stderr, "Continuing as uid %d\n", (int)uid); } } } if (do_unsubscribe(&ml, address, typesub, reasonsub, inform_not_subscribed, unsubconfirm, quiet, send_goodbye_mail)) return(EXIT_SUCCESS); return(EXIT_FAILURE); } mlmmj/src/mlmmj.c000066400000000000000000000372611502303113500142430ustar00rootroot00000000000000/* * Copyright (C) 2021-2024 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "getlistdelim.h" #include "send_mail.h" #include "mlmmj.h" #include "utils.h" #include "log_error.h" #include "xmalloc.h" #include "chomp.h" #include "gethdrline.h" #include "mygetline.h" #include "subscriberfuncs.h" #include "prepstdreply.h" #include "find_email_adr.h" #include "strgen.h" #include "ctrlvalue.h" bool send_probe(struct ml *ml, const char *addr) { text *txt; file_lines_state *fls; char *myaddr, *from, *a, *queuefilename; char *probefile; int fd, bfd; time_t t; struct mail mail = { 0 }; myaddr = lowercase(addr); gen_addr_cookie(from, ml, "bounces-probe-", myaddr) a = strrchr(myaddr, '='); if (!a) { free(myaddr); free(from); log_error(LOG_ARGS, "do_probe(): malformed address"); return (false); } *a = '@'; bfd = openat(ml->fd, "bounce", O_DIRECTORY); if (bfd == -1) { free(myaddr); free(from); log_error(LOG_ARGS, "impossible to open bounce directory"); return (false); } txt = open_text(ml->fd, "probe", NULL, NULL, NULL, "bounce-probe"); MY_ASSERT(txt); register_default_unformatted(txt, ml); fls = init_file_lines_data(openat(bfd, addr, O_RDONLY), ':', ml); register_formatted(txt, "bouncenumbers", rewind_file_lines, get_msgid_line, fls); queuefilename = prepstdreply(txt, ml, "$listowner$", myaddr, NULL); MY_ASSERT(queuefilename); close_text(txt); finish_file_lines(fls); xasprintf(&probefile, "%s-probe", addr); t = time(NULL); fd = openat(bfd, probefile, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR); if(fd < 0) log_error(LOG_ARGS, "Could not open %s", probefile); else if (dprintf(fd, "%ld", (long int)t) < 0) log_error(LOG_ARGS, "Could not write time in probe"); mail.to = myaddr; mail.from = from; mail.fp = fopen(queuefilename, "r"); if (!send_single_mail(&mail, ml, false)) { unlinkat(bfd, probefile, 0); free(probefile); return (false); } free(probefile); fclose(mail.fp); return (true); } char * find_in_list(strlist *l, const char *pattern) { size_t len; if (l == NULL) return (NULL); if (pattern == NULL) return (NULL); len = strlen(pattern); tll_foreach(*l, el) { char *str = el->item; if (str == NULL) continue; if (strncasecmp(str, pattern, len) == 0) return (str); } return (NULL); } void parse_content_type(strlist *allhdrs, char **mime_type, char **boundary) { *boundary = NULL; *mime_type = NULL; char *pos; size_t len = 0; char *hdr = find_in_list(allhdrs, "Content-Type:"); if (hdr == NULL) return; /* No Content-Type */ pos = hdr + 13; while (*pos && (*pos == ' ' || *pos == '\t')) ++pos; if (*pos == '"') { ++pos; while (pos[len] && pos[len] != '"') ++len; } else { while (pos[len] && pos[len] != ' ' && pos[len] != '\t' && pos[len] != ';') ++len; } if (len > 0) *mime_type = xstrndup(pos, len); pos += len; len = 0; while (*pos && strncasecmp(pos, "boundary=", 9)) ++pos; if (*pos == '\0') return; /* No boundaries */ pos += 9; if (*pos == '"') { ++pos; while (pos[len] && pos[len] != '"') ++len; } else { while(pos[len] && pos[len] != ' ' && pos[len] != '\t' && pos[len] != ';') ++len; } *boundary = xstrndup(pos, len); } bool parse_lastdigest(char *line, long *lastindex, time_t *lasttime, long *lastissue, const char **errstr) { size_t nfield = 0; char *walk; *errstr = NULL; if (line == NULL) { *lastindex = 0; *lasttime = 0; *lastissue = 0; return (true); } walk = line; while (strsep(&walk, ":") != NULL) nfield++; if (nfield < 2 || nfield > 3) { *errstr = "Invalid format, expecting 2 or 3 fields"; return (false); } *lastindex = strtoim(line, 0, LONG_MAX, errstr); if (*errstr != NULL) { *errstr = "Invalid value for lastindex"; return (false); } walk = line + strlen(line) + 1; *lasttime = strtotimet(walk, errstr); if (*errstr != NULL) { *errstr = "Invalid value for lasttime"; return (false); } if (nfield == 2) { *lastissue = 0; return true; } walk = walk + strlen(walk) + 1; chomp(walk); *lastissue = strtoim(walk, LONG_MIN, LONG_MAX, errstr); if (*errstr != NULL) { *errstr = "Invalid value for lastissue"; return (false); } return (true); } time_t extract_bouncetime(char *line, const char **errstr) { char *walk; *errstr = NULL; walk = strrchr(line, '#'); if (walk == NULL) { *errstr = "comment is missing"; return (0); } *walk = '\0'; walk--; while (walk > line && isspace(*walk)) { *walk = '\0'; walk--; } walk = strchr(line, ':'); if (walk == NULL) { *errstr = "':' missing"; return (0); } walk++; return (strtotimet(walk, errstr)); } static const char *subtype_dirs[] = { "subscribers.d", "digesters.d", "nomailsubs.d", NULL, NULL, NULL, NULL, }; int open_subscriber_directory(int listfd, enum subtype typesub, const char **subdir) { const char *dir = subtype_dirs[typesub]; if (subdir != NULL) *subdir = dir; if (dir == NULL) return (-1); return (openat(listfd, dir, O_DIRECTORY|O_CLOEXEC|O_RDONLY)); } bool unsubscribe(int listfd, const char *address, enum subtype typesub) { struct dirent *dp; DIR *dir; bool ret = true; struct stat st; int fd; int groupwritable = 0; const char *subdir; size_t alen, len; switch (typesub) { case SUB_ALL: if (!unsubscribe(listfd, address, SUB_NORMAL)) ret = false; if (!unsubscribe(listfd, address, SUB_DIGEST)) ret = false; if (!unsubscribe(listfd, address, SUB_NOMAIL)) ret = false; return (ret); case SUB_NORMAL: case SUB_DIGEST: case SUB_NOMAIL: break; default: return (false); } fd = open_subscriber_directory(listfd, typesub, &subdir); if (fd == -1 || (dir = fdopendir(fd)) == NULL) { log_err("Could not opendir(%s)", subdir); return (false); } if (fstat(fd, &st) == 0) { if (st.st_mode & S_IWGRP) { groupwritable = S_IRGRP|S_IWGRP; umask(S_IWOTH); } } alen = strlen(address); while ((dp = readdir(dir)) != NULL) { struct stat st; int rfd, wfd; char *wrname, *start, *cur, *next, *end, *pos, *posend; if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) continue; rfd = openat(fd, dp->d_name, O_RDONLY, 0644); if (rfd == -1) continue; if (!lock(rfd, false)) continue; if (fstat(rfd, &st) == -1) { log_err("Impossible to determine the size of %s/%s: %s", subdir, dp->d_name, strerror(errno)); close(rfd); ret = false; continue; } if (st.st_size == 0) continue; if (!S_ISREG(st.st_mode)) { log_err("Non regular files in subscribers.d"); continue; } start = mmap(0, st.st_size, PROT_READ, MAP_SHARED, rfd, 0); if (start == MAP_FAILED) { log_err("Unable to mmap %s/%s: %s", subdir, dp->d_name, strerror(errno)); close(rfd); ret = false; continue; } end = start + st.st_size; pos = NULL; for (next = cur = start; next < end; next++) { if (*next != '\n') continue; len = next - cur; if (strncasecmp(address, cur, len) == 0) { pos = cur; break; } cur = next + 1; } if (pos == NULL && next > cur) { len = next - cur; if (strncasecmp(address, cur, len) == 0) pos = cur; } /* not found */ if (pos == NULL) { munmap(start, st.st_size); close(rfd); continue; } /* * if the file only contains the email to unsubscribe, just * remove it */ posend = pos + alen; while (posend < end && *posend == '\n') posend++; if (pos == start && posend == end) { unlinkat(fd, dp->d_name, 0); continue; } xasprintf(&wrname, "%s.new", dp->d_name); wfd = openat(fd, wrname, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|groupwritable); if (wfd == -1 && !lock(wfd, true)) { log_err("Could not open '%s/%s': %s", subdir, wrname, strerror(errno)); munmap(start, st.st_size); close(rfd); free(wrname); ret = false; continue; } dprintf(wfd, "%.*s", (int)(pos - start), start); dprintf(wfd, "%.*s", (int) (end - posend), posend); if (renameat(fd, wrname, fd, dp->d_name) == -1) { log_err("Could not rename '%s', to '%s'", wrname, dp->d_name); ret = false; } close(wfd); munmap(start, st.st_size); close(rfd); free(wrname); } closedir(dir); return (ret); } bounce_t bouncemail(int listfd, const char *theaddress, const char *identifier) { char *tmp, buf[26]; char *address = lowercase(theaddress); int fd, bdfd, bfd; time_t t; struct stat st; /* check if it's sub/unsub requests bouncing, and in that case * simply remove the confirmation file. Variablenames address and * number are a bit misleading in this case due to the different * construction of the sub/unsub confirmation From header. */ if (strcmp(identifier, "confsub") == 0) { fd = openat(listfd, "subconf", O_DIRECTORY); if (fd == -1) { free(address); return (BOUNCE_OK); } unlinkat(fd, address, 0); close(fd); free(address); return (BOUNCE_OK); } if (strcmp(identifier, "confunsub") == 0) { fd = openat(listfd, "unsubconf", O_DIRECTORY); if (fd == -1) { free(address); return (BOUNCE_OK); } unlinkat(fd, address, 0); close(fd); free(address); return (BOUNCE_OK); } /* Below checks for bounce probes bouncing. If they do, simply remove * the probe file and exit successfully. Yes, I know the variables * have horrible names, but please bear with me. */ bdfd = openat(listfd, "bounce", O_DIRECTORY|O_CLOEXEC); if (bdfd == -1) { log_error(LOG_ARGS, "No bounce directory"); free(address); return (BOUNCE_FAIL); } if(strcmp(identifier, "probe") == 0) { char *a; xasprintf(&a, "%s-probe", address); unlinkat(bdfd, a, 0); close(bdfd); free(address); free(a); return (BOUNCE_OK); } tmp = strrchr(address, '='); if (tmp == NULL) { close(bdfd); free(address); return (BOUNCE_OK); } if(fstatat(bdfd, address, &st, AT_SYMLINK_NOFOLLOW) == 0) { if(S_ISLNK(st.st_mode)) { log_error(LOG_ARGS, "bounce/%s is a symbolic link", address); free(address); return (BOUNCE_FAIL); } } *tmp = '@'; if (is_subbed(listfd, address, 0) == SUB_NONE) { log_error(LOG_ARGS, "%s is bouncing but not subscribed?", address); free(address); return (BOUNCE_OK); } *tmp = '='; bfd = openat(bdfd, address, O_WRONLY|O_APPEND|O_CREAT, S_IRUSR|S_IWUSR); close(bdfd); if (bfd == -1) { log_error(LOG_ARGS, "Cound not open(bounce/%s)", address); free(address); return (BOUNCE_FAIL); } t = time(NULL); ctime_r(&t, buf); dprintf(bfd, "%s:%ld # %s", identifier, (long int)t, buf); close(bfd); free(address); return (BOUNCE_DONE); } void save_lastbouncedmsg(int listfd, const char *address, const char *mailname) { char *savename, *fname; fname = lowercase(address); xasprintf(&savename, "bounce/%s.lastmsg", fname); renameat(AT_FDCWD, mailname, listfd, savename); free(savename); free(fname); } char *dsnparseaddr(const char *mailname) { FILE *f; char *buf = NULL; size_t bufcap = 0; char *line, *hdr, *walk, *addr = NULL, *boundary = NULL; bool quoted = false; bool indsn = false; strlist emails = tll_init(); f = fopen(mailname, "r"); if(f == NULL) { log_error(LOG_ARGS, "Could not open bounceindexfile %s", mailname); return NULL; } while((line = gethdrline(f, NULL))) { if (strncasecmp(line, "content-type:", 13) != 0) { free(line); continue; } walk = line + 13; while (isspace(*walk) && *walk != '\0') walk++; if (strncasecmp(walk, "multipart/report;", 17) != 0) { free(line); break; } walk += 17; while (isspace(*walk) && *walk != '\0') walk++; if (strncasecmp(walk, "report-type=delivery-status;", 28) != 0) { free(line); break; } walk += 28; while (isspace(*walk) && *walk != '\0') walk++; if (strncasecmp(walk, "boundary=", 9) != 0) { free(line); break; } walk += 9; if (*walk == '"') { walk++; quoted = true; } xasprintf(&boundary, "--%s", walk); boundary[strcspn(boundary, quoted ? " \t\"" : " \t")] = '\0'; free(line); break; } /* this is not a miltipart/report mail see RFC1839 */ if (boundary == NULL) return NULL; while ((getline(&buf, &bufcap, f) > 0)) { chomp(buf); if (indsn) { if (strncasecmp(buf, "Final-Recipient:", 16) == 0) { walk = strchr(buf, ';'); if (walk == NULL) { break; } find_email_adr(walk+1, &emails); if(tll_length(emails) > 0) { addr = xstrdup(tll_front(emails)); tll_free_and_free(emails, free); } break; } } if (strcmp(buf, boundary) == 0) { if (indsn) break; /* check our content type is a valid one */ while ((hdr = gethdrline(f, NULL))) { if (indsn) { /* skip the rest of the headers if any */ free(hdr); continue; } if (strncasecmp(hdr, "content-type:", 13) != 0) { free(hdr); continue; } walk = hdr + 13; while (isspace(*walk) && *walk != '\0') walk++; if (strncasecmp(walk, "message/delivery-status", 23) != 0) { free(hdr); break; } free(hdr); indsn = true; } } } free(buf); return addr; } int open_listdir(const char *listdir, bool usercheck) { struct stat st; uid_t uid; int fd; fd = open(listdir, O_DIRECTORY|O_CLOEXEC); if (fd == -1) { warn("Cannot open(%s)", listdir); return (-1); } if (!usercheck) return (fd); if (fstat(fd, &st) != 0) { log_error(LOG_ARGS, "Cannot stat %s", listdir); errx(EXIT_FAILURE, "Cannot stat %s", listdir); } uid = getuid(); if (uid && uid != st.st_uid) { log_error(LOG_ARGS, "Have to invoke either as root or as the " "user owning listdir"); errx(EXIT_FAILURE, "Have to invoke either as root or as the " "user owning listdir"); } return (fd); } void ml_init(struct ml *ml) { ml->dir = NULL; ml->fd = -1; ml->ctrlfd = -1; ml->delim = NULL; ml->addr = NULL; ml->fqdn = NULL; ml->name = NULL; } bool ml_open(struct ml *ml, bool checkuser) { if (ml->dir == NULL) return (false); ml->fd = open_listdir(ml->dir, checkuser); if (ml->fd == -1) return (false); ml->ctrlfd = openat(ml->fd, "control", O_DIRECTORY|O_CLOEXEC); if (ml->ctrlfd == -1) { warn("Cannot open(%s/control)", ml->dir); ml_close(ml); return (false); } ml->addr = ctrlvalue(ml->ctrlfd, "listaddress"); if (ml->addr == NULL) { warnx("Missing list address"); ml_close(ml); return (false); } ml->delim = getlistdelim(ml->ctrlfd); if (!splitlistaddr(ml->addr, &ml->name, &ml->fqdn)) { warnx("%s: is not a valid mailing list address, " "missing '@'", ml->addr); ml_close(ml); return (false); } return (true); } void ml_close(struct ml *ml) { free(ml->delim); free(ml->addr); free(ml->name); if (ml->fd != -1) close(ml->fd); if (ml->ctrlfd != -1) close(ml->ctrlfd); } mlmmj/src/mygetline.c000066400000000000000000000037631502303113500151240ustar00rootroot00000000000000/* Copyright (C) 2004 Morten K. Poulsen * Copyright (C) 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include "mygetline.h" #include "xmalloc.h" static char *mygetuntil(int fd, int eof) { size_t i = 0, buf_size = BUFSIZE; /* initial buffer size */ ssize_t res; char *buf, ch; buf = xmalloc(buf_size); buf[0] = '\0'; while(1) { res = read(fd, &ch, 1); if(res < 0) { if(errno == EINTR) continue; else { free(buf); return NULL; } } if(res == 0) { if(buf[0]) { buf[i] = '\0'; return buf; } else { free(buf); return NULL; } } if(i == buf_size - 1) { buf_size *= 2; buf = xrealloc(buf, buf_size); } buf[i++] = ch; if(eof != EOF && ch == eof) { buf[i] = '\0'; return buf; } } } char *mygetline(int fd) { return mygetuntil(fd, '\n'); } mlmmj/src/prepstdreply.c000066400000000000000000001241741502303113500156640ustar00rootroot00000000000000/* * Copyright (C) 2004 Mads Martin Joergensen * Copyright (C) 2007 Morten K. Poulsen * Copyright (C) 2011 Ben Schmidt * Copyright (C) 2023-2025 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "prepstdreply.h" #include "statctrl.h" #include "ctrlvalue.h" #include "strgen.h" #include "chomp.h" #include "log_error.h" #include "wrappers.h" #include "mlmmj.h" #include "unistr.h" #include "xstring.h" #include "do_all_the_voodoo_here.h" struct substitution { char *token; char *subst; }; struct formatted { char *token; rewind_function rew; get_function get; void *state; }; struct source; typedef struct source source; struct source { source *prev; char *upcoming; int processedlen; int processedwidth; char *prefix; int prefixlen; int prefixwidth; char *suffix; FILE *fp; struct formatted *fmt; int transparent; int limit; }; struct conditional; typedef struct conditional conditional; struct conditional { int satisfied; int elsepart; conditional *outer; }; enum conditional_target { ACTION, REASON, TYPE, CONTROL }; enum wrap_mode { WRAP_WORD, WRAP_CHAR, WRAP_USER }; enum width_reckoning { WIDTH_THIN, WIDTH_WIDE }; struct text { char *action; char *reason; char *type; source *src; tll(struct substitution *) substs; char *mailname; tll(struct formatted *) fmts; int wrapindent; int wrapwidth; enum wrap_mode wrapmode; enum width_reckoning widthreckoning; char *zerowidth; conditional *cond; conditional *skip; }; struct memory_lines_state { char *lines; char *pos; char *end; }; struct file_lines_state { char *filename; FILE *fp; char truncate; char *line; size_t linecap; char *formatted_str; void *data; }; memory_lines_state * init_memory_lines(const char *lines) { memory_lines_state *s = xcalloc(1, sizeof(memory_lines_state)); char *l; l = s->lines = xstrdup(lines); chomp(s->lines); s->end = s->lines + strlen(s->lines); while (strsep(&l, "\n")); return (s); } void rewind_memory_lines(void *state) { memory_lines_state *s = (memory_lines_state *)state; if (s == NULL) return; s->pos = NULL; } const char * get_memory_line(void *state) { memory_lines_state *s = (memory_lines_state *)state; if (s == NULL) return NULL; if (s->pos == NULL) { s->pos = s->lines; return (s->pos); } s->pos += strlen(s->pos); if (s->pos >= s->end) return (NULL); while (s->pos[0] == '\0' && s->pos < s->end) s->pos++; return (s->pos); } void finish_memory_lines(memory_lines_state *s) { if (s == NULL) return; free(s->lines); free(s); } file_lines_state * init_file_lines(const char *filename, char truncate) { file_lines_state *s = xcalloc(1, sizeof(file_lines_state)); s->filename = xstrdup(filename); s->truncate = truncate; return s; } file_lines_state *init_file_lines_fd(int fd, char truncate) { file_lines_state *s; if (fd == -1) return (NULL); s = xcalloc(1, sizeof(file_lines_state)); s->fp = fdopen(fd, "r"); s->truncate = truncate; return (s); } file_lines_state * init_file_lines_data(int fd, char truncate, void *data) { file_lines_state *s; s = init_file_lines_fd(fd, truncate); if (s == NULL) return (NULL); s->data = data; return (s); } void rewind_file_lines(void *state) { file_lines_state *s = (file_lines_state *)state; if (s == NULL) return; if (s->filename != NULL) { s->fp = fopen(s->filename, "r"); free(s->filename); s->filename = NULL; } if (s->fp != NULL) rewind(s->fp); } const char *get_file_line(void *state) { file_lines_state *s = (file_lines_state *)state; char *end; if (s == NULL) return (NULL); if (s->fp == NULL) return (NULL); if (getline(&s->line, &s->linecap, s->fp) <= 0) return (NULL); if (s->truncate != '\0') { end = strchr(s->line, s->truncate); if (end == NULL) return NULL; *end = '\0'; } else { chomp(s->line); } return s->line; } const char * get_msgid_line(void *state) { file_lines_state *s = (file_lines_state *)state; const char *id = get_file_line(state); if (id == NULL) return (NULL); if (s->data == NULL) { return (id); } struct ml *m = (struct ml *)s->data; struct mailhdr readhdrs[] = { { "Message-ID", 0, NULL }, { NULL, 0, NULL } }; int archive_fd = openat(m->fd, "archive", O_DIRECTORY|O_RDONLY); if (archive_fd == -1) return (id); int msgfd = openat(archive_fd, id, O_RDONLY); close(archive_fd); if (msgfd == -1) return (id); FILE *f = fdopen(msgfd, "r"); scan_headers(f, readhdrs, NULL, NULL); fclose(f); if (readhdrs[0].valuecount == 0) return (id); free(s->formatted_str); xasprintf(&s->formatted_str, "%s, %s%s", id, readhdrs[0].token, readhdrs[0].values[0]); return (s->formatted_str); } void finish_file_lines(file_lines_state *s) { if (s == NULL) return; free(s->line); free(s->formatted_str); if (s->fp != NULL) fclose(s->fp); if (s->filename != NULL) free(s->filename); free(s); } static char *filename_token(char *token) { const char *pos = token; if (*pos == '\0') return NULL; while ( (*pos >= '0' && *pos <= '9') || (*pos >= 'A' && *pos <= 'Z') || (*pos >= 'a' && *pos <= 'z') || (*pos == '_') || (*pos == '-') || (*pos == '.' && pos != token) ) { pos++; } if (*pos != '\0') return NULL; return token; } static char *numeric_token(char *token) { char *pos; if (*token == '\0') return NULL; for(pos = token; *pos != '\0'; pos++) { if(*pos >= '0' && *pos <= '9') continue; break; } if (*pos != '\0') return NULL; return token; } static size_t do_substitute(xstring *str, const char *line, int listfd, int ctrlfd, text *txt) { const char *key, *endpos; char *value = NULL; char *token = NULL; struct substitution *subst; bool found = true; size_t len; if (*line != '$') return (0); line++; key = line; endpos = strchr(key, '$'); if (endpos == NULL) { fputc('$', str->fp); return (0); } len = endpos - key; if (len == 8 && strncmp(key, "control ", 8) == 0) { token = xstrndup(key + 8, endpos - key + 8); if (strchr(token, '/') == NULL) /* ensure stay in the directory */ value = ctrlcontent(ctrlfd, token); } else if (len == 5 && strncmp(key, "text ", 5) == 0) { token = xstrndup(key + 5, endpos - key + 5); if (strchr(token, '/') == NULL) /* ensure stay in the directory */ value = textcontent(listfd, token); } else { found = false; tll_foreach(txt->substs, it) { subst = it->item; if (strlen (subst->token) == len && strncmp(key, subst->token, len) == 0) { fputs(subst->subst, str->fp); found = true; break; } } } free(value); free(token); if (!found) fprintf(str->fp, "$%.*s$", (int)(endpos - key), key); return (len +1); } static void substitute_one(char **line_p, char **pos_p, int *width_p, int listfd, int ctrlfd, text *txt) { /* It is important for this function to leave the length of the * processed portion unchanged, or increase it by just one ASCII * character (for $$). */ char *line = *line_p; char *pos = *pos_p; char *token = pos + 1; char *endpos; char *value = NULL; struct substitution *subst; endpos = strchr(token, '$'); if (endpos == NULL) { (*pos_p)++; (*width_p)++; return; } *pos = '\0'; *endpos = '\0'; if(strncmp(token, "control ", 8) == 0) { token = filename_token(token + 8); if (token != NULL) value = ctrlcontent(ctrlfd, token); } else if(strncmp(token, "text ", 5) == 0) { token = filename_token(token + 5); if (token != NULL) value = textcontent(listfd, token); } else { tll_foreach(txt->substs, it) { subst = it->item; if(strcmp(token, subst->token) == 0) { value = xstrdup(subst->subst); break; } } } if (value != NULL) { xasprintf(&line, "%s%s%s", line, value, endpos + 1); *pos_p = line + (*pos_p - *line_p); if (strcmp(value, "$") == 0) { (*pos_p)++; (*width_p)++; } free(*line_p); *line_p = line; free(value); } else { *pos = '$'; *endpos = '$'; (*pos_p)++; (*width_p)++; } } char *substitute(const char *line, int listfd, int ctrlfd, text *txt) { const char *pos = line; xstring *str = xstring_new(); while (*pos != '\0') { if (*pos != '$') fputc(*pos, str->fp); else pos += do_substitute(str, pos, listfd, ctrlfd, txt); pos++; } return xstring_get(str); } text *open_text_file(int listfd, const char *filename) { char *tmp; int fd; xasprintf(&tmp, "text/%s", filename); fd = openat(listfd, tmp, O_RDONLY); free(tmp); if (fd == -1) { xasprintf(&tmp, DEFAULTTEXTDIR"/default/%s", filename); fd = open(tmp, O_RDONLY); free(tmp); } if (fd == -1) { xasprintf(&tmp, DEFAULTTEXTDIR"/en/%s", filename); fd = open(tmp, O_RDONLY); free(tmp); } if (fd == -1) return (NULL); return (open_text_fd(fd)); } text *open_text_fd(int fd) { text *txt; txt = xcalloc(1, sizeof(text)); txt->src = xcalloc(1, sizeof(source)); txt->src->limit = -1; txt->wrapmode = WRAP_WORD; txt->widthreckoning = WIDTH_THIN; txt->src->fp = fdopen(fd, "r"); return (txt); } text *open_text(int listfd, const char *purpose, const char *action, const char *reason, const char *type, const char *compat) { size_t filenamelen, len; char *filename; text *txt; filenamelen = xasprintf(&filename, "%s-%s-%s-%s", purpose != NULL ? purpose : "", action != NULL ? action : "", reason != NULL ? reason : "", type != NULL ? type: ""); do { if ((txt = open_text_file(listfd, filename)) != NULL) break; len = type ? strlen(type) : 0; filename[filenamelen-len-1] = '\0'; if ((txt = open_text_file(listfd, filename)) != NULL) break; filename[filenamelen-len-1] = '-'; filenamelen -= len + 1; len = reason ? strlen(reason) : 0; filename[filenamelen-len-1] = '\0'; if ((txt = open_text_file(listfd, filename)) != NULL) break; filename[filenamelen-len-1] = '-'; filenamelen -= len + 1; len = action ? strlen(action) : 0; filename[filenamelen-len-1] = '\0'; if ((txt = open_text_file(listfd, filename)) != NULL) break; filename[filenamelen-len-1] = '-'; if ((txt = open_text_file(listfd, compat)) != NULL) { free(filename); filename = xstrdup(compat); break; } log_error(LOG_ARGS, "Could not open listtext '%s'", filename); free(filename); return NULL; } while (0); txt->action = action != NULL ? xstrdup(action) : NULL; txt->reason = reason != NULL ? xstrdup(reason) : NULL; txt->type = type != NULL ? xstrdup(type) : NULL; return txt; } void close_source(text *txt) { source *tmp; if (txt->src->fp != NULL) fclose(txt->src->fp); if (txt->src->prefix != NULL) free(txt->src->prefix); if (txt->src->suffix != NULL) free(txt->src->suffix); tmp = txt->src; txt->src = txt->src->prev; free(tmp); } void register_unformatted(text *txt, const char *token, const char *replacement) { struct substitution * subst = xmalloc(sizeof(struct substitution)); subst->token = xstrdup(token); subst->subst = xstrdup(replacement); tll_push_back(txt->substs, subst); } void register_default_unformatted(text *txt, struct ml *ml) { char *tmp; register_unformatted(txt, "", "$"); register_unformatted(txt, "listaddr", ml->addr); xasprintf(&tmp, "%s%s", ml->name, ml->delim); register_unformatted(txt, "list+", tmp); register_unformatted(txt, "list", ml->name); register_unformatted(txt, "domain", ml->fqdn); free(tmp); gen_addr(tmp, ml, "owner"); register_unformatted(txt, "listowner", tmp); free(tmp); gen_addr(tmp, ml, "help"); register_unformatted(txt, "helpaddr", tmp); free(tmp); gen_addr(tmp, ml, "faq"); register_unformatted(txt, "faqaddr", tmp); free(tmp); gen_addr(tmp, ml, "get-N"); register_unformatted(txt, "listgetN", tmp); free(tmp); gen_addr(tmp, ml, "unsubscribe"); register_unformatted(txt, "listunsubaddr", tmp); free(tmp); gen_addr(tmp, ml, "unsubscribe-digest"); register_unformatted(txt, "digestunsubaddr", tmp); free(tmp); gen_addr(tmp, ml, "unsubscribe-nomail"); register_unformatted(txt, "nomailunsubaddr", tmp); free(tmp); gen_addr(tmp, ml, "subscribe"); register_unformatted(txt, "listsubaddr", tmp); free(tmp); gen_addr(tmp, ml, "subscribe-digest"); register_unformatted(txt, "digestsubaddr", tmp); free(tmp); gen_addr(tmp, ml, "subscribe-nomail"); register_unformatted(txt, "nomailsubaddr", tmp); free(tmp); } void register_originalmail(text *txt, const char *mailname) { txt->mailname = xstrdup(mailname); } void register_formatted(text *txt, const char *token, rewind_function rew, get_function get, void *state) { struct formatted * fmt = xmalloc(sizeof(struct formatted)); fmt->token = xstrdup(token); fmt->rew = rew; fmt->get = get; fmt->state = state; tll_push_back(txt->fmts, fmt); } static void begin_new_source_file(text *txt, char **line_p, char **pos_p, int *width_p, const char *filename, int transparent) { char *line = *line_p; char *pos = *pos_p; char *tmp = NULL, *esc; size_t tmpcap = 0; source *src; FILE *fp; int i; /* Save any later lines for use after finishing the source */ while (*pos != '\0' && *pos != '\r' && *pos != '\n') pos++; if (*pos == '\r') pos++; if (*pos == '\n') pos++; if (*pos != '\0') { txt->src->upcoming = xstrdup(pos); txt->src->processedlen = 0; txt->src->processedwidth = 0; } fp = fopen(filename, "r"); if (fp == NULL) { /* Act as if the source were an empty line */ **pos_p = '\0'; return; } src = xmalloc(sizeof(source)); src->prev = txt->src; src->upcoming = NULL; src->prefixlen = strlen(line); src->prefixwidth = *width_p; src->prefix = xmalloc((*width_p + 1) * sizeof(char)); for (tmp = src->prefix, i = 0; i < *width_p; tmp++, i++) *tmp = ' '; *tmp = '\0'; src->suffix = NULL; src->fp = fp; src->fmt = NULL; src->transparent = transparent; src->limit = -1; txt->src = src; tmp = NULL; if (getline(&tmp, &tmpcap, fp) <= 0) { close_source(txt); **pos_p = '\0'; return; } if (!transparent) { esc = unistr_escaped_to_utf8(tmp); free(tmp); tmp = esc; } xasprintf(&line, "%s%s", line, tmp); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; free(tmp); } static void begin_new_formatted_source(text *txt, char **line_p, char **pos_p, int *width_p, char *suffix, struct formatted *fmt, int transparent) { char *line = *line_p; char *pos = *pos_p; const char *str; source *src; /* Save any later lines for use after finishing the source */ while (*pos != '\0' && *pos != '\r' && *pos != '\n') pos++; if (*pos == '\r') pos++; if (*pos == '\n') pos++; if (*pos != '\0') { txt->src->upcoming = xstrdup(pos); txt->src->processedlen = 0; txt->src->processedwidth = 0; } (*fmt->rew)(fmt->state); src = xmalloc(sizeof(source)); src->prev = txt->src; src->upcoming = NULL; if (*line == '\0') { src->prefix = NULL; } else { src->prefix = xstrdup(line); } src->prefixlen = strlen(line); src->prefixwidth = *width_p; if (*suffix == '\0' || *suffix == '\r' || *suffix == '\n') { src->suffix = NULL; } else { src->suffix = xstrdup(suffix); } src->fp = NULL; src->fmt = fmt; src->transparent = transparent; src->limit = -1; txt->src = src; str = (*fmt->get)(fmt->state); if (str == NULL) { close_source(txt); **line_p = '\0'; *pos_p = *line_p; *width_p = 0; return; } if (!transparent) str = unistr_escaped_to_utf8(str); xasprintf(&line, "%s%s", line, str); /* The suffix will be added back in get_processed_text_line() */ *pos_p = line + strlen(*line_p); free(*line_p); *line_p = line; } static int handle_conditional(text *txt, char **line_p, char **pos_p, int *skipwhite_p, char *token, int neg, enum conditional_target tgt, int multi, int ctrlfd) { /* This function handles a conditional directive and returns a boolean * (0 or 1) representing whether it was successfully handled or not. * The conditional should already have been identified, and the type of * conditional, whether it is negative, whether multiple parameters are * acceptable, and the position of the first parameter should be passed * in. */ char *line = *line_p; char *pos; int satisfied = 0; int matches; conditional *cond; if (txt->skip == NULL) { for (;;) { pos = token; if (*pos == '\0') break; while ( (*pos >= '0' && *pos <= '9') || (*pos >= 'A' && *pos <= 'Z') || (*pos >= 'a' && *pos <= 'z') || (*pos == '_') || (*pos == '-') || (*pos == '.' && pos != token) ) { pos++; } if (*pos == ' ') { *pos = '\0'; } else { multi = 0; } if (*pos != '\0') return 1; matches = 0; if (tgt == ACTION) { if (txt->action == NULL) return 1; if (strcasecmp(token, txt->action) == 0) matches = 1; } else if (tgt == REASON) { if (txt->reason == NULL) return 1; if (strcasecmp(token, txt->reason) == 0) matches = 1; } else if (tgt == TYPE) { if (txt->type == NULL) return 1; if (strcasecmp(token, txt->type) == 0) matches = 1; } else if (tgt == CONTROL) { if (statctrl(ctrlfd, token)) matches = 1; } if ((matches && !neg) || (!matches && neg)) { satisfied = 1; break; } if (!multi) break; *pos = ' '; token = pos + 1; } } else { /* We consider nested conditionals as successful while skipping * text so they don't register themselves as the reason for * skipping, nor trigger swallowing blank lines */ satisfied = 1; pos = token + 1; while (*pos != '\0') pos++; multi = 0; } cond = xmalloc(sizeof(conditional)); cond->satisfied = satisfied; cond->elsepart = 0; cond->outer = txt->cond; txt->cond = cond; if (!satisfied) txt->skip = cond; if (multi) { *pos = ' '; pos++; while (*pos != '\0') pos++; } pos++; if (*skipwhite_p) { while (*pos == ' ' || *pos == '\t') pos++; } xasprintf(&line, "%s%s", line, pos); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } static int handle_directive(text *txt, char **line_p, char **pos_p, int *width_p, int *skipwhite_p, int conditionalsonly, struct ml *ml) { /* This function returns 1 to swallow a preceding blank line, i.e. if * we just finished processing a failed conditional without an else * part, -1 if we did nothing due to only processing conditionals, and * 0 otherwise. */ char *line = *line_p; char *pos = *pos_p; char *token = pos + 1; char *endpos; char *filename; int limit; struct formatted *fmt; conditional *cond; int swallow; endpos = strchr(token, '%'); if (endpos == NULL) { if (conditionalsonly) return -1; (*pos_p)++; return 0; } *pos = '\0'; *endpos = '\0'; if(strncmp(token, "ifaction ", 9) == 0) { token += 9; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 0, ACTION, 1, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifreason ", 9) == 0) { token += 9; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 0, REASON, 1, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "iftype ", 7) == 0) { token += 7; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 0, TYPE, 1, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifcontrol ", 10) == 0) { token += 10; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 0, CONTROL, 1, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifnaction ", 10) == 0) { token += 10; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 1, ACTION, 0, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifnreason ", 10) == 0) { token += 10; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 1, REASON, 0, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifntype ", 8) == 0) { token += 8; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 1, TYPE, 0, ml->ctrlfd) == 0) return 0; } else if(strncmp(token, "ifncontrol ", 11) == 0) { token += 11; if (handle_conditional(txt, line_p, pos_p, skipwhite_p, token, 1, CONTROL, 1, ml->ctrlfd) == 0) return 0; } else if(strcmp(token, "else") == 0) { if (txt->cond != NULL) { if (txt->skip == txt->cond) txt->skip = NULL; else if (txt->skip == NULL) txt->skip = txt->cond; txt->cond->elsepart = 1; endpos++; if (*skipwhite_p) { while (*endpos == ' ' || *endpos == '\t') endpos++; } xasprintf(&line, "%s%s", line, endpos); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } } else if(strcmp(token, "endif") == 0) { if (txt->cond != NULL) { if (txt->skip == txt->cond) txt->skip = NULL; cond = txt->cond; swallow = (!cond->satisfied && !cond->elsepart)?1:0; txt->cond = cond->outer; free(cond); endpos++; if (*skipwhite_p) { while (*endpos == ' ' || *endpos == '\t') endpos++; } xasprintf(&line, "%s%s", line, endpos); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return swallow; } } if (conditionalsonly) { *pos = '%'; *endpos = '%'; return -1; } if (txt->skip != NULL) { /* We don't process anything but conditionals if we're * already skipping text in one. */ *pos = '%'; *endpos = '%'; (*pos_p)++; (*width_p)++; return 0; } *skipwhite_p = 0; if(strcmp(token, "") == 0) { xasprintf(&line, "%s%%%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p) + 1; (*width_p)++; free(*line_p); *line_p = line; return 0; } else if(strcmp(token, "^") == 0) { if (txt->src->prefixlen != 0) { line[txt->src->prefixlen] = '\0'; xasprintf(&line, "%s%s", line, endpos + 1); *width_p = txt->src->prefixwidth; } else { line = xstrdup(endpos + 1); *width_p = 0; } *pos_p = line; free(*line_p); *line_p = line; return 0; } else if(strcmp(token, "comment") == 0 || strcmp(token, "$") == 0 ) { pos = endpos + 1; while (*pos != '\0' && *pos != '\r' && *pos != '\n') pos++; xasprintf(&line, "%s%s", line, pos); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strncmp(token, "wrap", 4) == 0) { token += 4; limit = 0; if (*token == '\0') { limit = 76; } else if (*token == ' ') { token = numeric_token(token + 1); if (token != NULL) limit = atol(token); } if (limit != 0) { txt->wrapindent = *width_p; txt->wrapwidth = limit; xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } } else if(strcmp(token, "nowrap") == 0) { txt->wrapwidth = 0; xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strcmp(token, "ww") == 0 || strcmp(token, "wordwrap") == 0 || strcmp(token, "cw") == 0 || strcmp(token, "charwrap") == 0 || strcmp(token, "uw") == 0 || strcmp(token, "userwrap") == 0) { if (*token == 'w') txt->wrapmode = WRAP_WORD; if (*token == 'c') txt->wrapmode = WRAP_CHAR; if (*token == 'u') txt->wrapmode = WRAP_USER; xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strcmp(token, "thin") == 0) { txt->widthreckoning = WIDTH_THIN; xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strcmp(token, "wide") == 0) { txt->widthreckoning = WIDTH_WIDE; xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strncmp(token, "zero ", 5) == 0) { token += 5; if (txt->zerowidth != NULL) free(txt->zerowidth); txt->zerowidth = xstrdup(token); xasprintf(&line, "%s%s", line, endpos + 1); *pos_p = line + (*pos_p - *line_p); free(*line_p); *line_p = line; return 0; } else if(strncmp(token, "control ", 8) == 0) { token = filename_token(token + 8); if (token != NULL) { xasprintf(&filename, "%s/control/%s", ml->dir, token); begin_new_source_file(txt, line_p, pos_p, width_p, filename, 0); free(filename); return 0; } } else if(strncmp(token, "text ", 5) == 0) { token = filename_token(token + 5); if (token != NULL) { xasprintf(&filename, "%s/text/%s", ml->dir, token); begin_new_source_file(txt, line_p, pos_p, width_p, filename, 0); free(filename); return 0; } } else if(strncmp(token, "originalmail", 12) == 0 && txt->mailname != NULL) { token += 12; limit = 0; if (*token == '\0') { limit = -1; } else if (*token == ' ') { token = numeric_token(token + 1); if (token != NULL) limit = atol(token); } else { token = numeric_token(token); if (token != NULL) limit = atol(token); } if (limit != 0) { begin_new_source_file(txt, line_p, pos_p, width_p, txt->mailname, 1); if (limit == -1) txt->src->limit = -1; else txt->src->limit = limit - 1; return 0; } } if (token == NULL) { /* We have encountered a directive, but not been able to deal * with it, so just advance through the string. */ *pos = '%'; *endpos = '%'; (*pos_p)++; (*width_p)++; return 0; } tll_foreach(txt->fmts, it) { fmt = it->item; if (strcmp(token, fmt->token) == 0) { begin_new_formatted_source(txt, line_p, pos_p, width_p, endpos + 1, fmt, 0); return 0; } } /* No recognised directive; just advance through the string. */ *pos = '%'; *endpos = '%'; (*pos_p)++; (*width_p)++; return 0; } char *get_processed_text_line(text *txt, bool headers, struct ml *ml) { char *line; const char *item; char *pos; char *tmp; char *prev = NULL; int len, width, i; int processedlen = 0, processedwidth = 0; int wrapindentlen = -1; int incision, linebreak, linebreakwidth; int directive, inhibitbreak; int peeking = 0; /* for a failed conditional without an else */ int skipwhite; /* skip whitespace after a conditional directive */ int swallow; char utf8char[5] = {0, 0, 0, 0, 0}; for (;;) { line = NULL; while (txt->src != NULL) { if (txt->src->upcoming != NULL) { if (prev != NULL) { /* If wrapping, we are going to swallow * leading whitespace anyway, which is * what the prefix will always be, so * we needn't include it, nor the * wrapindent; wrapindentlen is also * already set from the previous * iteration. */ line = txt->src->upcoming; txt->src->upcoming = NULL; break; } /* Join the prefix, wrapindent and upcoming * line. */ len = strlen(txt->src->upcoming); processedlen = txt->src->processedlen; processedwidth = txt->src->processedwidth; if (txt->src->prefixwidth != 0) { /* prefixlen may be true for an existing * prefix, not the one in txt->src, so * set it afresh. */ txt->src->prefixlen = strlen(txt->src->prefix); len += txt->src->prefixlen; processedlen += txt->src->prefixlen; processedwidth += txt->src->prefixwidth; } if (txt->wrapwidth != 0) { /* wrapindent is a width, but includes * the prefix; the excess we make up * with just spaces though, so one byte * per character. */ len += txt->wrapindent - txt->src->prefixwidth; processedlen += txt->wrapindent - txt->src->prefixwidth; processedwidth += txt->wrapindent - txt->src->prefixwidth; } line = xmalloc((len + 1) * sizeof(char)); if (txt->src->prefixwidth != 0) { strcpy(line, txt->src->prefix); pos = line + txt->src->prefixlen; } else { pos = line; } if (txt->wrapwidth != 0) { i = txt->wrapindent - txt->src->prefixwidth; for (; i > 0; i--) *pos++ = ' '; wrapindentlen = pos - line; } strcpy(pos, txt->src->upcoming); free(txt->src->upcoming); txt->src->upcoming = NULL; break; } if (txt->src->limit != 0) { tmp = NULL; if (txt->src->fp != NULL) { size_t linecap = 0; if (getline(&tmp, &linecap, txt->src->fp) <= 0) { free(tmp); tmp = NULL; } } else if (txt->src->fmt != NULL) { item = (*txt->src->fmt->get)( txt->src->fmt->state); if (item != NULL) tmp = xstrdup(item); } if (txt->src->limit > 0) txt->src->limit--; if (tmp == NULL) { txt->src->upcoming = NULL; } else if (txt->src->transparent) { txt->src->upcoming = tmp; txt->src->processedlen = 0; txt->src->processedwidth = 0; } else { txt->src->upcoming = unistr_escaped_to_utf8(tmp); txt->src->processedlen = 0; txt->src->processedwidth = 0; free(tmp); } } else { txt->src->upcoming = NULL; } if (txt->src->upcoming != NULL) continue; close_source(txt); } if (line == NULL) { if (peeking) return xstrdup(""); if (prev != NULL) return prev; return NULL; } if (prev != NULL) { /* Wrapping; join and start processing at the new bit, * which is always unprocessed. */ len = strlen(prev); pos = prev + len - 1; /* The width remains set from the previous iteration. */ if (txt->wrapmode == WRAP_WORD) { while (pos >= prev + wrapindentlen && (*pos == ' ' || *pos == '\t')) { pos--; len--; width--; } } pos++; *pos = '\0'; pos = line; while (*pos == ' ' || *pos == '\t') pos++; if ((*pos == '\r' || *pos == '\n' || *pos == '\0') && txt->skip == NULL) { /* Empty/white line; stop wrapping, finish the last line and save the empty/white line for later. */ txt->wrapwidth = 0; txt->src->upcoming = line; txt->src->processedlen = 0; txt->src->processedwidth = 0; line = prev; pos = line + len; skipwhite = 0; } else { if (*prev == '\0') { tmp = xstrdup(pos); } else { if (txt->wrapmode == WRAP_WORD && len > wrapindentlen) { xasprintf(&tmp, "%s %s", prev, pos); len++; width++; } else { xasprintf(&tmp, "%s%s", prev, pos); } } free(line); line = tmp; free(prev); pos = line + len; skipwhite = 1; } /* We can always line-break where the input had one */ linebreak = len; linebreakwidth = width; prev = NULL; } else { /* Not wrapping; start processing where we left off; * there can't be any break opportunities in the * processed part, and if it looks like there are, they * must have been inhibited so aren't really. */ pos = line + processedlen; len = processedlen; width = processedwidth; linebreak = 0; linebreakwidth = 0; skipwhite = 0; } if (txt->skip != NULL) { incision = len; } else { incision = -1; } directive = 0; inhibitbreak = 0; while (*pos != '\0') { if (txt->wrapwidth != 0 && width >= txt->wrapwidth && !peeking && linebreak > wrapindentlen && linebreak < len) break; if ((unsigned char)*pos > 0xbf && txt->skip == NULL && txt->wrapmode == WRAP_CHAR && !inhibitbreak) { linebreak = len; linebreakwidth = width; } if (*pos == '\r') { *pos = '\0'; pos++; if (*pos == '\n') pos++; if (*pos == '\0') break; txt->src->upcoming = xstrdup(pos); txt->src->processedlen = 0; txt->src->processedwidth = 0; break; } else if (*pos == '\n') { *pos = '\0'; pos++; if (*pos == '\0') break; txt->src->upcoming = xstrdup(pos); txt->src->processedlen = 0; txt->src->processedwidth = 0; break; } else if (*pos == ' ') { if (txt->skip == NULL && txt->wrapmode != WRAP_USER && !inhibitbreak) { linebreak = len + 1; linebreakwidth = width + 1; } inhibitbreak = 0; } else if (*pos == '\t') { /* Avoid breaking due to peeking */ inhibitbreak = 0; } else if (txt->src->transparent) { /* Do nothing if the file is to be included * transparently */ if (peeking && txt->skip == NULL) break; inhibitbreak = 0; } else if (*pos == '\\' && txt->skip == NULL) { if (peeking) break; if (*(pos + 1) == '/') { linebreak = len; linebreakwidth = width; tmp = pos + 2; inhibitbreak = 0; } else if (*(pos + 1) == '=') { tmp = pos + 2; /* Ensure we don't wrap the next * character */ inhibitbreak = 1; } else { /* Includes space and backslash */ tmp = pos + 1; /* Ensure we don't wrap a space */ if (*(pos+1) == ' ') inhibitbreak = 1; else inhibitbreak = 0; } *pos = '\0'; xasprintf(&tmp, "%s%s", line, tmp); pos = tmp + len; free(line); line = tmp; skipwhite = 0; continue; } else if (*pos == '$' && txt->skip == NULL) { if (peeking) break; substitute_one(&line, &pos, &width, ml->fd, ml->ctrlfd, txt); if (len != pos - line) { /* Cancel any break inhibition if the * length changed (which will be * because of $$) */ inhibitbreak = 0; len = pos - line; } skipwhite = 0; /* The function sets up for the next character * to process, so continue straight away. */ continue; } else if (*pos == '%') { directive = 1; swallow = handle_directive(txt, &line, &pos, &width, &skipwhite, peeking, ml); if (swallow == 1) peeking = 0; if (swallow == -1) break; if (txt->skip != NULL) { if (incision == -1) { /* We have to cut a bit out * later */ incision = pos - line; } } else { if (incision != -1) { /* Time to cut */ if (pos - line != incision) { line[incision] = '\0'; xasprintf(&tmp, "%s%s", line, pos); pos = tmp + incision; free(line); line = tmp; } incision = -1; } } if (len != pos - line) { /* Cancel any break inhibition if the * length changed (which will be * because of %% or %^% or an empty * list) */ inhibitbreak = 0; len = pos - line; } if (txt->wrapwidth != 0 && wrapindentlen == -1) { /* Started wrapping. */ wrapindentlen = len; } /* handle_directive() sets up for the next * character to process, so continue straight * away. */ continue; } else if (peeking && txt->skip == NULL) { break; } if (txt->skip == NULL) { len++; if ((unsigned char)*pos < 0x80) { width++; } else if ((unsigned char)*pos > 0xbf) { /* Not a UTF-8 continuation byte. */ if (txt->zerowidth != NULL) { tmp = pos; utf8char[0] = *tmp++; for (i = 1; i < 4; i++, tmp++) { if ((unsigned char)*tmp<0x80 || (unsigned char)*tmp>0xbf) break; utf8char[i] = *tmp; } utf8char[i] = '\0'; if (strstr(txt->zerowidth, utf8char) == NULL) { width++; if (txt->widthreckoning == WIDTH_WIDE) width++; } } else { width++; if (txt->widthreckoning == WIDTH_WIDE) width++; } } } pos++; skipwhite = 0; } if (incision == 0) { /* The whole line was skipped; nothing to return yet; * keep reading */ incision = -1; free(line); continue; } if (incision != -1) { /* Time to cut */ if (pos - line != incision) { line[incision] = '\0'; tmp = xstrdup(line); pos = tmp + incision; free(line); line = tmp; } incision = -1; } if (txt->wrapwidth != 0 && !peeking) { if (width < txt->wrapwidth || linebreak <= wrapindentlen || linebreak >= len) { prev = line; continue; } if (linebreak != 0) { if (txt->wrapmode == WRAP_WORD && line[linebreak-1] == ' ') line[linebreak-1] = '\0'; if (line[linebreak] == '\0') linebreak = 0; } if (linebreak != 0) { if (txt->src->upcoming == NULL) { tmp = xstrdup(line + linebreak); } else { /* If something's coming up, it's because * it was a new line. */ if (*(line + linebreak) != '\0') { xasprintf(&tmp, "%s\n%s", line + linebreak, txt->src->upcoming); free(txt->src->upcoming); } else { tmp = txt->src->upcoming; } } txt->src->upcoming = tmp; txt->src->processedlen = len - linebreak; txt->src->processedwidth = width - linebreakwidth; } line[linebreak] = '\0'; tmp = xstrdup(line); free(line); line = tmp; } else { if (directive) { pos = line; while (*pos == ' ' || *pos == '\t') pos++; if (*pos == '\0') { /* Omit whitespace-only line with * directives */ free(line); continue; } } if (*line == '\0' && !headers && !peeking) { /* Non-wrapped bona fide blank line that isn't * ending the headers; peek ahead to check it's * not followed by an unsatisfied conditional * without an else */ peeking = 1; free(line); continue; } else if (peeking) { /* We found something; return preceding blank * line */ if (txt->src->upcoming == NULL) { txt->src->upcoming = line; txt->src->processedlen = len; txt->src->processedwidth = width; } else { tmp = txt->src->upcoming; xasprintf(&txt->src->upcoming, "%s\n%s", line, txt->src->upcoming); txt->src->processedlen = len; txt->src->processedwidth = width; free(line); free(tmp); } line = xstrdup(""); } } if (txt->src->suffix != NULL) { xasprintf(&tmp, "%s%s", line, txt->src->suffix); free(line); return tmp; } else { return line; } } } static void substitution_free(struct substitution *subst) { free(subst->token); free(subst->subst); free(subst); } static void formatted_free(struct formatted *fmt) { free(fmt->token); free(fmt); } void close_text(text *txt) { conditional *cond; while (txt->src != NULL) { close_source(txt); } tll_free_and_free(txt->substs, substitution_free); if (txt->mailname != NULL) free(txt->mailname); tll_free_and_free(txt->fmts, formatted_free); while (txt->cond != NULL) { cond = txt->cond; txt->cond = txt->cond->outer; free(cond); } free(txt); } bool prepstdreply_to(text *txt, struct ml *ml, const char *from, const char *to, const char *replyto, int tofd, const char *msgid) { bool ret = false; char *tmp, *line; int i; size_t len; char *headers[10] = { NULL }; /* relies on NULL to flag end */ for (i=0; i<6; i++) { tmp = xstrdup("randomN"); tmp[6] = '0' + i; char *str = random_str(); register_unformatted(txt, tmp, str); free(tmp); free(str); } tmp = substitute(from, ml->fd, ml->ctrlfd, txt); xasprintf(&headers[0], "From: %s", tmp); free(tmp); tmp = substitute(to, ml->fd, ml->ctrlfd, txt); xasprintf(&headers[1], "To: %s", tmp); free(tmp); if (msgid) headers[2] = xstrdup(msgid); else headers[2] = genmsgid(ml->fqdn); chomp(headers[2]); if (msgid) headers[3] = xstrdup(msgid); else headers[3] = gendatestr(); chomp(headers[3]); headers[4] = xstrdup("Subject: mlmmj administrivia"); headers[5] = xstrdup("MIME-Version: 1.0"); headers[6] = xstrdup("Content-Type: text/plain; charset=utf-8"); headers[7] = xstrdup("Content-Transfer-Encoding: 8bit"); if(replyto) { tmp = substitute(replyto, ml->fd, ml->fd, txt); xasprintf(&headers[8], "Reply-To: %s", tmp); free(tmp); } for(;;) { line = get_processed_text_line(txt, true, ml); if (!line) { log_error(LOG_ARGS, "No body in listtext"); break; } if (*line == '\0') { /* end of headers */ free(line); line = NULL; break; } if (*line == ' ' || *line == '\t') { /* line beginning with linear whitespace is a continuation of previous header line */ if(dprintf(tofd, "%s\n", line) < 0) { log_error(LOG_ARGS, "Could not write std mail"); free(line); goto freeandreturn; } } else { tmp = line; len = 0; while (*tmp && *tmp != ':') { tmp++; len++; } if (!*tmp) { log_error(LOG_ARGS, "No headers or invalid " "header in listtext"); break; } tmp++; len++; /* remove the standard header if one matches */ for (i=0; headers[i] != NULL; i++) { if (strncasecmp(line, headers[i], len) == 0) { free(headers[i]); while (headers[i] != NULL) { headers[i] = headers[i+1]; i++; } break; } } if (strncasecmp(line, "Subject:", len) == 0) { tmp = unistr_utf8_to_header(tmp); free(line); xasprintf(&line, "Subject: %s", tmp); free(tmp); } if(dprintf(tofd, "%s\n", line) < 0) { log_error(LOG_ARGS, "Could not write std mail"); free(line); goto freeandreturn; } } free(line); line = NULL; } for (i=0; headers[i] != NULL; i++) { if(dprintf(tofd, "%s\n", headers[i]) < 0) { log_error(LOG_ARGS, "Could not write std mail"); if (line) free(line); goto freeandreturn; } } /* end the headers */ if(dprintf(tofd, "\n") < 0) { log_error(LOG_ARGS, "Could not write std mail"); if (line) free(line); goto freeandreturn; } if (line == NULL) { line = get_processed_text_line(txt, false, ml); } while(line) { if(dprintf(tofd, "%s\n", line) < 0) { log_error(LOG_ARGS, "Could not write std mail"); goto freeandreturn; } free(line); line = get_processed_text_line(txt, false, ml); } fsync(tofd); close(tofd); ret = true; freeandreturn: return ret; } char *prepstdreply(text *txt, struct ml *ml, const char *from, const char *to, const char *replyto) { int outfd; char *tmp, *retstr = NULL; do { tmp = random_str(); if (retstr) free(retstr); xasprintf(&retstr, "%s/queue/%s", ml->dir, tmp); free(tmp); outfd = open(retstr, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while ((outfd < 0) && (errno == EEXIST)); if(outfd < 0) { log_error(LOG_ARGS, "Could not open std mail %s", retstr); free(retstr); free(txt); return NULL; } if (!prepstdreply_to(txt, ml, from, to, replyto, outfd, NULL)) return (NULL); return (retstr); } mlmmj/src/print-version.c000066400000000000000000000026601502303113500157410ustar00rootroot00000000000000/* Copyright (C) 2003, 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include "mlmmj.h" void print_version(const char *prg) { char *lastslashindex = strrchr(prg, '/'); if(!lastslashindex) lastslashindex = (char *)prg; else lastslashindex++; printf("%s version "VERSION"\n", lastslashindex); } mlmmj/src/random-int.c000066400000000000000000000040321502303113500151650ustar00rootroot00000000000000/* Copyright (C) 2002, 2003 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include "wrappers.h" #include "config.h" int random_int(void) { #ifndef HAVE_ARC4RANDOM_UNIFORM static int init = 0; unsigned int seed; int devrandom; uint32_t ch; if (init) return rand(); seed = (unsigned int)time(NULL); devrandom = open("/dev/urandom", O_RDONLY); if(devrandom < 0) devrandom = open("/dev/random", O_RDONLY); if (devrandom >= 0) { readn(devrandom, &ch, 1); seed ^= ch; readn(devrandom, &ch, 1); seed ^= ch << 8; readn(devrandom, &ch, 1); seed ^= ch << 16; readn(devrandom, &ch, 1); seed ^= ch << 24; close(devrandom); } srand(seed); init = 1; return rand(); #else return arc4random_uniform(INT_MAX); #endif } #if 0 int main(int argc, char **argv) { int i; for(i = 0; i < 25; i++) printf("%i\n", random_int()); return 0; } #endif mlmmj/src/readn.c000066400000000000000000000032471502303113500142150ustar00rootroot00000000000000/* Copyright (C) 2005 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include "wrappers.h" /* classic read wrapper from Stevens */ ssize_t readn(int fd, void *vptr, size_t n) { size_t nleft; ssize_t nread; char *ptr; ptr = vptr; nleft = n; while(nleft > 0) { if((nread = read(fd, ptr, nleft)) < 0) { if(errno == EINTR) nread = 0; /* and call read() again */ else return -1; /* Caller can check errno */ } else if (nread == 0) break; /* EOF */ nleft -= nread; ptr += nread; } return n - nleft; /* return >= 0 */ } mlmmj/src/send_digest.c000066400000000000000000000257541502303113500154230ustar00rootroot00000000000000/* Copyright (C) 2004, 2005 Morten K. Poulsen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include "mlmmj.h" #include "send_digest.h" #include "log_error.h" #include "strgen.h" #include "xmalloc.h" #include "wrappers.h" #include "prepstdreply.h" #include "gethdrline.h" #include "statctrl.h" #include "unistr.h" #include "utils.h" struct mail { int idx; char *from; }; struct thread { char *subject; int num_mails; struct mail *mails; }; struct thread_list_state; typedef struct thread_list_state thread_list_state; struct thread_list_state { const char *listdir; int firstindex; int lastindex; int num_threads; struct thread *threads; int cur_thread; int cur_mail; }; static thread_list_state *init_thread_list( const char *listdir, int firstindex, int lastindex) { /* We use a static variable rather than dynamic allocation as * there will never be two lists in use simultaneously */ static thread_list_state s; s.listdir = listdir; s.firstindex = firstindex; s.lastindex = lastindex; s.num_threads = 0; s.threads = NULL; s.cur_thread = -1; return &s; } static void rewind_thread_list(void * state) { thread_list_state *s = (thread_list_state *)state; FILE *archivef; int i, j, thread_idx; char *line = NULL, *tmp, *subj, *from, *tmpfrom; size_t linecap = 0; char *archivename; int num_threads = 0; struct thread *threads = NULL; char buf[45]; if (s->cur_thread != -1) { /* We have gathered the data already; just rewind */ s->cur_thread = 0; s->cur_mail = -1; return; } for (i=s->firstindex; i<=s->lastindex; i++) { xasprintf(&archivename, "%s/archive/%d", s->listdir, i); archivef = fopen(archivename, "r"); free(archivename); if (archivef == NULL) continue; subj = NULL; from = NULL; while (getline(&line, &linecap, archivef) > 0) { if (strncasecmp(line, "Subject:", 8) == 0) { free(subj); subj = unistr_header_to_utf8(line + 8); } if (strncasecmp(line, "From:", 5) == 0) { free(from); from = unistr_header_to_utf8(line + 5); } } if (!subj) { subj = xstrdup("no subject"); } if (!from) { from = xstrdup("anonymous"); } tmp = subj; for (;;) { if (isspace(*tmp)) { tmp++; continue; } if (strncasecmp(tmp, "Re:", 3) == 0) { tmp += 3; continue; } break; } /* tmp is now the clean subject */ thread_idx = -1; for (j=0; jnum_threads = num_threads; s->threads = threads; s->cur_thread = 0; s->cur_mail = -1; } static const char *get_thread_list_line(void * state) { thread_list_state *s = (thread_list_state *)state; if (s->cur_thread >= s->num_threads) return NULL; if (s->cur_mail == -1) { s->cur_mail = 0; return s->threads[s->cur_thread].subject; } if (s->cur_mail >= s->threads[s->cur_thread].num_mails) { s->cur_thread++; s->cur_mail = -1; return "\n"; } return s->threads[s->cur_thread].mails[s->cur_mail++].from; } static void finish_thread_list(thread_list_state * s) { int i, j; if (s->threads == NULL) return; for (i=0; inum_threads; i++) { free(s->threads[i].subject); for (j=0; jthreads[i].num_mails; j++) { free(s->threads[i].mails[j].from); } free(s->threads[i].mails); } free(s->threads); s->threads = NULL; } int send_digest(struct ml *ml, int firstindex, int lastindex, int issue, const char *addr, const char *mlmmjsend) { int i, fd, archivefd, hdrfd; size_t len; text * txt; char buf[100]; char *tmp, *queuename = NULL, *archivename, *subject = NULL, *line = NULL; char *boundary; thread_list_state * tls; if (addr) { errno = 0; log_error(LOG_ARGS, "send_digest() does not support sending " "digest mails to only one recipient yet"); return -1; } if (firstindex > lastindex) return -1; do { tmp = random_str(); free(queuename); xasprintf(&queuename, "%s/queue/%s", ml->dir, tmp); free(tmp); fd = open(queuename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while ((fd < 0) && (errno == EEXIST)); if (fd < 0) { log_error(LOG_ARGS, "Could not open digest queue file '%s'", queuename); free(queuename); return -1; } hdrfd = openat(ml->ctrlfd, "customheaders", O_RDONLY); boundary = random_str(); txt = open_text_file(ml->fd, "digest"); if (txt == NULL) { log_error(LOG_ARGS, "Could not open listtext 'digest'"); goto fallback_subject; } register_default_unformatted(txt, ml); snprintf(buf, sizeof(buf), "%d", firstindex); register_unformatted(txt, "digestfirst", buf); snprintf(buf, sizeof(buf), "%d", lastindex); register_unformatted(txt, "digestlast", buf); if (lastindex == firstindex) { snprintf(buf, sizeof(buf), "%d", firstindex); } else { snprintf(buf, sizeof(buf), "%d-%d", firstindex, lastindex); } register_unformatted(txt, "digestinterval", buf); snprintf(buf, sizeof(buf), "%d", issue); register_unformatted(txt, "digestissue", buf); tls = init_thread_list(ml->dir, firstindex, lastindex); register_formatted(txt, "digestthreads", rewind_thread_list, get_thread_list_line, tls); line = get_processed_text_line(txt, true, ml); if (line == NULL) { log_error(LOG_ARGS, "No content in digest listtext"); goto fallback_subject; } tmp = line; len = 0; while (*tmp && *tmp != ':') { tmp++; len++; } if (!*tmp) { log_error(LOG_ARGS, "No subject or invalid " "subject in digest listtext"); goto fallback_subject; } tmp++; len++; if (strncasecmp(line, "Subject:", len) == 0) { tmp = unistr_utf8_to_header(tmp); xasprintf(&subject, "Subject: %s", tmp); free(tmp); /* Skip the empty line after the subject */ line = get_processed_text_line(txt, true, ml); if (line == NULL || *line != '\0') { log_error(LOG_ARGS, "Too many headers " "in digest listtext"); goto fallback_subject; } free(line); line = NULL; } else { log_error(LOG_ARGS, "No subject or invalid " "subject in digest listtext"); goto fallback_subject; } fallback_subject: if (subject == NULL) { if (lastindex == firstindex) { snprintf(buf, sizeof(buf), "%d", firstindex); } else { snprintf(buf, sizeof(buf), "%d-%d", firstindex, lastindex); } tmp = xstrdup(buf); snprintf(buf, sizeof(buf), "Digest of %s issue %d (%s)", ml->addr, issue, tmp); subject = unistr_utf8_to_header(buf); free(tmp); } if (dprintf(fd, "From: %s%shelp@%s" "\nMIME-Version: 1.0" "\nContent-Type: multipart/" DIGESTMIMETYPE "; " "boundary=%s" "\nSubject: %s\n", ml->name, ml->delim, ml->fqdn, boundary, subject) < 0) { free(subject); goto errdighdrs; } free(subject); if(hdrfd >= 0 && dumpfd2fd(hdrfd, fd) < 0) { goto errdighdrs; } close(hdrfd); hdrfd = -1; if (dprintf(fd, "\n") < 0) { errdighdrs: log_error(LOG_ARGS, "Could not write digest headers to '%s'", queuename); close(fd); unlink(queuename); free(boundary); free(queuename); if (txt != NULL) { close_text(txt); free(line); } if (hdrfd > 0) { close(hdrfd); } return -1; } if ((txt != NULL) && !statctrl(ml->ctrlfd, "nodigesttext")) { if (dprintf(fd, "\n--%s" "\nContent-Type: text/plain; charset=UTF-8" "\nContent-Transfer-Encoding: 8bit" "\n\n", boundary) < 0) { log_error(LOG_ARGS, "Could not write digest text/plain" " part headers to '%s'", queuename); close(fd); unlink(queuename); free(boundary); free(queuename); if (txt != NULL) { close_text(txt); free(line); } return -1; } for (;;) { line = get_processed_text_line(txt, false, ml); if (line == NULL) break; if(dprintf(fd, "%s\n", line) < 0) { log_error(LOG_ARGS, "Could not write" " std mail"); break; } free(line); line = NULL; } finish_thread_list(tls); close_text(txt); } else if (txt != NULL) { finish_thread_list(tls); close_text(txt); } if (line != NULL) free(line); for (i=firstindex; i<=lastindex; i++) { xasprintf(&archivename, "archive/%d", i); archivefd = openat(ml->fd, archivename, O_RDONLY); free(archivename); if (archivefd < 0) continue; if (dprintf(fd, "\n--%s" "\nContent-Type: message/rfc822" "\nContent-Disposition: inline; filename=\"%s_%s.eml\"\n\n", boundary, ml->name, buf) < 0) { log_error(LOG_ARGS, "Could not write digest part " "headers for archive index %d to " "'%s'", i, queuename); close(fd); close(archivefd); unlink(queuename); free(boundary); free(queuename); return -1; } if (dumpfd2fd(archivefd, fd) < 0) { log_error(LOG_ARGS, "Could not write digest part %d " "to '%s'", i, queuename); close(fd); close(archivefd); unlink(queuename); free(boundary); free(queuename); return -1; } close(archivefd); } if (dprintf(fd, "\n--%s--\n", boundary) < 0) { log_error(LOG_ARGS, "Could not write digest end to '%s'", queuename); close(fd); unlink(queuename); free(boundary); free(queuename); return -1; } close(fd); free(boundary); exec_and_wait(mlmmjsend, "-l", "7", "-L", ml->dir, "-m", queuename, NULL); free(queuename); return 0; } mlmmj/src/send_help.c000066400000000000000000000035261502303113500150650ustar00rootroot00000000000000/* * Copyright (C) 2003 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include "mlmmj.h" #include "send_help.h" #include "utils.h" #include "xmalloc.h" #include "send_mail.h" void send_help_noexit(struct ml *ml, const char *queuefilename, const char *emailaddr) { char *fromaddr; struct mail mail = { 0 }; gen_addr(fromaddr, ml, "bounces-help"); mail.to = emailaddr; mail.from = fromaddr; mail.fp = fopen(queuefilename, "r"); if (!send_single_mail(&mail, ml, false)) save_queue(queuefilename, &mail); else unlink(queuefilename); } void send_help(struct ml *ml, const char *queuefilename, const char *emailaddr) { send_help_noexit(ml, queuefilename, emailaddr); exit(EXIT_SUCCESS); } mlmmj/src/send_list.c000066400000000000000000000117541502303113500151120ustar00rootroot00000000000000/* * Copyright (C) 2005 Mads Martin Joergensen * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "mlmmj.h" #include "send_list.h" #include "strgen.h" #include "log_error.h" #include "chomp.h" #include "wrappers.h" #include "prepstdreply.h" #include "utils.h" #include "send_help.h" struct subs_list_state { int listfd; char *dirname; DIR *dirp; FILE *fp; int dfd; char *line; size_t linecap; bool used; }; struct subs_list_state *init_subs_list(int listfd, const char *dirname) { struct subs_list_state *s = xcalloc(1, sizeof(struct subs_list_state)); s->listfd = listfd; s->dirname = xstrdup(dirname); return s; } void rewind_subs_list(void *state) { struct subs_list_state *s = (struct subs_list_state *)state; if (s == NULL) return; if (s->dirp != NULL) closedir(s->dirp); s->dfd = openat(s->listfd, s->dirname, O_DIRECTORY|O_CLOEXEC|O_RDONLY); if (s->dfd == -1 || (s->dirp = fdopendir(s->dfd)) == NULL) log_error(LOG_ARGS, "Could not opendir(%s);\n", s->dirname); s->used = true; } const char *get_sub(void *state) { struct subs_list_state *s = (struct subs_list_state *)state; struct dirent *dp; int fd; if (s == NULL) return NULL; if (s->dirp == NULL) return NULL; if (s->line != NULL) { free(s->line); s->line = NULL; } for (;;) { if (s->fp == NULL) { dp = readdir(s->dirp); if (dp == NULL) { closedir(s->dirp); s->dirp = NULL; return NULL; } if ((strcmp(dp->d_name, "..") == 0) || (strcmp(dp->d_name, ".") == 0)) continue; fd = openat(s->dfd, dp->d_name, O_RDONLY); if(fd < 0 || (s->fp = fdopen(fd, "r")) == NULL) { log_error(LOG_ARGS, "Could not open %s/%s for reading", s->dirname, dp->d_name); continue; } } if (getline(&s->line, &s->linecap, s->fp) <= 0) { fclose(s->fp); s->fp = NULL; continue; } chomp(s->line); return (s->line); } } void finish_subs_list(struct subs_list_state *s) { if (s == NULL) return; if (s->line != NULL) free(s->line); if (s->fp != NULL) fclose(s->fp); if (s->dirp != NULL) closedir(s->dirp); free(s->dirname); free(s); } void print_subs(int fd, struct subs_list_state *s) { const char *sub; rewind_subs_list(s); while ((sub = get_sub(s)) != NULL) dprintf(fd, "%s\n", sub); } void send_list(struct ml *ml, const char *emailaddr) { text *txt; struct subs_list_state *normalsls, *digestsls, *nomailsls; char *queuefilename; int fd; normalsls = init_subs_list(ml->fd, "subscribers.d"); digestsls = init_subs_list(ml->fd, "digesters.d"); nomailsls = init_subs_list(ml->fd, "nomailsubs.d"); txt = open_text(ml->fd, "list", NULL, NULL, subtype_strs[SUB_ALL], "listsubs"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_formatted(txt, "listsubs", rewind_subs_list, get_sub, normalsls); register_formatted(txt, "normalsubs", rewind_subs_list, get_sub, normalsls); register_formatted(txt, "digestsubs", rewind_subs_list, get_sub, digestsls); register_formatted(txt, "nomailsubs", rewind_subs_list, get_sub, nomailsls); queuefilename = prepstdreply(txt, ml, "$listowner$", emailaddr, NULL); MY_ASSERT(queuefilename); close_text(txt); /* DEPRECATED */ /* Add lists manually if they weren't encountered in the list text */ if (!normalsls->used && !digestsls->used && !nomailsls->used) { fd = open(queuefilename, O_WRONLY|O_APPEND); if(fd < 0) { log_error(LOG_ARGS, "Could not open sub list mail"); exit(EXIT_FAILURE); } print_subs(fd, normalsls); dprintf(fd, "\n-- \n"); print_subs(fd, nomailsls); dprintf(fd, "\n-- \n"); print_subs(fd, digestsls); dprintf(fd, "\n-- \nend of output\n"); close(fd); } finish_subs_list(normalsls); finish_subs_list(digestsls); finish_subs_list(nomailsls); send_help(ml, queuefilename, emailaddr); } mlmmj/src/send_mail.c000066400000000000000000000312541502303113500150560ustar00rootroot00000000000000/* * Copyright (C) 2004, 2003, 2004 Mads Martin Joergensen * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include "checkwait_smtpreply.h" #include "mail-functions.h" #include "getlistdelim.h" #include "send_mail.h" #include "log_error.h" #include "init_sockfd.h" #include "mlmmj.h" #include "strgen.h" #include "tllist.h" #include "xmalloc.h" #include "ctrlvalue.h" #include "utils.h" int initsmtp(int *sockfd, const char *relayhost, unsigned short port, const char *heloname) { int retval = 0; int try_ehlo = 1; char *reply = NULL; do { init_sockfd(sockfd, relayhost, port); if(*sockfd == -1) { retval = EBADF; break; } if((reply = checkwait_smtpreply(*sockfd, MLMMJ_CONNECT)) != NULL) { log_error(LOG_ARGS, "No proper greeting to our connect" "Reply: [%s]", reply); free(reply); retval = MLMMJ_CONNECT; /* FIXME: Queue etc. */ break; } if (try_ehlo) { write_ehlo(*sockfd, heloname); if((reply = checkwait_smtpreply(*sockfd, MLMMJ_EHLO)) == NULL) { /* EHLO successful don't try more */ break; } /* RFC 1869 - 4.5. - In the case of any error response, * the client SMTP should issue either the HELO or QUIT * command. * RFC 1869 - 4.5. - If the server SMTP recognizes the * EHLO command, but the command argument is * unacceptable, it will return code 501. */ if (strncmp(reply, "501", 3) == 0) { free(reply); /* Commmand unacceptable; we choose to QUIT but * ignore any QUIT errors; return that EHLO was * the error. */ endsmtp(sockfd); retval = MLMMJ_EHLO; break; } /* RFC 1869 - 4.6. - A server SMTP that conforms to RFC * 821 but does not support the extensions specified * here will not recognize the EHLO command and will * consequently return code 500, as specified in RFC * 821. The server SMTP should stay in the same state * after returning this code (see section 4.1.1 of RFC * 821). The client SMTP may then issue either a HELO * or a QUIT command. */ if (reply[0] != '5') { free(reply); /* Server doesn't understand EHLO, but gives a * broken response. Try with new connection. */ endsmtp(sockfd); try_ehlo = 0; continue; } free(reply); /* RFC 1869 - 4.7. - Other improperly-implemented * servers will not accept a HELO command after EHLO has * been sent and rejected. In some cases, this problem * can be worked around by sending a RSET after the * failure response to EHLO, then sending the HELO. */ write_rset(*sockfd); reply = checkwait_smtpreply(*sockfd, MLMMJ_RSET); /* RFC 1869 - 4.7. - Clients that do this should be * aware that many implementations will return a failure * code (e.g., 503 Bad sequence of commands) in response * to the RSET. This code can be safely ignored. */ free(reply); /* Try HELO on the same connection */ } write_helo(*sockfd, heloname); if((reply = checkwait_smtpreply(*sockfd, MLMMJ_HELO)) == NULL) { /* EHLO successful don't try more */ break; } if (try_ehlo) { free(reply); /* We reused a connection we tried EHLO on. Maybe * that's why it failed. Try with new connection. */ endsmtp(sockfd); try_ehlo = 0; continue; } log_error(LOG_ARGS, "Error with HELO. Reply: " "[%s]", reply); free(reply); /* FIXME: quit and tell admin to configure * correctly */ retval = MLMMJ_HELO; break; } while (1); return retval; } int endsmtp(int *sockfd) { int retval = 0; char *reply = NULL; if(*sockfd == -1) return retval; write_quit(*sockfd); reply = checkwait_smtpreply(*sockfd, MLMMJ_QUIT); if(reply) { log_error(LOG_ARGS, "Mailserver would not let us QUIT. " "We close the socket anyway though. " "Mailserver reply = [%s]", reply); free(reply); retval = MLMMJ_QUIT; } close(*sockfd); *sockfd = -1; return retval; } int do_bouncemail(int listfd, int ctrlfd, const char *from) { /* expected format for the from: "something+anything--anything@anything" */ char *tofree; char *myfrom = xstrdup(from); char *listdelim = getlistdelim(ctrlfd); char *addr, *num, *c; tofree = myfrom; if((c = strchr(myfrom, '@')) == NULL) { free(myfrom); free(listdelim); return 0; /* Success when malformed 'from' */ } *c = '\0'; num = strrchr(myfrom, '-'); if (num == NULL) { free(tofree); return (0); /* Success when malformed 'from' */ } num++; c = strstr(myfrom, listdelim); if (c == NULL) { free(tofree); return (0); /* Success when malformed 'from' */ } myfrom = strchr(c, '-'); /* malformed entry with delimiter after the -num */ if (myfrom == NULL) { free(tofree); return (0); } myfrom++; if (num <= myfrom) { free(tofree); return (0); /* Success when malformed 'from' */ } addr = xstrndup(myfrom, num - myfrom - 1); free(listdelim); bouncemail(listfd, num, addr); free(tofree); free(addr); return 1; } int send_mail(int sockfd, struct mail *mail, int listfd, int ctrlfd, bool bounce) { int retval = 0; char *reply, *reply2; if(sockfd == -1) return EBADF; if (mail->to == NULL) { errno = 0; log_error(LOG_ARGS, "No 'to' address, ignoring"); return (0); } if(strchr(mail->to, '@') == NULL) { errno = 0; log_error(LOG_ARGS, "No @ in address, ignoring %s", mail->to); return 0; } if (mail->from == NULL) { errno = 0; log_error(LOG_ARGS, "No from address, ignoring"); return 0; } if (mail->fp == NULL) { errno = 0; log_error(LOG_ARGS, "No mail to send, ignoring"); return 0; } rewind(mail->fp); retval = write_mail_from(sockfd, mail->from, ""); if(retval) { log_error(LOG_ARGS, "Could not write MAIL FROM\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_FROM); if(reply) { log_error(LOG_ARGS, "Error in MAIL FROM. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_FROM; } retval = write_rcpt_to(sockfd, mail->to); if(retval) { log_error(LOG_ARGS, "Could not write RCPT TO:\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_RCPTTO); if(reply) { write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); if(bounce && ((reply[0] == '4') || (reply[0] == '5')) && (reply[1] == '5')) { free(reply); return do_bouncemail(listfd, ctrlfd, mail->from); } else { log_error(LOG_ARGS, "Error in RCPT TO. RCPT = [%s]," " Reply = [%s]", mail->from, reply); free(reply); return MLMMJ_RCPTTO; } } retval = write_data(sockfd); if(retval) { log_error(LOG_ARGS, "Could not write DATA\b"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_DATA); if(reply) { log_error(LOG_ARGS, "Error with DATA. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_DATA; } if(mail->replyto) { retval = write_replyto(sockfd, mail->replyto); if(retval) { log_error(LOG_ARGS, "Could not write reply-to addr.\n"); return retval; } } write_mailbody(sockfd, mail->fp, mail->addtohdr ? mail->to : NULL); retval = write_dot(sockfd); if(retval) { log_error(LOG_ARGS, "Could not write .\n"); return retval; } reply = checkwait_smtpreply(sockfd, MLMMJ_DOT); if(reply) { log_error(LOG_ARGS, "Mailserver did not ack end of mail.\n" ". was written, to no" "avail. Reply = [%s]", reply); free(reply); write_rset(sockfd); reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET); if (reply2 != NULL) free(reply2); return MLMMJ_DOT; } return 0; } int newsmtp(struct ml *ml, const char *rhost) { int sockfd; char *relayhost = NULL, *smtphelo; unsigned short smtpport = ctrlushort(ml->ctrlfd, "smtpport", 25); if (rhost != NULL) relayhost = xstrdup(rhost); if (relayhost == NULL) relayhost = ctrlvalue(ml->ctrlfd, "relayhost"); if (relayhost == NULL) relayhost = xstrdup(RELAYHOST); smtphelo = ctrlvalue(ml->ctrlfd, "smtphelo"); if (smtphelo == NULL) smtphelo = hostnamestr(); if (initsmtp(&sockfd, relayhost, smtpport, smtphelo) != 0) return (-1); return (sockfd); } static bool save_file(const char *name, const char *ext, const char *content) { char *tmpstr; int fd; xasprintf(&tmpstr, "%s.%s", name, ext); fd = open(tmpstr, O_WRONLY|O_CREAT|O_EXCL|O_SYNC, S_IRUSR|S_IWUSR); if (fd == -1) { free(tmpstr); return (false); } dprintf(fd, "%s", content); close(fd); free(tmpstr); return (true); } void save_queue(const char *queuefilename, struct mail *mail) { if (!save_file(queuefilename, "mailfrom", mail->from)) return; if (!save_file(queuefilename, "reciptto", mail->to)) return; if (mail->replyto != NULL) save_file(queuefilename, "reply-to", mail->replyto); } bool send_single_mail(struct mail *mail, struct ml *ml, bool bounce) { int sockfd; sockfd = newsmtp(ml, NULL); if (sockfd == -1) return (false); if (send_mail(sockfd, mail, ml->fd, ml->ctrlfd, bounce)) { endsmtp(&sockfd); return (false); } endsmtp(&sockfd); return (true); } bool requeuemail(int listfd, int index, strlist *addrs, const char *addr) { int addrfd, dfd; char *dirname; if (addrs == NULL || tll_length(*addrs) == 0) return (false); xasprintf(&dirname, "requeue/%d", index); if(mkdirat(listfd, dirname, 0750) < 0 && errno != EEXIST) { log_error(LOG_ARGS, "Could not mkdir(%s) for " "requeueing. Mail cannot " "be requeued.", dirname); free(dirname); return (false); } dfd = openat(listfd, dirname, O_DIRECTORY); addrfd = openat(dfd, "subscribers", O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR); if(addrfd < 0) { log_error(LOG_ARGS, "Could not open %s/subscribers", dirname); free(dirname); close(dfd); return (false); } free(dirname); close(dfd); /* Dump the remaining addresses. We dump the remaining before * we write the failing address to ensure the potential good * ones will be tried first when mlmmj-maintd sends out mails * that have been requeued. addrcount was so far we were */ tll_foreach(*addrs, it) { dprintf(addrfd, "%s\n", it->item); } if (addr != NULL) dprintf(addrfd, "%s\n", addr); close(addrfd); return (true); } char * get_bounce_from_adr(const char *recipient, struct ml *ml, int index) { char *bounceaddr, *myrecipient; char *a = NULL; char *staticbounceaddr, *staticbounceaddr_localpart = NULL; const char *staticbounceaddr_domain = NULL; myrecipient = xstrdup(recipient); a = strchr(myrecipient, '@'); if (a) *a = '='; staticbounceaddr = ctrlvalue(ml->ctrlfd, "staticbounceaddr"); if (staticbounceaddr) { staticbounceaddr_localpart = genlistname(staticbounceaddr); staticbounceaddr_domain = genlistfqdn(staticbounceaddr); } if (staticbounceaddr) { xasprintf(&bounceaddr, "%s%s%s-bounces-%d-%s@%s", staticbounceaddr_localpart, ml->delim, ml->name, index, myrecipient, staticbounceaddr_domain); free(staticbounceaddr); free(staticbounceaddr_localpart); } else { xasprintf(&bounceaddr, "%s%sbounces-%d-%s@%s", ml->name, ml->delim, index, myrecipient, ml->fqdn); } free(myrecipient); return bounceaddr; } int get_index_from_filename(const char *filename) { char *myfilename, *indexstr; int ret; size_t len; myfilename = xstrdup(filename); len = strlen(myfilename); if (len > 9 && (strcmp(myfilename + len - 9, "/mailfile") == 0)) { myfilename[len - 9] = '\0'; } indexstr = strrchr(myfilename, '/'); if (indexstr) { indexstr++; /* skip the slash */ } else { indexstr = myfilename; } ret = strtoim(indexstr, 0, INT_MAX, NULL); free(myfilename); return ret; } mlmmj/src/statctrl.c000066400000000000000000000030241502303113500147550ustar00rootroot00000000000000/* Copyright (C) 2004 Mads Martin Joergensen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include "xmalloc.h" #include "statctrl.h" #include "log_error.h" bool statctrl(int fd, const char *ctrlstr) { if (faccessat(fd, ctrlstr, F_OK, 0) == -1) { if(errno == ENOENT) return (false); log_error(LOG_ARGS, "Could not stat control/%s. Bailing out.", ctrlstr); exit(EXIT_FAILURE); } return (true); } mlmmj/src/strgen.c000066400000000000000000000123131502303113500144200ustar00rootroot00000000000000/* * Copyright (C) 2003 Mads Martin Joergensen * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #if defined(__APPLE__) #include #endif #include "xmalloc.h" #include "mlmmj.h" #include "strgen.h" #include "wrappers.h" #include "log_error.h" char *random_str(void) { char *dest; xasprintf(&dest, "%08x%08x", random_int(), random_int()); return dest; } char *genlistname(const char *listaddr) { const char *atsign; atsign = strchr(listaddr, '@'); MY_ASSERT(atsign); return (xstrndup(listaddr, atsign - listaddr)); } const char *genlistfqdn(const char *listaddr) { const char *atsign; atsign = strrchr(listaddr, '@'); if (atsign == NULL) return (NULL); return (atsign + 1); } char *hostnamestr(void) { struct hostent *hostlookup; char *hostname = NULL; size_t len = 512; for (;;) { len *= 2; free(hostname); hostname = xmalloc(len); hostname[len-1] = '\0'; /* gethostname() is allowed to: * a) return -1 and undefined in hostname * b) return 0 and an unterminated string in hostname * c) return 0 and a NUL-terminated string in hostname * * We keep expanding the buffer until the hostname is * NUL-terminated (and pray that it is not truncated) * or an error occurs. */ if (gethostname(hostname, len - 1)) { if (errno == ENAMETOOLONG) { continue; } free(hostname); return xstrdup("localhost"); } if (hostname[len-1] == '\0') { break; } } if (strchr(hostname, '.')) { /* hostname is FQDN */ return hostname; } if ((hostlookup = gethostbyname(hostname))) { free(hostname); return xstrdup(hostlookup->h_name); } return hostname; } char *mydirname(const char *path) { char *allocated; char *walk; if (path == NULL) return (xstrdup(".")); allocated = xstrdup(path); walk = strrchr(allocated, '/'); if (walk == NULL) { allocated[0] = '.'; allocated[1] = '\0'; } else { *walk = '\0'; } return (allocated); } const char *mybasename(const char *path) { const char *r; r = strrchr(path, '/'); if (r == NULL) return (path); return (++r); } char *genmsgid(const char *fqdn) { char *buf; xasprintf(&buf, "Message-ID: <%ld-%d-mlmmj-%08x@%s>\n", (long int)time(NULL), (int)getpid(), random_int(), fqdn); return (buf); } char *gendatestr(void) { time_t t; locale_t l = newlocale(LC_TIME_MASK, "C", NULL); struct tm lttm; char *timestr; /* 6 + 26 + ' ' + timezone which is 5 + '\n\0' == 40 */ timestr = (char *)xmalloc(40); t = time(NULL); localtime_r(&t, <tm); strftime_l(timestr, 40, "Date: %a, %d %b %Y %T %z", <tm, l); freelocale(l); return timestr; } static int hexval(int c) { if ('0' <= c && c <= '9') return (c - '0'); return (10 + c - 'A'); } static int decode_char(const char *s) { return (16 * hexval(toupper(s[1])) + hexval(toupper(s[2]))); } char * decode_qp(const char *qpstr, bool qformat) { char *buffer = NULL; size_t size = 0; FILE *bufp; bufp = open_memstream(&buffer, &size); while (*qpstr) { switch (*qpstr) { case '=': if (strlen(qpstr) < 2) { fputc(*qpstr, bufp); break; } if (qpstr[1] == '\r' && qpstr[2] == '\n') { qpstr += 2; break; } if (qpstr[1] == '\n') { qpstr++; break; } if (strchr("0123456789ABCDEFabcdef", qpstr[1]) == NULL) { fputc(*qpstr, bufp); break; } if (strchr("0123456789ABCDEFabcdef", qpstr[2]) == NULL) { fputc(*qpstr, bufp); break; } fputc(decode_char(qpstr), bufp); qpstr += 2; break; case '_': if (qformat) { fputc(0x20, bufp); break; } /* FALLTHROUGH */ default: fputc(*qpstr, bufp); break; } qpstr++; } fclose(bufp); return (buffer); } bool splitlistaddr(const char *listaddr, char **listname, const char **listfqdn) { char *allocated, *walk; allocated = xstrdup(listaddr); walk = strchr(allocated, '@'); if (walk == NULL) { free(allocated); return (false); } *walk = '\0'; walk++; *listname = allocated; *listfqdn = walk; return (true); } mlmmj/src/subscriberfuncs.c000066400000000000000000000440621502303113500163260ustar00rootroot00000000000000/* * Copyright (C) 2003 Mads Martin Joergensen * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "subscriberfuncs.h" #include "log_error.h" #include "chomp.h" #include "utils.h" #include "prepstdreply.h" #include "xmalloc.h" #include "send_mail.h" #include "strgen.h" #include "send_help.h" #include "statctrl.h" #include "xstring.h" #include "ctrlvalues.h" char *subtype_strs[] = { "normal", "digest", "nomail", "file", "all", "both", "none" }; char * subreason_strs[] = { "request", "confirm", "permit", "admin", "bouncing", "switch" }; char *subtypes[] = { "SUB_NORMAL", "SUB_DIGEST", "SUB_NOMAIL", NULL, NULL, "SUB_BOTH", NULL, }; bool find_subscriber(int fd, const char *address) { FILE *f; char *line = NULL; size_t linecap = 0; bool ret = false; f = fdopen(fd, "r"); while (getline(&line, &linecap, f) > 0) { chomp(line); if (strcasecmp(address, line) == 0) { ret = true; break; } } free(line); fclose(f); return (ret); } int is_subbed_in(int dirfd, const char *subdirname, const char *address) { int subread; DIR *subddir; struct dirent *dp; bool ret = false; if((subddir = fdopendir(dirfd)) == NULL) { log_error(LOG_ARGS, "Could not opendir(%s)", subdirname); exit(EXIT_FAILURE); } while((dp = readdir(subddir)) != NULL) { if(!strcmp(dp->d_name, ".")) continue; if(!strcmp(dp->d_name, "..")) continue; subread = openat(dirfd, dp->d_name, O_RDONLY); if(subread < 0) { log_error(LOG_ARGS, "Could not open %s/%s", subdirname, dp->d_name); continue; } ret = find_subscriber(subread, address); if (ret) break; } closedir(subddir); return ret; } enum subtype is_subbed(int listfd, const char *address, bool both) { enum subtype typesub = SUB_NONE; int fd; fd = openat(listfd, "subscribers.d", O_DIRECTORY|O_RDONLY); if (fd != -1 && is_subbed_in(fd, "subscribers.d", address)) { if (!both) return SUB_NORMAL; typesub = SUB_NORMAL; } fd = openat(listfd, "digesters.d", O_DIRECTORY|O_RDONLY); if (fd != -1 && is_subbed_in(fd, "digesters.d", address)) { if (typesub == SUB_NORMAL) return SUB_BOTH; return SUB_DIGEST; } fd = openat(listfd, "nomailsubs.d", O_DIRECTORY|O_RDONLY); if (fd != -1 && is_subbed_in(fd, "nomailsubs.d", address)) return SUB_NOMAIL; return (typesub); } char * get_subcookie_content(int listfd, bool unsub, const char *param) { int dfd, fd; char *line = NULL; dfd = openat(listfd, unsub ? "unsubconf" : "subconf", O_DIRECTORY|O_CLOEXEC); if (dfd == -1) { log_error(LOG_ARGS, "Cannot open %ssubconf Ignoring mail", unsub ? "un" : ""); return (NULL); } fd = openat(dfd, param, O_RDONLY); if (fd == -1) { close(dfd); return (NULL); } line = readlf(fd, true); if (line != NULL) unlinkat(dfd, param, 0); close(dfd); return (line); } void notify_sub(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub) { char *tostr; text *txt; char *queuefilename = NULL; const char *listtext = NULL; gen_addr(tostr, ml, "owner"); switch(typesub) { default: case SUB_NORMAL: listtext = sub ? "notifysub" : "notifyunsub"; break; case SUB_DIGEST: listtext = sub ? "notifysub-digest": "notifyunsub-digest"; break; case SUB_NOMAIL: listtext = sub ? "notifysub-nomail": "notifyunsub-nomail"; break; case SUB_BOTH: /* No legacy list text as feature didn't exist. */ listtext = "notifysub"; break; } txt = open_text(ml->fd, "notify", sub? "sub":"unsub", subreason_strs[reasonsub], subtype_strs[typesub], listtext); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); queuefilename = prepstdreply(txt, ml, "$listowner$", "$listowner$", NULL); MY_ASSERT(queuefilename); close_text(txt); send_help(ml, queuefilename, tostr); exit(EXIT_SUCCESS); } void generate_subscription(struct ml *ml, const char *subaddr, enum subtype typesub, bool sub) { text *txt; char *queuefilename; txt = open_text(ml->fd, "deny", sub ? "sub" : "unsub", sub ? "subbed" : "unsubbed", subtype_strs[typesub], sub ? "sub-subscribed" : "unsub-notsubscribed"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); queuefilename = prepstdreply(txt, ml, "$helpaddr$", subaddr, NULL); MY_ASSERT(queuefilename); close_text(txt); send_help(ml, queuefilename, subaddr); } void generate_subconfirm(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub) { int subconffd; text *txt; char *queuefilename = NULL, *fromaddr; char *randomstr = NULL, *confirmaddr; const char *tmpstr, *listtext; int fd = openat(ml->fd, sub ? "subconf" : "unsubconf", O_DIRECTORY|O_CLOEXEC); struct mail mail = { 0 }; if (fd == -1) { log_error(LOG_ARGS, "Cound not open(%s/%s)", ml->dir, sub ? "subconf" : "unsubconf"); exit(EXIT_FAILURE); } do { free(randomstr); randomstr = random_str(); subconffd = openat(fd, randomstr, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } while ((subconffd < 0) && (errno == EEXIST)); if(subconffd < 0) { log_error(LOG_ARGS, "Could not open '%s/%s/%s'", ml->dir, sub ? "subconf" : "unsubconf", randomstr); free(randomstr); exit(EXIT_FAILURE); } dprintf(subconffd, "%s", subaddr); close(subconffd); gen_addr_cookie(fromaddr, ml, sub ? "bounces-confsub-" : "bounces-confunsub-", randomstr); switch(typesub) { default: case SUB_NORMAL: listtext = sub ? "sub-confirm" : "unsub-confirm"; tmpstr = sub ? "confsub-" : "confunsub-"; break; case SUB_DIGEST: listtext = sub ? "sub-confirm-digest" : "unsub-confirm-digest"; tmpstr = sub ? "confsub-digest-" : "confunsub-digest-"; break; case SUB_NOMAIL: listtext = sub ? "sub-confirm-nomail" : "unsub-confirm-nomail"; tmpstr = sub ? "confsub-nomail-" : "confunsub-nomail-"; break; case SUB_BOTH: /* No legacy list text as feature didn't exist. */ listtext = sub ? "sub-confirm" : "unsub-confirm"; tmpstr = sub ? "confsub-both-" : "confunsub-both-"; break; } gen_addr_cookie(confirmaddr, ml, tmpstr, randomstr); free(randomstr); txt = open_text(ml->fd, "confirm", sub ? "sub" : "unsub", subreason_strs[reasonsub], subtype_strs[typesub], listtext); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); register_unformatted(txt, "confirmaddr", confirmaddr); queuefilename = prepstdreply(txt, ml, "$helpaddr$", subaddr, confirmaddr); MY_ASSERT(queuefilename); close_text(txt); mail.to = subaddr; mail.from = fromaddr; mail.fp = fopen(queuefilename, "r"); if (!send_single_mail(&mail, ml, false)) save_queue(queuefilename, &mail); else unlink(queuefilename); exit(EXIT_SUCCESS); } void send_confirmation_mail(struct ml *ml, const char *subaddr, enum subtype typesub, enum subreason reasonsub, bool sub) { text *txt; char *queuefilename; const char *listtext; switch(typesub) { default: case SUB_BOTH: /* FALLTHROUGH */ case SUB_NORMAL: listtext = sub ? "sub-ok" : "unsub-ok"; break; case SUB_DIGEST: listtext = sub ? "sub-ok-digest" : "unsub-ok-digest"; break; case SUB_NOMAIL: listtext = sub ? "sub-ok-nomail" : "unsub-ok-nomail"; break; } txt = open_text(ml->fd, "finish", sub ? "sub" : "unsub", subreason_strs[reasonsub], subtype_strs[typesub], listtext); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); queuefilename = prepstdreply(txt, ml, "$helpaddr$", subaddr, NULL); MY_ASSERT(queuefilename); close_text(txt); send_help_noexit(ml, queuefilename, subaddr); } bool do_unsubscribe(struct ml *ml, const char *addr, enum subtype typesub, enum subreason reasonsub, bool inform_not_subscribed, bool confirm_unsubscription, bool quiet, bool send_goodbye_mail) { char *address; bool subscribed = false; address = lowercase(addr); if (typesub == SUB_ALL) { subscribed = is_subbed(ml->fd, address, false) != SUB_NONE; } else { const char *subdir; int fd = open_subscriber_directory(ml->fd, typesub, &subdir); if (fd == -1) { log_error(LOG_ARGS, "Could not opendir(%s/%s)", ml->dir, subdir); free(address); return (false); } subscribed = is_subbed_in(fd, subdir, address); close(fd); } if (!subscribed) { if (inform_not_subscribed) generate_subscription(ml, address, typesub, false); free(address); return (true); } if (confirm_unsubscription) generate_subconfirm(ml, address, typesub, reasonsub, false); unsubscribe(ml->fd, address, typesub); if (send_goodbye_mail) send_confirmation_mail(ml, address, typesub, reasonsub, false); /* Notify list owner about subscription */ if (!quiet && statctrl(ml->ctrlfd, "notifysub")) notify_sub(ml, address, typesub, reasonsub, false); free(address); return (true); } void mod_get_addr_and_type(struct ml *ml, const char *modstr, char **addrptr, enum subtype *subtypeptr) { int fd, dfd; char *readtype, *modfilename = NULL; char *buf, *walk; size_t i; if (strncmp(modstr, "subscribe", 9) == 0) modstr += 9; dfd = openat(ml->fd, "moderation/subscribe", O_DIRECTORY); if (dfd != -1) { fd = openat(dfd, modstr, O_RDONLY); } if (dfd == -1 || fd == -1) { xasprintf(&modfilename, "moderation/subscribe%s", modstr); fd = openat(ml->fd, modfilename, O_RDONLY); } if(fd < 0) { log_error(LOG_ARGS, "Could not open " "%s/moderation/subscribe/%s nor %s/%s", ml->dir, modstr, ml->dir, modfilename); exit(EXIT_FAILURE); } walk = buf = readlf(fd, false); if (buf == NULL) { if (modfilename == NULL) log_error(LOG_ARGS, "Invalid %s/moderation/subscribe/%s", ml->dir, modstr); else log_error(LOG_ARGS, "Invalid %s/%s", ml->dir, modfilename); exit(EXIT_FAILURE); } *addrptr = xstrdup(strsep(&walk, "\n")); readtype = strsep(&walk, "\n"); for (i = 0; i < NELEM(subtypes); i++) { if (subtypes[i] == NULL) continue; if (strcmp(subtypes[i], readtype) == 0) { *subtypeptr = i; break; } } if (i == NELEM(subtypes)) { log_error(LOG_ARGS, "Type %s not valid in %s/%s", readtype, ml->dir, modfilename); exit(EXIT_FAILURE); } free(buf); if (modfilename != NULL) unlinkat(ml->fd, modfilename, 0); else unlinkat(dfd, modstr, 0); if (dfd != -1) close(dfd); free(modfilename); } static void moderate_sub(struct ml *ml, const char *subaddr, struct subscription *sub) { int fd, status; text *txt; memory_lines_state *mls; char *a = NULL, *queuefilename, *from; char *modfilename, *mods, *to, *replyto, *moderators = NULL; char *cookie, *obstruct; strlist *submods; const char *type; pid_t childpid, pid; xstring *str = NULL; int modfd = -1; type = subtypes[sub->typesub]; for (;;) { cookie = random_str(); xasprintf(&modfilename, "moderation/subscribe%s", cookie); fd = openat(ml->fd, modfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); if (fd < 0) { if (errno == EEXIST) { free(cookie); free(modfilename); continue; } log_error(LOG_ARGS, "could not create %s" "ignoring request for: %s", subaddr); exit(EXIT_FAILURE); } break; } if (dprintf(fd, "%s\n%s\n", subaddr, type) < 0) { log_error(LOG_ARGS, "could not write to %s" "ignoring request for: %s", subaddr); exit(EXIT_FAILURE); } close(fd); submods = ctrlvalues(ml->ctrlfd, "submod"); if (submods == NULL) return; /* check to see if there's adresses in the submod control file */ tll_foreach(*submods, it) a = strchr(it->item, '@'); /* no addresses in submod control file, use owner */ if(a == NULL) { /* free the submods struct from above */ tll_free_and_free(*submods, free); free(submods); submods = ctrlvalues(ml->ctrlfd, "owner"); modfd = openat(ml->ctrlfd, "owner", O_RDONLY); } if (modfd == -1) modfd = openat(ml->ctrlfd, "submod", O_RDONLY); gen_addr(from, ml, "owner"); xasprintf(&to, "%s-moderators@%s", ml->name, ml->fqdn); gen_addr_cookie(replyto, ml, "permit-", cookie); gen_addr_cookie(obstruct, ml, "obstruct-", cookie); free(cookie); tll_foreach(*submods, sm) { if (str == NULL) str = xstring_new(); fprintf(str->fp, "%s\n", sm->item); } moderators = xstring_get(str); mls = init_memory_lines(moderators); free(moderators); txt = open_text(ml->fd, "gatekeep", "sub", subreason_strs[sub->reasonsub], subtype_strs[sub->typesub], "submod-moderator"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); register_unformatted(txt, "permitaddr", replyto); register_unformatted(txt, "obstructaddr", obstruct); register_formatted(txt, "gatekeepers", rewind_memory_lines, get_memory_line, mls); queuefilename = prepstdreply(txt, ml, "$listowner$", to, replyto); MY_ASSERT(queuefilename); close_text(txt); /* we might need to exec more than one mlmmj-send */ if (statctrl(ml->ctrlfd, "nosubmodmails")) childpid = -1; else { childpid = fork(); if(childpid < 0) log_error(LOG_ARGS, "Could not fork; requester not notified"); } if(childpid != 0) { if(childpid > 0) { do /* Parent waits for the child */ pid = waitpid(childpid, &status, 0); while(pid == -1 && errno == EINTR); } finish_memory_lines(mls); xasprintf(&mods, "%d", modfd); execl(sub->mlmmjsend, sub->mlmmjsend, "-a", "-l", "4", "-L", ml->dir, "-s", mods, "-F", from, "-R", replyto, "-m", queuefilename, (char *)NULL); log_error(LOG_ARGS, "execl() of '%s' failed", sub->mlmmjsend); exit(EXIT_FAILURE); } free(to); free(replyto); /* send mail to requester that the list is submod'ed */ txt = open_text(ml->fd, "wait", "sub", subreason_strs[sub->reasonsub], subtype_strs[sub->typesub], "submod-requester"); MY_ASSERT(txt); register_default_unformatted(txt, ml); register_unformatted(txt, "subaddr", subaddr); register_formatted(txt, "gatekeepers", rewind_memory_lines, get_memory_line, mls); queuefilename = prepstdreply(txt, ml, "$listowner$", subaddr, NULL); MY_ASSERT(queuefilename); close_text(txt); finish_memory_lines(mls); send_help(ml, queuefilename, subaddr); } static void subscribe_type(int listfd, char *address, enum subtype typesub) { int dirfd;; char chstr[2]; const char *subdir; int groupwritable = 0, subfilefd; struct stat st; dirfd = open_subscriber_directory(listfd, typesub, &subdir); if (dirfd == -1) err(EXIT_FAILURE, "cannot open(%s)", subdir); if (fstat(dirfd, &st) == 0) { if(st.st_mode & S_IWGRP) { groupwritable = S_IRGRP|S_IWGRP; umask(S_IWOTH); setgid(st.st_gid); } } chstr[0] = address[0]; chstr[1] = '\0'; subfilefd = openat(dirfd, chstr, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|groupwritable); if(subfilefd == -1 && !lock(subfilefd, true)) { log_error(LOG_ARGS, "Could not open '%s/%s'", subdir, chstr); exit(EXIT_FAILURE); } dprintf(subfilefd, "%s\n", address); close(dirfd); close(subfilefd); } bool do_subscribe(struct ml *ml, struct subscription *sub, const char *addr) { char *address = NULL; enum subtype subbed; if (addr != NULL) address = lowercase(addr); if (sub->modstr != NULL) { mod_get_addr_and_type(ml, sub->modstr, &address, &sub->typesub); sub->reasonsub = SUB_PERMIT; } if (address == NULL) errx(EXIT_FAILURE, "No address to subscribe found"); if(strncasecmp(ml->addr, address, strlen(ml->addr)) == 0) errx(EXIT_FAILURE, "Cannot subscribe the list address to the list"); subbed = is_subbed(ml->fd, address, 1); if (subbed == sub->typesub) { if (sub->gensubscribed) generate_subscription(ml, address, sub->typesub, true); free(address); return (true); } if (subbed != SUB_NONE) { sub->reasonsub = SUB_SWITCH; /* If we want to subscribe to both, we can just subscribe the * missing version, so don't unsub-> */ if (!(sub->typesub == SUB_BOTH && subbed != SUB_NOMAIL)) { enum subtype ts = SUB_ALL; if (subbed == SUB_BOTH) { if (sub->typesub == SUB_NORMAL) ts = SUB_DIGEST; if (sub->typesub == SUB_DIGEST) ts = SUB_NORMAL; } if (!unsubscribe(ml->fd, address, ts)) log_error(LOG_ARGS, "not unsubscribed from " "current version"); } } if (subbed == SUB_NONE && sub->subconfirm) generate_subconfirm(ml, address, sub->typesub, sub->reasonsub, true); if(sub->modstr == NULL && subbed == SUB_NONE && !sub->force && statctrl(ml->ctrlfd, "submod")) { moderate_sub(ml, address, sub); } if (sub->typesub == SUB_BOTH) { if (subbed != SUB_NORMAL) { subscribe_type(ml->fd, address, SUB_NORMAL); } if (subbed != SUB_DIGEST) { subscribe_type(ml->fd, address, SUB_DIGEST); } } else if (!(subbed == SUB_BOTH && sub->typesub != SUB_NOMAIL)) { subscribe_type(ml->fd, address, sub->typesub); } if (sub->send_welcome_email) send_confirmation_mail(ml, address, sub->typesub, sub->reasonsub, true); bool notifysub = !sub->quiet && sub->reasonsub != SUB_SWITCH && statctrl(ml->ctrlfd, "notifysub"); /* Notify list owner about subscription */ if (notifysub) notify_sub(ml, address, sub->typesub, sub->reasonsub, true); free(address); return (true); } mlmmj/src/unistr.c000066400000000000000000000331501502303113500144440ustar00rootroot00000000000000/* Copyright (C) 2005 Morten K. Poulsen * * $Id$ * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include "mlmmj.h" #include "xmalloc.h" #include "unistr.h" #include "strgen.h" #include "log_error.h" /* This is allocated on the stack, so it can't be too big. */ #define ICONV_BUFFER_SIZE 160 unistr *unistr_new(void) { unistr *ret; ret = xmalloc(sizeof(unistr)); ret->len = 0; ret->alloc_len = 64; ret->chars = xmalloc(ret->alloc_len * sizeof(unistr_char)); return ret; } void unistr_free(unistr *str) { if (!str) return; free(str->chars); free(str); } void unistr_append_char(unistr *str, unistr_char uc) { if (str->len >= str->alloc_len) { str->alloc_len *= 2; str->chars = xrealloc(str->chars, str->alloc_len * sizeof(unistr_char)); } str->chars[str->len++] = uc; } void unistr_append_usascii(unistr *str, const char *binary, size_t bin_len) { unsigned int i; for (i=0; i 0x7F) { unistr_append_char(str, '?'); } else { unistr_append_char(str, (unsigned char)binary[i]); } } } void unistr_append_utf8(unistr *str, const char *binary, size_t bin_len) { unsigned int i, j; unistr_char ch; unsigned char *bin = (unsigned char *)binary; for (i=0; i0; j--) { i++; ch <<= 6; if ((bin[i] & 192) != 128) { /* invalid byte sequence */ ch = '?'; break; } ch |= bin[i] & 63; } unistr_append_char(str, ch); } } } void unistr_append_iso88591(unistr *str, const char *binary, size_t bin_len) { unsigned int i; for (i=0; i 0) { buffer = bytes; bufferleft = ICONV_BUFFER_SIZE; if (iconv(cd, &binary, &bin_len, &buffer, &bufferleft) == (size_t)-1) { if (errno == EILSEQ) { /* illegal sequence; try to recover */ unistr_append_utf8(str, bytes, ICONV_BUFFER_SIZE - bufferleft); unistr_append_usascii(str, "?", 1); bin_len--; binary++; continue; } else if (errno == EINVAL) { /* incomplete sequence; we're done */ unistr_append_usascii(str, "?", 1); break; } else if (errno != E2BIG) { /* some other error; abort */ unistr_append_usascii(str, "???", 1); break; } } /* success or buffer full */ unistr_append_utf8(str, bytes, ICONV_BUFFER_SIZE - bufferleft); } iconv_close(cd); } char *unistr_to_utf8(const unistr *str) { unsigned int i; size_t len = 0; char *ret; char *p; for (i=0; ilen; i++) { if (str->chars[i] <= 0x7F) { len++; } else if (str->chars[i] <= 0x7FF) { len += 2; } else if (str->chars[i] <= 0xFFFF) { len += 3; } else if (str->chars[i] <= 0x1FFFFF) { len += 4; } else if (str->chars[i] <= 0x3FFFFFF) { len += 5; } else if (str->chars[i] <= 0x7FFFFFFF) { len += 6; } else { errno = 0; log_error(LOG_ARGS, "unistr_to_utf8(): can not utf-8 encode" "U+%04X", str->chars[i]); return xstrdup(""); } } len++; /* NUL */ ret = xmalloc(len); p = ret; for (i=0; ilen; i++) { if (str->chars[i] <= 0x7F) { /* 1 */ *(p++) = str->chars[i]; } else if (str->chars[i] <= 0x7FF) { /* 2 */ *(p++) = 192 + ((str->chars[i] & 1984) >> 6); *(p++) = 128 + (str->chars[i] & 63); } else if (str->chars[i] <= 0xFFFF) { /* 3 */ *(p++) = 224 + ((str->chars[i] & 61440) >> 12); *(p++) = 128 + ((str->chars[i] & 4032) >> 6); *(p++) = 128 + (str->chars[i] & 63); } else if (str->chars[i] <= 0x1FFFFF) { /* 4 */ *(p++) = 240 + ((str->chars[i] & 1835008) >> 18); *(p++) = 128 + ((str->chars[i] & 258048) >> 12); *(p++) = 128 + ((str->chars[i] & 4032) >> 6); *(p++) = 128 + (str->chars[i] & 63); } else if (str->chars[i] <= 0x3FFFFFF) { /* 5 */ *(p++) = 248 + ((str->chars[i] & 50331648) >> 24); *(p++) = 128 + ((str->chars[i] & 16515072) >> 18); *(p++) = 128 + ((str->chars[i] & 258048) >> 12); *(p++) = 128 + ((str->chars[i] & 4032) >> 6); *(p++) = 128 + (str->chars[i] & 63); } else if (str->chars[i] <= 0x7FFFFFFF) { /* 6 */ *(p++) = 252 + ((str->chars[i] & 1073741824) >> 30); *(p++) = 128 + ((str->chars[i] & 1056964608) >> 24); *(p++) = 128 + ((str->chars[i] & 16515072) >> 18); *(p++) = 128 + ((str->chars[i] & 258048) >> 12); *(p++) = 128 + ((str->chars[i] & 4032) >> 6); *(p++) = 128 + (str->chars[i] & 63); } else { errno = 0; log_error(LOG_ARGS, "unistr_to_utf8(): can not utf-8 encode" "U+%04X", str->chars[i]); } } *(p++) = '\0'; return ret; } static void decode_quoted_print(char *str, char **binary, size_t *bin_len) { *binary = decode_qp(str, true); *bin_len = strlen(*binary); } static void decode_base64(char *str, char **binary, size_t *bin_len) { int tab[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; size_t len; unsigned int i; unsigned int out; int out_numbits; int val; /* decoded string will never be longer, and we don't include a NUL */ len = strlen(str); *binary = xmalloc(len); *bin_len = 0; out = 0; out_numbits = 0; for (i=0; i= 8) { (*binary)[(*bin_len)++] = (out >> (out_numbits - 8)) & 255; out_numbits -= 8; } } } /* wsp, if not NULL, is an earlier offset into the same string as word, * to whitespace that should only be included if word is not encoded. */ static int header_decode_word(char *wsp, char *word, unistr *ret) { char *my_word; char *charset, *encoding, *string, *end; char *binary; size_t bin_len; if (wsp == NULL) wsp = word; if ((word[0] != '=') || (word[1] != '?')) { unistr_append_usascii(ret, wsp, strlen(wsp)); return 0; } my_word = xstrdup(word); charset = my_word + 2; if ((encoding = strchr(charset, '?')) == NULL) { /* missing encoding */ unistr_append_usascii(ret, wsp, word-wsp); unistr_append_usascii(ret, "???", 3); free(my_word); return 0; } *(encoding++) = '\0'; if ((string = strchr(encoding, '?')) == NULL) { /* missing string */ unistr_append_usascii(ret, wsp, word-wsp); unistr_append_usascii(ret, "???", 3); free(my_word); return 0; } *(string++) = '\0'; if ((end = strchr(string, '?')) == NULL) { /* missing end */ unistr_append_usascii(ret, wsp, word-wsp); unistr_append_usascii(ret, "???", 3); free(my_word); return 0; } *(end++) = '\0'; if ((end[0] != '=') || (end[1] != '\0')) { /* broken end */ unistr_append_usascii(ret, wsp, word-wsp); unistr_append_usascii(ret, "???", 3); free(my_word); return 0; } if (tolower(encoding[0]) == 'q') { decode_quoted_print(string, &binary, &bin_len); } else if (tolower(encoding[0]) == 'b') { decode_base64(string, &binary, &bin_len); } else { /* unknown encoding */ unistr_append_usascii(ret, wsp, word-wsp); unistr_append_usascii(ret, "???", 3); free(my_word); return 0; } if (strcasecmp(charset, "us-ascii") == 0) { unistr_append_usascii(ret, binary, bin_len); } else if (strcasecmp(charset, "utf-8") == 0) { unistr_append_utf8(ret, binary, bin_len); } else if (strcasecmp(charset, "iso-8859-1") == 0) { unistr_append_iso88591(ret, binary, bin_len); } else { unistr_append_iconv(ret, binary, bin_len, charset); } free(my_word); free(binary); return 1; } /* IN: " =?iso-8859-1?Q?hyggem=F8de?= torsdag " * OUT: "hyggem\xC3\xB8de torsdag" */ char *unistr_header_to_utf8(const char *str) { char *my_str; char *word; char *p; char c; char *wsp = NULL; int decoded = 0; unistr *us; char *ret; my_str = xstrdup(str); us = unistr_new(); p = my_str + strspn(my_str, " \t\n"); wsp = p; while (*p) { if (!decoded) { unistr_append_usascii(us, wsp, p-wsp); wsp = NULL; } word = p; p += strcspn(p, " \t\n"); c = *p; *p = '\0'; decoded = header_decode_word(wsp, word, us); *p = c; wsp = p; p += strspn(p, " \t\n"); } free(my_str); ret = unistr_to_utf8(us); unistr_free(us); return ret; } static int is_ok_in_header(char ch) { if ((ch >= 'a') && (ch <= 'z')) return 1; if ((ch >= 'A') && (ch <= 'Z')) return 1; if ((ch >= '0') && (ch <= '9')) return 1; if (ch == '.') return 1; if (ch == ',') return 1; if (ch == ':') return 1; if (ch == ';') return 1; if (ch == '-') return 1; if (ch == ' ') return 1; return 0; } /* IN: " hyggem\xC3\xB8de torsdag " * OUT: "=?utf-8?Q?hyggem=C3=B8de_torsdag?=" */ char *unistr_utf8_to_header(const char *str) { unistr *us; char *my_str; char *ret; char *wsp = NULL; char *p; int clean; char buf[4]; my_str = xstrdup(str); /* trim whitespace and see if the header is clean */ ret = my_str + strspn(my_str, " \t\n"); clean = 1; for (p=ret; *p; p++) { if (*p == ' ' || *p == '\t' || *p == '\n') { if (wsp == NULL) wsp = p; } else { wsp = NULL; } if (clean && !is_ok_in_header(*p)) clean = 0; } if (wsp != NULL) *wsp = '\0'; if (clean) { ret = xstrdup(ret); free(my_str); return ret; } us = unistr_new(); unistr_append_usascii(us, "=?utf-8?q?", 10); for (p=ret; *p; p++) { if (*p == 0x20) { unistr_append_char(us, '_'); } else if (is_ok_in_header(*p)) { unistr_append_char(us, *p); } else { snprintf(buf, sizeof(buf), "=%02X", (unsigned char)*p); unistr_append_usascii(us, buf, 3); } } unistr_append_usascii(us, "?=", 2); ret = unistr_to_utf8(us); unistr_free(us); free(my_str); return ret; } /* IN: "hyggem\\u00F8de torsdag" * OUT: "hyggem\xC3\xB8de torsdag" */ char *unistr_escaped_to_utf8(const char *str) { unistr_char ch; unistr *us; char *ret; char u[5]; int len; int skip = 0; us = unistr_new(); while (*str) { if (*str == '\\') { str++; if (*str == 'u' && !skip) { str++; if (!isxdigit(str[0]) || !isxdigit(str[1]) || !isxdigit(str[2]) || !isxdigit(str[3])) { unistr_append_char(us, '?'); continue; } u[0] = *str++; u[1] = *str++; u[2] = *str++; u[3] = *str++; u[4] = '\0'; ch = strtol(u, NULL, 16); unistr_append_char(us, ch); continue; } else { unistr_append_char(us, '\\'); /* Avoid processing the second backslash of a * double-backslash; but if this was a such a * one, go back to normal */ skip = !skip; continue; } } else { u[0] = *str; len = 1; str++; while (*str && (unsigned char)u[0] > 0x7F) { u[0] = *str; len++; str++; } unistr_append_utf8(us, str - len, len); } } ret = unistr_to_utf8(us); unistr_free(us); return ret; } mlmmj/src/utils.c000066400000000000000000000153171502303113500142650ustar00rootroot00000000000000/* * Copyright (C) 2021-2022 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "utils.h" #include "getlistdelim.h" #include "chomp.h" extern char **environ; intmax_t strtoim(const char *np, intmax_t minval, intmax_t maxval, const char **errpp) { char *endp; intmax_t ret; if (errpp != NULL) *errpp = NULL; if (minval > maxval || np == NULL) { errno = EINVAL; if (errpp != NULL) *errpp = "invalid"; return (0); } errno = 0; ret = strtoimax(np, &endp, 10); if (endp == np || *endp != '\0') { errno = EINVAL; if (errpp != NULL) *errpp = "invalid"; return (0); } if (ret < minval) { errno = ERANGE; if (errpp != NULL) *errpp = "too small"; return (0); } if (errno == ERANGE || ret > maxval) { errno = ERANGE; if (errpp != NULL) *errpp = "too large"; return (0); } return (ret); } time_t strtotimet(const char *np, const char **errpp) { if (sizeof(time_t) == 4) return ((time_t)strtoim(np, INT_MIN, INT_MAX, errpp)); return ((time_t)strtoim(np, LLONG_MIN, LLONG_MAX, errpp)); } uintmax_t strtouim(const char *np, uintmax_t minval, uintmax_t maxval, const char **errpp) { char *endp; uintmax_t ret; if (errpp != NULL) *errpp = NULL; if (minval > maxval || np == NULL) { errno = EINVAL; if (errpp != NULL) *errpp = "invalid"; return (0); } errno = 0; ret = strtoumax(np, &endp, 10); if (endp == np || *endp != '\0') { errno = EINVAL; if (errpp != NULL) *errpp = "invalid"; return (0); } if (ret < minval) { errno = ERANGE; if (errpp != NULL) *errpp = "too small"; return (0); } if (errno == ERANGE || ret > maxval) { errno = ERANGE; if (errpp != NULL) *errpp = "too large"; return (0); } return (ret); } char * lowercase(const char *address) { char *loweraddress; int i = 0; loweraddress = xstrdup(address); while (loweraddress[i] != '\0') { loweraddress[i] = tolower(loweraddress[i]); i++; } return (loweraddress); } void exec_or_die(const char *arg, ...) { va_list ap; const char **argv; int n; va_start(ap, arg); n = 1; while (va_arg(ap, char *) != NULL) n++; va_end(ap); argv = xmalloc((n +1) * sizeof(argv)); va_start(ap, arg); argv[0] = arg; n = 1; while ((argv[n] = va_arg(ap, char *)) != NULL) n++; va_end(ap); execvp(argv[0], (char *const *)argv); err(EXIT_FAILURE, "Execution failed for '%s'", argv[0]); } int exec_and_wait(const char *arg, ...) { va_list ap; const char **argv; int n; pid_t p; int pstat; va_start(ap, arg); n = 1; while (va_arg(ap, char *) != NULL) n++; va_end(ap); argv = xmalloc((n +1) * sizeof(argv)); va_start(ap, arg); argv[0] = arg; n = 1; while ((argv[n] = va_arg(ap, char *)) != NULL) n++; va_end(ap); if (0 != posix_spawnp(&p, argv[0], NULL, NULL, (char *const *) argv, environ)) { warn("Execution failed for '%s'", argv[0]); free(argv); return (-1); } while (waitpid(p, &pstat, 0) == -1) { if (errno != EINTR) warn("Could not wait for the execution of '%s'", argv[0]); free(argv); return (-1); } free(argv); return (WEXITSTATUS(pstat)); } bool lock(int fd, bool wr) { struct flock lck; int r; if (fd == -1) return (false); lck.l_type = wr ? F_WRLCK : F_RDLCK; lck.l_whence = SEEK_SET; lck.l_start = 0; lck.l_len = 0; int i = 0; do { i++; if (i == 2) { warn("plop"); exit(1); } r = fcntl(fd, F_SETLKW, &lck); } while (r < 0 && errno != EINTR); if (r == -1) { close(fd); return (false); } return (true); } char * get_recipextra_from_env(int ctrlfd) { const char *envstr; char *listdelim, *recipextra; /* address extension (the "foo" part of "user+foo@domain.tld") */ /* qmail */ if((envstr = getenv("DEFAULT")) != NULL) return (xstrdup(envstr)); /* postfix */ if((envstr = getenv("EXTENSION")) != NULL) return (xstrdup(envstr)); /* exim */ if ((envstr = getenv("LOCAL_PART_SUFFIX")) != NULL) { listdelim = getlistdelim(ctrlfd); if (strncmp(envstr, listdelim, strlen(listdelim)) == 0) recipextra = xstrdup(envstr + strlen(listdelim)); else recipextra = xstrdup(envstr); return (recipextra); } return (NULL); } bool addrmatch(const char *listaddr, const char *addr, const char *listdelim, char **recipextra) { char *delim, *atsign; size_t len; if (recipextra) *recipextra = NULL; if (addr == NULL) return (false); if(strcasecmp(listaddr, addr) == 0) return (true); if (listdelim == NULL) return (false); delim = strstr(addr, listdelim); if (delim == NULL) return (false); len = delim - addr; if(strncasecmp(listaddr, addr, len) != 0) return (false); if(*(listaddr + len) != '@') return (false); delim += strlen(listdelim); atsign = strrchr(delim, '@'); if (!atsign) return (false); if(strcasecmp(listaddr + len + 1, atsign + 1) != 0) return (false); if (recipextra) { len = atsign - delim; if (len > 0) *recipextra = xstrndup(delim, len); } return (true); } bool find_email(strlist *list, strlist *matches, const char *delim, char **recipextra) { tll_foreach(*list, lit) { tll_foreach(*matches, mit) { if (addrmatch(mit->item, lit->item, delim, recipextra)) return true; } } return false; } char * readlf(int fd, bool oneline) { FILE *fp; size_t bufcap = 0; ssize_t buflen; char *buf = NULL; fp = fdopen(fd, "r"); if (fp == NULL) { close(fd); return (NULL); } if (oneline) { buflen = getline(&buf, &bufcap, fp); if (buflen > 0) chomp(buf); } else { buflen = getdelim(&buf, &bufcap, EOF, fp); } fclose(fp); if (buflen < 0) { free(buf); buf = NULL; } return (buf); } mlmmj/tests/000077500000000000000000000000001502303113500133255ustar00rootroot00000000000000mlmmj/tests/Kyuafile000066400000000000000000000005561502303113500150270ustar00rootroot00000000000000syntax(2) test_suite('mlmmj') atf_test_program{name='mlmmj'} atf_test_program{name='mlmmj-send'} atf_test_program{name='functional-tests'} atf_test_program{name='mlmmj-maintd'} atf_test_program{name='mlmmj-sub'} atf_test_program{name='mlmmj-bounce'} atf_test_program{name='mlmmj-list'} atf_test_program{name='mlmmj-process'} atf_test_program{name='mlmmj-receive'} mlmmj/tests/dsnmail000066400000000000000000000051741502303113500147060ustar00rootroot00000000000000From @ Wed Aug 17 14:43:39 2022 Return-Path: <> Delivered-To: bapt@plop.meh Received: from plop.meh by plop.meh with LMTP id 76qJDHvi/GL/tAAA5alX6Q (envelope-from <>) for ; Wed, 17 Aug 2022 14:43:39 +0200 Received: by plop.meh (Postfix) id 2C213EFE39; Wed, 17 Aug 2022 14:43:39 +0200 (CEST) Date: Wed, 17 Aug 2022 14:43:39 +0200 (CEST) From: Mail Delivery System Subject: Undelivered Mail Returned to Sender To: bapt@plop.meh Auto-Submitted: auto-replied MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary="C80F3EFBDB.1660740219/plop.meh" Content-Transfer-Encoding: 8bit Message-Id: <20220817124339.2C213EFE39@plop.meh> Status: RO Content-Length: 3136 Lines: 78 This is a MIME-encapsulated message. --C80F3EFBDB.1660740219/plop.meh Content-Description: Notification Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit This is the mail system at host plop.meh. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system : host mx1.oups.com said: 550-5.1.1 : Recipient address rejected: User unknown in virtual alias table 550 5.1.1 in case of permanent delivery errors (e.g. 5XX SMTP errors) --C80F3EFBDB.1660740219/plop.meh Content-Description: Delivery report Content-Type: message/delivery-status Reporting-MTA: dns; plop.meh X-Postfix-Queue-ID: C80F3EFBDB X-Postfix-Sender: rfc822; bapt@plop.meh Arrival-Date: Wed, 17 Aug 2022 14:43:30 +0200 (CEST) Final-Recipient: rfc822; mgrmbl@oups.com Original-Recipient: rfc822;mgrmbl@oups.com Action: failed Status: 5.1.1 Remote-MTA: dns; mx1.oups.com Diagnostic-Code: smtp; 550-5.1.1 : Recipient address rejected: User unknown in virtual alias table 550 5.1.1 in case of permanent delivery errors (e.g. 5XX SMTP errors) --C80F3EFBDB.1660740219/plop.meh Content-Description: Undelivered Message Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Return-Path: Received: by plop.meh (Postfix, from userid 1001) id C80F3EFBDB; Wed, 17 Aug 2022 14:43:30 +0200 (CEST) Date: Wed, 17 Aug 2022 14:43:30 +0200 From: bapt To: mgrmbl@oups.com Subject: plop Message-ID: <20220817124330.dzeob2kx23pbjk4h@plop.meh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline this is a test --C80F3EFBDB.1660740219/plop.meh-- mlmmj/tests/fakesmtpd.c000066400000000000000000000073501502303113500154540ustar00rootroot00000000000000/* * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #ifndef NELEM #define NELEM(array) (sizeof(array) / sizeof((array)[0])) #endif static struct replies { const char *cmd; const char *reply; } reps [] = { { "EHLO", "250-hostname.net\n250 CHUNKING\n" }, { "QUIT", "221 2.0.0 bye\n" }, { "MAIL FROM", "250 2.1.0 Ok\n"}, { "RCPT TO", "250 2.1.0 Ok\n" }, { "DATA", "354 End data with .\n" }, }; int main(void) { int s, c; FILE *f; socklen_t clsize = sizeof(struct sockaddr_in); struct sockaddr_in me = { 0 }, cl; char *line = NULL; size_t linecap = 0; int mailnum = 0; s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) err(EXIT_FAILURE, "socket"); int opt = 1; if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) != 0) err(EXIT_FAILURE, "setsockopt"); me.sin_family = AF_INET; me.sin_addr.s_addr = inet_addr("127.0.0.1"); /* specific interface */ me.sin_port = htons(25678); if (bind(s, (struct sockaddr *) &me, sizeof(me)) == -1) err(EXIT_FAILURE, "bin"); if (listen(s, 1) == -1) err(EXIT_FAILURE, "listen"); if (daemon(1, 0) != 0) err(EXIT_FAILURE, "daemon"); f = fopen("fakesmtp.pid", "w+"); if (f == NULL) err(EXIT_FAILURE, "fopen"); fprintf(f, "%d\n", getpid()); fclose(f); for (;;) { char *mail; FILE *fp, *fp2; c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(EXIT_FAILURE, "accept"); mailnum++; asprintf(&mail, "mail-%d.txt", mailnum); fp = fopen(mail, "w+"); fp2 = fopen("debugmail.txt", "w+"); free(mail); f = fdopen(c, "rb"); dprintf(c, "220 me fake smtp\n"); fprintf(fp2, "==>: 220 me fake smtp\n"); bool data = false; while (getline(&line, &linecap, f) > 0) { fprintf(fp, "%s", line); fprintf(fp2, "<==: %s", line); if (!data) { for (size_t i = 0; i < NELEM(reps); i++) { if (strncmp(reps[i].cmd, line, strlen(reps[i].cmd)) == 0) { fprintf(fp2, "==>: %s", reps[i].reply); dprintf(c, "%s", reps[i].reply); if (strcmp(reps[i].cmd, "DATA") == 0) data = true; if (strcmp(reps[i].cmd, "QUIT") == 0) goto next; goto nextline; } } fprintf(fp2, "==>: %s", "500 5.5.2 Error\n"); dprintf(c, "500 5.5.2 Error: command not recognized\n"); } nextline: if (data && (strcmp(line, ".\r\n") == 0 || strcmp(line, ".\n") == 0)) { data = false; fprintf(fp2, "==>: %s", "250 2.1.0 Ok\n"); dprintf(c, "250 2.1.0 Ok\n"); } } next: fclose(fp); fclose(fp2); fclose(f); } return (EXIT_SUCCESS); } mlmmj/tests/functional-tests.in000066400000000000000000000022371502303113500171630ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ discard discard_body() { mlmmjrecv=$(command -v mlmmj-receive) mlmmjmaint=$(command -v mlmmj-maintd) init_ml list echo "list@test" > list/control/listaddress here=$(pwd) atf_check -s exit:0 $mlmmjrecv -L list -F <<-EOF bla EOF atf_check -o inline:"bla\n" cat list/queue/discarded/* # the discarded file is too new, do not drop it yet atf_check -s exit:0 -e ignore $mlmmjmaint -F -L ${here}/list atf_check -o inline:"bla\n" cat list/queue/discarded/* atf_check touch -m -t 197001010101 list/queue/discarded/* atf_check -s exit:0 -e ignore $mlmmjmaint -F -L ${here}/list atf_check -o inline:"list/queue/discarded\n" find list/queue/discarded -type d -empty #now with relative path atf_check -s exit:0 $mlmmjrecv -L list -F <<-EOF bla EOF atf_check -o inline:"bla\n" cat list/queue/discarded/* atf_check -s exit:0 -e ignore $mlmmjmaint -F -L list atf_check -o inline:"bla\n" cat list/queue/discarded/* atf_check touch -m -t 197001010101 list/queue/discarded/* atf_check -s exit:0 -e ignore $mlmmjmaint -F -L list atf_check -o inline:"list/queue/discarded\n" find list/queue/discarded -type d -empty } mlmmj/tests/mlmmj-bounce.in000066400000000000000000000101241502303113500162400ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ basics_0 \ basics_1 \ basics_2 \ basics_3 \ basics_4 \ basics_5 \ basics_6 \ basics_7 \ bounce_subscription \ probe \ dsnparse basics_0_body() { mlmmjbounce=$(command -v mlmmj-bounce) helptxt="Usage: $mlmmjbounce -L /path/to/list [-a john=doe.org | -d] [-n num | -p] -a: Address string that bounces -h: This help -L: Full path to list directory -n: Message number in the archive -d: Attempt to parse DSN to determine address -p: Send out a probe -V: Print version " init_ml ml echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:1 -e "inline:mlmmj-bounce: You have to specify -L, -a or -d and -n or -p\n$mlmmjbounce -h for help\n" $mlmmjbounce atf_check -s exit:0 -o "inline:$helptxt" $mlmmjbounce -h } basics_1_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress # no '=' in the mail address atf_check -s exit:0 $mlmmjbounce -L ./ml -a me -n 2 } basics_2_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress touch ${TMPDIR}/plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me -n 2 -m ${TMPDIR}/plop atf_check -s exit:1 test -f ${TMPDIR}/plop } basics_3_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress # not subscribed atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n 2 } basics_4_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress touch ${TMPDIR}/plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n 2 -m ${TMPDIR}/plop atf_check -s exit:1 test -f ${TMPDIR}/plop } basics_5_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress # now the user is subscribed but the file is a symlink echo "me@meh" > ml/subscribers.d/m ln -sf plop ml/bounce/me=meh atf_check -s exit:1 $mlmmjbounce -L ./ml -a me=meh -n 2 rm ml/bounce/me=meh } basics_6_body() { test $(id -u) = 0 && atf_skip "Can only be run as non-root" mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress echo "me@meh" > ml/subscribers.d/m # not allowed to write chmod 444 ml/bounce atf_check -s exit:1 $mlmmjbounce -L ./ml -a me=meh -n 2 chmod 755 ml/bounce atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n 2 atf_check test -f ml/bounce/me=meh } basics_7_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress echo "me@meh" > ml/subscribers.d/m echo "coucou" > ${TMPDIR}/plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n 2 -m ${TMPDIR}/plop atf_check -o inline:"coucou\n" cat ml/bounce/me=meh.lastmsg atf_check -s exit:1 test -f ${TMPDIR}/plop rm ml/bounce/me=meh.lastmsg } bounce_subscription_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress touch ml/subconf/me=meh atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n confsub atf_check -s exit:1 test -f ml/subconf/me=meh touch plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n confsub -m ${TMPDIR}/plop atf_check -s exit:1 test -f ${TMPDIR}/plop touch ml/unsubconf/me=meh atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n confunsub atf_check -s exit:1 test -f ml/unsubconf/me=meh touch plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n confunsub -m ${TMPDIR}/plop atf_check -s exit:1 test -f ${TMPDIR}/plop } probe_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress touch ml/bounce/me=meh-probe atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n probe atf_check -s exit:1 test -f ml/bounce/me=meh-probe touch ${TMPDIR}/plop atf_check -s exit:0 $mlmmjbounce -L ./ml -a me=meh -n probe -m ${TMPDIR}/plop atf_check -s exit:1 test -f ${TMPDIR}/plop } dsnparse_body() { mlmmjbounce=$(command -v mlmmj-bounce) init_ml ml echo test@mlmmjtest > ml/control/listaddress cp ${top_srcdir}/tests/dsnmail dsnmail atf_check -s exit:0 $mlmmjbounce -L ./ml -d -n 2 -m dsnmail } mlmmj/tests/mlmmj-list.in000066400000000000000000000051631502303113500157470ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ basics \ normal \ nomail \ digest \ moderators \ owner normal_body() { init_ml ml atf_check mlmmj-list -L ml -s atf_check -o "inline:0\n" mlmmj-list -L ml -s -c mkdir ml/subscribers.d/j atf_check mlmmj-list -L ml -s atf_check -o "inline:0\n" mlmmj-list -L ml -s -c rmdir ml/subscribers.d/j touch ml/subscribers.d/j atf_check mlmmj-list -L ml -s atf_check -o "inline:0\n" mlmmj-list -L ml -s -c echo "john@doe.org" > ml/subscribers.d/j atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml -s atf_check -o "inline:1\n" mlmmj-list -L ml -s -c # check the default atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml atf_check -o "inline:1\n" mlmmj-list -L ml -c echo "jane@doe.org" >> ml/subscribers.d/j atf_check -o "inline:john@doe.org\njane@doe.org\n" mlmmj-list -L ml atf_check -o "inline:2\n" mlmmj-list -L ml -c echo -n "jack@doe.org" >> ml/subscribers.d/j atf_check -o "inline:john@doe.org\njane@doe.org\njack@doe.org\n" mlmmj-list -L ml atf_check -o "inline:3\n" mlmmj-list -L ml -c } nomail_body() { init_ml ml echo "john@doe.org" > ml/nomailsubs.d/j atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml -n atf_check -o "inline:1\n" mlmmj-list -L ml -n -c } digest_body() { init_ml ml echo "john@doe.org"> ml/digesters.d/j atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml -d atf_check -o "inline:1\n" mlmmj-list -L ml -d -c } moderators_body() { init_ml ml echo "john@doe.org"> ml/control/moderators atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml -m atf_check -o "inline:1\n" mlmmj-list -L ml -m -c } owner_body() { init_ml ml echo "john@doe.org"> ml/control/owner atf_check -o "inline:john@doe.org\n" mlmmj-list -L ml -o atf_check -o "inline:1\n" mlmmj-list -L ml -o -c } basics_body() { helptxt="Usage: mlmmj-list -L /path/to/listdir [-c] [-d] [-h] [-m] [-n] [-o] [-s] [-V] -L: Full path to list directory -c: Print subscriber count -d: Print for digesters list -h: This help -m: Print moderators for list -n: Print for nomail version of list -o: Print owner(s) of list -s: Print normal subscribers (default) -V: Print version " atf_check -s exit:1 -e "inline:mlmmj-list: You have to specify -L\nmlmmj-list -h for help\n" mlmmj-list atf_check -s exit:1 -e "inline:mlmmj-list: Cannot open(nonexisting): No such file or directory\n" mlmmj-list -L nonexisting mkdir ml atf_check -s exit:1 -e "inline:mlmmj-list: Unable to open(ml/subscribers.d): No such file or directory\n" mlmmj-list -L ml atf_check -s exit:0 -o "match:mlmmj-list version .*" mlmmj-list -V atf_check -s exit:0 -o "inline:$helptxt" mlmmj-list -h } mlmmj/tests/mlmmj-maintd.in000066400000000000000000000614461502303113500162560ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh mlmmjmaintd=$(command -v mlmmj-maintd) tests_init \ nolongerbouncing \ discarded \ digests_0 \ digests_1 \ digests_2 \ digests_3 \ digests_4 \ digests_5 \ unsub_bouncers_0 \ unsub_bouncers_1 \ unsub_bouncers_2 \ unsub_bouncers_3 \ unsub_bouncers_4 \ unsub_bouncers_5 \ unsub_bouncers_6 \ unsub_bouncers_7 \ unsub_bouncers_8 \ unsub_bouncers_9 \ unsub_bouncers_10 \ basics_0 \ basics_1 \ basics_2 \ basics_3 \ basics_4 \ basics_5 \ basics_6 \ basics_7 \ basics_8 \ basics_9 \ basics_10 \ basics_11 \ resend_requeue \ resend_queue nolongerbouncing_body() { mkdir lists init_ml lists/ml mkdir -p lists/ml/bounce echo test@mlmmjtest > lists/ml/control/listaddress f1=lists/ml/bounce/msg1 f2=lists/ml/bounce/msg2 now=$(date +%s) now=$((now - 2)) echo "12" > ${f1}-probe touch ${f1} touch ${f1}.lastmsg echo "$now" > ${f2}-probe touch ${f2} touch ${f2}.lastmsg atf_check -s exit:0 -o empty $mlmmjmaintd -L lists/ml -F atf_check -s exit:1 -o empty -e empty test -f $f1 atf_check -s exit:1 -o empty -e empty test -f $f1-probe atf_check -s exit:1 -o empty -e empty test -f $f1.lastmsg atf_check -s exit:0 -o empty -e empty test -f $f2 atf_check -s exit:0 -o empty -e empty test -f $f2-probe atf_check -s exit:0 -o empty -e empty test -f $f2.lastmsg } discarded_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress mkdir -p lists/ml/queue/discarded f1=lists/ml/queue/discarded/veryold f2=lists/ml/queue/discarded/notsoold atf_check touch -t "197001020000" $f1 atf_check touch $f2 atf_check -s exit:0 -o empty $mlmmjmaintd -L lists/ml -F atf_check -s exit:1 -o empty -e empty test -f $f1 atf_check -s exit:0 -o empty -e empty test -f $f2 } basics_0_body() { mkdir lists init_ml lists/ml helptxt="Usage: $mlmmjmaintd [-L | -d] /path/to/dir [-F] -d: Full path to directory with listdirs Use this to run maintenance on all list directories in that directory. -L: Full path to one list directory -F: Don't fork, performing one maintenance run only. This option should be used when one wants to avoid running another daemon, and use e.g. cron to control it instead. " atf_check -s exit:1 -e "inline:mlmmj-maintd: You have to specify -d or -L\n$mlmmjmaintd -h for help\n" $mlmmjmaintd atf_check -s exit:1 -e "inline:mlmmj-maintd: You have to specify either -d or -L\n$mlmmjmaintd -h for help\n" $mlmmjmaintd -L lists/ml -d . atf_check -s exit:0 -o "match:mlmmj-maintd version" $mlmmjmaintd -V atf_check -s exit:0 -o "inline:$helptxt" $mlmmjmaintd -h } basics_1_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress atf_check -s exit:1 -e match:"Could not open the directory containing mailing lists.*: No such file or directory" $mlmmjmaintd -F -d nonexisting } basics_2_body() { test $(id -u) = 0 && atf_skip "Can only be run as non-root" mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress chmod -w lists/ml atf_check -s exit:0 -e match:"Could not open maintdlog.* Permission denied" $mlmmjmaintd -F -L lists/ml } basics_3_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress atf_check -s exit:0 $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log rm lists/ml/*.log } basics_4_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -s exit:0 $mlmmjmaintd -d lists -F atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_5_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rmdir lists/ml/queue/discarded atf_check -s exit:0 -e match:"An error occurred while cleaning discarded mails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded - Could not open 'queue/discarded': No such file or directory clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_6_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/queue atf_check -s exit:0 -e match:"An error occurred while cleaning discarded mails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded - Could not open 'queue/discarded': No such file or directory clean_subconf clean_unsubconf resend_queue - Could not open 'queue': No such file or directory resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_7_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/requeue atf_check -s exit:0 -e match:"An error occurred while resending requeued mails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue - Could not open 'requeue': No such file or directory clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_8_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/bounce atf_check -s exit:0 -e match:"An error occurred while cleaning no longer bouncing traces, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F atf_check -s exit:0 -e match:"An error occurred while unsubscribing bouncing emails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F atf_check -s exit:0 -e match:"An error occurred while sending probes for bouncers, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing - Could not open 'bounce': No such file or directory unsub_bouncers - Could not open 'bounce': No such file or directory probe_bouncers - Could not open 'bounce': No such file or directory run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_9_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/subconf atf_check -s exit:0 -e match:"An error occurred while cleaning subscribtion confirmations, mails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf - Could not open 'subconf': No such file or directory clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_10_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/unsubconf atf_check -s exit:0 -e match:"An error occurred while cleaning unsubscribtion confirmations, mails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf - Could not open 'unsubconf': No such file or directory resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } basics_11_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress rm -rf lists/ml/moderation atf_check -s exit:0 -e match:"An error occurred while cleaning moderation, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation - Could not open 'moderation': No such file or directory clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_0_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress touch lists/ml/control/noarchive atf_check -s exit:0 $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - noarchive tunable: skipping digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_1_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress touch lists/ml/index atf_check -s exit:0 $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_2_body() { test $(id -u) = 0 && atf_skip "Can only be run as non-root" mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress chmod -r lists/ml/index atf_check -s exit:0 $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_3_body() { mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress echo "-1" > lists/ml/index atf_check -s exit:0 -e match:"An error occurred while running digests, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - Invalid index content '-1': too small " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_4_body() { test $(id -u) = 0 && atf_skip "Can only be run as non-root" mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress echo "0" > lists/ml/index touch lists/ml/lastdigest chmod -w lists/ml/lastdigest atf_check -s exit:0 -e match:"An error occurred while running digests, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests - Could not open or create 'lastdigest': Permission denied " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } digests_5_body() { test $(id -u) = 0 && atf_skip "Can only be run as non-root" mkdir lists init_ml lists/ml echo test@mlmmjtest > lists/ml/control/listaddress echo "0" > lists/ml/index echo "3774:1702743593:141" > lists/ml/lastdigest atf_check -s exit:0 $mlmmjmaintd -L lists/ml -F output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers probe_bouncers run_digests " atf_check -o "inline:$output" sed -e "s/at .*/at/" lists/ml/mlmmj-maintd.lastrun.log } unsub_bouncers_0_body() { init_ml list echo "test@test" > list/control/listaddress # empty file, it should be ignored touch list/bounce/plop atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop } unsub_bouncers_1_body() { init_ml list echo test@mlmmjtest > list/control/listaddress # ignore probe files touch list/bounce/plop-probe atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop-probe } unsub_bouncers_2_body() { init_ml list echo test@mlmmjtest > list/control/listaddress # ignore lastmsg files touch list/bounce/plop.lastmsg atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop.lastmsg } unsub_bouncers_3_body() { init_ml list echo test@mlmmjtest > list/control/listaddress # ignore files with a probe out already echo "a:1234 # plop" > list/bounce/plop touch list/bounce/plop-probe atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop atf_check -s exit:0 test -f list/bounce/plop-probe } unsub_bouncers_4_body() { init_ml list echo "test@test" > list/control/listaddress # filename should contain a = to be properly treated echo "a:1234 # plop" > list/bounce/plop atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop } unsub_bouncers_5_body() { init_ml list echo "test@test" > list/control/listaddress # Log if invalid format echo "a:a #plop" > list/bounce/plop=meh atf_check -s exit:0 -e match:"An error occurred while unsubscribing bouncing emails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop=meh output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers - Error parsing the first line of bounce/plop=meh: invalid probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" list/mlmmj-maintd.lastrun.log } unsub_bouncers_6_body() { init_ml list echo "test@test" > list/control/listaddress test $(id -u) = 0 && atf_skip "Can only be run as non-root" # Log unreabable bouncefile echo "a:1234 #plop" > list/bounce/plop=meh chmod -r list/bounce/plop=meh atf_check -s exit:0 -e match:"An error occurred while unsubscribing bouncing emails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop=meh output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers - Could not open bounce/plop=meh: Permission denied probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" list/mlmmj-maintd.lastrun.log } unsub_bouncers_7_body() { mkdir lists init_ml list echo "test@test" > list/control/listaddress # keep if recent enough echo "a:$(date +%s) # plop" > list/bounce/plop=meh atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop=meh } unsub_bouncers_8_body() { init_ml list echo "test@test" > list/control/listaddress echo "a:1234 # plop" > list/bounce/plop=meh atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:1 test -f list/bounce/plop=meh } unsub_bouncers_9_body() { init_ml list echo "test@test" > list/control/listaddress # last message properly cleaned out echo "a:1234 # plop" > list/bounce/plop=meh echo plop > list/bounce/plop=meh.lastmsg atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:1 test -f list/bounce/plop=meh atf_check -s exit:1 test -f list/bounce/plop=meh.lastmsg } unsub_bouncers_10_body() { init_ml list echo "test@test" > list/control/listaddress # has been unsubscribe from regular echo "a:1234 # plop" > list/bounce/plop=meh echo "plop@meh" > list/subscribers.d/p echo "plop@meh" > list/digesters.d/p echo "plop@meh" > list/nomailsubs.d/p atf_check -s exit:0 $mlmmjmaintd -L list -F atf_check -s exit:1 test -f list/bounce/plop=meh atf_check -s exit:1 test -f list/subscribers.d/p atf_check -s exit:1 test -f list/digesters.d/p atf_check -s exit:1 test -f list/nomailsubs.d/p echo "a:1234 # plop" > list/bounce/plop=meh echo "plop@meh" > list/digesters.d/p rm -rf list/nomailsubs.d atf_check -s exit:0 -e match:"An error occurred while unsubscribing bouncing emails, see mlmmj-maintd.lastrun.log" $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/bounce/plop=meh atf_check -s exit:1 test -f list/digesters.d/p output="Starting maintenance run at clean_moderation clean_discarded clean_subconf clean_unsubconf resend_queue resend_requeue clean_nolongerbouncing unsub_bouncers - Some errors during unsubscription of plop@meh probe_bouncers run_digests - No readable index file: no digest " atf_check -o "inline:$output" sed -e "s/at .*/at/" list/mlmmj-maintd.lastrun.log } resend_requeue_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list echo "test@test" > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo # Not a directory cat >> list/requeue/1 <> expect1.txt <> list/requeue/1/subscribers < list/requeue/3/mailfile < list/requeue/3/mailfile <> list/requeue/3/subscribers < expect1.txt < RCPT TO: DATA From: plop To: bla Subject: test body . QUIT EOF atf_check -o file:expect1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/bounces-.*-/bounces-/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt atf_check -s exit:1 test -f list/requeue/3/mailfile cat > list/archive/1 < expect2.txt < RCPT TO: DATA From: plop To: bla Subject: test body . MAIL FROM: RCPT TO: DATA From: plop To: bla Subject: test body . MAIL FROM: RCPT TO: DATA From: plop To: bla Subject: test body . QUIT EOF atf_check $mlmmjmaintd -L list -F atf_check -o file:expect2.txt sed -e "/^Message-ID:/d; /^Date:/d; s/bounces-.*-/bounces-/g" mail-2.txt atf_check -s exit:1 test -f mail-3.txt atf_check -s exit:0 test -f list/archive/1 atf_check -s exit:1 test -f lists/requeue/1/subscribers atf_check -s exit:1 test -f list/requeue/3/mailfile atf_check -s exit:1 test -d list/requeue/1 mkdir list/requeue/1 cat > list/archive/1 <> list/requeue/1/subscribers < expect3.txt < RCPT TO: DATA From: plop To: bla Subject: test To: user1@test1 body . MAIL FROM: RCPT TO: DATA From: plop To: bla Subject: test To: user2@test2 body . MAIL FROM: RCPT TO: DATA From: plop To: bla Subject: test To: user3@test3 body . QUIT EOF touch list/control/addtohdr atf_check $mlmmjmaintd -L list -F atf_check -o file:expect3.txt sed -e "/^Message-ID:/d; /^Date:/d; s/bounces-.*-/bounces-/g" mail-3.txt atf_check -s exit:1 test -f mail-4.txt atf_check -s exit:1 test -d list/requeue/1 } resend_queue_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list echo "test@test" > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo touch list/queue/file touch list/queue/plop.hey # no .mailfrom, no.reciptto no.reply-to but recent atf_check $mlmmjmaintd -L list -F atf_check -s exit:1 test -f mail-1.txt atf_check -s exit:0 test -f list/queue/file atf_check -s exit:1 test -f list/queue/plop.hey touch -t 197001010101 list/queue/file # no .mailfrom, no.reciptto no.reply-to but recent atf_check $mlmmjmaintd -L list -F atf_check -s exit:1 test -f mail-1.txt atf_check -s exit:1 test -f list/queue/file touch -t 197001010101 list/queue/file echo "bla" > list/queue/file.mailfrom # no.reciptto no.reply-to old recent atf_check $mlmmjmaintd -L list -F atf_check -s exit:1 test -f mail-1.txt atf_check -s exit:1 test -f list/queue/file atf_check -s exit:1 test -f list/queue/file.mailfrom touch -t 197001010101 list/queue/file echo "bla" > list/queue/file.mailfrom touch list/queue/file.reply-to # no.reciptto no.reply-to old recent atf_check $mlmmjmaintd -L list -F atf_check -s exit:1 test -f list/queue/file atf_check -s exit:1 test -f list/queue/file.mailfrom atf_check -s exit:1 test -f list/queue/file.reply-to touch -t 197001010101 list/queue/file echo "bla" > list/queue/file.mailfrom echo "meh" > list/queue/file.reciptto touch list/queue/file.reply-to atf_check $mlmmjmaintd -L list -F atf_check -s exit:1 test -f list/queue/file atf_check -s exit:1 test -f list/queue/file.mailfrom atf_check -s exit:1 test -f list/queue/file.reciptto atf_check -s exit:1 test -f list/queue/file.reply-to touch list/queue/file touch list/queue/file.mailfrom echo "meh" > list/queue/file.reciptto touch list/queue/file.reply-to atf_check $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/queue/file atf_check -s exit:0 test -f list/queue/file.mailfrom atf_check -s exit:0 test -f list/queue/file.reciptto atf_check -s exit:0 test -f list/queue/file.reply-to touch list/queue/file touch list/queue/file.mailfrom touch list/queue/file.reciptto touch list/queue/file.reply-to atf_check $mlmmjmaintd -L list -F atf_check -s exit:0 test -f list/queue/file atf_check -s exit:0 test -f list/queue/file.mailfrom atf_check -s exit:0 test -f list/queue/file.reciptto atf_check -s exit:0 test -f list/queue/file.reply-to # actually send the queued email cat > list/queue/file < list/queue/file.mailfrom echo "bob@test2" > list/queue/file.reciptto rm list/queue/file.reply-to atf_check $mlmmjmaintd -L list -F cat > expected.txt < RCPT TO: DATA From: plop To: bla Subject: hey Body . QUIT EOF atf_check -o file:expected.txt cat mail-1.txt atf_check -s exit:1 test -f mail-2.txt atf_check -s exit:1 test -f list/queue/file atf_check -s exit:1 test -f list/queue/file.mailfrom atf_check -s exit:1 test -f list/queue/file.reciptto # actually send the queued email with reply-to cat > list/queue/file < list/queue/file.mailfrom echo "bob@test2" > list/queue/file.reciptto echo "jane@test2" > list/queue/file.reply-to rm list/queue/file.reply-to atf_check $mlmmjmaintd -L list -F cat > expected.txt < RCPT TO: DATA From: plop To: bla Subject: hey Body . QUIT EOF atf_check -o file:expected.txt cat mail-2.txt atf_check -s exit:1 test -f mail-3.txt atf_check -s exit:1 test -f list/queue/file atf_check -s exit:1 test -f list/queue/file.mailfrom atf_check -s exit:1 test -f list/queue/file.reciptto atf_check -s exit:1 test -f list/queue/file.reply-to } mlmmj/tests/mlmmj-process.in000066400000000000000000000036731502303113500164560ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ usage \ basic_0 \ basic_1 \ basic_2 \ basic_3 \ basic_4 \ basic_5 \ addr_in_to_cc mlmmjprocess=$(command -v mlmmj-process) usage_body() { output="Usage: $mlmmjprocess -L /path/to/list -m /path/to/mail [-h] [-P] [-V] -h: This help -L: Full path to list directory -m: Full path to mail file -P: Don't execute mlmmj-send -V: Print version " atf_check -o inline:"$output" $mlmmjprocess -h } basic_0_body() { output="mlmmj-process: You have to specify -L and -m $mlmmjprocess -h for help " atf_check -s exit:1 -e inline:"$output" $mlmmjprocess } basic_1_body() { output="mlmmj-process: You have to specify -L and -m $mlmmjprocess -h for help " atf_check -s exit:1 -e inline:"$output" $mlmmjprocess -L plop } basic_2_body() { atf_check -s exit:1 -e inline:"mlmmj-process: Cannot open(plop): No such file or directory\n" $mlmmjprocess -L plop -m meh } basic_3_body() { mkdir plop atf_check -s exit:1 -e inline:"mlmmj-process: Cannot open(plop/control): No such file or directory\n" $mlmmjprocess -L plop -m meh } basic_4_body() { mkdir -p plop/control echo "test@test" > plop/control/listaddress atf_check -s exit:1 $mlmmjprocess -L plop -m meh } basic_5_body() { mkdir -p plop/control mkdir -p plop/queue echo "test@test" > plop/control/listaddress atf_check -s exit:1 $mlmmjprocess -L plop -m meh } addr_in_to_cc_body() { init_ml list cat > mailfile < list/control/listaddress # ensure we don't try to really send email to a real mailserver echo "25678" > list/control/smtpport rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text atf_check -s exit:0 $mlmmjprocess -L list -m mailfile rm list/queue/*.reciptto rm list/queue/*.mailfrom rmdir list/queue/discarded atf_check -o match:".*The message from with subject \"\" was unable to be delivered.*" cat list/queue/* } mlmmj/tests/mlmmj-receive.in000066400000000000000000002466551502303113500164330ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ basics \ simple \ simple \ subscribe \ subscribe_digest \ subscribe_nomail \ subscribe_nomail_confunsub \ subscribe_digest_confunsub \ subscribe_both \ ctrl_list \ ctrl_help \ ctrl_faq \ ctrl_get \ subscription_moderation \ moderation \ moderation_notifymod \ moderation_notmetoo \ moderation_reject_invalid \ maxmailsize \ maxmailsize0 \ normal_email \ delheaders \ customheaders \ customheaders_blanks \ customheaders_with_subst \ verp \ normal_email_with_dot \ multi_line_headers mlmmjreceive=$(command -v mlmmj-receive) basics_body() { helptxt="Usage: $mlmmjreceive -L /path/to/listdir [-s sender@example.org] [-e extension] [-h] [-V] [-P] [-F] -h: This help -F: Don't fork in the background -L: Full path to list directory -s: Specify sender address -e: The foo part of user+foo@example.org -P: Don't execute mlmmj-process -V: Print version " init_ml ml atf_check -s exit:1 -e "inline:mlmmj-receive: You have to specify -L\n$mlmmjreceive -h for help\n" $mlmmjreceive atf_check -s exit:0 -o "match:mlmmj-receive version .*" $mlmmjreceive -V atf_check -s exit:0 -o "inline:$helptxt" $mlmmjreceive -h echo test@mlmmjtest > ml/control/listaddress rm -rf ml/incoming atf_check -s exit:1 -e inline:"mlmmj-receive: Cannot open(ml/incoming): No such file or directory\n" $mlmmjreceive -L ml -e bla -s meh -P < list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > incoming-invalid << EOF From: bob@test To: invalid@test Subject: subscribe this is a subscribtion test EOF atf_check -s exit:1 $mlmmjreceive -L list -F incoming << EOF From: bob@test To: invalid@test Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Post_to_test=40mlmmjtest_denied:_subscribe?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: bob@test --=RANDOM= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The message from with subject "subscribe" was unable to be delivered to the list because the list address was not found in either the To: or CC: header. (The denied message is below.) --=RANDOM= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: invalid@test Subject: subscribe this is a subscribtion test --=RANDOM=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/boundary=.*/boundary/g; s/--=.*=/--=RANDOM=/g" mail-1.txt cat > incoming << EOF From: bob@test To: test@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF cat > archived << EOF From: bob@test To: test@mlmmjtest Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list. This means every time a post is sent to the list, you will receive a copy of it. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the normal version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/subscribers.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f list/subscribers.d/b } subscribe_digest_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe-digest@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-digest@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list, to receive digests. This means you will receive multiple posts in a single mail message, at regular intervals, or when a lot of posts have accumulated. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-digest.*@mlmmjtest/confsub-digest@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-digest-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the digest version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/digesters.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f list/digesters.d/b } subscribe_nomail_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe-nomail@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-nomail@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list, without mail delivery. This means you will not receive any posts to the list, but you are considered a member. This means, for instance, you are able to post to a list which only subscribers may post to, while you follow the list using a web archive or another subscribed email address. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-nomail.*@mlmmjtest/confsub-nomail@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-nomail-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the no-mail version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/nomailsubs.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f list/nomailsubs.d/b } subscribe_both_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe-both@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-both@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-both.*@mlmmjtest/confsub-both@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-both-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/subscribers.d/b atf_check -o inline:"bob@test\n" cat list/digesters.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f list/subscribers.d/b atf_check -s exit:1 test -f list/digesters.d/b } subscribe_nomail_confunsub_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe-nomail@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-nomail@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list, without mail delivery. This means you will not receive any posts to the list, but you are considered a member. This means, for instance, you are able to post to a list which only subscribers may post to, while you follow the list using a web archive or another subscribed email address. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-nomail.*@mlmmjtest/confsub-nomail@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-nomail-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the no-mail version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/nomailsubs.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-nomail-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f list/nomailsubs.d/b } subscribe_digest_confunsub_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > subscribe << EOF From: bob@test To: test+subscribe-digest@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-digest@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list, to receive digests. This means you will receive multiple posts in a single mail message, at regular intervals, or when a lot of posts have accumulated. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-digest.*@mlmmjtest/confsub-digest@mlmmjtest/g; s/bounces-confsub-.*@mlmmjtest/bounces-confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-digest-${var##*/}@mlmmjtest Return-Path: jane@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your subscription. You have now been added to the digest version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt atf_check -o inline:"bob@test\n" cat list/digesters.d/b atf_check -s exit:1 test -f list/subconf/${var} # second confirmation atf_check $mlmmjreceive -L list -F expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_subscribe_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be subscribed to the list because you are already subscribed. . QUIT EOF # New subscribtion atf_check $mlmmjreceive -L list -F unsubscribe < expected-4.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confunsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that the email address be removed from the list. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confunsub-.*@mlmmjtest/confunsub-@mlmmjtest/g" mail-4.txt var=$(ls list/unsubconf) cat > confirm-unsub << EOF From: bob@test To: test+confunsub-digest-${var##*/}@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F expected-5.txt < RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Thank you for confirming your unsubscribe. You have now been removed from the list. . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt } ctrl_list_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > ctrllist << EOF From: bob@test To: test+list@mlmmjtest Return-Path: jane@test EOF atf_check $mlmmjreceive -L list -F list/control/owner atf_check $mlmmjreceive -L list -F expected-1.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Subscribers_to_test=40mlmmjtest?= From: test+owner@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Here is the list of subscribers (to all versions of the list): . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt printf "bob@test" > list/control/owner printf "jane@doe.org\njo@bob.org\n" > list/subscribers.d/j printf "jane@doe.org\n" > list/digesters.d/j printf "bob@doe.org" > list/nomailsubs.d/b cat > expected-2.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Subscribers_to_test=40mlmmjtest?= From: test+owner@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Here is the list of subscribers (to all versions of the list): - jane@doe.org - jo@bob.org - jane@doe.org - bob@doe.org . QUIT EOF atf_check $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > ctrlhelp << EOF From: bob@test To: test+help@mlmmjtest Return-Path: jane@test EOF cat > expected-1.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Information_for_test=40mlmmjtest?= From: test+owner@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Here is some information about the list. You can subscribe to the following versions: - The normal version: Every time a post is sent to the list, subscribers receive a copy of it. Subscribe by emailing . - The digest version: Subscribers receive multiple posts in a single mail message, at regular intervals, or when a lot of posts have accumulated. Subscribe by emailing . - The no-mail version: Subscribers do not receive any posts to the list. This means, though, they are able to post to a list which only subscribers may post to, while they follow the list using a web archive or another subscribed email address. Subscribe by emailing . Unsubscribe by emailing . Posts are made by emailing . Subscribers can retrieve message number N from the list's archive by sending a message to (change the N to the number of the desired message). You can retrieve the frequently asked questions document for the list by sending a message to . To contact the list owner, send a message to . . QUIT EOF atf_check $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > ctrlhelp << EOF From: bob@test To: test+faq@mlmmjtest Return-Path: jane@test EOF cat > expected-1.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Frequently_asked_questions_of_test=40mlmmjtest?= From: test+owner@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sorry, no FAQ available yet. . QUIT EOF atf_check $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo cat > ctrlget << EOF From: bob@test To: test+get-1@mlmmjtest Return-Path: jane@test EOF cat > ctrlbadget < list/subscribers.d/b atf_check -s exit:0 $mlmmjreceive -L list -F list/archive/1 < expected-1.txt < RCPT TO: DATA meh . QUIT EOF atf_check -s exit:0 $mlmmjreceive -L list -F list/archive/1 < expected-1.txt < RCPT TO: DATA From: plop To: test@mlmmjtest Subject: meh meh . QUIT EOF atf_check -s exit:0 $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "me@modos" > list/control/owner touch list/control/submod cat > subs < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. Somebody (and we hope it was you) has requested that your email address be added to the list. This means every time a post is sent to the list, you will receive a copy of it. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-1.txt var=$(ls list/subconf) cat > confirm << EOF From: bob@test To: test+confsub-${var##*/}@mlmmjtest Return-Path: bob@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Awaiting_permission_to_join_test=40mlmmjtest?= From: test+owner@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Your request to join the list has been received. However, the gatekeepers are being asked to review it before permitting you to join. . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt cat > expected-3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Subscription_request_for_test=40mlmmjtest:_bob=40test?= From: test+owner@mlmmjtest To: test-moderators@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+permit-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. There has been a request from to join the normal version of the list. To permit this, please send a message to which can usually be done simply by replying to this message. If you do not want to do this, either send a message to or simply ignore this message. The following gatekeepers have received this mail: - me@modos . QUIT EOF atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d; s/permit-.*@mlmmjtest/permit-@mlmmjtest/g; s/obstruct-.*@mlmmjtest/obstruct-@mlmmjtest/g" mail-3.txt var=$(ls list/moderation/subscribe*) cat > reject << EOF From: me@modos To: test+obstruct-${var##*/subscribe}@mlmmjtest Return-Path: bob@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F confirm << EOF From: bob@test To: test+confsub-${var##*/}@mlmmjtest Return-Path: bob@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F permit << EOF From: me@modos To: test+permit-${var##*/subscribe}@mlmmjtest Return-Path: bob@test Subject: subscribe this is a subscribtion test EOF atf_check $mlmmjreceive -L list -F expected-7.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: bob@test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. A gatekeeper has permitted you to join us. You have now been added to the normal version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected-7.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-7.txt } moderation_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "me@modos" > list/control/moderators touch list/control/moderated printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Please_moderate_test=40mlmmjtest:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary" Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: test-moderators@mlmmjtest Reply-To: test+release-@mlmmjtest --=boundary= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. A message from with subject "yeah" has been submitted for posting. You are being asked to moderate because this is a moderated list. The message is below. To release it to the list, please send a message to which can usually be done simply by replying to this message. If you do not want to do any of this, either send a message to or simply ignore this message. The following moderators have received this mail: - me@modos --=boundary= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=boundary=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt var=$(ls list/moderation/) cat > reject << EOF From: test@modos To: test+reject-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F release << EOF From: test@modos To: test+release-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt } moderation_notifymod_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "me@modos" > list/control/moderators touch list/control/moderated touch list/control/notifymod printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Awaiting_release_to_test=40mlmmjtest:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary" Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: bob@test --=boundary= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The message from with subject "yeah" has been submitted to the list. However, the moderators are being asked to review it before releasing it to the list because this is a moderated list. (The message is below.) --=boundary= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=boundary=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-1.txt cat > expected-2.txt < RCPT TO: DATA Subject: =?utf-8?q?Please_moderate_test=40mlmmjtest:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary" Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: test-moderators@mlmmjtest Reply-To: test+release-@mlmmjtest --=boundary= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. A message from with subject "yeah" has been submitted for posting. You are being asked to moderate because this is a moderated list. The message is below. To release it to the list, please send a message to which can usually be done simply by replying to this message. If you do not want to do any of this, either send a message to or simply ignore this message. The following moderators have received this mail: - me@modos --=boundary= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=boundary=-- . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-2.txt atf_check -s exit:1 test -f mail-3.txt var=$(ls list/moderation/) cat > reject << EOF From: test@modos To: test+reject-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F release << EOF From: test@modos To: test+release-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-3.txt atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-4.txt atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-5.txt } moderation_notmetoo_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "me@modos" > list/control/moderators touch list/control/moderated touch list/control/notmetoo printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Please_moderate_test=40mlmmjtest:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary" Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: test-moderators@mlmmjtest Reply-To: test+release-@mlmmjtest --=boundary= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. A message from with subject "yeah" has been submitted for posting. You are being asked to moderate because this is a moderated list. The message is below. To release it to the list, please send a message to which can usually be done simply by replying to this message. If you do not want to do any of this, either send a message to or simply ignore this message. The following moderators have received this mail: - me@modos --=boundary= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=boundary=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt var=$(ls list/moderation/ | grep -v omit) atf_check -o inline:"bob@test" cat list/moderation/${var}.omit cat > reject << EOF From: test@modos To: test+reject-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F release << EOF From: test@modos To: test+release-${var}@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt } moderation_reject_invalid_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "me@modos" > list/control/moderators touch list/control/moderated touch list/control/notmetoo printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Please_moderate_test=40mlmmjtest:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary" Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: test-moderators@mlmmjtest Reply-To: test+release-@mlmmjtest --=boundary= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. A message from with subject "yeah" has been submitted for posting. You are being asked to moderate because this is a moderated list. The message is below. To release it to the list, please send a message to which can usually be done simply by replying to this message. If you do not want to do any of this, either send a message to or simply ignore this message. The following moderators have received this mail: - me@modos --=boundary= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=boundary=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/release-.*@mlmmjtest/release-@mlmmjtest/g; s/reject-.*@mlmmjtest/reject-@mlmmjtest/g; s/boundary=\".*\"/boundary=\"boundary\"/g; s/^--=.*=/--=boundary=/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt var=$(ls list/moderation/ | grep -v omit) atf_check -o inline:"bob@test" cat list/moderation/${var}.omit cat > reject << EOF From: test@modos To: test+reject-nopenope@mlmmjtest Return-path: test@modos EOF atf_check -s exit:0 $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "1" > list/control/maxmailsize printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Post_to_test=40mlmmjtest_denied:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: bob@test --=RANDOM= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The message from with subject "yeah" was unable to be delivered to the list because it exceeded the maximum allowed message size of 1 bytes. (The beginning of the denied message is below.) --=RANDOM= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=RANDOM=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/boundary=.*/boundary/g; s/--=.*=/--=RANDOM=/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt return } maxmailsize0_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo echo "0" > list/control/maxmailsize printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < expected-1.txt < RCPT TO: DATA Subject: =?utf-8?q?Post_to_test=40mlmmjtest_denied:_yeah?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary Content-Transfer-Encoding: 8bit From: test+owner@mlmmjtest To: bob@test --=RANDOM= Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The message from with subject "yeah" was unable to be delivered to the list because it exceeded the maximum allowed message size of 0 bytes. (The beginning of the denied message is below.) --=RANDOM= Content-Type: message/rfc822 Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="message.eml" From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email --=RANDOM=-- . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d; s/boundary=.*/boundary/g; s/--=.*=/--=RANDOM=/g" mail-1.txt atf_check -s exit:1 test -f mail-2.txt return } normal_email_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < nosubject <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt touch list/control/footer atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt printf "myfooter\nreally" > list/control/footer touch list/control/prefix atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email myfooter really . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email myfooter really . QUIT EOF atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt echo "[plop]" > list/control/prefix atf_check -s exit:0 $mlmmjreceive -L list -F > expected-4.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: [plop] yeah Let's go, first email myfooter really . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: [plop] yeah Let's go, first email myfooter really . QUIT EOF atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-4.txt atf_check -s exit:0 $mlmmjreceive -L list -F > expected-5.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: [plop] Let's go, first email myfooter really . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: [plop] Let's go, first email myfooter really . QUIT EOF atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-5.txt touch list/control/replyto atf_check -s exit:0 $mlmmjreceive -L list -F > expected-6.txt < RCPT TO: DATA From: bob@test Reply-To: bob@test To: test@mlmmjtest Subject: [plop] Let's go, first email myfooter really . MAIL FROM: RCPT TO: DATA From: bob@test Reply-To: bob@test To: test@mlmmjtest Subject: [plop] Let's go, first email myfooter really . QUIT EOF atf_check -o file:expected-6.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-6.txt } delheaders_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "X-H1\nNope\n" > list/control/delheaders printf "user@test\nuser2@test" > list/subscribers.d/u cat > first <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt } customheaders_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "X-H1: test\nNope: really not\n" > list/control/customheaders printf "user@test\nuser2@test" > list/subscribers.d/u cat > first <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt cat > second <> expected-2.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not Mime: really Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not Mime: really Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt } customheaders_blanks_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "X-H1: test\nNope: really not\n\n \n" > list/control/customheaders printf "user@test\nuser2@test" > list/subscribers.d/u cat > first <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt cat > second <> expected-2.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not Mime: really Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not Mime: really Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt } customheaders_with_subst_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "X-H1: test\nNope: really not\nX-Poster-Address: \$posteraddr\$\n" > list/control/customheaders printf "user@test\nuser2@test" > list/subscribers.d/u cat > first <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not X-Poster-Address: bob@test Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not X-Poster-Address: bob@test Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt cat > second <> expected-2.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not X-Poster-Address: bob@test Mime: really Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest X-H1: test Nope: really not X-Poster-Address: bob@test Mime: really Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt } verp_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "postfix" > list/control/verp echo 2 > list/control/maxverprecips echo "heloname" > list/control/smtphelo printf "X-H1: test\nNope: really not\n" > list/control/customheaders printf "user@test\nuser2@test\nuser3@test" > list/subscribers.d/u cat > first <> expected-1.txt < XVERP=-= QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt cat > second <> expected-2.txt < XVERP=-= RCPT TO: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt cat >> expected-3.txt < XVERP=-= RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah X-H1: test Nope: really not Let's go, first email . QUIT EOF atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt atf_check -s exit:1 test -f mail-4.txt } normal_email_with_dot_body() { atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM init_ml list rmdir list/text ln -s ${top_srcdir}/listtexts/en list/text echo test@mlmmjtest > list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "user@test\nuser2@test" > list/subscribers.d/u cat > first < nosubject <> expected-1.txt < RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Hello ..world . MAIL FROM: RCPT TO: DATA From: bob@test To: test@mlmmjtest Subject: yeah Hello ..world . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt touch list/control/footer atf_check -s exit:0 $mlmmjreceive -L list -F list/control/listaddress echo "25678" > list/control/smtpport echo "heloname" > list/control/smtphelo printf "user@test\nuser2@test" > list/subscribers.d/u cat > first <; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Return-path: bob@test Subject: yeah Let's go, first email EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-1.txt < RCPT TO: DATA Received: from test.com ( mail.test.com [192.168.168.1]) by 192.168.168.168 with ESMTP id 0A21C400643 for ; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA Received: from test.com ( mail.test.com [192.168.168.1]) by 192.168.168.168 with ESMTP id 0A21C400643 for ; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt cat > second <; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Return-path: bob@test Mime: really Subject: yeah Let's go, first email EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt < RCPT TO: DATA Received: from test.com ( mail.test.com [192.168.168.1]) by 192.168.168.168 with ESMTP id 0A21C400643 for ; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Mime: really Subject: yeah Let's go, first email . MAIL FROM: RCPT TO: DATA Received: from test.com ( mail.test.com [192.168.168.1]) by 192.168.168.168 with ESMTP id 0A21C400643 for ; Sat, 10 May 2025 17:17:17 +0000 (UTC) From: bob@test To: test@mlmmjtest Mime: really Subject: yeah Let's go, first email . QUIT EOF atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt } mlmmj/tests/mlmmj-send.in000066400000000000000000000030411502303113500157160ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ basics basics_body() { mlmmjsend=$(command -v mlmmj-send) helptxt="Usage: $mlmmjsend [-L /path/to/list -m /path/to/mail | -l listctrl] [-a] [-D] [-F sender@example.org] [-h] [-o address@example.org] [-r 127.0.0.1] [-R reply@example.org] [-s /path/to/subscribers] [-T recipient@example.org] [-V] -a: Don't archive the mail -D: Don't delete the mail after it's sent -F: What to use as MAIL FROM: -h: This help -l: List control variable: '1' means 'send a single mail' '2' means 'mail to moderators' '3' means 'resend failed list mail' '4' means 'send to file with recipients' '5' means 'bounceprobe' '6' means 'single listmail to single recipient' '7' means 'digest' -L: Full path to list directory -m: Full path to mail file -o: Address to omit from distribution (normal mail only) -r: Relayhost IP address (defaults to 127.0.0.1) -R: What to use as Reply-To: header -s: Subscribers file name -T: What to use as RCPT TO: -V: Print version " init_ml ml atf_check -s exit:1 -e "inline:mlmmj-send: You have to specify -m and -L or -l\n$mlmmjsend -h for help\n" $mlmmjsend atf_check -s exit:0 -o "match:mlmmj-send version " $mlmmjsend -V atf_check -s exit:0 -o "inline:$helptxt" $mlmmjsend -h atf_check -s exit:1 -e "inline:mlmmj-send: -l only accept the following arguments: 1, 2, 3, 4, 5, 6 or 7\n" $mlmmjsend -l 8 atf_check -s exit:1 -e "inline:mlmmj-send: -l only accept the following arguments: 1, 2, 3, 4, 5, 6 or 7\n" $mlmmjsend -l 0 } mlmmj/tests/mlmmj-sub.in000066400000000000000000000621541502303113500155700ustar00rootroot00000000000000#!@ATFSH@ . $(atf_get_srcdir)/test_env.sh tests_init \ add_basics \ add_normal \ add_normal_welcome \ add_normal_welcome_confirm \ add_normal_welcome_confirm_and_send_owner \ add_normal_welcome_moderate \ add_normal_owner \ add_nomail \ add_digest \ add_normal_then_nomail \ add_both \ add_both_with_digest \ add_both_with_normal \ add_normal_with_both \ add_digest_with_both \ add_nomail_with_both \ remove_basics \ remove_normal \ remove_normal_confirm \ remove_normal_confirm_and_send_owner \ remove_normal_owner \ remove_nomail \ remove_digest add_normal_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -a jane@doe.org atf_check -o inline:"john@doe.org\njane@doe.org\n" cat ml/subscribers.d/j } add_normal_welcome_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org cat > expected.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has subscribed you to the normal version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:1 test -f mail-2.txt } add_normal_welcome_confirm_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text atf_check -s exit:0 $mlmmjsub -L ml -c -C -a john@doe.org cat > expected.txt < RCPT TO: DATA Subject: =?utf-8?q?Confirm_subscription_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+confsub-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. An administrator has requested that your email address be added to the list. This means every time a post is sent to the list, you will receive a copy of it. To confirm you want to do this, please send a message to which can usually be done simply by replying to this message. The subject and the body of the message can be anything. After doing so, you should receive a reply informing you that the operation succeeded. If you do not want to do this, simply ignore this message. . QUIT EOF atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-1.txt atf_check -s exit:1 test -f ml/subscribers.d/j atf_check -o match:"^ml/subconf/.*" find ml/subconf/ -type f atf_check -s exit:1 test -f mail-2.txt } add_normal_welcome_confirm_and_send_owner_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo touch ml/control/notifysub rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org cat > expected.txt < RCPT TO: DATA Subject: =?utf-8?q?Welcome_to_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has subscribed you to the normal version of the list. The email address you are subscribed with is . If you ever wish to unsubscribe, send a message to using this email address. The subject and the body of the message can be anything. You will then receive confirmation or further instructions. For other information and help about this list, send a message to . . QUIT EOF atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-1.txt cat > expected2.txt < RCPT TO: DATA Subject: =?utf-8?q?Subscribed_to_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test+owner@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The address has been subscribed to the normal version of the list because an administrator commanded it. . QUIT EOF atf_check -o file:expected2.txt sed -e "/^Message-ID:/d; /^Date:/d; s/confsub-.*@mlmmjtest/confsub-@mlmmjtest/g" mail-2.txt atf_check -s exit:1 test -f mail-3.txt } add_normal_welcome_moderate_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text cat > ml/control/submod < expected.txt < RCPT TO: DATA Subject: =?utf-8?q?Awaiting_permission_to_join_test=40mlmmjtest?= From: test+owner@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. Your request to join the list has been received. However, the gatekeepers are being asked to review it before permitting you to join. . QUIT EOF cat > expected-modos.txt < RCPT TO: DATA Subject: =?utf-8?q?Subscription_request_for_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test-moderators@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+permit-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. There has been a request from to join the normal version of the list. To permit this, please send a message to which can usually be done simply by replying to this message. If you do not want to do this, either send a message to or simply ignore this message. The following gatekeepers have received this mail: - modo1@test - modo2@test . MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Subscription_request_for_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test-moderators@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: test+permit-@mlmmjtest Hi, this is the Mlmmj program managing the mailing list. There has been a request from to join the normal version of the list. To permit this, please send a message to which can usually be done simply by replying to this message. If you do not want to do this, either send a message to or simply ignore this message. The following gatekeepers have received this mail: - modo1@test - modo2@test . QUIT EOF atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt atf_check -s exit:1 test -f ml/subscribers.d/j atf_check -o file:expected-modos.txt sed -e "/^Message-ID:/d; /^Date:/d; s/permit-.*@mlmmjtest/permit-@mlmmjtest/g; s/obstruct-.*@mlmmjtest/obstruct-@mlmmjtest/g" mail-2.txt atf_check -s exit:1 test -f mail-3.txt atf_check -o match:"^ml/moderation/subscribe.*" find ml/moderation/ -type f atf_check -o inline:"john@doe.org\nSUB_NORMAL\n" cat ml/moderation/subscribe* file=$(ls ml/moderation/subscribe*) atf_check ${mlmmjsub} -L ml -m ${file##*subscribe} -c atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:1 test -f $file } add_normal_then_nomail_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -n -a john@doe.org atf_check -o inline:"john@doe.org\n" cat ml/nomailsubs.d/j if [ -f ml/subscribers.d/j ]; then atf_fail "John Doe still subscribed" fi } add_normal_owner_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -q -a john@doe.org atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j } add_digest_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -d atf_check -o inline:"john@doe.org\n" cat ml/digesters.d/j } add_nomail_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -n atf_check -o inline:"john@doe.org\n" cat ml/nomailsubs.d/j } add_both_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -b atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -o inline:"john@doe.org\n" cat ml/digesters.d/j } add_both_with_digest_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/digesters.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -b atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -o inline:"john@doe.org\n" cat ml/digesters.d/j } add_both_with_normal_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -b atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -o inline:"john@doe.org\n" cat ml/digesters.d/j } add_normal_with_both_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "john@doe.org" > ml/digesters.d/j echo "john@doe.org" > ml/nomailsubs.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org atf_check -s exit:1 test -f ml/digesters.d/j atf_check -o inline:"john@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:1 test -f ml/nomail.d/j } add_digest_with_both_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "john@doe.org" > ml/digesters.d/j echo "john@doe.org" > ml/nomailsubs.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -d atf_check -s exit:1 test -f ml/subscribers.d/j atf_check -o inline:"john@doe.org\n" cat ml/digesters.d/j atf_check -s exit:1 test -f ml/nomail.d/j } add_nomail_with_both_body() { init_ml ml mlmmjsub=$(command -v mlmmj-sub) echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "john@doe.org" > ml/digesters.d/j echo "john@doe.org" > ml/nomailsubs.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -n atf_check -s exit:1 test -f ml/subscribers.d/j atf_check -s exit:1 test -f ml/digesters.d/j atf_check -s exit:1 test -f ml/nomail.d/j } remove_normal_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "bob@doe.org" >> ml/subscribers.d/j echo "rebecca@doe.org" >> ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -a jane@doe.org -q -s atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j } remove_normal_confirm_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "bob@doe.org" >> ml/subscribers.d/j echo "rebecca@doe.org" >> ml/subscribers.d/j echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has removed you from the list. . QUIT EOF atf_check -s exit:1 test -f mail-2.txt atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt touch ml/control/notifysub atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected2.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be unsubscribed from the list because you are not subscribed. If you are receiving messages, perhaps a different email address is subscribed. To find out which address you are subscribed with, refer to the message welcoming you to the list, or look at the envelope "Return-Path" header of a message you receive from the list. . QUIT EOF atf_check -o file:expected2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt echo "john@doe.org" >> ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has removed you from the list. . QUIT EOF atf_check -o file:expected3.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-3.txt cat > expected4.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unsubscribed_from_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test+owner@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The address has been unsubscribed from the list because an administrator commanded it. . QUIT EOF atf_check -o file:expected4.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-4.txt atf_check -s exit:1 test -f mail-5.txt } remove_normal_confirm_and_send_owner_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) atf_check $top_builddir/tests/fakesmtpd trap kill_fakesmtp EXIT TERM echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/subscribers.d/j echo "bob@doe.org" >> ml/subscribers.d/j echo "rebecca@doe.org" >> ml/subscribers.d/j echo "25678" > ml/control/smtpport echo "heloname" > ml/control/smtphelo touch ml/control/notifysub rmdir ml/text ln -s ${top_srcdir}/listtexts/en ml/text atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has removed you from the list. . QUIT EOF atf_check -s exit:0 test -f mail-2.txt atf_check -o file:expected.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt cat > notify.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unsubscribed_from_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test+owner@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The address has been unsubscribed from the list because an administrator commanded it. . QUIT EOF atf_check -o file:notify.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt touch ml/control/notifysub atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected2.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unable_to_unsubscribe_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. You were unable to be unsubscribed from the list because you are not subscribed. If you are receiving messages, perhaps a different email address is subscribed. To find out which address you are subscribed with, refer to the message welcoming you to the list, or look at the envelope "Return-Path" header of a message you receive from the list. . QUIT EOF atf_check -o file:expected2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-3.txt echo "john@doe.org" >> ml/subscribers.d/j atf_check -s exit:0 $mlmmjsub -L ml -c -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j cat > expected3.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Goodbye_from_test=40mlmmjtest?= From: test+help@mlmmjtest To: john@doe.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. An administrator has removed you from the list. . QUIT EOF atf_check -o file:expected3.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-4.txt cat > expected4.txt << EOF EHLO heloname MAIL FROM: RCPT TO: DATA Subject: =?utf-8?q?Unsubscribed_from_test=40mlmmjtest:_john=40doe.org?= From: test+owner@mlmmjtest To: test+owner@mlmmjtest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, this is the Mlmmj program managing the mailing list. The address has been unsubscribed from the list because an administrator commanded it. . QUIT EOF atf_check -o file:expected4.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt atf_check -s exit:1 test -f mail-6.txt } remove_normal_owner_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail echo 25678 > ml/control/smtpport echo test@mlmmjtest > ml/control/listaddress echo owner@mlmmjtest > ml/control/owner echo "john@doe.org" > ml/subscribers.d/j echo "bob@doe.org" >> ml/subscribers.d/j echo "rebecca@doe.org" >> ml/subscribers.d/j touch ml/control/notifysub atf_check -s exit:0 $mlmmjsub -L ml -q -a john@doe.org atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/subscribers.d/j } remove_digest_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/digesters.d/j echo "bob@doe.org" >> ml/digesters.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -d atf_check -o inline:"bob@doe.org\n" cat ml/digesters.d/j } remove_nomail_body() { init_ml ml mlmmjsub=$(command -v mlmmj-unsub) printf "To: test@mlmmjtest1\r\nSubject: test\n\nplop" > mail echo test@mlmmjtest > ml/control/listaddress echo "john@doe.org" > ml/nomailsubs.d/j echo "bob@doe.org" >> ml/nomailsubs.d/j echo "rebecca@doe.org" >> ml/nomailsubs.d/j atf_check -s exit:0 $mlmmjsub -L ml -a john@doe.org -n atf_check -o inline:"bob@doe.org\nrebecca@doe.org\n" cat ml/nomailsubs.d/j } add_basics_body() { mlmmjsub=$(command -v mlmmj-sub) helptxt="Usage: $mlmmjsub -L /path/to/list {-a john@doe.org | -m str} [-c] [-C] [-f] [-h] [-L] [-d | -n] [-q] [-r | -R] [-s] [-U] [-V] -a: Email address to subscribe -c: Send welcome mail (unless requesting confirmation) -C: Request mail confirmation (unless switching versions) -d: Subscribe to digest of list -f: Force subscription (do not moderate) -h: This help -L: Full path to list directory -m: moderation string -n: Subscribe to no mail version of list -q: Be quiet (don't notify owner about the subscription) -r: Behave as if request arrived via email (internal use) -R: Behave as if confirmation arrived via email (internal use) -s: Don't send a mail to subscriber if already subscribed -U: Don't switch to the user id of the listdir owner -V: Print version To ensure a silent subscription, use -f -q -s" init_ml ml echo "test@mlmmjtest" > ml/control/listaddress atf_check -s exit:1 -e "inline:mlmmj-sub: No '@' in the provided email address 'plop'\n" $mlmmjsub -L ml -a plop -n atf_check -s exit:1 -e "inline:mlmmj-sub: You have to specify -a or -m\n$mlmmjsub -h for help\n" $mlmmjsub -L ml atf_check -s exit:1 -e "inline:mlmmj-sub: Specify at most one of -b, -d and -n\n$mlmmjsub -h for help\n" $mlmmjsub -L ml -a john@doe.org -b -d -n atf_check -s exit:1 -e "inline:mlmmj-sub: Cannot subscribe the list address to the list\n" $mlmmjsub -L ml -a test@mlmmjtest -b atf_check -s exit:0 -o "inline:${helptxt}\n" $mlmmjsub -h atf_check -s exit:0 -o "match:mlmmj-sub version" $mlmmjsub -V atf_check -s exit:1 -e "inline:mlmmj-sub: You have to specify -L\n$mlmmjsub -h for help\n" $mlmmjsub } remove_basics_body() { mlmmjsub=$(command -v mlmmj-unsub) helptxt="Usage: $mlmmjsub -L /path/to/list -a john@doe.org [-c | -C] [-h] [-L] [-d | -n | -N] [-q] [-r | -R] [-s] [-V] -a: Email address to unsubscribe -c: Send goodbye mail -C: Request mail confirmation -d: Unsubscribe from digest of list -h: This help -L: Full path to list directory -n: Unsubscribe from no mail version of list -N: Unsubscribe from normal version of list -q: Be quiet (don't notify owner about the subscription) -r: Behave as if request arrived via email (internal use) -R: Behave as if confirmation arrived via email (internal use) -s: Don't send a mail to the address if not subscribed -U: Don't switch to the user id of the listdir owner -V: Print version To ensure a silent unsubscription, use -q -s" init_ml ml echo "test@mlmmjtest" > ml/control/listaddress atf_check -s exit:1 -e "inline:mlmmj-unsub: No '@' in the provided email address 'plop'\n" $mlmmjsub -L ml -a plop -n atf_check -s exit:1 -e "inline:mlmmj-unsub: You have to specify -L and -a\n$mlmmjsub -h for help\n" $mlmmjsub -L ml atf_check -s exit:0 -o "inline:${helptxt}\n" $mlmmjsub -h atf_check -s exit:0 -o "match:mlmmj-unsub version" $mlmmjsub -V atf_check -s exit:1 -e "inline:mlmmj-unsub: You have to specify -L and -a\n$mlmmjsub -h for help\n" $mlmmjsub } mlmmj/tests/mlmmj.c000066400000000000000000002777701502303113500146310ustar00rootroot00000000000000/* * Copyright (C) 2022-2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include "tllist.h" #if defined(__clang__) #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" #elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wformat-zero-length" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "atf-c/macros.h" #include "atf-c/utils.h" #include "mlmmj.h" #include "send_list.h" #include "xmalloc.h" #include "wrappers.h" #include "chomp.h" #include "utils.h" #include "strgen.h" #include "mail-functions.h" #include "mygetline.h" #include "init_sockfd.h" #include "checkwait_smtpreply.h" #include "find_email_adr.h" #include "send_mail.h" #include "getlistdelim.h" #include "statctrl.h" #include "subscriberfuncs.h" #include "getaddrsfromfile.h" #include "ctrlvalue.h" #include "ctrlvalues.h" #include "incindexfile.h" #include "log_oper.h" #include "listcontrol.h" #include "mlmmj-process.h" #include "prepstdreply.h" #include "mlmmj_tests.h" #include "send_help.h" #include "gethdrline.h" #include "unistr.h" ATF_TC_WITHOUT_HEAD(random_int); ATF_TC_WITHOUT_HEAD(chomp); ATF_TC_WITHOUT_HEAD(mydirname); ATF_TC_WITHOUT_HEAD(mybasename); ATF_TC_WITHOUT_HEAD(mygetline); ATF_TC_WITHOUT_HEAD(init_sock); ATF_TC_WITHOUT_HEAD(genmsgid); ATF_TC_WITHOUT_HEAD(lowercase); ATF_TC_WITHOUT_HEAD(exec_or_die); ATF_TC_WITHOUT_HEAD(exec_and_wait); ATF_TC_WITHOUT_HEAD(find_email_adr); ATF_TC_WITHOUT_HEAD(strtoim); ATF_TC_WITHOUT_HEAD(write_ehlo); ATF_TC_WITHOUT_HEAD(write_helo); ATF_TC_WITHOUT_HEAD(write_dot); ATF_TC_WITHOUT_HEAD(write_data); ATF_TC_WITHOUT_HEAD(write_quit); ATF_TC_WITHOUT_HEAD(write_rset); ATF_TC_WITHOUT_HEAD(write_replyto); ATF_TC_WITHOUT_HEAD(write_rcpt_to); ATF_TC_WITHOUT_HEAD(write_mail_from); ATF_TC_WITHOUT_HEAD(write_mailbody); ATF_TC_WITHOUT_HEAD(strtotimet); ATF_TC_WITHOUT_HEAD(decode_qp); ATF_TC_WITHOUT_HEAD(parse_lastdigest); ATF_TC_WITHOUT_HEAD(extract_bouncetime); ATF_TC_WITHOUT_HEAD(open_subscriber_directory); ATF_TC_WITHOUT_HEAD(unsubscribe); ATF_TC_WITHOUT_HEAD(genlistname); ATF_TC_WITHOUT_HEAD(genlistfqdn); ATF_TC_WITHOUT_HEAD(smtp); ATF_TC_WITHOUT_HEAD(init_smtp); ATF_TC_WITHOUT_HEAD(smtp_bad_greetings); ATF_TC_WITHOUT_HEAD(smtp_bad_ehlo); ATF_TC_WITHOUT_HEAD(smtp_no_ehlo); ATF_TC_WITHOUT_HEAD(endsmtp); ATF_TC_WITHOUT_HEAD(do_bouncemail); ATF_TC_WITHOUT_HEAD(bouncemail); ATF_TC_WITHOUT_HEAD(send_mail_basics); ATF_TC_WITHOUT_HEAD(send_mail); ATF_TC_WITHOUT_HEAD(getlistdelim); ATF_TC_WITHOUT_HEAD(getlistdelim_0); ATF_TC_WITHOUT_HEAD(getlistdelim_1); ATF_TC_WITHOUT_HEAD(getlistdelim_2); ATF_TC_WITHOUT_HEAD(getlistdelim_3); ATF_TC_WITHOUT_HEAD(getlistdelim_4); ATF_TC_WITHOUT_HEAD(statctrl); ATF_TC_WITHOUT_HEAD(is_subbed_in); ATF_TC_WITHOUT_HEAD(getaddrsfromfile); ATF_TC_WITHOUT_HEAD(dumpfd2fd); ATF_TC_WITHOUT_HEAD(copy_file); ATF_TC_WITHOUT_HEAD(copy_file_1); ATF_TC_WITHOUT_HEAD(copy_file_2); ATF_TC_WITHOUT_HEAD(controls); ATF_TC_WITHOUT_HEAD(incindexfile); ATF_TC_WITHOUT_HEAD(log_oper); ATF_TC_WITHOUT_HEAD(get_ctrl_command); ATF_TC_WITHOUT_HEAD(get_recipextra_from_env_none); ATF_TC_WITHOUT_HEAD(get_recipextra_from_env_qmail); ATF_TC_WITHOUT_HEAD(get_recipextra_from_env_postfix); ATF_TC_WITHOUT_HEAD(get_recipextra_from_env_exim); ATF_TC_WITHOUT_HEAD(addrmatch); ATF_TC_WITHOUT_HEAD(get_subcookie_content); ATF_TC_WITHOUT_HEAD(ml_list); ATF_TC_WITHOUT_HEAD(gen_addr); ATF_TC_WITHOUT_HEAD(memory_lines); ATF_TC_WITHOUT_HEAD(text_0); ATF_TC_WITHOUT_HEAD(text_1); ATF_TC_WITHOUT_HEAD(file_lines); ATF_TC_WITHOUT_HEAD(list_subs); ATF_TC_WITHOUT_HEAD(notify_sub); ATF_TC_WITHOUT_HEAD(get_processed_text_line); ATF_TC_WITHOUT_HEAD(newsmtp); ATF_TC_WITHOUT_HEAD(save_queue); ATF_TC_WITHOUT_HEAD(send_single_mail); ATF_TC_WITHOUT_HEAD(generate_subscription); ATF_TC_WITHOUT_HEAD(generate_subconfirm); ATF_TC_WITHOUT_HEAD(send_confirmation_mail); ATF_TC_WITHOUT_HEAD(listcontrol); ATF_TC_WITHOUT_HEAD(send_help); ATF_TC_WITHOUT_HEAD(requeuemail); ATF_TC_WITHOUT_HEAD(gethdrline); ATF_TC_WITHOUT_HEAD(readlf); ATF_TC_WITHOUT_HEAD(mod_get_addr_type); ATF_TC_WITHOUT_HEAD(send_probe_no_probefile); ATF_TC_WITHOUT_HEAD(send_probe_arobase); ATF_TC_WITHOUT_HEAD(send_probe); ATF_TC_WITHOUT_HEAD(send_probe_archive); ATF_TC_WITHOUT_HEAD(parse_content_type); ATF_TC_WITHOUT_HEAD(find_in_list); ATF_TC_WITHOUT_HEAD(do_access); ATF_TC_WITHOUT_HEAD(unistr_header_to_utf8); ATF_TC_BODY(random_int, tc) { intmax_t val = random_int(); ATF_REQUIRE_MSG(val < INT_MAX, "Invalid integer"); } ATF_TC_BODY(chomp, tc) { char test1[] = "\n"; char test2[] = "\r"; char test3[] = "\r\n"; char test4[] = "test\r\n"; char test5[] = ""; ATF_REQUIRE(chomp(NULL) == NULL); char *bla = chomp(test1); ATF_REQUIRE(bla != NULL); ATF_REQUIRE_STREQ(bla, ""); bla = chomp(test2); ATF_REQUIRE(bla != NULL); ATF_REQUIRE_STREQ(bla, ""); bla = chomp(test3); ATF_REQUIRE(bla != NULL); ATF_REQUIRE_STREQ(bla, ""); bla = chomp(test4); ATF_REQUIRE(bla != NULL); ATF_REQUIRE_STREQ(bla, "test"); bla = chomp(test5); ATF_REQUIRE(bla != NULL); ATF_REQUIRE_STREQ(bla, ""); } ATF_TC_BODY(mydirname, tc) { char plop[] = "/path/to/a/file"; char *t = mydirname(plop); ATF_REQUIRE_STREQ(t, "/path/to/a"); free(t); t = mydirname(NULL); ATF_REQUIRE_STREQ(t, "."); free(t); t = mydirname("a"); ATF_REQUIRE_STREQ(t, "."); free(t); } ATF_TC_BODY(mybasename, tc) { char plop[] = "/path/to/a/file"; char plop1[] = "file"; ATF_REQUIRE_STREQ(mybasename(plop), "file"); ATF_REQUIRE_STREQ(mybasename(plop1), "file"); } ATF_TC_BODY(mygetline, tc) { int fd = open("test", O_CREAT|O_RDWR, 0644); ATF_REQUIRE(mygetline(fd) == NULL); dprintf(fd, "a"); lseek (fd, 0, SEEK_SET); char *res = mygetline(fd); ATF_REQUIRE(res != NULL); ATF_REQUIRE_STREQ(res, "a"); for (int i = 0; i < BUFSIZ + 2; i++) dprintf(fd, "a"); lseek (fd, 0, SEEK_SET); res = mygetline(fd); ATF_REQUIRE(res != NULL); dprintf(fd, "\nab\n"); lseek (fd, 0, SEEK_SET); mygetline(fd); res = mygetline(fd); ATF_REQUIRE(res != NULL); ATF_REQUIRE_STREQ(res, "ab\n"); close(fd); } ATF_TC_BODY(lowercase, tc) { ATF_REQUIRE_STREQ(lowercase("MAR23anC"), "mar23anc"); } ATF_TC_BODY(init_sock, tc) { int mypipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, mypipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(mypipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); /* * Now we can accept incoming connections one * at a time using accept(2). */ c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); exit(0); } close(mypipe[1]); atf_utils_readline(mypipe[0]); int sock; do { init_sockfd(&sock, "127.0.0.1", 25678); if (sock == -1 && errno != EPERM) break; if (sock != -1) break; } while (1); if (sock == -1) atf_tc_fail("%s", strerror(errno)); atf_utils_wait(p, 0, "", ""); } ATF_TC_BODY(genmsgid, tc) { char *test = genmsgid("test.net"); ATF_REQUIRE_MATCH_MSG("Message-ID: <[0-9]+-[0-9]+-mlmmj-........@test.net>\n", test, "Invalid msgid '%s'", test); free(test); } ATF_TC_BODY(exec_or_die, tc) { pid_t p = atf_utils_fork(); if (p == 0) { exec_or_die("/usr/bin/nopenope", NULL); } atf_utils_wait(p, 1, "", "mlmmj: Execution failed for '/usr/bin/nopenope': No such file or directory\n"); p = atf_utils_fork(); if (p == 0) { exec_or_die("true", (char *)NULL); } atf_utils_wait(p, 0, "", ""); p = atf_utils_fork(); if (p == 0) { exec_or_die("/bin/echo", "a", (char *)NULL); } atf_utils_wait(p, 0, "a\n", ""); } ATF_TC_BODY(exec_and_wait, tc) { int val = exec_and_wait("/usr/bin/nopenope", NULL); ATF_REQUIRE_EQ(val, -1); val = exec_and_wait("true", NULL); ATF_REQUIRE_EQ(val, 0); val = exec_and_wait("false", NULL); ATF_REQUIRE_EQ(val, 1); } ATF_TC_BODY(find_email_adr, tc) { strlist c = tll_init(); strlist c1 = tll_init(); strlist c2 = tll_init(); strlist c3 = tll_init(); strlist c4 = tll_init(); strlist c5 = tll_init(); strlist c6 = tll_init(); strlist c7 = tll_init(); find_email_adr("test@foo.bar", &c); ATF_REQUIRE_EQ(tll_length(c), 1); find_email_adr("test@foo.bar, meh@bar", &c1); ATF_REQUIRE_EQ(tll_length(c1), 2); find_email_adr("test@foo.bar, meh@bar, nope", &c2); ATF_REQUIRE_EQ(tll_length(c2), 3); find_email_adr("name ", &c3); ATF_REQUIRE_EQ(tll_length(c3), 1); ATF_REQUIRE_STREQ(tll_front(c3), "test@foo.com"); find_email_adr("(name ) test@foo.com", &c4); ATF_REQUIRE_EQ(tll_length(c4), 1); ATF_REQUIRE_STREQ(tll_front(c4), " test@foo.com"); find_email_adr("\"name \" test@foo.com", &c5); ATF_REQUIRE_EQ(tll_length(c5), 1); ATF_REQUIRE_STREQ(tll_front(c5), "name test@foo.com"); find_email_adr("\"name test@foo.com", &c6); ATF_REQUIRE_EQ(tll_length(c6), 1); ATF_REQUIRE_STREQ(tll_front(c6), "name test@foo.com"); find_email_adr("\"name \\ test@foo.com", &c7); ATF_REQUIRE_EQ(tll_length(c7), 1); ATF_REQUIRE_STREQ(tll_front(c7), "name test@foo.com"); find_email_adr("\"name test@foo.com\\", &c7); ATF_REQUIRE_EQ(tll_length(c7), 2); ATF_REQUIRE_STREQ(tll_back(c7), "name test@foo.com"); find_email_adr("test at foo.com", &c7); ATF_REQUIRE_EQ(tll_length(c7), 3); ATF_REQUIRE_STREQ(tll_back(c7), "test@foo.com"); find_email_adr("test atfoo.com", &c7); ATF_REQUIRE_EQ(tll_length(c7), 4); ATF_REQUIRE_STREQ(tll_back(c7), "test atfoo.com"); find_email_adr("test a t foo.com", &c7); ATF_REQUIRE_EQ(tll_length(c7), 5); ATF_REQUIRE_STREQ(tll_back(c7), "test a t foo.com"); find_email_adr("test@foo.com, \"meh\"", &c7); ATF_REQUIRE_EQ(tll_length(c7), 7); ATF_REQUIRE_STREQ(tll_back(c7), "\"meh\""); find_email_adr("test@foo.com, \"meh\\\"", &c7); ATF_REQUIRE_EQ(tll_length(c7), 9); ATF_REQUIRE_STREQ(tll_back(c7), "meh "); find_email_adr("", &c7); ATF_REQUIRE_EQ(tll_length(c7), 9); find_email_adr("\"meh\" , ", &c7); ATF_REQUIRE_EQ(tll_length(c7), 10); ATF_REQUIRE_STREQ(tll_back(c7), "meh"); find_email_adr("\"meh , ", &c7); ATF_REQUIRE_EQ(tll_length(c7), 11); ATF_REQUIRE_STREQ(tll_back(c7), "meh "); find_email_adr("\t,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 11); find_email_adr("\r,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 11); find_email_adr("\n,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 11); find_email_adr(", m", &c7); ATF_REQUIRE_EQ(tll_length(c7), 12); find_email_adr(", \"m", &c7); ATF_REQUIRE_EQ(tll_length(c7), 13); find_email_adr("bob @ foo.net", &c7); ATF_REQUIRE_EQ(tll_length(c7), 14); ATF_REQUIRE_STREQ(tll_back(c7), "bob@foo.net"); find_email_adr("bob @foo.net", &c7); ATF_REQUIRE_EQ(tll_length(c7), 15); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net"); find_email_adr("bob @foo.net>", &c7); ATF_REQUIRE_EQ(tll_length(c7), 16); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net>"); find_email_adr(" garbage,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 17); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net"); find_email_adr(" garbage (more garbage) ,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 18); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net"); find_email_adr(" garbage \"more garbage\" ,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 19); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net"); find_email_adr(" garbage \"more garbage \\ ,", &c7); ATF_REQUIRE_EQ(tll_length(c7), 20); ATF_REQUIRE_STREQ(tll_back(c7), "bob @foo.net"); } ATF_TC_BODY(strtoim, tc) { const char *errp; ATF_REQUIRE_EQ(strtoim(NULL, 0, 10, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtoim("10", 0, 10, &errp), 10); ATF_REQUIRE(errp == NULL); ATF_REQUIRE_EQ(strtoim("10", 0, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too large"); ATF_REQUIRE_EQ(strtoim("-1", 0, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too small"); ATF_REQUIRE_EQ(strtoim("-1", 10, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtoim("ba12", 0, 9, &errp), 0); ATF_REQUIRE_EQ(errno, EINVAL); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtoim("ba12", 0, 9, NULL), 0); ATF_REQUIRE_EQ(strtouim(NULL, 0, 10, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtouim("10", 0, 10, &errp), 10); ATF_REQUIRE(errp == NULL); ATF_REQUIRE_EQ(strtouim("10", 0, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too large"); ATF_REQUIRE_EQ(strtouim("1", 2, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too small"); ATF_REQUIRE_EQ(strtouim("-1", 0, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too large"); ATF_REQUIRE_EQ(strtouim("-1", 10, 9, &errp), 0); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtouim("ba12", 0, 9, &errp), 0); ATF_REQUIRE_EQ(errno, EINVAL); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "invalid"); ATF_REQUIRE_EQ(strtouim("ba12", 0, 9, NULL), 0); } ATF_TC_BODY(write_ehlo, tc) { ATF_REQUIRE_EQ(write_ehlo(-1, "myname"), -1); int fd = open("ehlo.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_ehlo(fd, "myname"), 0); close(fd); if (!atf_utils_compare_file("ehlo.txt", "EHLO myname\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_helo, tc) { ATF_REQUIRE_EQ(write_helo(-1, "myname"), -1); int fd = open("helo.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_helo(fd, "myname"), 0); close(fd); if (!atf_utils_compare_file("helo.txt", "HELO myname\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_dot, tc) { ATF_REQUIRE_EQ(write_dot(-1), -1); int fd = open("dot.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_dot(fd), 0); close(fd); if (!atf_utils_compare_file("dot.txt", "\r\n.\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_data, tc) { ATF_REQUIRE_EQ(write_data(-1), -1); int fd = open("data.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_data(fd), 0); close(fd); if (!atf_utils_compare_file("data.txt", "DATA\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_quit, tc) { ATF_REQUIRE_EQ(write_quit(-1), -1); int fd = open("quit.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_quit(fd), 0); close(fd); if (!atf_utils_compare_file("quit.txt", "QUIT\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_rset, tc) { ATF_REQUIRE_EQ(write_rset(-1), -1); int fd = open("rset.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_rset(fd), 0); close(fd); if (!atf_utils_compare_file("rset.txt", "RSET\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_replyto, tc) { ATF_REQUIRE_EQ(write_replyto(-1, "toto"), -1); int fd = open("replyto.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_replyto(fd, "toto"), 0); close(fd); if (!atf_utils_compare_file("replyto.txt", "Reply-To: toto\r\n")) atf_tc_fail("Unexpected output"); } ATF_TC_BODY(write_rcpt_to, tc) { ATF_REQUIRE_EQ(write_rcpt_to(-1, "toto"), -1); int fd = open("rcpt_to.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_rcpt_to(fd, "toto"), 0); close(fd); if (!atf_utils_compare_file("rcpt_to.txt", "RCPT TO:\r\n")) { atf_utils_cat_file("rcpt_to.txt", ""); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(write_mail_from, tc) { ATF_REQUIRE_EQ(write_mail_from(-1, "toto", NULL), -1); int fd = open("mail_from.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_mail_from(fd, "toto", NULL), 0); close(fd); if (!atf_utils_compare_file("mail_from.txt", "MAIL FROM:\r\n")) { atf_utils_cat_file("mail_from.txt", ""); atf_tc_fail("Unexpected output"); } fd = open("mail_from.txt", O_CREAT|O_WRONLY, 0644); ATF_REQUIRE_EQ(write_mail_from(fd, "toto", "meh"), 0); close(fd); if (!atf_utils_compare_file("mail_from.txt", "MAIL FROM: meh\r\n")) { atf_utils_cat_file("mail_from.txt", ""); atf_tc_fail("Unexpected output"); } fd = open("mail_from.txt", O_CREAT|O_WRONLY|O_TRUNC, 0644); ATF_REQUIRE_EQ(write_mail_from(fd, "toto", ""), 0); close(fd); if (!atf_utils_compare_file("mail_from.txt", "MAIL FROM:\r\n")) { atf_utils_cat_file("mail_from.txt", ""); atf_tc_fail("Unexpected output"); } fd = open("mail_from.txt", O_CREAT|O_WRONLY|O_TRUNC, 0644); ATF_REQUIRE_EQ(write_mail_from(fd, "toto", " "), 0); close(fd); if (!atf_utils_compare_file("mail_from.txt", "MAIL FROM: \r\n")) { atf_utils_cat_file("mail_from.txt", ""); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(write_mailbody, tc) { /* no new lines: ignore */ FILE *fp; atf_utils_create_file("myemailbody.txt", "line"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); int fd = open("out.txt", O_CREAT|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); fclose(fp); close(fd); if (!atf_utils_compare_file("out.txt", "line")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (no new lines case)"); } /* With a single new line */ atf_utils_create_file("myemailbody.txt", "line\n"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\n")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (a single new line)"); } /* With a single new line with a single . */ atf_utils_create_file("myemailbody.txt", "line\n."); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\n..")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (single new line with a .)"); } /* New line starting with a dot */ atf_utils_create_file("myemailbody.txt", "line\n.no"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\n..no")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (single new line with a .)"); } /* With a single new line, 2 new lines */ atf_utils_create_file("myemailbody.txt", "line\n\n"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\nTo: test@plop.meh\r\n\r\n")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (a single new line, 2 new lines)"); } /* With a single 2 lines separated by 2 new lines*/ atf_utils_create_file("myemailbody.txt", "line\n\nline2\n\n"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, "test@plop.meh"); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\nTo: test@plop.meh\r\n\r\nline2\r\n\r\n")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (2 lines separated by 2 new lines)"); } /* No to header */ atf_utils_create_file("myemailbody.txt", "line\n\nline2\n\n"); fp = fopen("myemailbody.txt", "r"); ATF_REQUIRE(fp != NULL); fd = open("out.txt", O_CREAT|O_TRUNC|O_WRONLY, 0644); write_mailbody(fd, fp, NULL); close(fd); fclose(fp); if (!atf_utils_compare_file("out.txt", "line\r\n\r\nline2\r\n\r\n")) { atf_utils_cat_file("out.txt", ">"); atf_tc_fail("Unexpected output (no to header)"); } } ATF_TC_BODY(strtotimet, tc) { const char *errp; char *str; ATF_REQUIRE_EQ(strtotimet("10", &errp), 10); ATF_REQUIRE(errp == NULL); asprintf(&str, "1%"PRIdMAX, INTMAX_MAX); ATF_REQUIRE_EQ(strtotimet(str, &errp), 0); free(str); ATF_REQUIRE(errp != NULL); ATF_REQUIRE_STREQ(errp, "too large"); } ATF_TC_BODY(decode_qp, tc) { ATF_REQUIRE_STREQ(decode_qp("=", false), "="); ATF_REQUIRE_STREQ(decode_qp("=\ra", false), "=\ra"); ATF_REQUIRE_STREQ(decode_qp("=\r\na", false), "a"); ATF_REQUIRE_STREQ(decode_qp("=\na", false), "a"); ATF_REQUIRE_STREQ(decode_qp("This is a subject", false), "This is a subject"); ATF_REQUIRE_STREQ(decode_qp("This= is a subject", false), "This= is a subject"); ATF_REQUIRE_STREQ(decode_qp("This=2 is a subject", false), "This=2 is a subject"); ATF_REQUIRE_STREQ(decode_qp("This=23 is a subject", false), "This# is a subject"); ATF_REQUIRE_STREQ(decode_qp("This=3D is a subject", false), "This= is a subject"); ATF_REQUIRE_STREQ(decode_qp("This_ is a subject", false), "This_ is a subject"); ATF_REQUIRE_STREQ(decode_qp("This_ is a subject", true), "This is a subject"); } ATF_TC_BODY(parse_lastdigest, tc) { time_t lasttime; long lastissue; long lastindex; const char *errstr; char *line; line = xstrdup("1:2:3"); ATF_REQUIRE(parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE(errstr == NULL); ATF_REQUIRE(lastindex == 1); ATF_REQUIRE(lasttime == 2); ATF_REQUIRE(lastissue == 3); free(line); line = xstrdup("1"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid format, expecting 2 or 3 fields"); free(line); line = xstrdup("1:2:3:4"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid format, expecting 2 or 3 fields"); free(line); ATF_REQUIRE(parse_lastdigest(NULL, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE(errstr == NULL); ATF_REQUIRE(lastindex == 0); ATF_REQUIRE(lasttime == 0); ATF_REQUIRE(lastissue == 0); line = xstrdup("1:2"); ATF_REQUIRE(parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE(errstr == NULL); ATF_REQUIRE(lastindex == 1); ATF_REQUIRE(lasttime == 2); ATF_REQUIRE(lastissue == 0); free(line); line = xstrdup("a:2"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lastindex"); free(line); line = xstrdup("-1:2"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lastindex"); free(line); line = xstrdup("1:"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lasttime"); free(line); line = xstrdup("1:a"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lasttime"); free(line); line = xstrdup("1:1:"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lastissue"); free(line); line = xstrdup("1:1:a"); ATF_REQUIRE(!parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_STREQ(errstr, "Invalid value for lastissue"); free(line); line = xstrdup("3774:1702743593:141"); ATF_REQUIRE(parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_EQ(lastindex, 3774); ATF_REQUIRE_EQ(lasttime, 1702743593); ATF_REQUIRE_EQ(lastissue, 141); free(line); line = xstrdup("3774:1702743593:141\n"); ATF_REQUIRE(parse_lastdigest(line, &lastindex, &lasttime, &lastissue, &errstr)); ATF_REQUIRE_EQ(lastindex, 3774); ATF_REQUIRE_EQ(lasttime, 1702743593); ATF_REQUIRE_EQ(lastissue, 141); free(line); } ATF_TC_BODY(extract_bouncetime, tc) { char *line; const char *errstr; line = xstrdup("any:1234 # comment"); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 1234); ATF_REQUIRE(errstr == NULL); free(line); line = xstrdup("any:meh # comment"); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 0); ATF_REQUIRE_STREQ(errstr, "invalid"); free(line); line = xstrdup("any:meh "); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 0); ATF_REQUIRE_STREQ(errstr, "comment is missing"); free(line); line = xstrdup("any:1234 # comment"); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 1234); ATF_REQUIRE(errstr == NULL); free(line); line = xstrdup(" # comment"); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 0); ATF_REQUIRE_STREQ(errstr, "':' missing"); free(line); line = xstrdup("a # comment"); ATF_REQUIRE_EQ(extract_bouncetime(line, &errstr), 0); ATF_REQUIRE_STREQ(errstr, "':' missing"); free(line); } ATF_TC_BODY(open_subscriber_directory, tc) { int fd; const char *dir; init_ml(true); int dfd = open("list", O_DIRECTORY); rmdir("list/subscribers.d"); fd = open_subscriber_directory(dfd, SUB_NORMAL, &dir); ATF_REQUIRE(fd == -1); ATF_REQUIRE_STREQ(dir, "subscribers.d"); mkdir("list/subscribers.d", 0755); fd = open_subscriber_directory(dfd, SUB_NORMAL, NULL); ATF_REQUIRE(fd != -1); close(fd); rmdir("list/digesters.d"); fd = open_subscriber_directory(dfd, SUB_DIGEST, &dir); ATF_REQUIRE(fd == -1); ATF_REQUIRE_STREQ(dir, "digesters.d"); mkdir("list/digesters.d", 0755); fd = open_subscriber_directory(dfd, SUB_DIGEST, NULL); ATF_REQUIRE(fd != -1); close(fd); rmdir("list/nomailsubs.d"); fd = open_subscriber_directory(dfd, SUB_NOMAIL, &dir); ATF_REQUIRE(fd == -1); ATF_REQUIRE_STREQ(dir, "nomailsubs.d"); mkdir("list/nomailsubs.d", 0755); fd = open_subscriber_directory(dfd, SUB_NOMAIL, NULL); ATF_REQUIRE(fd != -1); close(fd); fd = open_subscriber_directory(dfd, SUB_ALL, &dir); ATF_REQUIRE_EQ(fd, -1); ATF_REQUIRE(dir == NULL); close(dfd); } ATF_TC_BODY(unsubscribe, tc) { int listfd; init_ml(true); listfd = open("list", O_DIRECTORY); atf_utils_create_file("list/subscribers.d/j", "john@doe.org"); atf_utils_create_file("list/nomailsubs.d/j", "john@doe.org\njane@doe.org\n"); atf_utils_create_file("list/digesters.d/j", "john@doe.org\n"); ATF_REQUIRE(unsubscribe(listfd, "john@doe.org", SUB_ALL)); ATF_REQUIRE_EQ_MSG(access("list/subscribers.d/j", F_OK), -1, "Not unsubscribed"); ATF_REQUIRE_EQ_MSG(access("list/digesters.d/j", F_OK), -1, "Not unsubscribed from digest"); if (!atf_utils_compare_file("list/nomailsubs.d/j", "jane@doe.org\n")) { atf_utils_cat_file("list/nomailsubs.d/j", ">"); atf_tc_fail("Not unsubscribed from nomail"); } ATF_REQUIRE(unsubscribe(listfd, "jane@doe.org", SUB_NOMAIL)); ATF_REQUIRE_EQ_MSG(access("list/nomailsubs.d/j", F_OK), -1, "Not unsubscribed from nomail"); ATF_REQUIRE(!unsubscribe(listfd, "plop@meh", SUB_BOTH)); rmdir("list/subscribers.d"); ATF_REQUIRE(!unsubscribe(listfd, "plop@meh", SUB_NORMAL)); mkdir("list/subscribers.d", 0755); atf_utils_create_file("list/nomailsubs.d/j", ""); chmod("list/nomailsubs.d/j", 0111); ATF_REQUIRE(unsubscribe(listfd, "plop@meh", SUB_NOMAIL)); chmod("list/nomailsubs.d/j", 0644); ATF_REQUIRE(unsubscribe(listfd, "plop@meh", SUB_NOMAIL)); unlink("list/nomailsubs.d/j"); atf_utils_create_file("list/nomailsubs.d/j", "john@doe.org\njane@doe.org\n"); ATF_REQUIRE(unsubscribe(listfd, "plop@meh", SUB_NOMAIL)); ATF_REQUIRE(!unsubscribe(-1, "plop@meh", SUB_ALL)); } ATF_TC_BODY(genlistname, tc) { char *ret; ret = genlistname("plop@bla"); ATF_REQUIRE_STREQ(ret, "plop"); free(ret); ret = genlistname("plop@bla@meh"); ATF_REQUIRE_STREQ(ret, "plop"); free(ret); } ATF_TC_BODY(genlistfqdn, tc) { const char *ret; ret = genlistfqdn("plop@bla"); ATF_REQUIRE_STREQ(ret, "bla"); ret = genlistfqdn("plop@bla@meh"); ATF_REQUIRE_STREQ(ret, "meh"); } ATF_TC_BODY(smtp, tc) { int smtppipe[2]; char *reply; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { const char *replies[] = { "250-hostname.net\n" "250-PIPELINEING\n" "250-SIZE 20480000\n" "250-ETRN\n" "250-STARTTLS\n" "250-ENHANCEDSTATUSCODES\n" "250-8BITMIME\n" "250-DSN\n" "250-SMTPUTF8\n" "250 CHUNKING\n", /* EHLO */ "250-hostname.net\n", /* HELO */ "250 2.1.0 Ok\n", /* MAIL FROM */ "250 2.1.0 Ok\n", /* RCPT TO */ "354 Send message content; end with .\n", /* DATA */ NULL, /* BEFORE DOT */ "250 2.1.0 Ok\n", /* DATA */ "221 2.0.0 Bye\n", /* QUIT */ "250 2.0.0 Ok\n", /* RSET */ }; dprintf(smtppipe[0], "220 me fake smtp\n"); for (uint8_t i = 0; i < NELEM(replies); i++) { atf_utils_readline(smtppipe[0]); if ( replies[i] != NULL ) { dprintf(smtppipe[0], "%s", replies[i]); } } exit (0); } close(smtppipe[0]); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_CONNECT); ATF_REQUIRE_EQ(reply, NULL); write_ehlo(smtppipe[1], "plop"); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_EHLO); ATF_REQUIRE_EQ(reply, NULL); write_helo(smtppipe[1], "plop"); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_HELO); ATF_REQUIRE_EQ(reply, NULL); write_mail_from(smtppipe[1], "plop", NULL); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_FROM); ATF_REQUIRE_EQ(reply, NULL); write_rcpt_to(smtppipe[1], "plop"); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_RCPTTO); ATF_REQUIRE_EQ(reply, NULL); write_data(smtppipe[1]); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_DATA); ATF_REQUIRE_EQ(reply, NULL); write_dot(smtppipe[1]); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_DOT); ATF_REQUIRE_EQ(reply, NULL); write_quit(smtppipe[1]); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_QUIT); ATF_REQUIRE_EQ(reply, NULL); write_rset(smtppipe[1]); reply = checkwait_smtpreply(smtppipe[1], MLMMJ_RSET); ATF_REQUIRE_EQ(reply, NULL); } ATF_TC_BODY(init_smtp, tc) { int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(smtppipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); const char *replies[] = { "250-hostname.net\n" "250-PIPELINEING\n" "250-SIZE 20480000\n" "250-ETRN\n" "250-STARTTLS\n" "250-ENHANCEDSTATUSCODES\n" "250-8BITMIME\n" "250-DSN\n" "250-SMTPUTF8\n" "250 CHUNKING\n", "221 2.0.0 bye\n", }; read_print_reply(c, replies, NELEM(replies)); exit(0); } close(smtppipe[1]); atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, 0); ATF_REQUIRE_EQ(endsmtp(&sockfd), 0); atf_utils_wait(p, 0, "EHLO heloname\r\nQUIT\r\n", ""); } ATF_TC_BODY(smtp_bad_greetings, tc) { int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(smtppipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "me fake smtp\n"); exit(0); } close(smtppipe[1]); atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, MLMMJ_CONNECT); atf_utils_wait(p, 0, "", ""); } ATF_TC_BODY(smtp_bad_ehlo, tc) { int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(smtppipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); const char *rep = "501 nop nope\n"; read_print_reply(c, &rep, 1); exit(0); } close(smtppipe[1]); atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, MLMMJ_EHLO); atf_utils_wait(p, 0, "EHLO heloname\r\n", ""); } ATF_TC_BODY(smtp_no_ehlo, tc) { int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(smtppipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); const char *replies [] = { "801 meh\n", NULL, }; read_print_reply(c, replies, NELEM(replies)); close(c); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); const char *rep = "250 OK\n"; read_print_reply(c, &rep, 1); exit(0); } close(smtppipe[1]); atf_utils_readline(smtppipe[0]); int sockfd; int ret = initsmtp(&sockfd, "127.0.0.1", 25678, "heloname"); ATF_REQUIRE_EQ(ret, 0); atf_utils_wait(p, 0, "EHLO heloname\r\nQUIT\r\nHELO heloname\r\n", ""); } ATF_TC_BODY(endsmtp, tc) { int sock = -1; ATF_REQUIRE_EQ(endsmtp(&sock), 0); } ATF_TC_BODY(do_bouncemail, tc) { init_ml(true); int lfd = open("list", O_DIRECTORY); int ctrlfd = openat(lfd, "control", O_DIRECTORY); /* malformed */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop"), 0); /* malformed, missing number */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop@meh"), 0); /* malformed, empty numbr */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop-@meh"), 0); /* no listdelim */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop-0@meh"), 0); /* listdelim before */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop+-0@meh"), 0); /* listdelim before */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop-0+@meh"), 0); /* 2 ticks */ ATF_REQUIRE_EQ(do_bouncemail(lfd, ctrlfd, "plop+--bla@meh"), 1); close(lfd); close(ctrlfd); } ATF_TC_BODY(bouncemail, tc) { mkdir("list", 0755); int fd = open("list", O_DIRECTORY); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "confsub"), BOUNCE_OK); mkdir("list/subconf", 0755); close(open("list/subconf/bapt=freebsd.org", O_CREAT, 0644)); ATF_REQUIRE_EQ(access("list/subconf/bapt=freebsd.org", F_OK), 0); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "confsub"), BOUNCE_OK); ATF_REQUIRE_EQ(access("list/subconf/bapt=freebsd.org", F_OK), -1); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "confunsub"), BOUNCE_OK); mkdir("list/unsubconf", 0755); close(open("list/unsubconf/bapt=freebsd.org", O_CREAT, 0644)); ATF_REQUIRE_EQ(access("list/unsubconf/bapt=freebsd.org", F_OK), 0); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "confunsub"), BOUNCE_OK); ATF_REQUIRE_EQ(access("list/unsubconf/bapt=freebsd.org", F_OK), -1); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "probe"), BOUNCE_FAIL); mkdir("list/bounce", 0755); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "probe"), BOUNCE_OK); close(open("list/bounce/bapt=freebsd.org-probe", O_CREAT, 0644)); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "probe"), BOUNCE_OK); ATF_REQUIRE_EQ(access("list/bounce/bapt=freebsd.org-probe", F_OK), -1); ATF_REQUIRE_EQ(bouncemail(fd, "bapt@FreeBSD.org", "plop"), BOUNCE_OK); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "1234"), BOUNCE_OK); ATF_REQUIRE_EQ(access("list/bounce/bapt=freebsd.org", F_OK), -1); mkdir("list/subscribers.d", 0755); atf_utils_create_file("list/subscribers.d/b", "bapt@FreeBSD.org"); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "1234"), BOUNCE_DONE); ATF_REQUIRE_EQ(access("list/bounce/bapt=freebsd.org", F_OK), 0); ATF_REQUIRE(atf_utils_grep_file("1234:.*", "list/bounce/bapt=freebsd.org")); ATF_REQUIRE_EQ(bouncemail(fd, "bapt=FreeBSD.org", "2323"), BOUNCE_DONE); ATF_REQUIRE_EQ(access("list/bounce/bapt=freebsd.org", F_OK), 0); ATF_REQUIRE(atf_utils_grep_file("1234:.*", "list/bounce/bapt=freebsd.org")); ATF_REQUIRE(atf_utils_grep_file("2323:.*", "list/bounce/bapt=freebsd.org")); } ATF_TC_BODY(send_mail_basics, tc) { struct mail mail = { 0 }; ATF_REQUIRE_EQ_MSG(send_mail(1, &mail, -1, -1, false), 0, "Failure with to == NULL"); mail.to = "plop"; ATF_REQUIRE_EQ_MSG(send_mail(1, &mail, -1, -1, false), 0, "Failure with to without @"); mail.to = "plop@meh"; ATF_REQUIRE_EQ_MSG(send_mail(1, &mail, -1, -1, false), 0, "Failure with from == NULL"); } ATF_TC_BODY(send_mail, tc) { int smtppipe[2]; struct mail mail = { 0 }; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { const char *replies [] = { "250 2.1.0 OK\n", "250 2.1.0 OK\n", "350 2.1.0 OK\n", NULL, NULL, NULL, NULL, NULL, "250 2.1.0 OK\n", }; read_print_reply(smtppipe[0], replies, NELEM(replies)); exit(0); } close(smtppipe[0]); mail.to = "plop@meh"; mail.from = "test@meh"; atf_utils_create_file("mymail.txt", "headers\n\nbody\n"); mail.fp = fopen("mymail.txt", "r"); mail.addtohdr = true; ATF_REQUIRE_EQ(send_mail(smtppipe[1], &mail, -1, -1, false), 0); atf_utils_wait(p, 0, "MAIL FROM:\r\nRCPT TO:\r\nDATA\r\nheaders\r\nTo: plop@meh\r\n\r\nbody\r\n\r\n.\r\n", ""); } ATF_TC_BODY(getlistdelim, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), DEFAULT_RECIPDELIM, "Invalid fallback"); } ATF_TC_BODY(getlistdelim_0, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); atf_utils_create_file("list/control/delimiter", ""); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), DEFAULT_RECIPDELIM, "Invalid fallback, in case of empty delimiter"); } ATF_TC_BODY(getlistdelim_1, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); atf_utils_create_file("list/control/delimiter", "\n"); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), DEFAULT_RECIPDELIM, "Invalid fallback, in case of empty delimiter"); } ATF_TC_BODY(getlistdelim_2, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); atf_utils_create_file("list/control/delimiter", "mydelim\n"); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), "mydelim", "Invalid delimiter found"); } ATF_TC_BODY(getlistdelim_3, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); atf_utils_create_file("list/control/delimiter", "mydelim\nignoreme\n"); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), "mydelim", "Invalid delimiter found"); } ATF_TC_BODY(getlistdelim_4, tc) { init_ml(true); int fd = open("list/control", O_RDONLY); atf_utils_create_file("list/control/delimiter", "mydelim"); ATF_REQUIRE_STREQ_MSG(getlistdelim(fd), "mydelim", "Invalid delimiter found"); } ATF_TC_BODY(statctrl, tc) { pid_t p; p = atf_utils_fork(); if (p == 0) { statctrl(-1, "test"); exit(0); } atf_utils_wait(p, EXIT_FAILURE, "", ""); mkdir("plop", 0755); int fd = open("plop", O_DIRECTORY); ATF_REQUIRE_EQ(statctrl(fd, "test"), false); atf_utils_create_file("plop/test", ""); ATF_REQUIRE_EQ(statctrl(fd, "test"), true); } ATF_TC_BODY(is_subbed_in, tc) { pid_t p; p = atf_utils_fork(); if (p == 0) { is_subbed_in(-1, "plop", "meh"); } atf_utils_wait(p, EXIT_FAILURE, "", ""); } ATF_TC_BODY(getaddrsfromfile, tc) { strlist stl = tll_init(); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, NULL, 2), -1); atf_utils_create_file("list", ""); FILE *fp; fp = fopen("list", "r"); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, fp, 2), 0); fclose(fp); atf_utils_create_file("list", "\n"); fp = fopen("list", "r"); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, fp, 2), 0); atf_utils_create_file("list", "mail1@fqdn\n"); fp = fopen("list", "r"); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, fp, 2), 0); fclose(fp); ATF_REQUIRE_EQ_MSG(tll_length(stl), 1, "%zu is not 1", tll_length(stl)); ATF_REQUIRE_STREQ(tll_front(stl), "mail1@fqdn"); tll_free_and_free(stl, free); fp = fopen("list", "r"); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, fp, 0), -1); atf_utils_create_file("list", "mail1@fqdn\nmail2@fqdn\nmail3@fqdn"); fp = fopen("list", "r"); ATF_REQUIRE(getaddrsfromfile(&stl, fp, 2) > 0); ATF_REQUIRE_EQ(tll_length(stl), 2); ATF_REQUIRE_STREQ(tll_front(stl), "mail1@fqdn"); ATF_REQUIRE_STREQ(tll_back(stl), "mail2@fqdn"); tll_free_and_free(stl, free); ATF_REQUIRE_EQ(getaddrsfromfile(&stl, fp, 2), 0); ATF_REQUIRE_EQ_MSG(tll_length(stl), 1, "%zu is not 1", tll_length(stl)); ATF_REQUIRE_STREQ(tll_front(stl), "mail3@fqdn"); fclose(fp); } ATF_TC_BODY(dumpfd2fd, tc) { atf_utils_create_file("from", "bla\n"); int from = open("from", O_RDONLY); int to = open("to.txt", O_WRONLY|O_CREAT|O_TRUNC, 0644); ATF_REQUIRE_EQ_MSG(dumpfd2fd(from, to), 0, "Invalid simple copy"); close(from); close(to); if (!atf_utils_compare_file("to.txt", "bla\n")) { atf_utils_cat_file("to.txt", ""); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(copy_file, tc) { atf_utils_create_file("from.txt", "bla\n"); int from = open("from.txt", O_RDONLY); int to = open("to.txt", O_WRONLY|O_CREAT|O_TRUNC, 0644); int ret = copy_file(from, to, BUFSIZ); close(from); close(to); ATF_REQUIRE_EQ_MSG(ret, 4, "Invalid simple copy"); if (!atf_utils_compare_file("to.txt", "bla\n")) { atf_utils_cat_file("to.txt", ">>"); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(copy_file_1, tc) { atf_utils_create_file("from.txt", ""); int to = open("to.txt", O_WRONLY|O_CREAT|O_TRUNC, 0644); int from = open("from.txt", O_RDONLY); int ret = copy_file(from, to, BUFSIZ); close(from); close(to); ATF_REQUIRE_EQ_MSG(ret, 0, "Invalid simple copy"); if (!atf_utils_compare_file("to.txt", "")) { atf_utils_cat_file("to.txt", ">>"); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(copy_file_2, tc) { atf_utils_create_file("from.txt", "bla\n"); int from = open("from.txt", O_RDONLY); int to = open("to.txt", O_WRONLY|O_CREAT|O_TRUNC, 0644); int ret = copy_file(from, to, 3); close(from); close(to); ATF_REQUIRE_EQ_MSG(ret, 3, "Invalid simple copy"); if (!atf_utils_compare_file("to.txt", "bla")) { atf_utils_cat_file("to.txt", ">"); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(controls, tc) { int ctrlfd; mkdir("control", 0755); ctrlfd = open("control", O_DIRECTORY); atf_utils_create_file("control/listaddress", "test@test\n"); ATF_REQUIRE_EQ(ctrlcontent(-1, "plop"), NULL); ATF_REQUIRE_EQ(ctrlcontent(ctrlfd, "plop"), NULL); ATF_REQUIRE_EQ(ctrlvalues(ctrlfd, "plop"), NULL); ATF_REQUIRE(!ctrlvalues_contains(ctrlfd, "plop", "nope", false)); ATF_REQUIRE(ctrlvalues_contains(ctrlfd, "listaddress", "test@test", false)); ATF_REQUIRE(!ctrlvalues_contains(ctrlfd, "listaddress", "tesT@test", true)); ATF_REQUIRE(ctrlvalues_contains(ctrlfd, "listaddress", "tesT@test", false)); ATF_REQUIRE_STREQ(ctrlcontent(ctrlfd, "listaddress"), "test@test\n"); ATF_REQUIRE_EQ(ctrltimet(ctrlfd, "listaddress", 0), 0); ATF_REQUIRE_EQ(ctrltimet(ctrlfd, "plop", 0), 0); atf_utils_create_file("control/val", "12"); ATF_REQUIRE_EQ(ctrltimet(ctrlfd, "val", 0), 12); ATF_REQUIRE_EQ(ctrllong(ctrlfd, "listaddress", 0), 0); ATF_REQUIRE_EQ(ctrllong(ctrlfd, "plop", 0), 0); ATF_REQUIRE_EQ(ctrllong(ctrlfd, "val", 0), 12); ATF_REQUIRE_EQ(ctrlint(ctrlfd, "listaddress", 0), 0); ATF_REQUIRE_EQ(ctrlint(ctrlfd, "plop", 0), 0); ATF_REQUIRE_EQ(ctrlint(ctrlfd, "val", 0), 12); ATF_REQUIRE_EQ(ctrlsizet(ctrlfd, "listaddress", 0), 0); ATF_REQUIRE_EQ(ctrlsizet(ctrlfd, "plop", 0), 0); ATF_REQUIRE_EQ(ctrlsizet(ctrlfd, "val", 0), 12); atf_utils_create_file("control/val", "line1\nline2\n\nline3\n"); strlist *l = ctrlvalues(ctrlfd, "val"); ATF_REQUIRE(l != NULL); ATF_REQUIRE_EQ(tll_length(*l), 3); ATF_REQUIRE_STREQ(tll_front(*l), "line1"); ATF_REQUIRE_STREQ(tll_back(*l), "line3"); ATF_REQUIRE_EQ(textcontent(ctrlfd, "text"), NULL); mkdir("control/text",0755); ATF_REQUIRE_EQ(textcontent(ctrlfd, "text"), NULL); atf_utils_create_file("control/text/text", "this is a test"); ATF_REQUIRE_STREQ(textcontent(ctrlfd, "text"), "this is a test"); ATF_REQUIRE(ctrlvalues_contains(ctrlfd, "val", "line2", true)); ATF_REQUIRE(!ctrlvalues_contains(ctrlfd, "val", "Line2", true)); ATF_REQUIRE(ctrlvalues_contains(ctrlfd, "val", "Line2", false)); } ATF_TC_BODY(incindexfile, tc) { mkdir("list", 0755); int fd = open("list", O_DIRECTORY|O_CLOEXEC); ATF_REQUIRE_EQ(incindexfile(-1), 0); ATF_REQUIRE_EQ(incindexfile(fd), 1); atf_utils_create_file("list/index", "meh"); ATF_REQUIRE_EQ(incindexfile(fd), 0); unlink("list/index"); ATF_REQUIRE_EQ(incindexfile(fd), 1); unlink("list/index"); atf_utils_create_file("list/index", ""); ATF_REQUIRE_EQ(incindexfile(fd), 1); unlink("list/index"); atf_utils_create_file("list/index", "1"); ATF_REQUIRE_EQ(incindexfile(fd), 2); ATF_REQUIRE_EQ(incindexfile(fd), 3); close(fd); } ATF_TC_BODY(log_oper, tc) { mkdir("list", 0755); int fd = open("list", O_DIRECTORY); ATF_REQUIRE_EQ(log_oper(fd, "plop", "one line with formatting %d", fd), 0); if (!atf_utils_grep_file(".* one line with formatting .*", "list/plop")) { atf_utils_cat_file("list/plop", ">"); atf_tc_fail("Invalid log file"); } } ATF_TC_BODY(get_ctrl_command, tc) { char *param = NULL; struct ctrl_command *ctrl; ATF_REQUIRE(get_ctrl_command("plop", ¶m) == NULL); ATF_REQUIRE(param == NULL); ctrl = get_ctrl_command("list", ¶m); ATF_REQUIRE(ctrl != NULL); ATF_REQUIRE(ctrl->type == CTRL_LIST); ATF_REQUIRE(param == NULL); ctrl = get_ctrl_command("list-", ¶m); ATF_REQUIRE(ctrl == NULL); ctrl = get_ctrl_command("get", ¶m); ATF_REQUIRE(ctrl == NULL); ctrl = get_ctrl_command("get-", ¶m); ATF_REQUIRE(ctrl != NULL); ATF_REQUIRE(param != NULL); ATF_REQUIRE_STREQ(param, ""); free(param); ctrl = get_ctrl_command("get-1", ¶m); ATF_REQUIRE(ctrl != NULL); ATF_REQUIRE(param != NULL); ATF_REQUIRE_STREQ(param, "1"); free(param); ctrl = get_ctrl_command("get-a/b", ¶m); ATF_REQUIRE(ctrl == NULL); } ATF_TC_BODY(get_recipextra_from_env_none, tc) { ATF_REQUIRE(get_recipextra_from_env(-1) == NULL); } ATF_TC_BODY(get_recipextra_from_env_qmail, tc) { char *str; setenv("DEFAULT", "value", 1); str = get_recipextra_from_env(-1); ATF_REQUIRE_STREQ(str, "value"); free(str); } ATF_TC_BODY(get_recipextra_from_env_postfix, tc) { char *str; setenv("EXTENSION", "value", 1); str = get_recipextra_from_env(-1); ATF_REQUIRE_STREQ(str, "value"); free(str); } ATF_TC_BODY(get_recipextra_from_env_exim, tc) { char *str; setenv("LOCAL_PART_SUFFIX", "+value", 1); str = get_recipextra_from_env(-1); ATF_REQUIRE_STREQ(str, "value"); free(str); /* no valid delimiter */ setenv("LOCAL_PART_SUFFIX", "=value", 1); str = get_recipextra_from_env(-1); ATF_REQUIRE_STREQ(str, "=value"); free(str); } ATF_TC_BODY(addrmatch, tc) { char *extra; ATF_REQUIRE(addrmatch("lists@test.org", "lists@test.org", "+", &extra)); ATF_REQUIRE(extra == NULL); ATF_REQUIRE(!addrmatch("lists@test.org", NULL, "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "nope@test.org", "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "nope@test.org", NULL, &extra)); ATF_REQUIRE(addrmatch("lists@test.org", "lists+@test.org", "+", &extra)); ATF_REQUIRE(extra == NULL); ATF_REQUIRE(!addrmatch("lists@test.org", "list+@test.org", "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "lists+@bla.org", "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "bla+@test.org", "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "list+@bla.org", "+", &extra)); ATF_REQUIRE(!addrmatch("lists@test.org", "list+test.org", "+", &extra)); ATF_REQUIRE(addrmatch("lists@test.org", "lists+value@test.org", "+", &extra)); ATF_REQUIRE_STREQ(extra, "value"); } ATF_TC_BODY(get_subcookie_content, tc) { init_ml(true); int fd = open("list", O_DIRECTORY); ATF_REQUIRE(fd != -1); rmdir("list/unsubconf"); ATF_REQUIRE(get_subcookie_content(fd, true, "test") == NULL); mkdir("list/unsubconf", 0755); rmdir("list/subconf"); ATF_REQUIRE(get_subcookie_content(fd, false, "test") == NULL); mkdir("list/subconf", 0755); ATF_REQUIRE(get_subcookie_content(fd, false, "test") == NULL); atf_utils_create_file("list/subconf/test", ""); ATF_REQUIRE(get_subcookie_content(fd, false, "test") == NULL); atf_utils_create_file("list/subconf/test", "bla\nplop\n"); ATF_REQUIRE_STREQ(get_subcookie_content(fd, false, "test"), "bla"); } ATF_TC_BODY(ml_list, tc) { struct ml list; ml_init(&list); ATF_REQUIRE(ml_open(&list, false) == false); list.dir = "list"; pid_t p = atf_utils_fork(); if (p == 0) { ATF_REQUIRE(ml_open(&list, false) == false); exit(0); } atf_utils_wait(p, 0, "", "mlmmj: Cannot open(list): No such file or directory\n"); init_ml(false); rmdir("list/control"); ml_init(&list); list.dir = "list"; p = atf_utils_fork(); if (p == 0) { ATF_REQUIRE(ml_open(&list, false) == false); exit (0); } atf_utils_wait(p, 0, "", "mlmmj: Cannot open(list/control): No such file or directory\n"); mkdir("list/control", 0755); ml_init(&list); list.dir = "list"; p = atf_utils_fork(); if (p == 0) { ATF_REQUIRE(ml_open(&list, false) == false); exit (0); } atf_utils_wait(p, 0, "", "mlmmj: Missing list address\n"); atf_utils_create_file("list/control/listaddress", "test"); ml_init(&list); list.dir = "list"; p = atf_utils_fork(); if (p == 0) { ATF_REQUIRE(ml_open(&list, false) == false); exit (0); } atf_utils_wait(p, 0, "", "mlmmj: test: is not a valid mailing list address, missing '@'\n"); atf_utils_create_file("list/control/listaddress", "test@test"); ml_init(&list); list.dir = "list"; p = atf_utils_fork(); if (p == 0) { ATF_REQUIRE(ml_open(&list, false) == true); ATF_REQUIRE_STREQ_MSG(list.delim, "+", "Invalid delimiter"); atf_utils_create_file("list/control/delimiter", "#bla#"); ml_init(&list); list.dir = "list"; ATF_REQUIRE(ml_open(&list, false) == true); ATF_REQUIRE_STREQ_MSG(list.delim, "#bla#", "Invalid delimiter"); exit (0); } atf_utils_wait(p, 0, "", ""); } ATF_TC_BODY(gen_addr, tc) { char *var = NULL; struct ml ml; init_ml(true); ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); gen_addr(var, &ml, "bla"); ATF_REQUIRE_STREQ(var, "test+bla@test"); free(var); gen_addr_cookie(var, &ml, "bla", "cookie"); ATF_REQUIRE_STREQ(var, "test+blacookie@test"); free(var); } ATF_TC_BODY(memory_lines, tc) { finish_memory_lines(NULL); memory_lines_state *s = init_memory_lines("plop"); ATF_REQUIRE_STREQ(get_memory_line(s), "plop"); finish_memory_lines(s); s = init_memory_lines("plop\n"); ATF_REQUIRE_STREQ(get_memory_line(s), "plop"); finish_memory_lines(s); s = init_memory_lines("line1\nline2\nline3"); ATF_REQUIRE_STREQ(get_memory_line(s), "line1"); ATF_REQUIRE_STREQ(get_memory_line(s), "line2"); ATF_REQUIRE_STREQ(get_memory_line(s), "line3"); ATF_REQUIRE_EQ(get_memory_line(s), NULL); rewind_memory_lines(NULL); rewind_memory_lines(s); ATF_REQUIRE_STREQ(get_memory_line(s), "line1"); ATF_REQUIRE_STREQ(get_memory_line(s), "line2"); } ATF_TC_BODY(text_0, tc) { struct ml ml; atf_utils_create_file("intext", "plop\n"); int fd = open("intext", O_RDONLY); text *txt = open_text_fd(fd); ATF_REQUIRE(txt != NULL); int tofd = open("totext", O_CREAT|O_WRONLY, 0644); init_ml(true); ml_init(&ml); ml.dir = "list"; ATF_REQUIRE(ml_open(&ml, false)); ATF_REQUIRE(prepstdreply_to(txt, &ml, "me@fqdn.org", "to@plop.org", NULL, tofd, "Message-Id: ")); close_text(txt); fsync(tofd); close(tofd); close(fd); if (!atf_utils_compare_file("totext", "From: me@fqdn.org\n" "To: to@plop.org\n" "Message-Id: \n" "Message-Id: \n" "Subject: mlmmj administrivia\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "\n" "plop\n")) { atf_utils_cat_file("totext", ""); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(text_1, tc) { struct ml ml; atf_utils_create_file("intext", "Subject: huhu\n" "plop\n" "$$\n" "$listaddr$\n" "$list+$\n" "$listowner$\n" "$helpaddr$\n" "$faqaddr$\n" "$listgetN$\n" "$listunsubaddr$\n" "$nomailunsubaddr$\n" "$digestunsubaddr$\n" "$listsubaddr$\n" "$digestsubaddr$\n" "$nomailsubaddr$\n" ); int fd = open("intext", O_RDONLY); text *txt = open_text_fd(fd); ATF_REQUIRE(txt != NULL); int tofd = open("totext", O_CREAT|O_WRONLY, 0644); init_ml(true); ml_init(&ml); ml.dir = "list"; ATF_REQUIRE(ml_open(&ml, false)); register_default_unformatted(txt, &ml); ATF_REQUIRE(prepstdreply_to(txt, &ml, "me@fqdn.org", "to@plop.org", "bla@me.org", tofd, "Message-Id: ")); close_text(txt); fsync(tofd); close(tofd); close(fd); if (!atf_utils_compare_file("totext", "Subject: huhu\n" "From: me@fqdn.org\n" "To: to@plop.org\n" "Message-Id: \n" "Message-Id: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Reply-To: bla@me.org\n" "\n" "plop\n" "$\n" "test@test\n" "test+\n" "test+owner@test\n" "test+help@test\n" "test+faq@test\n" "test+get-N@test\n" "test+unsubscribe@test\n" "test+unsubscribe-nomail@test\n" "test+unsubscribe-digest@test\n" "test+subscribe@test\n" "test+subscribe-digest@test\n" "test+subscribe-nomail@test\n" )) { atf_utils_cat_file("totext", ""); atf_tc_fail("Unexpected output"); } } ATF_TC_BODY(file_lines, tc) { atf_utils_create_file("file", "line1\nline2\n"); file_lines_state *s = init_file_lines("file", ':'); ATF_REQUIRE(s != NULL); ATF_REQUIRE(get_file_line(s) == NULL); rewind_file_lines(s); ATF_REQUIRE(get_file_line(s) == NULL); finish_file_lines(s); atf_utils_create_file("file", "line1: plop\nline2\nline3: meh"); s = init_file_lines("file", ':'); ATF_REQUIRE(s != NULL); ATF_REQUIRE(get_file_line(s) == NULL); rewind_file_lines(s); ATF_REQUIRE_STREQ(get_file_line(s), "line1"); ATF_REQUIRE(get_file_line(s) == NULL); ATF_REQUIRE_STREQ(get_file_line(s), "line3"); ATF_REQUIRE(get_file_line(s) == NULL); finish_file_lines(s); s = init_file_lines("file", '\0'); finish_file_lines(s); s = init_file_lines("file", '\0'); ATF_REQUIRE(s != NULL); ATF_REQUIRE(get_file_line(s) == NULL); rewind_file_lines(s); ATF_REQUIRE_STREQ(get_file_line(s), "line1: plop"); ATF_REQUIRE_STREQ(get_file_line(s), "line2"); ATF_REQUIRE_STREQ(get_file_line(s), "line3: meh"); ATF_REQUIRE(get_file_line(s) == NULL); rewind_file_lines(s); finish_file_lines(s); rewind_file_lines(NULL); ATF_REQUIRE(get_file_line(NULL) == NULL); finish_file_lines(NULL); } ATF_TC_BODY(list_subs, tc) { struct ml ml; init_ml(true); ml_init(&ml); atf_utils_create_file("list/subscribers.d/a", "auser1\nauser2"); atf_utils_create_file("list/subscribers.d/b", ""); ml.dir = "list"; ml_open(&ml, false); struct subs_list_state *s = init_subs_list(ml.fd, "subscribers.d"); rewind_subs_list(NULL); ATF_REQUIRE(get_sub(s) == NULL); rewind_subs_list(s); ATF_REQUIRE(get_sub(NULL) == NULL); ATF_REQUIRE_STREQ(get_sub(s), "auser1"); ATF_REQUIRE_STREQ(get_sub(s), "auser2"); ATF_REQUIRE(get_sub(s) == NULL); finish_subs_list(NULL); int fd = open("output", O_WRONLY|O_CREAT, 0644); print_subs(fd, s); close(fd); if (!atf_utils_compare_file("output", "auser1\nauser2\n")) { atf_utils_cat_file("output", ""); atf_tc_fail("Unexpected output, expected"); } rewind_subs_list(s); rewind_subs_list(s); ATF_REQUIRE_STREQ(get_sub(s), "auser1"); ATF_REQUIRE_STREQ(get_sub(s), "auser2"); ATF_REQUIRE(get_sub(s) == NULL); finish_subs_list(s); s = init_subs_list(ml.fd, "subscribers.d"); finish_subs_list(s); s = init_subs_list(ml.fd, "subscribers.d"); rewind_subs_list(s); finish_subs_list(s); s = init_subs_list(ml.fd, "subscribers.d"); rewind_subs_list(s); ATF_REQUIRE_STREQ(get_sub(s), "auser1"); finish_subs_list(s); } static void setup_listtext(const atf_tc_t *tc) { char *dir = NULL; rmdir("list/text"); ATF_REQUIRE_MSG(atf_tc_has_config_var(tc, "top_srcdir"), "missing configuration variable 'top_srcdir'"); xasprintf(&dir, "%s/listtexts/en", atf_tc_get_config_var(tc, "top_srcdir")); symlink(dir, "list/text"); } ATF_TC_BODY(notify_sub, tc) { const char *path; init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); pid_t p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); path = "mailout.txt"; if (!atf_utils_grep_file(".*The address has been subscribed to the normal.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } atf_utils_cat_file(path, ""); if (!atf_utils_grep_file(".*because an administrator commanded it.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been subscribed to the digest.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*because an administrator commanded it.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been subscribed to the no-mail.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*because a request to join was confirmed.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been subscribed to the version.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*because a request to join was received.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been unsubscribed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } atf_utils_cat_file(path, ""); if (!atf_utils_grep_file(".*administrator commanded it.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been unsubscribed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*administrator commanded it.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been unsubscribed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file unsubscribe nomail confirm"); } if (!atf_utils_grep_file(".*request to unsubscribe was confirmed.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { notify_sub(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*The address has been unsubscribed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*request to unsubscribe was received.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(get_processed_text_line, tc) { struct ml ml; char *ret; atf_utils_create_file("intext", "Subject: huhu, $listaddr$ $listowner$\n" "plop\n" "$$\n" "$listaddr$\n" "$list+$\n" "$listowner$\n" "$helpaddr$\n" "$faqaddr$\n" "$listgetN$\n" "$listunsubaddr$\n" "$nomailunsubaddr$\n" "$digestunsubaddr$\n" "$listsubaddr$\n" "$digestsubaddr$\n" "$nomailsubaddr$\n" ); int fd = open("intext", O_RDONLY); text *txt = open_text_fd(fd); ATF_REQUIRE(txt != NULL); init_ml(true); ml_init(&ml); ml.dir = "list"; ATF_REQUIRE(ml_open(&ml, false)); register_default_unformatted(txt, &ml); ret = get_processed_text_line(txt, true, &ml); ATF_REQUIRE(ret != NULL); ATF_REQUIRE_STREQ(ret, "Subject: huhu, test@test test+owner@test"); ret = get_processed_text_line(txt, true, &ml); ATF_REQUIRE_STREQ(ret, "plop"); close_text(txt); } ATF_TC_BODY(newsmtp, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ATF_REQUIRE_MSG(ml_open(&ml, false), "impossible to open the mailing list"); atf_utils_create_file("list/control/smtpport", "25678"); int fd = newsmtp(&ml, NULL); ATF_REQUIRE_MSG(fd == -1, "Socket should not have open"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(smtppipe[1]); int c; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) err(5, "accept()"); dprintf(c, "220 me fake smtp\n"); const char *replies[] = { "250-hostname.net\n" "250-PIPELINEING\n" "250-SIZE 20480000\n" "250-ETRN\n" "250-STARTTLS\n" "250-ENHANCEDSTATUSCODES\n" "250-8BITMIME\n" "250-DSN\n" "250-SMTPUTF8\n" "250 CHUNKING\n", "221 2.0.0 bye\n", }; read_print_reply(c, replies, NELEM(replies)); exit(0); } close(smtppipe[1]); atf_utils_readline(smtppipe[0]); atf_utils_create_file("list/control/smtphelo", "heloname"); atf_utils_create_file("list/control/relayhost", "127.0.0.1"); fd = newsmtp(&ml, NULL); ATF_REQUIRE_MSG(fd != -1, "Invalid socket"); endsmtp(&fd); atf_utils_wait(p, 0, "EHLO heloname\r\nQUIT\r\n", ""); } ATF_TC_BODY(save_queue, tc) { struct mail mail = { 0 }; mail.to = "plop"; mail.from = "bla"; save_queue("myfile", &mail); if (!atf_utils_file_exists("myfile.reciptto")) atf_tc_fail("myfile.receiptto does not exists"); if (!atf_utils_compare_file("myfile.reciptto", "plop")) atf_tc_fail("myfile.reciptto: invalid content"); if (!atf_utils_file_exists("myfile.mailfrom")) atf_tc_fail("myfile.receiptto does not exists"); if (!atf_utils_compare_file("myfile.mailfrom", "bla")) atf_tc_fail("myfile.mailfrom: invalid content"); if (atf_utils_file_exists("myfile.reply-to")) atf_tc_fail("myfile.reply-to should not exists"); mail.replyto = "hey"; save_queue("myfile2", &mail); if (!atf_utils_file_exists("myfile2.reciptto")) atf_tc_fail("myfile2.receiptto does not exists"); if (!atf_utils_compare_file("myfile2.reciptto", "plop")) atf_tc_fail("myfile2.recriptto: invalid content"); if (!atf_utils_file_exists("myfile2.mailfrom")) atf_tc_fail("myfile2.receiptto does not exists"); if (!atf_utils_compare_file("myfile2.mailfrom", "bla")) atf_tc_fail("myfile2.mailfrom: invalid content"); if (!atf_utils_file_exists("myfile2.reply-to")) atf_tc_fail("myfile2.reply-to does not exists"); if (!atf_utils_compare_file("myfile2.reply-to", "hey")) atf_tc_fail("myfile2.reply-to: invalid content"); unlink("myfile2.reply-to"); unlink("myfile2.mailfrom"); /* the files exists reciptto exist so it should fail and stop there */ save_queue("myfile2", &mail); if (!atf_utils_file_exists("myfile2.mailfrom")) atf_tc_fail("myfile2.mailfrom does not exists but should have been created"); if (atf_utils_file_exists("myfile2.reply-to")) atf_tc_fail("myfile2.reply-to should not exists"); /* will return in the first loop */ unlink("myfile2.reciptto"); save_queue("myfile2", &mail); if (atf_utils_file_exists("myfile2.reciptto")) atf_tc_fail("myfile2.reciptto should not exists"); if (atf_utils_file_exists("myfile2.reply-to")) atf_tc_fail("myfile2.reply-to should not exists"); } ATF_TC_BODY(send_single_mail, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; struct mail mail = { 0 }; ATF_REQUIRE_MSG(ml_open(&ml, false), "impossible to open the mailing list"); atf_utils_create_file("list/control/smtpport", "25678"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = single_mail_reception(smtppipe[1]); close(smtppipe[1]); atf_utils_readline(smtppipe[0]); atf_utils_create_file("list/control/smtphelo", "heloname"); atf_utils_create_file("list/control/relayhost", "127.0.0.1"); atf_utils_create_file("mymail.txt", "headers\n\nbody\n"); mail.to = "plop@meh"; mail.from = "test@meh"; mail.fp = fopen("mymail.txt", "r"); mail.addtohdr = true; ATF_REQUIRE(send_single_mail(&mail, &ml, false)); atf_utils_wait(p, 0, "save:out.txt", ""); const char *output = "" "EHLO heloname\r\n" "MAIL FROM:\r\n" "RCPT TO:\r\n" "DATA\r\nheaders\r\n" "To: plop@meh\r\n" "\r\n" "body\r\n" "\r\n" ".\r\n" "QUIT\r\n"; if (!atf_utils_compare_file("out.txt", output)) { printf("Invalid file expected: \n===\n%s\n===\ngot:\n===\n", output); atf_utils_cat_file("out.txt", ">"); printf("\n===\n"); atf_tc_fail("Invalid output"); } } ATF_TC_BODY(generate_subscription, tc) { const char *path; init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); pid_t p = atf_utils_fork(); if (p == 0) { generate_subscription(&ml, "test@plop", SUB_NORMAL, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); path = "mailout.txt"; if (!atf_utils_grep_file(".*You were unable to be subscribed to the list because you are already*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subscription(&ml, "test@plop", SUB_NORMAL, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); path = "mailout.txt"; if (!atf_utils_grep_file(".*You were unable to be unsubscribed from the list because you are not*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(generate_subconfirm, tc) { const char *path; init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); pid_t p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); path = "mailout.txt"; if (!atf_utils_grep_file(".*An administrator has requested that your email address be added.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*To confirm you want to do this, please send a message to*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*An administrator has requested that your email address be added.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*to the list, to receive digests.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*To confirm you want to do this, please send a message to*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*has requested that your email address be added to the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*without mail delivery.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, true); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*Somebody \\(and we hope it was you\\) has requested that your email address.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".* be added.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*An administrator has requested that the email address be.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*An administrator has requested that the email address be.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*test\\+confunsub-digest.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".*has requested that the email address be removed from the list..*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file unsubscribe nomail confirm"); } if (!atf_utils_grep_file(".*test\\+confunsub-nomail.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); p = atf_utils_fork(); if (p == 0) { generate_subconfirm(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, false); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file(".* be removed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*test\\+confunsub-both-.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(send_confirmation_mail, tc) { const char *path; init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, true); atf_utils_wait(p2, 0, "save:mailout.txt", ""); path = "mailout.txt"; if (!atf_utils_grep_file(".*An administrator has subscribed you to the normal version of the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*The email address you are subscribed with is .*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, true); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*An administrator has subscribed you to the digest version of the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*The email address you are subscribed with is .*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, true); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*Thank you for confirming your subscription. You have now been added to the.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*no-mail version of the list..*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, true); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*Thank you for your request to join us. You have now been added to the.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } if (!atf_utils_grep_file(".*The email address you are subscribed with is .*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, false); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*An administrator has removed you from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, false); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*An administrator has removed you from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, false); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*Thank you for confirming your unsubscribe. You have now been removed from.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file unsubscribe nomail confirm"); } p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); send_confirmation_mail(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, false); atf_utils_wait(p2, 0, "save:mailout.txt", ""); if (!atf_utils_grep_file(".*You have now been removed from the list.*", path)) { atf_utils_cat_file(path, ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(listcontrol, tc) { struct ml ml; init_ml(true); ml_init(&ml); ml.dir = "list"; strlist fromemails = tll_init(); ATF_REQUIRE(ml_open(&ml, false)); ATF_REQUIRE_EQ(listcontrol(NULL, &ml, "plop", NULL, "meh"), -1); ATF_REQUIRE_EQ(listcontrol(&fromemails, &ml, "help", NULL, "meh"), -1); atf_utils_create_file("list/control/closedlist", ""); atf_utils_create_file("meh", "mail"); tll_push_back(fromemails, "plop@test"); ATF_REQUIRE_EQ(listcontrol(&fromemails, &ml, "unsubscribe", NULL, "meh"), -1); if (atf_utils_file_exists("me")) atf_tc_fail("mail should have been removed"); unlink("list/control/closedlist"); atf_utils_create_file("list/control/closedlistsub", ""); ATF_REQUIRE_EQ(listcontrol(&fromemails, &ml, "subscribe", NULL, "meh"), -1); } ATF_TC_BODY(send_help, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); atf_utils_create_file("mail", "headers\n\nbody\n"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); pid_t p = atf_utils_fork(); if (p == 0) { send_help(&ml, "mail", "test@plop"); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); const char *output= "EHLO heloname\r\n" "MAIL FROM:\r\n" "RCPT TO:\r\n" "DATA\r\n" "headers\r\n" "\r\n" "body\r\n" "\r\n" ".\r\n" "QUIT\r\n"; if (!atf_utils_compare_file("mailout.txt", output)) { atf_utils_cat_file("mailout.txt", ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(requeuemail, tc) { strlist l = tll_init(); init_ml(true); int dfd = open("list", O_DIRECTORY); rmdir("list/requeue"); ATF_REQUIRE(!requeuemail(dfd, 1, NULL, NULL)); ATF_REQUIRE(!requeuemail(dfd, 1, NULL, NULL)); ATF_REQUIRE(!requeuemail(dfd, 1, &l, NULL)); tll_push_back(l, "test1"); rmdir("list/requeue"); ATF_REQUIRE(!requeuemail(dfd, 1, &l, NULL)); mkdir("list/requeue", 0755); ATF_REQUIRE(requeuemail(dfd, 1, &l, NULL)); if (!atf_utils_file_exists("list/requeue/1/subscribers")) atf_tc_fail("queue file does not exists"); if (!atf_utils_compare_file("list/requeue/1/subscribers", "test1\n")) { atf_utils_cat_file("list/requeue/1/subscribers", ""); atf_tc_fail("Invalid queue content"); } unlink("list/requeue/1/subscribers"); tll_push_back(l, "testhey"); tll_push_back(l, "test2"); ATF_REQUIRE(requeuemail(dfd, 1, &l, NULL)); if (!atf_utils_file_exists("list/requeue/1/subscribers")) atf_tc_fail("queue file does not exists"); if (!atf_utils_compare_file("list/requeue/1/subscribers", "test1\ntesthey\ntest2\n")) { atf_utils_cat_file("list/requeue/1/subscribers", ""); atf_tc_fail("Invalid queue content"); } unlink("list/requeue/1/subscribers"); ATF_REQUIRE(requeuemail(dfd, 1, &l, "fail")); if (!atf_utils_file_exists("list/requeue/1/subscribers")) atf_tc_fail("queue file does not exists"); if (!atf_utils_compare_file("list/requeue/1/subscribers", "test1\ntesthey\ntest2\nfail\n")) { atf_utils_cat_file("list/requeue/1/subscribers", ">"); atf_tc_fail("Invalid queue content (fail)"); } close(dfd); } ATF_TC_BODY(gethdrline, tc) { atf_utils_create_file("mail1", ""); atf_utils_create_file("mail2", "\n"); atf_utils_create_file("mail3", "From: bob"); atf_utils_create_file("mail4", "From: bob\nTo: Jane\nSubject: bla\r\n\nplop.\n"); atf_utils_create_file("mail5", "From: bob\n grmbl\nTo: Jane\n\t"); FILE *f; char *plop, *l; f = fopen("mail1", "r"); ATF_REQUIRE(gethdrline(f, NULL) == NULL); ATF_REQUIRE(gethdrline(f, &plop) == NULL); ATF_REQUIRE(plop == NULL); fclose(f); f = fopen("mail2", "r"); ATF_REQUIRE(gethdrline(f, NULL) == NULL); fclose(f); f = fopen("mail3", "r"); l = gethdrline(f, NULL); ATF_REQUIRE_STREQ(l, "From: bob"); fclose(f); f = fopen("mail4", "r"); l = gethdrline(f, NULL); ATF_REQUIRE_STREQ(l, "From: bob"); l = gethdrline(f, &plop); ATF_REQUIRE_STREQ(l, "To: Jane"); ATF_REQUIRE_STREQ(plop, "To: Jane\n"); l = gethdrline(f, &plop); ATF_REQUIRE_STREQ(l, "Subject: bla"); ATF_REQUIRE_STREQ(plop, "Subject: bla\r\n"); l = gethdrline(f, &plop); ATF_REQUIRE(l == NULL); fclose(f); f = fopen("mail5", "r"); l = gethdrline(f, &plop); ATF_REQUIRE_STREQ(l, "From: bob grmbl"); ATF_REQUIRE_STREQ(plop, "From: bob\n grmbl\n"); l = gethdrline(f, &plop); ATF_REQUIRE_STREQ(l, "To: Jane\t"); ATF_REQUIRE_STREQ(plop, "To: Jane\n\t"); fclose(f); } ATF_TC_BODY(readlf, tc) { ATF_REQUIRE(readlf(-1, true) == NULL); } ATF_TC_BODY(mod_get_addr_type, tc) { mkdir("moderation/", 0775); atf_utils_create_file("moderation/subscribeinvalid", ""); atf_utils_create_file("moderation/subscribevalid", "user\nSUB_BOTH\n"); atf_utils_create_file("moderation/subscribeinvalid2", "user\n"); atf_utils_create_file("moderation/subscribeinvalid3", "user\ninvalid3\n"); pid_t p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "modstr", &addr, &subtype); } atf_utils_wait(p, 1, "", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "invalid", &addr, &subtype); } atf_utils_wait(p, 1, "", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "subscribevalid", &addr, &subtype); ATF_REQUIRE_STREQ(addr, "user"); ATF_REQUIRE_EQ(subtype, SUB_BOTH); exit(EXIT_SUCCESS); } atf_utils_wait(p, 0, "", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "subscribeinvalid2", &addr, &subtype); exit(EXIT_SUCCESS); } atf_utils_wait(p, 1, "", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "subscribeinvalid3", &addr, &subtype); exit(EXIT_SUCCESS); } atf_utils_wait(p, 1, "", ""); mkdir("moderation/subscribe", 0755); atf_utils_create_file("moderation/subscribe/valid2", "user1\nSUB_BOTH\n"); atf_utils_create_file("moderation/subscribevalid2", "user2\nSUB_BOTH\n"); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "valid2", &addr, &subtype); ATF_REQUIRE_STREQ(addr, "user1"); ATF_REQUIRE_EQ(subtype, SUB_BOTH); exit(EXIT_SUCCESS); } atf_utils_wait(p, 0, "", ""); atf_utils_create_file("moderation/subscribevalid3", "user2\nSUB_BOTH\n"); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "valid3", &addr, &subtype); ATF_REQUIRE_STREQ(addr, "user2"); ATF_REQUIRE_EQ(subtype, SUB_BOTH); exit(EXIT_SUCCESS); } atf_utils_wait(p, 0, "", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "valid4", &addr, &subtype); exit(EXIT_SUCCESS); } atf_utils_wait(p, 1, "", ""); atf_utils_create_file("moderation/subscribe/invalid5", ""); p = atf_utils_fork(); if (p == 0) { struct ml ml; ml_init(&ml); ml.dir = "list"; enum subtype subtype = 0; char *addr; ml.fd = open(".", O_DIRECTORY); mod_get_addr_and_type(&ml, "invalid5", &addr, &subtype); exit(EXIT_SUCCESS); } atf_utils_wait(p, 1, "", ""); } ATF_TC_BODY(send_probe_no_probefile, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); pid_t p = atf_utils_fork(); if (p == 0) { if (send_probe(&ml, "bapt=freebsd.org")) exit(0); exit(1); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file("Some messages to you could not be delivered", "mailout.txt")) { atf_utils_cat_file("mailout.txt", ""); atf_tc_fail("invalid file"); } } ATF_TC_BODY(send_probe_arobase, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p = atf_utils_fork(); if (p == 0) { if (send_probe(&ml, "bapt@freebsd.org")) exit(0); exit(1); } atf_utils_wait(p, 1, "", ""); } ATF_TC_BODY(send_probe, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); atf_utils_create_file("list/bounce/bapt=freebsd.org", "1234:blabla\n32:qftgd\n"); pid_t p = atf_utils_fork(); if (p == 0) { if (send_probe(&ml, "bapt=freebsd.org")) exit(0); exit(1); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file("1234\r", "mailout.txt")) { atf_utils_cat_file("mailout.txt", ">"); atf_tc_fail("invalid mail sent"); } } ATF_TC_BODY(send_probe_archive, tc) { init_ml(true); struct ml ml; ml_init(&ml); ml.dir = "list"; ml_open(&ml, false); setup_listtext(tc); atf_utils_create_file("list/control/smtpport", "25678"); atf_utils_create_file("list/control/smtphelo", "heloname"); int smtppipe[2]; ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0); pid_t p2 = single_mail_reception(smtppipe[1]); atf_utils_readline(smtppipe[0]); atf_utils_create_file("list/bounce/bapt=freebsd.org", "1234:blabla\n21:hey\n32:ertt\n"); atf_utils_create_file("list/archive/1234", "From: bob@test\nMessage-ID: \nX-None: bla\n\nContent\n"); atf_utils_create_file("list/archive/21", "From: bob@test\nMessage-ID: \nX-None: bla\n\nContent\n"); pid_t p = atf_utils_fork(); if (p == 0) { if (send_probe(&ml, "bapt=freebsd.org")) exit(0); exit(1); } atf_utils_wait(p2, 0, "save:mailout.txt", ""); atf_utils_wait(p, 0, "", ""); if (!atf_utils_grep_file("- 1234, Message-ID: \r", "mailout.txt")) { atf_utils_cat_file("mailout.txt", ">"); atf_tc_fail("invalid mail sent"); } if (!atf_utils_grep_file("- 21, Message-ID: \r", "mailout.txt")) { atf_utils_cat_file("mailout.txt", ">"); atf_tc_fail("invalid mail sent"); } if (!atf_utils_grep_file("- 32\r", "mailout.txt")) { atf_utils_cat_file("mailout.txt", ">"); atf_tc_fail("invalid mail sent"); } } ATF_TC_BODY(find_in_list, tc) { strlist bla = tll_init(); ATF_REQUIRE(find_in_list(NULL, NULL) == NULL); ATF_REQUIRE(find_in_list(&bla, NULL) == NULL); ATF_REQUIRE(find_in_list(&bla, "test") == NULL); tll_push_back(bla, NULL); ATF_REQUIRE(find_in_list(&bla, "test") == NULL); tll_push_back(bla, "plop"); ATF_REQUIRE(find_in_list(&bla, "test") == NULL); tll_push_back(bla, "test"); ATF_REQUIRE_STREQ(find_in_list(&bla, "test"), "test"); tll_pop_back(bla); tll_push_back(bla, "test longer"); ATF_REQUIRE_STREQ(find_in_list(&bla, "test"), "test longer"); } ATF_TC_BODY(parse_content_type, tc) { char *m, *b; strlist hdrs = tll_init(); parse_content_type(NULL, &m, &b); ATF_REQUIRE(m == NULL); ATF_REQUIRE(b == NULL); tll_push_back(hdrs, "From: plop"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE(m == NULL); ATF_REQUIRE(b == NULL); tll_push_back(hdrs, "Content-Type:"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE(m == NULL); ATF_REQUIRE(b == NULL); tll_pop_back(hdrs); tll_push_back(hdrs, "Content-Type: multipart/mixed"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE_STREQ(m, "multipart/mixed"); free(m); ATF_REQUIRE(b == NULL); tll_pop_back(hdrs); tll_push_back(hdrs, "Content-Type: multipart/mixed;"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE_STREQ(m, "multipart/mixed"); free(m); ATF_REQUIRE(b == NULL); tll_pop_back(hdrs); tll_push_back(hdrs, "Content-Type: multipart/mixed;\tboundary=bla"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE_STREQ(m, "multipart/mixed"); free(m); ATF_REQUIRE_STREQ(b,"bla"); free(b); tll_pop_back(hdrs); tll_push_back(hdrs, "Content-Type: multipart/mixed;\tboundary=bla;"); parse_content_type(&hdrs, &m, &b); ATF_REQUIRE_STREQ(m, "multipart/mixed"); free(m); ATF_REQUIRE_STREQ(b,"bla"); free(b); } ATF_TC_BODY(do_access, tc) { strlist rules = tll_init(); strlist headers = tll_init(); tll_push_back(rules, "allow"); char *msg = NULL; char *qualifier = NULL; ATF_REQUIRE_EQ(do_access(NULL, NULL, "test@plop", &msg, &qualifier), ACT_ALLOW); ATF_REQUIRE(msg == NULL); ATF_REQUIRE(qualifier == NULL); ATF_REQUIRE_EQ(do_access(&rules, NULL, "test@plop", &msg, &qualifier), ACT_ALLOW); ATF_REQUIRE_STREQ(msg, "access - A mail from \"test@plop\" was allowed by rule #0 \"allow\""); ATF_REQUIRE(qualifier == NULL); tll_pop_back(rules); tll_push_back(rules, "deny"); ATF_REQUIRE_EQ(do_access(&rules, NULL, "test@plop", &msg, &qualifier), ACT_DENY); ATF_REQUIRE_STREQ(msg, "access - A mail from \"test@plop\" was denied by rule #0 \"deny\""); ATF_REQUIRE(qualifier == NULL); tll_pop_back(rules); tll_push_back(rules, "crap"); ATF_REQUIRE_EQ(do_access(&rules, NULL, "test@plop", &msg, &qualifier), ACT_DENY); ATF_REQUIRE_STREQ(msg, "Unable to parse rule #0 \"crap\": Missing action keyword. Denying post from \"test@plop\""); ATF_REQUIRE(qualifier == NULL); tll_pop_back(rules); tll_push_back(headers, "from: toto@bla"); tll_push_back(rules, "moderate ^from: toto@"); ATF_REQUIRE_EQ(do_access(&rules, &headers, "test@plop", &msg, &qualifier), ACT_MODERATE); ATF_REQUIRE_STREQ(msg, "access - A mail from \"test@plop\" with header \"from: toto@bla\" was moderated by rule #0 \"moderate ^from: toto@\""); ATF_REQUIRE(qualifier == NULL); tll_push_front(rules, "moderatemeh ^from: toto@"); ATF_REQUIRE_EQ(do_access(&rules, &headers, "test@plop", &msg, &qualifier), ACT_DENY); ATF_REQUIRE_STREQ(msg, "Unable to parse rule #0 \"moderatemeh ^from: toto@\": Invalid character after action keyword. Denying post from \"test@plop\""); ATF_REQUIRE(qualifier == NULL); tll_push_front(rules, "moderate- ^from: toto@"); ATF_REQUIRE_EQ(do_access(&rules, &headers, "test@plop", &msg, &qualifier), ACT_MODERATE); ATF_REQUIRE(qualifier == NULL); ATF_REQUIRE_STREQ(msg, "access - A mail from \"test@plop\" with header \"from: toto@bla\" was moderated by rule #0 \"moderate- ^from: toto@\""); tll_push_front(rules, "moderate-meh ^from: toto@"); ATF_REQUIRE_EQ(do_access(&rules, &headers, "test@plop", &msg, &qualifier), ACT_MODERATE); ATF_REQUIRE_STREQ(qualifier, "meh"); ATF_REQUIRE_STREQ(msg, "access - A mail from \"test@plop\" with header \"from: toto@bla\" was moderated by rule #0 \"moderate-meh ^from: toto@\""); } ATF_TC_BODY(unistr_header_to_utf8, tc) { const char *input = "=?UTF-8?B?SGVsbG8gd29ybGQ=?="; char *out = unistr_header_to_utf8(input); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "Hello world"); out = unistr_header_to_utf8("=?UTF-8?B?Sm9obiBEb2U=?= "); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "John Doe "); out = unistr_header_to_utf8("=?utf-8?b?5aSq6YOO?= "); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "太郎 "); out = unistr_header_to_utf8("=?ISO-8859-1?Q?Jean-Pierre_Dupont?= "); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "Jean-Pierre Dupont "); out = unistr_header_to_utf8("=?koi8-r?b?8NLJ18XUIM3J0g==?="); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "Привет мир"); out = unistr_header_to_utf8("=?us-ascii?Q?useless_but_why_not?="); ATF_REQUIRE(out != NULL); ATF_REQUIRE_STREQ(out, "useless but why not"); } ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, random_int); ATF_TP_ADD_TC(tp, chomp); ATF_TP_ADD_TC(tp, mydirname); ATF_TP_ADD_TC(tp, mybasename); ATF_TP_ADD_TC(tp, mygetline); ATF_TP_ADD_TC(tp, lowercase); ATF_TP_ADD_TC(tp, init_sock); ATF_TP_ADD_TC(tp, genmsgid); ATF_TP_ADD_TC(tp, exec_or_die); ATF_TP_ADD_TC(tp, exec_and_wait); ATF_TP_ADD_TC(tp, find_email_adr); ATF_TP_ADD_TC(tp, strtoim); ATF_TP_ADD_TC(tp, write_ehlo); ATF_TP_ADD_TC(tp, write_helo); ATF_TP_ADD_TC(tp, write_dot); ATF_TP_ADD_TC(tp, write_data); ATF_TP_ADD_TC(tp, write_quit); ATF_TP_ADD_TC(tp, write_rset); ATF_TP_ADD_TC(tp, write_replyto); ATF_TP_ADD_TC(tp, write_rcpt_to); ATF_TP_ADD_TC(tp, write_mail_from); ATF_TP_ADD_TC(tp, write_mailbody); ATF_TP_ADD_TC(tp, strtotimet); ATF_TP_ADD_TC(tp, decode_qp); ATF_TP_ADD_TC(tp, parse_lastdigest); ATF_TP_ADD_TC(tp, extract_bouncetime); ATF_TP_ADD_TC(tp, open_subscriber_directory); ATF_TP_ADD_TC(tp, unsubscribe); ATF_TP_ADD_TC(tp, genlistname); ATF_TP_ADD_TC(tp, genlistfqdn); ATF_TP_ADD_TC(tp, smtp); ATF_TP_ADD_TC(tp, init_smtp); ATF_TP_ADD_TC(tp, smtp_bad_greetings); ATF_TP_ADD_TC(tp, smtp_bad_ehlo); ATF_TP_ADD_TC(tp, smtp_no_ehlo); ATF_TP_ADD_TC(tp, endsmtp); ATF_TP_ADD_TC(tp, do_bouncemail); ATF_TP_ADD_TC(tp, bouncemail); ATF_TP_ADD_TC(tp, send_mail_basics); ATF_TP_ADD_TC(tp, send_mail); ATF_TP_ADD_TC(tp, getlistdelim); ATF_TP_ADD_TC(tp, getlistdelim_0); ATF_TP_ADD_TC(tp, getlistdelim_1); ATF_TP_ADD_TC(tp, getlistdelim_2); ATF_TP_ADD_TC(tp, getlistdelim_3); ATF_TP_ADD_TC(tp, getlistdelim_4); ATF_TP_ADD_TC(tp, statctrl); ATF_TP_ADD_TC(tp, is_subbed_in); ATF_TP_ADD_TC(tp, getaddrsfromfile); ATF_TP_ADD_TC(tp, dumpfd2fd); ATF_TP_ADD_TC(tp, copy_file); ATF_TP_ADD_TC(tp, copy_file_1); ATF_TP_ADD_TC(tp, copy_file_2); ATF_TP_ADD_TC(tp, controls); ATF_TP_ADD_TC(tp, incindexfile); ATF_TP_ADD_TC(tp, log_oper); ATF_TP_ADD_TC(tp, get_ctrl_command); ATF_TP_ADD_TC(tp, get_recipextra_from_env_none); ATF_TP_ADD_TC(tp, get_recipextra_from_env_qmail); ATF_TP_ADD_TC(tp, get_recipextra_from_env_postfix); ATF_TP_ADD_TC(tp, get_recipextra_from_env_exim); ATF_TP_ADD_TC(tp, addrmatch); ATF_TP_ADD_TC(tp, get_subcookie_content); ATF_TP_ADD_TC(tp, ml_list); ATF_TP_ADD_TC(tp, gen_addr); ATF_TP_ADD_TC(tp, memory_lines); ATF_TP_ADD_TC(tp, text_0); ATF_TP_ADD_TC(tp, text_1); ATF_TP_ADD_TC(tp, file_lines); ATF_TP_ADD_TC(tp, list_subs); ATF_TP_ADD_TC(tp, notify_sub); ATF_TP_ADD_TC(tp, get_processed_text_line); ATF_TP_ADD_TC(tp, newsmtp); ATF_TP_ADD_TC(tp, save_queue); ATF_TP_ADD_TC(tp, send_single_mail); ATF_TP_ADD_TC(tp, generate_subscription); ATF_TP_ADD_TC(tp, generate_subconfirm); ATF_TP_ADD_TC(tp, send_confirmation_mail); ATF_TP_ADD_TC(tp, listcontrol); ATF_TP_ADD_TC(tp, send_help); ATF_TP_ADD_TC(tp, requeuemail); ATF_TP_ADD_TC(tp, gethdrline); ATF_TP_ADD_TC(tp, readlf); ATF_TP_ADD_TC(tp, mod_get_addr_type); ATF_TP_ADD_TC(tp, send_probe_no_probefile); ATF_TP_ADD_TC(tp, send_probe_arobase); ATF_TP_ADD_TC(tp, send_probe); ATF_TP_ADD_TC(tp, send_probe_archive); ATF_TP_ADD_TC(tp, parse_content_type); ATF_TP_ADD_TC(tp, find_in_list); ATF_TP_ADD_TC(tp, do_access); ATF_TP_ADD_TC(tp, unistr_header_to_utf8); return (atf_no_error()); } mlmmj/tests/mlmmj_tests.c000066400000000000000000000071011502303113500160260ustar00rootroot00000000000000/* * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include "mlmmj_tests.h" #include #include #include #include #include #include #include #include #include const char *listdir[] = { "incoming", "queue", "queue/discarded", "archive", "text", "subconf", "unsubconf", "bounce", "control", "moderation", "subscribers.d", "digesters.d", "requeue", "nomailsubs.d" }; void init_ml(bool complete) { int fd; ATF_CHECK(mkdir("list", 00755) != -1); fd = open("list", O_DIRECTORY); ATF_CHECK(fd != -1); for (uintmax_t i = 0; i < NELEM(listdir); i++) { ATF_CHECK(mkdirat(fd, listdir[i], 00755) != -1); } if (complete) atf_utils_create_file("list/control/listaddress", "test@test"); } int fakesmtp(int pipe) { int s; struct sockaddr_in me = { 0 }; s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) exit(1); if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &(int) { 1 }, sizeof(int)) != 0) exit(2); me.sin_family = AF_INET; me.sin_addr.s_addr = inet_addr("127.0.0.1"); /* specific interface */ me.sin_port = htons(25678); if (bind(s, (struct sockaddr *) &me, sizeof(me)) == -1) exit(3); if (listen(s, 1) == -1) exit(4); dprintf(pipe, "ready\n"); return (s); } void read_print_reply(int fd, const char **replies, size_t nreplies) { char *r; for (size_t i = 0; i < nreplies; i++) { r = atf_utils_readline(fd); if (r == NULL) atf_tc_fail("Impossible to read response %zu", i); printf("%s\n", r); if (replies[i] != NULL) dprintf(fd, "%s", replies[i]); free(r); } } pid_t single_mail_reception(int fd) { pid_t p = atf_utils_fork(); if (p == 0) { int s = fakesmtp(fd); int c; char *r; struct sockaddr_in cl; socklen_t clsize = sizeof(struct sockaddr_in); c = accept(s, (struct sockaddr *) &cl, &clsize); if (c == -1) exit(5); dprintf(c, "220 me fake smtp\n"); const char *replies[] = { "250-hostname.net\n" "250-PIPELINEING\n" "250-SIZE 20480000\n" "250-ETRN\n" "250-STARTTLS\n" "250-ENHANCEDSTATUSCODES\n" "250-8BITMIME\n" "250-DSN\n" "250-SMTPUTF8\n" "250 CHUNKING\n", "250 2.1.0 OK\n", "250 2.1.0 OK\n", "350 2.1.0 OK\n", }; read_print_reply(c, replies, NELEM(replies)); while ((r = atf_utils_readline(c)) != NULL) { printf("%s\n", r); if (strcmp(r, ".\r") == 0) { dprintf(c, "250 2.1.0 OK\n"); break; } } const char *rep = "221 2.0.0 bye\n"; read_print_reply(c, &rep, 1); exit(0); } return (p); } mlmmj/tests/mlmmj_tests.h000066400000000000000000000026451502303113500160430ustar00rootroot00000000000000/* * Copyright (C) 2023 Baptiste Daroussin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #pragma once #include #include #ifndef NELEM #define NELEM(array) (sizeof(array) / sizeof((array)[0])) #endif void init_ml(bool complete); int fakesmtp(int pipe); void read_print_reply(int fd, const char **replies, size_t nreplies); pid_t single_mail_reception(int fd); mlmmj/tests/test_env.sh.in000066400000000000000000000011611502303113500161140ustar00rootroot00000000000000top_srcdir="@abs_top_srcdir@" top_builddir="@abs_top_builddir@" export PATH="${top_builddir}/src:${PATH}" prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" tests_init() { TESTS="$@" export TESTS for t ; do atf_test_case $t done } atf_init_test_cases() { for t in ${TESTS}; do atf_add_test_case $t done } init_ml() { local ml="$1" mkdir "$ml" for d in incoming queue queue/discarded archive text subconf unsubconf \ bounce control moderation subscribers.d digesters.d requeue \ nomailsubs.d; do mkdir $ml/$d done } kill_fakesmtp() { pid=$(cat fakesmtp.pid) kill -15 $pid }