-
-
Notifications
You must be signed in to change notification settings - Fork 3
qmail lspawn.8
qmail-lspawn - schedule local deliveries
qmail-lspawn defaultdelivery
qmail-lspawn reads a series of local delivery commands from descriptor 0, invokes qmail-local to perform the deliveries, and prints the results to descriptor 1. It passes defaultdelivery to qmail-local as the default delivery instruction.
qmail-lspawn invokes qmail-local asynchronously, so the results may not be in the same order as the commands. If the environment variable QMAILLOCAL is defined the executable defined by QMAILLOCAL is invoked instead.
qmail-lspawn sets the environment variable MESSID pointing message file in the queue.
qmail-lspawn runs with uid 0. For each recipient address, qmail-lspawn finds out which local user controls that address. It first checks the qmail-users mechanism; if the address is not listed there, it invokes qmail-getpw(8). qmail-lspawn then runs qmail-local under the user's uid and gid. For address fetched using qmail-getpw, it sets up supplementary groups for the user if the environment variable SETUSER_PRIVILEGES is set. qmail-lspawn does not perform deliveries as root. If the environment variable QMAILGETPW is set, qmail-lspawn will call the binary defined by QMAILGETPW, instead of qmail-getpw.
If the environment variable AUTHSELF is set, qmail-lspawn connects to MySQL and fetches user records for virtual domains in virtualdomains control file. If connecton to MySQL fails, qmail-lspawn exits with -2, resulting in a deferral. For an empty mailbox name (e.g. double bounces to virtual domains), mails can be routed to user defined by ROUTE_NULL_USER environment variable. If this variable is set but empty, qmail-lspawn will treat the empty mailbox name as a trash address. If the domain portion, belongs to a virtual domain on the host, the mail will be routed to the mailbox name at the virtual domain. If the domain portion, doesn't belong to a virtual domain set in IndiMail, the mail will be silently deliverd to local user, ignoring the domain name following the '@' sign. For all other cases not covered by setting AUTHSELF environment variable, qmail-lspawn treats an empty mailbox name as a trash address.
qmail-lspawn can load an external library to add functionality. The virtual package can be loaded by setting the environment variable VIRTUAL_PKG_LIB or by using the control file libindimail. The value in libindimail is set to libindimail.so by default. If there is any problem loading the library or loading symbols required, qmail-lspawn will exit with -3. If the environment AUTHSELF isn't defined the external library will not be loaded.
Following functions should be provided by the shared library for adding features to qmail-lspawn - isvirtualdomain(), iopen(), sql_getpw(), iclose() (and inquery() if using cache from inlookup(8) daemon. If such a library is opened qmail-lspawn connects to MySQL(1) and sets the environment variable PWSTRUCT having the passwd structure for the user. The environment variable is set to "No such user" in case the user is not found in the local MySQL database. This environment variable can be used by delivery agents without having to read the passwd file or a database. For a user-cluster domain, if a mail is injected for a user not found in the local MySQL database, qmail-lspawn will set PWSTRUCT to "No such user". However, a delivery agent like vdelivermail(8) reroutes the email to the correct destination host which has the user account, using qmail-remote. qmail-lspawn can get cached results from inlookup(8) daemon if QUERY_CACHE environment variable is set. When using cache, qmail-lspawn avoids connecting to MySQL each time a record for a user account needs to be fetched.
qmail-lspawn goes ahead without attempting to load external library if AUTHSELF is not set.
envelopes(5), qmail-users(5), qmail-getpw(8), qscheduler(8), qmail-start(8), qmail-send(8), todo-proc(8), qmail-local(8),