Home | History | Annotate | Line # | Download | only in virtual
      1 /*	$NetBSD: virtual.c,v 1.5 2026/05/09 18:49:23 christos Exp $	*/
      2 
      3 /*++
      4 /* NAME
      5 /*	virtual 8
      6 /* SUMMARY
      7 /*	Postfix virtual domain mail delivery agent
      8 /* SYNOPSIS
      9 /*	\fBvirtual\fR [generic Postfix daemon options]
     10 /* DESCRIPTION
     11 /*	The \fBvirtual\fR(8) delivery agent is designed for virtual mail
     12 /*	hosting services. Originally based on the Postfix \fBlocal\fR(8)
     13 /*	delivery
     14 /*	agent, this agent looks up recipients with map lookups of their
     15 /*	full recipient address, instead of using hard-coded unix password
     16 /*	file lookups of the address local part only.
     17 /*
     18 /*	This delivery agent only delivers mail.  Other features such as
     19 /*	mail forwarding, out-of-office notifications, etc., must be
     20 /*	configured via virtual_alias maps or via similar lookup mechanisms.
     21 /* MAILBOX LOCATION
     22 /* .ad
     23 /* .fi
     24 /*	The mailbox location is controlled by the \fBvirtual_mailbox_base\fR
     25 /*	and \fBvirtual_mailbox_maps\fR configuration parameters (see below).
     26 /*	The \fBvirtual_mailbox_maps\fR table is indexed by the recipient
     27 /*	address as described under TABLE SEARCH ORDER below.
     28 /*
     29 /*	The mailbox pathname is constructed as follows:
     30 /*
     31 /* .nf
     32 /*	  \fB$virtual_mailbox_base/$virtual_mailbox_maps(\fIrecipient\fB)\fR
     33 /* .fi
     34 /*
     35 /*	where \fIrecipient\fR is the full recipient address.
     36 /* UNIX MAILBOX FORMAT
     37 /* .ad
     38 /* .fi
     39 /*	When the mailbox location does not end in \fB/\fR, the message
     40 /*	is delivered in UNIX mailbox format.   This format stores multiple
     41 /*	messages in one textfile.
     42 /*
     43 /*	The \fBvirtual\fR(8) delivery agent prepends a "\fBFrom \fIsender
     44 /*	time_stamp\fR" envelope header to each message, prepends a
     45 /*	\fBDelivered-To:\fR message header with the envelope recipient
     46 /*	address,
     47 /*	prepends an \fBX-Original-To:\fR header with the recipient address as
     48 /*	given to Postfix,
     49 /*	prepends a \fBReturn-Path:\fR message header with the
     50 /*	envelope sender address, prepends a \fB>\fR character to lines
     51 /*	beginning with "\fBFrom \fR", and appends an empty line.
     52 /*
     53 /*	The mailbox is locked for exclusive access while delivery is in
     54 /*	progress. In case of problems, an attempt is made to truncate the
     55 /*	mailbox to its original length.
     56 /* QMAIL MAILDIR FORMAT
     57 /* .ad
     58 /* .fi
     59 /*	When the mailbox location ends in \fB/\fR, the message is delivered
     60 /*	in qmail \fBmaildir\fR format. This format stores one message per file.
     61 /*
     62 /*	The \fBvirtual\fR(8) delivery agent prepends a \fBDelivered-To:\fR
     63 /*	message header with the final envelope recipient address,
     64 /*	prepends an \fBX-Original-To:\fR header with the recipient address as
     65 /*	given to Postfix, and prepends a
     66 /*	\fBReturn-Path:\fR message header with the envelope sender address.
     67 /*
     68 /*	By definition, \fBmaildir\fR format does not require application-level
     69 /*	file locking during mail delivery or retrieval.
     70 /* MAILBOX OWNERSHIP
     71 /* .ad
     72 /* .fi
     73 /*	Mailbox ownership is controlled by the \fBvirtual_uid_maps\fR
     74 /*	and \fBvirtual_gid_maps\fR lookup tables, which are indexed
     75 /*	with the full recipient address. Each table provides
     76 /*	a string with the numerical user and group ID, respectively.
     77 /*
     78 /*	The \fBvirtual_minimum_uid\fR parameter imposes a lower bound on
     79 /*	numerical user ID values that may be specified in any
     80 /*	\fBvirtual_uid_maps\fR.
     81 /* CASE FOLDING
     82 /* .ad
     83 /* .fi
     84 /*	All delivery decisions are made using the full recipient
     85 /*	address, folded to lower case. See also the next section
     86 /*	for a few exceptions with optional address extensions.
     87 /* TABLE SEARCH ORDER
     88 /* .ad
     89 /* .fi
     90 /*	Normally, a lookup table is specified as a text file that
     91 /*	serves as input to the \fBpostmap\fR(1) command. The result, an
     92 /*	indexed file in \fBdbm\fR or \fBdb\fR format, is used for fast
     93 /*	searching by the mail system.
     94 /*
     95 /*	The search order is as follows. The search stops
     96 /*	upon the first successful lookup.
     97 /* .IP \(bu
     98 /*	When the recipient has an optional address extension the
     99 /*	\fIuser+extension (at) domain.tld\fR address is looked up first.
    100 /* .sp
    101 /*	With Postfix versions before 2.1, the optional address extension
    102 /*	is always ignored.
    103 /* .IP \(bu
    104 /*	The \fIuser (at) domain.tld\fR address, without address extension,
    105 /*	is looked up next.
    106 /* .IP \(bu
    107 /*	Finally, the recipient \fI@domain\fR is looked up.
    108 /* .PP
    109 /*	When the table is provided via other means such as NIS, LDAP
    110 /*	or SQL, the same lookups are done as for ordinary indexed files.
    111 /*
    112 /*	Alternatively, a table can be provided as a regular-expression
    113 /*	map where patterns are given as regular expressions. In that case,
    114 /*	only the full recipient address is given to the regular-expression
    115 /*	map.
    116 /* SECURITY
    117 /* .ad
    118 /* .fi
    119 /*	The \fBvirtual\fR(8) delivery agent is not security sensitive, provided
    120 /*	that the lookup tables with recipient user/group ID information are
    121 /*	adequately protected. This program is not designed to run chrooted.
    122 /*
    123 /*	The \fBvirtual\fR(8) delivery agent disallows regular expression
    124 /*	substitution of $1 etc. in regular expression lookup tables,
    125 /*	because that would open a security hole.
    126 /*
    127 /*	The \fBvirtual\fR(8) delivery agent will silently ignore requests
    128 /*	to use the \fBproxymap\fR(8) server. Instead it will open the
    129 /*	table directly. Before Postfix version 2.2, the virtual
    130 /*	delivery agent will terminate with a fatal error.
    131 /* STANDARDS
    132 /*	RFC 822 (ARPA Internet Text Messages)
    133 /* DIAGNOSTICS
    134 /*	Mail bounces when the recipient has no mailbox or when the
    135 /*	recipient is over disk quota. In all other problem cases, mail for
    136 /*	an existing recipient is deferred and a warning is logged.
    137 /*
    138 /*	Problems and transactions are logged to \fBsyslogd\fR(8)
    139 /*	or \fBpostlogd\fR(8).
    140 /*	Corrupted message files are marked so that the queue
    141 /*	manager can move them to the \fBcorrupt\fR queue afterwards.
    142 /*
    143 /*	Depending on the setting of the \fBnotify_classes\fR parameter,
    144 /*	the postmaster is notified of bounces and of other trouble.
    145 /* BUGS
    146 /*	This delivery agent supports address extensions in email
    147 /*	addresses and in lookup table keys, but does not propagate
    148 /*	address extension information to the result of table lookup.
    149 /*
    150 /*	Postfix should have lookup tables that can return multiple result
    151 /*	attributes. In order to avoid the inconvenience of maintaining
    152 /*	three tables, use an LDAP or MYSQL database.
    153 /* CONFIGURATION PARAMETERS
    154 /* .ad
    155 /* .fi
    156 /*	Changes to \fBmain.cf\fR are picked up automatically, as
    157 /*	\fBvirtual\fR(8)
    158 /*	processes run for only a limited amount of time. Use the command
    159 /*	"\fBpostfix reload\fR" to speed up a change.
    160 /*
    161 /*	The text below provides only a parameter summary. See
    162 /*	\fBpostconf\fR(5) for more details including examples.
    163 /* MAILBOX DELIVERY CONTROLS
    164 /* .ad
    165 /* .fi
    166 /* .IP "\fBvirtual_mailbox_base (empty)\fR"
    167 /*	A prefix that the \fBvirtual\fR(8) delivery agent prepends to all pathname
    168 /*	results from $virtual_mailbox_maps table lookups.
    169 /* .IP "\fBvirtual_mailbox_maps (empty)\fR"
    170 /*	Optional lookup tables with all valid addresses in the domains that
    171 /*	match $virtual_mailbox_domains.
    172 /* .IP "\fBvirtual_minimum_uid (100)\fR"
    173 /*	The minimum user ID value that the \fBvirtual\fR(8) delivery agent accepts
    174 /*	as a result from $virtual_uid_maps table lookup.
    175 /* .IP "\fBvirtual_uid_maps (empty)\fR"
    176 /*	Lookup tables with the per-recipient user ID that the \fBvirtual\fR(8)
    177 /*	delivery agent uses while writing to the recipient's mailbox.
    178 /* .IP "\fBvirtual_gid_maps (empty)\fR"
    179 /*	Lookup tables with the per-recipient group ID for \fBvirtual\fR(8) mailbox
    180 /*	delivery.
    181 /* .PP
    182 /*	Available in Postfix version 2.0 and later:
    183 /* .IP "\fBvirtual_mailbox_domains ($virtual_mailbox_maps)\fR"
    184 /*	Postfix is the final destination for the specified list of domains;
    185 /*	mail is delivered via the $virtual_transport mail delivery transport.
    186 /* .IP "\fBvirtual_transport (virtual)\fR"
    187 /*	The default mail delivery transport and next-hop destination for
    188 /*	final delivery to domains listed with $virtual_mailbox_domains.
    189 /* .PP
    190 /*	Available in Postfix version 2.5.3 and later:
    191 /* .IP "\fBstrict_mailbox_ownership (yes)\fR"
    192 /*	Defer delivery when a mailbox file is not owned by its recipient.
    193 /* LOCKING CONTROLS
    194 /* .ad
    195 /* .fi
    196 /* .IP "\fBvirtual_mailbox_lock (see 'postconf -d' output)\fR"
    197 /*	How to lock a UNIX-style \fBvirtual\fR(8) mailbox before attempting
    198 /*	delivery.
    199 /* .IP "\fBdeliver_lock_attempts (20)\fR"
    200 /*	The maximal number of attempts to acquire an exclusive lock on a
    201 /*	mailbox file or \fBbounce\fR(8) logfile.
    202 /* .IP "\fBdeliver_lock_delay (1s)\fR"
    203 /*	The time between attempts to acquire an exclusive lock on a mailbox
    204 /*	file or \fBbounce\fR(8) logfile.
    205 /* .IP "\fBstale_lock_time (500s)\fR"
    206 /*	The time after which a stale exclusive mailbox lockfile is removed.
    207 /* RESOURCE AND RATE CONTROLS
    208 /* .ad
    209 /* .fi
    210 /* .IP "\fBvirtual_mailbox_limit (51200000)\fR"
    211 /*	The maximal size in bytes of an individual \fBvirtual\fR(8) mailbox or
    212 /*	maildir file, or zero (no limit).
    213 /* .PP
    214 /*	Implemented in the qmgr(8) daemon:
    215 /* .IP "\fBvirtual_destination_concurrency_limit ($default_destination_concurrency_limit)\fR"
    216 /*	The maximal number of parallel deliveries to the same destination
    217 /*	via the virtual message delivery transport.
    218 /* .IP "\fBvirtual_destination_recipient_limit ($default_destination_recipient_limit)\fR"
    219 /*	The maximal number of recipients per message for the virtual
    220 /*	message delivery transport.
    221 /* MISCELLANEOUS CONTROLS
    222 /* .ad
    223 /* .fi
    224 /* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
    225 /*	The default location of the Postfix main.cf and master.cf
    226 /*	configuration files.
    227 /* .IP "\fBdaemon_timeout (18000s)\fR"
    228 /*	How much time a Postfix daemon process may take to handle a
    229 /*	request before it is terminated by a built-in watchdog timer.
    230 /* .IP "\fBdelay_logging_resolution_limit (2)\fR"
    231 /*	The maximal number of digits after the decimal point when logging
    232 /*	delay values.
    233 /* .IP "\fBipc_timeout (3600s)\fR"
    234 /*	The time limit for sending or receiving information over an internal
    235 /*	communication channel.
    236 /* .IP "\fBmax_idle (100s)\fR"
    237 /*	The maximum amount of time that an idle Postfix daemon process waits
    238 /*	for an incoming connection before terminating voluntarily.
    239 /* .IP "\fBmax_use (100)\fR"
    240 /*	The maximal number of incoming connections that a Postfix daemon
    241 /*	process will service before terminating voluntarily.
    242 /* .IP "\fBprocess_id (read-only)\fR"
    243 /*	The process ID of a Postfix command or daemon process.
    244 /* .IP "\fBprocess_name (read-only)\fR"
    245 /*	The process name of a Postfix command or daemon process.
    246 /* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
    247 /*	The location of the Postfix top-level queue directory.
    248 /* .IP "\fBsyslog_facility (mail)\fR"
    249 /*	The syslog facility of Postfix logging.
    250 /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR"
    251 /*	A prefix that is prepended to the process name in syslog
    252 /*	records, so that, for example, "smtpd" becomes "prefix/smtpd".
    253 /* .PP
    254 /*	Available in Postfix version 3.0 and later:
    255 /* .IP "\fBvirtual_delivery_status_filter ($default_delivery_status_filter)\fR"
    256 /*	Optional filter for the \fBvirtual\fR(8) delivery agent to change the
    257 /*	delivery status code or explanatory text of successful or unsuccessful
    258 /*	deliveries.
    259 /* .PP
    260 /*	Available in Postfix version 3.3 and later:
    261 /* .IP "\fBenable_original_recipient (yes)\fR"
    262 /*	Enable support for the original recipient address after an
    263 /*	address is rewritten to a different address (for example with
    264 /*	aliasing or with canonical mapping).
    265 /* .IP "\fBservice_name (read-only)\fR"
    266 /*	The master.cf service name of a Postfix daemon process.
    267 /* .PP
    268 /*	Available in Postfix 3.5 and later:
    269 /* .IP "\fBinfo_log_address_format (external)\fR"
    270 /*	The email address form that will be used in non-debug logging
    271 /*	(info, warning, etc.).
    272 /* SEE ALSO
    273 /*	qmgr(8), queue manager
    274 /*	bounce(8), delivery status reports
    275 /*	postconf(5), configuration parameters
    276 /*	postlogd(8), Postfix logging
    277 /*	syslogd(8), system logging
    278 /* README_FILES
    279 /*	Use "\fBpostconf readme_directory\fR" or
    280 /*	"\fBpostconf html_directory\fR" to locate this information.
    281 /*	VIRTUAL_README, domain hosting howto
    282 /* LICENSE
    283 /* .ad
    284 /* .fi
    285 /*	The Secure Mailer license must be distributed with this software.
    286 /* HISTORY
    287 /* .ad
    288 /* .fi
    289 /*	This delivery agent was originally based on the Postfix local delivery
    290 /*	agent. Modifications mainly consisted of removing code that either
    291 /*	was not applicable or that was not safe in this context: aliases,
    292 /*	~user/.forward files, delivery to "|command" or to /file/name.
    293 /*
    294 /*	The \fBDelivered-To:\fR message header appears in the \fBqmail\fR
    295 /*	system by Daniel Bernstein.
    296 /*
    297 /*	The \fBmaildir\fR structure appears in the \fBqmail\fR system
    298 /*	by Daniel Bernstein.
    299 /* AUTHOR(S)
    300 /*	Wietse Venema
    301 /*	IBM T.J. Watson Research
    302 /*	P.O. Box 704
    303 /*	Yorktown Heights, NY 10598, USA
    304 /*
    305 /*	Wietse Venema
    306 /*	Google, Inc.
    307 /*	111 8th Avenue
    308 /*	New York, NY 10011, USA
    309 /*
    310 /*	Andrew McNamara
    311 /*	andrewm (at) connect.com.au
    312 /*	connect.com.au Pty. Ltd.
    313 /*	Level 3, 213 Miller St
    314 /*	North Sydney 2060, NSW, Australia
    315 /*--*/
    316 
    317 /* System library. */
    318 
    319 #include <sys_defs.h>
    320 #include <stdlib.h>
    321 #ifdef USE_PATHS_H
    322 #include <paths.h>			/* XXX mail_spool_dir dependency */
    323 #endif
    324 
    325 /* Utility library. */
    326 
    327 #include <msg.h>
    328 #include <vstring.h>
    329 #include <vstream.h>
    330 #include <iostuff.h>
    331 #include <set_eugid.h>
    332 #include <dict.h>
    333 
    334 /* Global library. */
    335 
    336 #include <mail_queue.h>
    337 #include <recipient_list.h>
    338 #include <deliver_request.h>
    339 #include <deliver_completed.h>
    340 #include <mail_params.h>
    341 #include <mail_version.h>
    342 #include <mail_conf.h>
    343 #include <mail_params.h>
    344 #include <mail_addr_find.h>
    345 #include <flush_clnt.h>
    346 
    347 /* Single server skeleton. */
    348 
    349 #include <mail_server.h>
    350 
    351 /* Application-specific. */
    352 
    353 #include "virtual.h"
    354 
    355  /*
    356   * Tunable parameters.
    357   */
    358 char   *var_virt_mailbox_maps;
    359 char   *var_virt_uid_maps;
    360 char   *var_virt_gid_maps;
    361 int     var_virt_minimum_uid;
    362 char   *var_virt_mailbox_base;
    363 char   *var_virt_mailbox_lock;
    364 long    var_virt_mailbox_limit;
    365 char   *var_mail_spool_dir;		/* XXX dependency fix */
    366 bool    var_strict_mbox_owner;
    367 char   *var_virt_dsn_filter;
    368 
    369  /*
    370   * Mappings.
    371   */
    372 MAPS   *virtual_mailbox_maps;
    373 MAPS   *virtual_uid_maps;
    374 MAPS   *virtual_gid_maps;
    375 
    376  /*
    377   * Bit masks.
    378   */
    379 int     virtual_mbox_lock_mask;
    380 
    381 /* local_deliver - deliver message with extreme prejudice */
    382 
    383 static int local_deliver(DELIVER_REQUEST *rqst, char *service)
    384 {
    385     const char *myname = "local_deliver";
    386     RECIPIENT *rcpt_end = rqst->rcpt_list.info + rqst->rcpt_list.len;
    387     RECIPIENT *rcpt;
    388     int     rcpt_stat;
    389     int     msg_stat;
    390     LOCAL_STATE state;
    391     USER_ATTR usr_attr;
    392 
    393     if (msg_verbose)
    394 	msg_info("local_deliver: %s from %s", rqst->queue_id, rqst->sender);
    395 
    396     /*
    397      * Initialize the delivery attributes that are not recipient specific.
    398      */
    399     state.level = 0;
    400     deliver_attr_init(&state.msg_attr);
    401     state.msg_attr.queue_name = rqst->queue_name;
    402     state.msg_attr.queue_id = rqst->queue_id;
    403     state.msg_attr.fp = rqst->fp;
    404     state.msg_attr.offset = rqst->data_offset;
    405     state.msg_attr.sender = rqst->sender;
    406     state.msg_attr.dsn_envid = rqst->dsn_envid;
    407     state.msg_attr.dsn_ret = rqst->dsn_ret;
    408     state.msg_attr.relay = service;
    409     state.msg_attr.msg_stats = rqst->msg_stats;
    410     RESET_USER_ATTR(usr_attr, state.level);
    411     state.request = rqst;
    412 
    413     /*
    414      * Iterate over each recipient named in the delivery request. When the
    415      * mail delivery status for a given recipient is definite (i.e. bounced
    416      * or delivered), update the message queue file and cross off the
    417      * recipient. Update the per-message delivery status.
    418      */
    419     for (msg_stat = 0, rcpt = rqst->rcpt_list.info; rcpt < rcpt_end; rcpt++) {
    420 	state.msg_attr.rcpt = *rcpt;
    421 	rcpt_stat = deliver_recipient(state, usr_attr);
    422 	if (rcpt_stat == 0 && (rqst->flags & DEL_REQ_FLAG_SUCCESS))
    423 	    deliver_completed(state.msg_attr.fp, rcpt->offset);
    424 	msg_stat |= rcpt_stat;
    425     }
    426 
    427     deliver_attr_free(&state.msg_attr);
    428     return (msg_stat);
    429 }
    430 
    431 /* local_service - perform service for client */
    432 
    433 static void local_service(VSTREAM *stream, char *service, char **argv)
    434 {
    435     DELIVER_REQUEST *request;
    436     int     status;
    437 
    438     /*
    439      * Sanity check. This service takes no command-line arguments.
    440      */
    441     if (argv[0])
    442 	msg_fatal("unexpected command-line argument: %s", argv[0]);
    443 
    444     /*
    445      * This routine runs whenever a client connects to the UNIX-domain socket
    446      * that is dedicated to local mail delivery service. What we see below is
    447      * a little protocol to (1) tell the client that we are ready, (2) read a
    448      * delivery request from the client, and (3) report the completion status
    449      * of that request.
    450      */
    451     if ((request = deliver_request_read(stream)) != 0) {
    452 	status = local_deliver(request, service);
    453 	deliver_request_done(stream, request, status);
    454     }
    455 }
    456 
    457 /* pre_accept - see if tables have changed */
    458 
    459 static void pre_accept(char *unused_name, char **unused_argv)
    460 {
    461     const char *table;
    462 
    463     if ((table = dict_changed_name()) != 0) {
    464 	msg_info("table %s has changed -- restarting", table);
    465 	exit(0);
    466     }
    467 }
    468 
    469 /* post_init - post-jail initialization */
    470 
    471 static void post_init(char *unused_name, char **unused_argv)
    472 {
    473 
    474     /*
    475      * Drop privileges most of the time.
    476      */
    477     set_eugid(var_owner_uid, var_owner_gid);
    478 
    479     /*
    480      * No case folding needed: the recipient address is case folded.
    481      */
    482     virtual_mailbox_maps =
    483 	maps_create(VAR_VIRT_MAILBOX_MAPS, var_virt_mailbox_maps,
    484 		    DICT_FLAG_LOCK | DICT_FLAG_PARANOID
    485 		    | DICT_FLAG_UTF8_REQUEST);
    486 
    487     virtual_uid_maps =
    488 	maps_create(VAR_VIRT_UID_MAPS, var_virt_uid_maps,
    489 		    DICT_FLAG_LOCK | DICT_FLAG_PARANOID
    490 		    | DICT_FLAG_UTF8_REQUEST);
    491 
    492     virtual_gid_maps =
    493 	maps_create(VAR_VIRT_GID_MAPS, var_virt_gid_maps,
    494 		    DICT_FLAG_LOCK | DICT_FLAG_PARANOID
    495 		    | DICT_FLAG_UTF8_REQUEST);
    496 
    497     virtual_mbox_lock_mask = mbox_lock_mask(var_virt_mailbox_lock);
    498 }
    499 
    500 /* pre_init - pre-jail initialization */
    501 
    502 static void pre_init(char *unused_name, char **unused_argv)
    503 {
    504 
    505     /*
    506      * Reset the file size limit from the message size limit to the mailbox
    507      * size limit.
    508      *
    509      * We can't have mailbox size limit smaller than the message size limit,
    510      * because that prohibits the delivery agent from updating the queue
    511      * file.
    512      */
    513     if (ENFORCING_SIZE_LIMIT(var_virt_mailbox_limit)) {
    514 	if (!ENFORCING_SIZE_LIMIT(var_message_limit))
    515 	    msg_fatal("configuration error: %s is limited but %s is "
    516 		    "unlimited", VAR_VIRT_MAILBOX_LIMIT, VAR_MESSAGE_LIMIT);
    517 	if (var_virt_mailbox_limit < var_message_limit)
    518 	    msg_fatal("configuration error: %s is smaller than %s",
    519 		      VAR_VIRT_MAILBOX_LIMIT, VAR_MESSAGE_LIMIT);
    520 	set_file_limit(var_virt_mailbox_limit);
    521     }
    522 
    523     /*
    524      * flush client.
    525      */
    526     flush_init();
    527 }
    528 
    529 MAIL_VERSION_STAMP_DECLARE;
    530 
    531 /* main - pass control to the single-threaded skeleton */
    532 
    533 int     main(int argc, char **argv)
    534 {
    535     static const CONFIG_INT_TABLE int_table[] = {
    536 	VAR_VIRT_MINUID, DEF_VIRT_MINUID, &var_virt_minimum_uid, 1, 0,
    537 	0,
    538     };
    539     static const CONFIG_LONG_TABLE long_table[] = {
    540 	VAR_VIRT_MAILBOX_LIMIT, DEF_VIRT_MAILBOX_LIMIT, &var_virt_mailbox_limit, 0, 0,
    541 	0,
    542     };
    543     static const CONFIG_STR_TABLE str_table[] = {
    544 	VAR_MAIL_SPOOL_DIR, DEF_MAIL_SPOOL_DIR, &var_mail_spool_dir, 0, 0,
    545 	VAR_VIRT_MAILBOX_MAPS, DEF_VIRT_MAILBOX_MAPS, &var_virt_mailbox_maps, 0, 0,
    546 	VAR_VIRT_UID_MAPS, DEF_VIRT_UID_MAPS, &var_virt_uid_maps, 0, 0,
    547 	VAR_VIRT_GID_MAPS, DEF_VIRT_GID_MAPS, &var_virt_gid_maps, 0, 0,
    548 	VAR_VIRT_MAILBOX_BASE, DEF_VIRT_MAILBOX_BASE, &var_virt_mailbox_base, 1, 0,
    549 	VAR_VIRT_MAILBOX_LOCK, DEF_VIRT_MAILBOX_LOCK, &var_virt_mailbox_lock, 1, 0,
    550 	VAR_VIRT_DSN_FILTER, DEF_VIRT_DSN_FILTER, &var_virt_dsn_filter, 0, 0,
    551 	0,
    552     };
    553     static const CONFIG_BOOL_TABLE bool_table[] = {
    554 	VAR_STRICT_MBOX_OWNER, DEF_STRICT_MBOX_OWNER, &var_strict_mbox_owner,
    555 	0,
    556     };
    557 
    558     /*
    559      * Fingerprint executables and core dumps.
    560      */
    561     MAIL_VERSION_STAMP_ALLOCATE;
    562 
    563     single_server_main(argc, argv, local_service,
    564 		       CA_MAIL_SERVER_INT_TABLE(int_table),
    565 		       CA_MAIL_SERVER_LONG_TABLE(long_table),
    566 		       CA_MAIL_SERVER_STR_TABLE(str_table),
    567 		       CA_MAIL_SERVER_BOOL_TABLE(bool_table),
    568 		       CA_MAIL_SERVER_PRE_INIT(pre_init),
    569 		       CA_MAIL_SERVER_POST_INIT(post_init),
    570 		       CA_MAIL_SERVER_PRE_ACCEPT(pre_accept),
    571 		       CA_MAIL_SERVER_PRIVILEGED,
    572 		       CA_MAIL_SERVER_BOUNCE_INIT(VAR_VIRT_DSN_FILTER,
    573 						  &var_virt_dsn_filter),
    574 		       0);
    575 }
    576