diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-10-12 12:43:24 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-10-12 15:55:18 +0300 |
commit | 739c6ee525a4f7bb76b8fe2bd75e81a122764ced (patch) | |
tree | b90dfed5972048513d2076e5562a77e4e862d8b0 | |
parent | 6ec886e647516e800febddee3f70491edfb561b0 (diff) | |
download | mailutils-739c6ee525a4f7bb76b8fe2bd75e81a122764ced.tar.gz mailutils-739c6ee525a4f7bb76b8fe2bd75e81a122764ced.tar.bz2 |
Split maidag into three single-purpose tools
Maidag operated in three modes: mda, url and lmtp. In mda mode
it is normally started by sendmail with non-root privileges.
In order to be able to write to other users' mailboxes, the binary
must be setuid, which creates certain security threats. As these appear
to be impossible to avoid in a single multi-purpose program, it has
been decided to replace maidag with three single-purpose tools: mda,
putmail, and lmtpd. The mda tool is a local mail delivery agent. It is
the only one for which the setuid bit is required, so special measures
have been taken to secure it. In particular, to avoid unverified user
inputs it disallows to override any configuration settings from the
command line.
The two other tools provide the functionality of the url and lmtp mode.
* Makefile.am (MAIDAG_DIR): Replace with MDA_DIR
* configure.ac (MU_COND_MAILBOX_QUOTA): New conditional.
Use names relative to ${top_builddir} instead of ".".
* maidag: Remove.
* mda/.gitignore: New file.
* mda/Makefile.am: New file.
* mda/lib/Makefile.am: New file.
* mda/lib/deliver.c: New file.
* mda/lib/forward.c: New file.
* mda/lib/libmda.h: New file.
* mda/lib/mailquota.c: New file.
* mda/lib/script.c: New file.
* mda/lib/util.c: New file.
* mda/lmtpd.c: New file.
* mda/mda.c: New file.
* mda/putmail.c: New file.
* mda/tests/.gitignore: New file.
* mda/tests/Makefile.am: New file.
* mda/tests/atlocal.in: New file.
* mda/tests/input.msg: New file.
* mda/tests/lmtpd.at: New file.
* mda/tests/putmail.at: New file.
* mda/tests/testsuite.at: New file.
* doc/texinfo/programs/maidag.texi: Remove.
* doc/texinfo/programs/mda.texi: New file.
* doc/texinfo/programs/lmtpd.texi: New file.
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | doc/texinfo/Makefile.am | 4 | ||||
-rw-r--r-- | doc/texinfo/mailutils.texi | 61 | ||||
-rw-r--r-- | doc/texinfo/programs.texi | 20 | ||||
-rw-r--r-- | doc/texinfo/programs/lmtpd.texi | 66 | ||||
-rw-r--r-- | doc/texinfo/programs/mda.texi (renamed from doc/texinfo/programs/maidag.texi) | 515 | ||||
-rw-r--r-- | doc/texinfo/programs/putmail.texi | 83 | ||||
-rw-r--r-- | doc/texinfo/sieve.texi | 6 | ||||
-rw-r--r-- | maidag/.gitignore | 6 | ||||
-rw-r--r-- | maidag/maidag.c | 592 | ||||
-rw-r--r-- | maidag/maidag.h | 205 | ||||
-rw-r--r-- | maidag/script.c | 135 | ||||
-rw-r--r-- | maidag/tests/forward.at | 79 | ||||
-rw-r--r-- | maidag/tests/mda.at | 50 | ||||
-rw-r--r-- | mda/.gitignore | 3 | ||||
-rw-r--r-- | mda/Makefile.am (renamed from maidag/Makefile.am) | 55 | ||||
-rw-r--r-- | mda/lib/Makefile.am | 34 | ||||
-rw-r--r-- | mda/lib/deliver.c (renamed from maidag/deliver.c) | 206 | ||||
-rw-r--r-- | mda/lib/forward.c (renamed from maidag/forward.c) | 79 | ||||
-rw-r--r-- | mda/lib/libmda.h | 129 | ||||
-rw-r--r-- | mda/lib/mailquota.c (renamed from maidag/mailquota.c) | 70 | ||||
-rw-r--r-- | mda/lib/script.c | 260 | ||||
-rw-r--r-- | mda/lib/util.c (renamed from maidag/util.c) | 75 | ||||
-rw-r--r-- | mda/lmtpd.c (renamed from maidag/lmtp.c) | 284 | ||||
-rw-r--r-- | mda/mda.c | 143 | ||||
-rw-r--r-- | mda/putmail.c | 76 | ||||
-rw-r--r-- | mda/tests/.gitignore (renamed from maidag/tests/.gitignore) | 0 | ||||
-rw-r--r-- | mda/tests/Makefile.am (renamed from maidag/tests/Makefile.am) | 8 | ||||
-rw-r--r-- | mda/tests/atlocal.in (renamed from maidag/tests/atlocal.in) | 4 | ||||
-rw-r--r-- | mda/tests/input.msg (renamed from maidag/tests/input.msg) | 0 | ||||
-rw-r--r-- | mda/tests/lmtpd.at (renamed from maidag/tests/lmtp.at) | 10 | ||||
-rw-r--r-- | mda/tests/putmail.at (renamed from maidag/tests/url-mbox.at) | 10 | ||||
-rw-r--r-- | mda/tests/testsuite.at (renamed from maidag/tests/testsuite.at) | 19 |
34 files changed, 1697 insertions, 1612 deletions
diff --git a/Makefile.am b/Makefile.am index a0fb57c50..716be7a72 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,14 +29,14 @@ if MU_COND_POP3D endif if MU_COND_IMAP4D IMAP4D_DIR = imap4d endif -if MU_COND_MAIDAG - MAIDAG_DIR = maidag +if MU_COND_MDA + MDA_DIR = mda endif if MU_COND_MAIL MAIL_DIR = mail endif @@ -102,13 +102,13 @@ SUBDIRS = . \ examples\ mu\ $(SCHEME_DIR)\ $(FRM_DIR)\ $(POP3D_DIR)\ $(IMAP4D_DIR)\ - $(MAIDAG_DIR)\ + $(MDA_DIR)\ $(MAIL_DIR)\ $(SIEVE_DIR)\ $(MESSAGES_DIR)\ $(COMSAT_DIR)\ $(READMSG_DIR)\ $(DOTLOCK_DIR)\ diff --git a/configure.ac b/configure.ac index c841acfbf..5c7717289 100644 --- a/configure.ac +++ b/configure.ac @@ -930,13 +930,13 @@ dummy_init() { } if test -n "$SQL_MODULES"; then USE_SQL=1 AC_DEFINE(USE_SQL) BUILD_SQL=libsql.la - SQLLIB=../sql/libsql.la + SQLLIB='${top_builddir}/sql/libsql.la' for module in $SQL_MODULES do ${module:-dummy}_init if test $USE_LOADABLE_MODULES = yes; then SQL_LOADABLE_MODULES="$SQL_LOADABLE_MODULES ${module}.la" @@ -954,13 +954,12 @@ if test -n "$SQL_MODULES"; then [if test $USE_LOADABLE_MODULES = yes; then SQL_MODULES= else SQL_MODULES="$SQL_MODULES" fi]) fi - # LDAP support AC_ARG_WITH(ldap, AC_HELP_STRING([--with-ldap], [Configure to work with OpenLDAP]), [case $withval in @@ -977,12 +976,16 @@ if test $status_ldap = maybe; then AC_DEFINE(WITH_LDAP, 1, [Define to 1 if you want to use -lldap]) MU_AUTHLIBS="$MU_AUTHLIBS -lldap"], [status_ldap=no]) fi +# Mailbox quota support +AM_CONDITIONAL([MU_COND_MAILBOX_QUOTA],[test -n "$status_dbm$status_mysql"]) + + # Virtual domain support MU_ENABLE_SUPPORT(virtual-domains) AC_SUBST(SITE_VIRTUAL_PWDDIR) AC_ARG_WITH([virtual-pwddir], AC_HELP_STRING([--with-virtual-pwddir=DIR], [use DIR instead of $sysconfdir/domain]),[ @@ -1179,13 +1182,13 @@ GINT_INIT([gint],[2.2.0 with-guile], [useguile=yes AC_DEFINE([WITH_GUILE],1,[Enable Guile support]) GUILE_BINDIR=`guile-config info bindir` if test -z "$GUILE_BINDIR"; then GUILE_BINDIR="`guile-config info prefix`/bin" fi - LIBMU_SCM=../libmu_scm/libmu_scm.la + LIBMU_SCM='${top_builddir}/libmu_scm/libmu_scm.la' LIBMU_SCM_DEPS='${MU_LIB_MAILBOX} ${MU_LIB_MAILER}' MU_GUILE_SIEVE_MOD_DIR='$(GUILE_SITE)/$(PACKAGE)/sieve-modules' GINT_INCLUDES='${MU_APP_COMMON_INCLUDES}' if test $REPLACE_STRERROR = 1; then GINT_LDADD='${top_builddir}/lib/gnu/libgnu.la' fi @@ -1321,13 +1324,13 @@ client_list= MU_ENABLE_BUILD(pop3d,,,["$mu_build_servers" = yes],,[server_list]) MU_ENABLE_BUILD(imap4d,,,["$mu_build_servers" = yes],,[server_list]) MU_ENABLE_BUILD(comsat,,,["$mu_build_servers" = yes],,[server_list]) MU_ENABLE_BUILD(frm,,,["$mu_build_clients" = yes],,[client_list]) -MU_ENABLE_BUILD(maidag,,,["$mu_build_clients" = yes],,[client_list]) +MU_ENABLE_BUILD(mda,,,["$mu_build_clients" = yes],,[client_list]) MU_ENABLE_BUILD(mail,,,["$mu_build_clients" = yes],,[client_list]) AC_SUBST([MAILBINDIR],'${bindir}') AC_ARG_WITH([mailbindir], [AC_HELP_STRING([--with-mailbindir=DIR], [install mail to DIR [[BINDIR]]])], @@ -1360,13 +1363,13 @@ test -z "$client_list" && client_list=" [NONE]" AC_CONFIG_TESTDIR(testsuite) AC_CONFIG_FILES([testsuite/Makefile testsuite/atlocal]) MU_CONFIG_TESTSUITE(libmailutils) MU_CONFIG_TESTSUITE(frm) -MU_CONFIG_TESTSUITE(maidag) +MU_CONFIG_TESTSUITE(mda) MU_CONFIG_TESTSUITE(mail) MU_CONFIG_TESTSUITE(messages) MU_CONFIG_TESTSUITE(readmsg) MU_CONFIG_TESTSUITE(sieve) MU_CONFIG_TESTSUITE(mh) MU_CONFIG_TESTSUITE(comsat) @@ -1515,13 +1518,14 @@ AC_CONFIG_FILES([ libmu_dbm/Makefile libmu_sieve/Makefile libmu_sieve/extensions/Makefile libproto/Makefile libproto/mbox/Makefile libproto/mailer/Makefile - maidag/Makefile + mda/Makefile + mda/lib/Makefile mail/Makefile mail/testsuite/Makefile libmailutils/auth/Makefile libmailutils/base/Makefile libmailutils/address/Makefile libmailutils/sockaddr/Makefile diff --git a/doc/texinfo/Makefile.am b/doc/texinfo/Makefile.am index 453997fbc..95438eb00 100644 --- a/doc/texinfo/Makefile.am +++ b/doc/texinfo/Makefile.am @@ -33,13 +33,15 @@ programs_TEXINFOS = \ programs/mail.texi\ programs/messages.texi\ programs/movemail.texi\ programs/readmsg.texi\ programs/sieve.texi\ programs/guimb.texi\ - programs/maidag.texi\ + programs/mda.texi\ + programs/lmtpd.texi\ + programs/putmail.texi\ programs/mimeview.texi\ programs/pop3d.texi\ programs/imap4d.texi\ programs/comsatd.texi\ programs/mailutils.texi diff --git a/doc/texinfo/mailutils.texi b/doc/texinfo/mailutils.texi index b1a0a2724..f93f23367 100644 --- a/doc/texinfo/mailutils.texi +++ b/doc/texinfo/mailutils.texi @@ -138,13 +138,15 @@ Mailutils Programs * movemail:: Moves Mail from the User Maildrop to the Local File. * readmsg:: Extract Messages from a Folder. * sieve:: Mail Filtering Utility. * guimb:: Mailbox Scanning and Processing Language. -* maidag:: General-purpose Mail Delivery Agent. +* mda:: Local Mail Delivery Agent. +* lmtpd:: LMTP Daemon. +* putmail:: Incorporate a Message to a Mailbox. * mimeview:: Universal File Viewer. * pop3d:: POP3 Daemon. * imap4d:: IMAP4 Daemon. * comsatd:: Comsat Daemon. @@ -199,35 +201,19 @@ Debugging * Level BNF:: * Debugging Categories:: @command{mail} --- Send and Receive Mail * Invoking Mail:: Command Line Options. +* Reading Mail:: Reading Mail. * Composing Mail:: Composing Mail. * MIME:: How to Attach Files. -* Reading Mail:: Reading Mail. * Scripting:: Scripting. * Mail Variables:: How to Alter the Behavior of @command{mail}. * Mail Configuration Files:: Personal and System-wide Configuration Files. -Composing Mail - -* Quitting Compose Mode:: -* Getting Help on Compose Escapes:: -* Editing the Message:: -* Modifying the Headers:: -* Enclosing Another Message:: -* Adding a File to the Message:: -* Attaching a File to the Message:: -* Printing And Saving the Message:: -* Signing the Message:: -* Printing Another Message:: -* Inserting Value of a Mail Variable:: -* Executing Other Mail Commands:: -* Executing Shell Commands:: - Reading Mail * Command Syntax:: Syntax of mail internal commands. * Quitting the Program:: * Obtaining Online Help:: * Moving Within a Mailbox:: @@ -242,12 +228,28 @@ Reading Mail * Aliasing:: * Replying:: * Controlling Sender Fields:: * Incorporating New Mail:: * Shell Escapes:: +Composing Mail + +* Quitting Compose Mode:: +* Getting Help on Compose Escapes:: +* Editing the Message:: +* Modifying the Headers:: +* Enclosing Another Message:: +* Adding a File to the Message:: +* Attaching a File to the Message:: +* Printing And Saving the Message:: +* Signing the Message:: +* Printing Another Message:: +* Inserting Value of a Mail Variable:: +* Executing Other Mail Commands:: +* Executing Shell Commands:: + @command{movemail} --- Moves Mail from the User Maildrop to the Local File * Movemail Configuration:: * Ownership:: Setting Destination Mailbox Ownership * Summary:: Short Movemail Invocation Summary @@ -271,34 +273,33 @@ A Sieve Interpreter * Specifying Scheme Program to Execute:: * Specifying Mailboxes to Operate Upon:: * Passing Options to Scheme:: * Command Line Option Summary:: -maidag +mda -* Sendmail-maidag:: Using @command{maidag} with Sendmail. -* Exim-maidag:: Using @command{maidag} with Exim. -* MeTA1-maidag:: Using @command{maidag} with MeTA1. +* Sendmail-mda:: Using @command{mda} with Sendmail. +* Exim-mda:: Using @command{mda} with Exim. +* MeTA1-mda:: Using @command{mda} with MeTA1. * Mailbox Quotas:: -* Maidag Scripting:: +* MDA Scripting:: * Forwarding:: -* Url-mode:: Delivering Messages to a URL. -* Remote Mailbox Delivery:: -* Conf-maidag:: Maidag Configuration File Summary +* Conf-mda:: @command{mda} Configuration File Summary. +* Mailing lists:: How to implement Mailing Lists with @command{mda}. Mailbox Quotas * DBM Quotas:: Keeping Quotas in DBM File. * SQL Quotas:: Keeping Quotas in SQL Database. -Maidag Scripting +Scripting in @command{mda} -* Sieve Maidag Filters:: -* Scheme Maidag Filters:: -* Python Maidag Filters:: +* Sieve MDA Filters:: +* Scheme MDA Filters:: +* Python MDA Filters:: mimeview * Mimeview Invocation:: * Mimeview Config:: diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi index c8c3b978d..f2de68767 100644 --- a/doc/texinfo/programs.texi +++ b/doc/texinfo/programs.texi @@ -29,13 +29,15 @@ syntax. * movemail:: Moves Mail from the User Maildrop to the Local File. * readmsg:: Extract Messages from a Folder. * sieve:: Mail Filtering Utility. * guimb:: Mailbox Scanning and Processing Language. -* maidag:: General-purpose Mail Delivery Agent. +* mda:: Local Mail Delivery Agent. +* lmtpd:: LMTP Daemon. +* putmail:: Incorporate a Message to a Mailbox. * mimeview:: Universal File Viewer. * pop3d:: POP3 Daemon. * imap4d:: IMAP4 Daemon. * comsatd:: Comsat Daemon. @@ -2887,15 +2889,25 @@ Show payload information @page @node guimb @section @command{guimb} --- A Mailbox Scanning and Processing Language @include programs/guimb.texi @page -@node maidag -@section maidag -@include programs/maidag.texi +@node mda +@section mda +@include programs/mda.texi + +@page +@node lmtpd +@section lmtpd +@include programs/lmtpd.texi + +@page +@node putmail +@section putmail +@include programs/putmail.texi @page @node mimeview @section mimeview @include programs/mimeview.texi diff --git a/doc/texinfo/programs/lmtpd.texi b/doc/texinfo/programs/lmtpd.texi new file mode 100644 index 000000000..e0212db2f --- /dev/null +++ b/doc/texinfo/programs/lmtpd.texi @@ -0,0 +1,66 @@ +@c This is part of the GNU Mailutils manual. +@c Copyright (C) 1999-2019 Free Software Foundation, Inc. +@c See file mailutils.texi for copying conditions. +@comment ******************************************************************* +@pindex lmtpd +The @acronym{LMTP} is a local mail transport protocol defined in RFC +2033. GNU Mailutils is shipped with @command{lmtpd} - a daemon for +delivering messages using this protocol. + +The daemon shares most of its codebase and configuration with +@command{mda} and consequently provides the same features. +@xref{mda}, for a detailed description of these. + +The behavior of @command{lmtpd} is affected by the following configuration +statements: + +@multitable @columnfractions 0.3 0.6 +@headitem Statement @tab Reference +@item server @tab @xref{Server Settings} +@item acl @tab @xref{acl statement}. +@item tcp-wrappers @tab @xref{tcp-wrappers statement}. +@item debug @tab @xref{debug statement}. +@item mailbox @tab @xref{mailbox statement}. +@item locking @tab @xref{locking statement}. +@item pam @tab @xref{pam statement}. +@item sql @tab @xref{sql statement}. +@item virtdomain @tab @xref{virtdomain statement}. +@item radius @tab @xref{radius statement}. +@item ldap @tab @xref{ldap statement}. +@item auth @tab @xref{auth statement}. +@item mailer @tab @xref{mailer statement}. +@end multitable + +@menu +* MeTA1-lmtpd:: Using @command{lmtpd} with MeTA1. +@end menu + +@node MeTA1-lmtpd +@subsection Using @command{lmtpd} with MeTA1. +MeTA1 (@uref{http://meta1.org}) communicates with the delivery agent +using @acronym{LMTP}. + +The socket to listen for LMTP requests must be specified using the +@code{server} statement (@pxref{Server Settings}). For the purposes of +this section, let's suppose @command{lmtpd} will listen on a +@acronym{UNIX} socket @file{/var/spool/meta1/lmtpsock}. Then, the +following (minimal) @command{lmtpd} configuration will do the job: + +@example +# @r{Run as daemon.} +mode daemon; +# @r{Switch to this group after startup.} +group meta1c; +# @r{Configure server:} +server unix:///var/spool/meta1/lmtpsock @{ + transcript no; +@}; +@end example + +To configure MeTA1 to use this socket, add the following statement to +the @samp{smtpc} section in @file{/etc/meta1/meta1.conf}: + +@example + LMTP_socket="lmtpsock"; +@end example + diff --git a/doc/texinfo/programs/maidag.texi b/doc/texinfo/programs/mda.texi index c66d4aefa..acce8301f 100644 --- a/doc/texinfo/programs/maidag.texi +++ b/doc/texinfo/programs/mda.texi @@ -1,142 +1,112 @@ @c This is part of the GNU Mailutils manual. @c Copyright (C) 1999-2019 Free Software Foundation, Inc. @c See file mailutils.texi for copying conditions. @comment ******************************************************************* -@pindex maidag -@UNREVISED - -The name @samp{maidag} stands for @i{Mai}l @i{d}elivery @i{ag}ent. It -is a general-purpose @acronym{MDA} offering a rich set of -features. It can operate both in traditional mode, reading the message -from its standard input, and in @acronym{LMTP} mode. @command{Maidag} -is able to deliver mail to any mailbox format, supported by GNU -Mailutils. These formats, among others, include @samp{smtp://}, -@samp{prog://} and @samp{sendmail://} which are +@pindex mda +GNU local mail delivery agent reads a message from its standard input +and delivers it to one or more local recipients listed in the command +line. When we speak about @i{local} recipients, we mean that these +are system users that are known to the system that runs @command{mda}. +However, the mailboxes of these users can be local as well as remote +ones. @command{mda} is able to deliver mail to any mailbox format, +supported by GNU Mailutils. These formats, among others, include +@samp{smtp://}, @samp{prog://} and @samp{sendmail://} which are equivalent to forwarding a message over @acronym{SMTP} to a remote -node. Thus, @command{maidag} supersedes both @command{mail.local} and -@command{mail.remote} utilities from GNU Mailutils versions prior to -2.0. +node. -@command{Maidag} is also able to process incoming messages using +@command{Mda} is also able to process incoming messages using Sieve, Scheme or Python scripts and, based on results of this processing, to take a decision on whether to actually deliver and where to deliver them. Due to its extensive scripting facilities, -@command{maidag} offers much more flexibility than other popular -@acronym{MDA}s, such as @command{procmail}. +@command{mda} offers much more flexibility than other popular +@acronym{MDA}s. @menu -* Sendmail-maidag:: Using @command{maidag} with Sendmail. -* Exim-maidag:: Using @command{maidag} with Exim. -* MeTA1-maidag:: Using @command{maidag} with MeTA1. +* Sendmail-mda:: Using @command{mda} with Sendmail. +* Exim-mda:: Using @command{mda} with Exim. +* MeTA1-mda:: Using @command{mda} with MeTA1. * Mailbox Quotas:: -* Maidag Scripting:: +* MDA Scripting:: * Forwarding:: -* Url-mode:: Delivering Messages to a URL. -* Remote Mailbox Delivery:: -* Conf-maidag:: Maidag Configuration File Summary +* Conf-mda:: @command{mda} Configuration File Summary. +* Mailing lists:: How to implement Mailing Lists with @command{mda}. @end menu -@node Sendmail-maidag -@subsection Using @command{maidag} with Sendmail. +@node Sendmail-mda +@subsection Using @command{mda} with Sendmail. @cindex Sendmail -When used as a @acronym{MDA} with Sendmail, @command{maidag} must be -invoked from the local mailer definition in the @file{sendmail.cf} -file. It must have the following flags set: @samp{lswS}. These mean: -the mailer is local, quote characters should be stripped off the -address before invoking the mailer, the user must have a valid account -on this machine and the userid should not be reset before calling the -mailer. Additionally, the flags @samp{fn} may be specified to allow -@command{maidag} to generate the usual @samp{From } envelope instead +When used with Sendmail, @command{mda} must be invoked from the local +mailer definition in the @file{sendmail.cf} file. The flags +@samp{lswS} must be set for the mailer. These mean: the mailer is +local, quote characters should be stripped off the address before +invoking the mailer, the user must have a valid account on this +machine and the userid should not be reset before calling the mailer. +Additionally, the @samp{fn} flags may be specified to allow +@command{mda} to generate the usual @samp{From } envelope instead of the one supplied by @command{sendmail}. -If you wish to use @command{maidag} with non-local authentication, +If you wish to use @command{mda} with non-local authentication, such as @acronym{SQL} or @acronym{LDAP}, you also need to remove the @samp{w} flag, since in that case the user is not required to have a valid account on the machine that runs @command{sendmail}. Here is an example of mailer definition in @file{sendmail.cf} @example -Mlocal, P=/usr/local/sbin/maidag, +Mlocal, P=/usr/local/sbin/mda, F=lsDFMAw5:/|@@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix, A=mail $u @end example To define local mailer in @samp{mc} source file, it will suffice to set: @example -define(`LOCAL_MAILER_PATH', `/usr/local/sbin/maidag') +define(`LOCAL_MAILER_PATH', `/usr/local/sbin/mda') define(`LOCAL_MAILER_ARGS', `mail $u') @end example -@node Exim-maidag -@subsection Using @command{maidag} with Exim. +@node Exim-mda +@subsection Using @command{mda} with Exim. @cindex Exim -Using @command{maidag} with Exim is quite straightforward. The +Using @command{mda} with Exim is quite straightforward. The following example illustrates the definition of the appropriate transport and director in @file{exim.conf}: @example # transport -maidag_pipe: +mda_pipe: driver = pipe - command = /usr/local/sbin/maidag $local_part + command = /usr/local/sbin/mda $local_part return_path_add delivery_date_add envelope_to_add # director -maidag: +mda: driver = localuser - transport = maidag_pipe + transport = mda_pipe @end example -@node MeTA1-maidag -@subsection Using @command{maidag} with MeTA1. -@cindex LMTP +@node MeTA1-mda +@subsection Using @command{mda} with MeTA1. @cindex MeTA1 MeTA1 (@uref{http://meta1.org}) communicates with the delivery agent -using @acronym{LMTP}. - -LMTP mode is enabled in @command{maidag} by the @samp{delivery-mode lmtp} -statement. The socket to listen on must be specified using -@code{server} statement (@pxref{Server Settings}). For the purposes of -this section, let's suppose @command{maidag} will listen on a -@acronym{UNIX} socket @file{/var/spool/meta1/lmtpsock}. Then, the -following (minimal) @command{maidag} configuration will do the job: - -@example -# @r{Start in LMTP mode.} -delivery-mode lmtp; -# @r{Run as daemon.} -mode daemon; -# @r{Switch to this group after startup.} -group meta1c; -# @r{Configure server:} -server unix:///var/spool/meta1/lmtpsock @{ - transcript no; -@}; -@end example - -To configure MeTA1 to use this socket, add the following statement to -the @samp{smtpc} section in @file{/etc/meta1/meta1.conf}: - -@example - LMTP_socket="lmtpsock"; -@end example +using @acronym{LMTP}. Instead of using @command{mda} you will have to +start the @acronym{LMTP} daemon @command{lmtpd} and configure MeTA1 to +communicate with it. @xref{MeTA1-lmtpd}, for details. @node Mailbox Quotas @subsection Mailbox Quotas @dfn{Mailbox quota} is a limit on the size of the mailbox. When a -mailbox size reaches this limit, @command{maidag} stops accepting +mailbox size reaches this limit, @command{mda} stops accepting messages for this recipient and returns an error condition to the sender. The error code is accompanied by the following error message: @example @var{user}: mailbox quota exceeded for this recipient @end example @@ -152,13 +122,15 @@ well. In this case, the error message is: In both cases, the default return code will be @samp{service unavailable} (corresponding to the @acronym{SMTP} return code @samp{550}), unless the following statement is present in the @command{maidag} configuration file: @example -exit-quota-tempfail yes; +quota @{ + exit-tempfail yes; +@} @end example @noindent in which case a temporary error will be returned. The mailbox quota can be retrieved from the following sources: @@ -178,13 +150,13 @@ The mailbox quota can be retrieved from the following sources: @subsubsection Keeping Quotas in DBM File To use @acronym{DBM} quota database, GNU Mailutils must be compiled with one of the following command line options: @option{--with-gdbm}, @option{--with-berkeley-db}, @option{--with-ndbm}, @option{--with-tokyocabinet}, or @option{--with-kyotocabinet}. -Examine the output of @command{maidag --show-config-options}, if not sure. +Examine the output of @command{mda --show-config-options}, if not sure. The quota database should have the following structure: @table @asis @item Key Key represents the user name. Special key @samp{DEFAULT} means default @@ -196,13 +168,13 @@ Mailbox quota for this user. If it is a number, it represents the maximum mailbox size in bytes. A number may optionally be followed by @samp{kb} or @samp{mb}, meaning kilobytes and megabytes, respectively. A special value @samp{NONE} means no mailbox size limit for this user. @end table -Here is an example of a valid quota database +Here is an example of a quota database in text form: @example # Default quota value: DEFAULT 5mb # Following users have unlimited mailbox size @@ -212,23 +184,25 @@ smith NONE # Rest of users plog 26214400 karin 10mB @end example To use the @acronym{DBM} quota database, specify its absolute name using -@code{quota-db} configuration statement, e.g.: +the @code{database} configuration statement in the @code{quota} +section, e.g.: @example -quota-db /etc/mail/quota.db; +quota @{ + database /etc/mail/quota.db; +@} @end example @node SQL Quotas @subsubsection Keeping Quotas in SQL Database -Configuration statement @code{quota-query} allows to specify a special -query to retrieve the quota from the database. Currently (as of mailutils +User quotas can be kept in an SQL table as well. Currently (as of mailutils version @value{VERSION}) it is assumed that this table can be accessed using the credentials set in @samp{sql} configuration statement (@pxref{SQL Statement}). For example, suppose you have the following quota table: @@ -245,17 +219,27 @@ create table mailbox_quota ( To retrieve user quota the following query can be used: @example SELECT quota FROM mailbox_quota WHERE user_name='$@{user@}' @end example +To define this query use the @code{sql-query} statement: + +@example +quota @{ + sql-query "SELECT quota " + "FROM mailbox_quota " + "WHERE user_name='$@{user@}'"; +@} +@end example + There are no special provisions for specifying group quotas, similar to @samp{DEFAULT} in @acronym{DBM} databases. This is because group quotas can -easily be implemented using @acronym{SQL} language. @command{Maidag} +easily be implemented using @acronym{SQL} language. @command{Mda} always uses the first tuple from the set returned by mailbox quota -query. So, you may add a special entry to the @code{mailbox_quota} +query. So, you can add a special entry to the @code{mailbox_quota} table that would keep the group quota. In the discussion below we assume that the @code{user_name} column for this entry is lexicographically less than any other user name in the table. Let's suppose the group quota name is @samp{00DEFAULT}. Then the following query: @example @@ -265,30 +249,32 @@ WHERE user_name IN ('$@{user@}','00DEFAULT') ORDER BY user_name DESC @end example @noindent will return two tuples if the user is found in @code{mailbox_quota}. Due to @code{ORDER} statement, the first tuple -will contain the quota for the user, which will be used by -@command{maidag}. On the other hand, if the requested user name is not +will contain quota for the user, which will be used by +@command{mda}. On the other hand, if the requested user name is not present in the table, the above query will return a single tuple containing the group quota. The following configuration statement instructs @command{maidag} to use this query for retrieving the user quota: @example -quota-query "SELECT quota " +quota @{ + sql-query "SELECT quota " "FROM mailbox_quota " "WHERE user_name IN ('$@{user@}','00DEFAULT') " "ORDER BY user_name DESC"; +@} |