diff --git a/postfix/HISTORY b/postfix/HISTORY index 408490f04..55d2a03e9 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -5752,17 +5752,24 @@ Apologies for any names omitted. Bugfix? Avoid surprises with source routed destinations and OK entries in SMTPD access maps. File: smtpd/smtpd_access.c. - Security: "postfix check" now looks for common stupidity - such as "chown -R postfix /var/spool/postfix" which makes - chrooted Postfix less secure than non-chrooted. These extra - tests are bound to raise a stink with third-party patches - such as TLS that introduce their own files into the jail. + Security: "postfix check" looks for damage by well-intended + but misguided use of "chown -R postfix /var/spool/postfix". + That would make chrooted Postfix less secure than non-chrooted + Postfix. These extra tests may cause complaints with + third-party patches such as TLS that introduce their own + files into the jail. + + Feature: disable the PIX workaround for mail that is queued + for less than $minimal_backoff_time seconds. + + Feature: static map type that always returns the map name + as lookup value, regardless of lookup key value. Contributed + Jeff Miller (jeffm at ghostgun.com) Open problems: - Low: log queue ID when enabling PIX workaround. - - Low: disable PIX workaround for mail < configurable age. + Low: after reorganizing configuration parameters, add flags + to all parameters whose value can be read from file. Low: replace null sender address internal representation by <> so that it can be looked up reliably in maps. Must diff --git a/postfix/VIRTUAL_README b/postfix/VIRTUAL_README index 12005afb0..94ed2f529 100644 --- a/postfix/VIRTUAL_README +++ b/postfix/VIRTUAL_README @@ -1,5 +1,5 @@ This code was created by Andrew McNamara -and adapted to snapshot 20001121 by Xavier Beaudouin. It was merged +and adapted to snapshot 50001121 by Xavier Beaudouin. It was merged with mainstream Postfix for 20010128 by Wietse. Purpose of this software @@ -84,6 +84,12 @@ virtual_uid_maps For security reasons, regexp maps are not allowed here, because their $1 etc. substitutions would open a security hole. + Specify a static map if all mailboxes should be owned by the same + UID. For example, to specify that all mailboxes are owned by the + UID 5000, specify: + + virtual_uid_maps = static:5000 + virtual_gid_maps Recipients are looked up in this map to determine the GID (group @@ -92,6 +98,12 @@ virtual_gid_maps For security reasons, regexp maps are not allowed here, because their $1 etc. substitutions would open a security hole. + Specify a static map if all mailboxes should be owned by the same + GID. For example, to specify that all mailboxes are owned by the + GID 5000, specify: + + virtual_gid_maps = static:5000 + virtual_mailbox_lock This setting is ignored in case of maildir delivery. @@ -174,7 +186,8 @@ Example 2: co-existing with the default local delivery agent In this example, the default Postfix local delivery agent handles the mail for non-virtual recipients; the virtual delivery agent -handles virtual recipients. +handles virtual recipients, and all virtual mailboxes are owned +by user ID 5000, group ID 5000. Instead of "hash" specify "dbm" or "btree", depending on your system type. The command "postconf -m" displays possible lookup table @@ -184,8 +197,8 @@ types. virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_maps = hash:/etc/postfix/vmailbox virtual_minimum_uid = 100 - virtual_uid_maps = hash:/etc/postfix/vuid - virtual_gid_maps = hash:/etc/postfix/vgid + virtual_uid_maps = static:5000 + virtual_gid_maps = static:5000 transport_maps = hash:/etc/postfix/transport # All domains that have final delivery on this machine @@ -216,23 +229,15 @@ types. test1@virtual1.domain test1 test2@virtual2.domain test2/ - /etc/postfix/vuid: - test1@virtual1.domain 5001 - test2@virtual2.domain 5002 - - /etc/postfix/vgid: - test1@virtual1.domain 5001 - test2@virtual2.domain 5002 - Execute something like the following commands for each mailbox recipient: # touch /var/mail/vhosts/test1 - # chown 5001:5001 /var/mail/vhosts/test1 + # chown 5000:5000 /var/mail/vhosts/test1 Execute something like the following commands for each maildir recipient: # mkdir /var/mail/vhosts/test2 - # chown 5002:5002 /var/mail/vhosts/test2 + # chown 5000:5000 /var/mail/vhosts/test2 Remember that each domain is required to have a postmaster contact address. diff --git a/postfix/conf/postfix-script-nosgid b/postfix/conf/postfix-script-nosgid index b13e19608..d7c02ea8e 100755 --- a/postfix/conf/postfix-script-nosgid +++ b/postfix/conf/postfix-script-nosgid @@ -211,10 +211,12 @@ check) ! \( -type p -o -type s \) ! -user $mail_owner \ -exec $WARN not owned by $mail_owner: {} \; - find `ls -d $queue_directory/* | \ - egrep -v '/(incoming|active|defer|deferred|bounce|saved|corrupt|public|private|flush|pid|maildrop)$'` \ - ! -user root \ - -exec $WARN not owned by root: {} \; + for name in `ls -d $queue_directory/* | \ + egrep '/(bin|etc|lib|usr)$'` ; \ + do \ + find $name ! -user root \ + -exec $WARN not owned by root: {} \; ; \ + done for dir in $queue_directory/maildrop do diff --git a/postfix/conf/postfix-script-sgid b/postfix/conf/postfix-script-sgid index f5290626d..f5df28ca1 100644 --- a/postfix/conf/postfix-script-sgid +++ b/postfix/conf/postfix-script-sgid @@ -212,10 +212,12 @@ check) ! \( -type p -o -type s \) ! -user $mail_owner \ -exec $WARN not owned by $mail_owner: {} \; - find `ls -d $queue_directory/* | \ - egrep -v '/(incoming|active|defer|deferred|bounce|saved|corrupt|public|private|flush|pid|maildrop)$'` \ - ! -user root \ - -exec $WARN not owned by root: {} \; + for name in `ls -d $queue_directory/* | \ + egrep '/(bin|etc|lib|usr)$'` ; \ + do \ + find $name ! -user root \ + -exec $WARN not owned by root: {} \; ; \ + done for dir in $queue_directory/maildrop do diff --git a/postfix/conf/sample-pcre.cf b/postfix/conf/sample-pcre-access.cf similarity index 100% rename from postfix/conf/sample-pcre.cf rename to postfix/conf/sample-pcre-access.cf diff --git a/postfix/conf/sample-regexp.cf b/postfix/conf/sample-regexp-access.cf similarity index 100% rename from postfix/conf/sample-regexp.cf rename to postfix/conf/sample-regexp-access.cf diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 7fec94cdf..6db2bf440 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20011208" +#define DEF_MAIL_VERSION "Snapshot-20011209" extern char *var_mail_version; /* LICENSE diff --git a/postfix/src/sendmail/sendmail.c b/postfix/src/sendmail/sendmail.c index bb006a868..8527cce0a 100644 --- a/postfix/src/sendmail/sendmail.c +++ b/postfix/src/sendmail/sendmail.c @@ -397,7 +397,7 @@ static void enqueue(const int flags, const char *sender, const char *full_name, msg_warn("-f option specified malformed sender: %s", sender); } else { if ((sender = username()) == 0) - msg_fatal("unable to find out your login name"); + fatal_error(EX_OSERR, "unable to find out your login name"); saved_sender = mystrdup(sender); } @@ -409,7 +409,8 @@ static void enqueue(const int flags, const char *sender, const char *full_name, * queue file. */ if (stat(MAIL_QUEUE_MAILDROP, &st) < 0) - msg_fatal("No maildrop directory %s: %m", MAIL_QUEUE_MAILDROP); + fatal_error(EX_UNAVAILABLE, "No maildrop directory %s: %m", + MAIL_QUEUE_MAILDROP); if (st.st_mode & S_IWOTH) { handle = mail_stream_file(MAIL_QUEUE_MAILDROP, MAIL_CLASS_PUBLIC, MAIL_SERVICE_PICKUP); @@ -418,8 +419,8 @@ static void enqueue(const int flags, const char *sender, const char *full_name, postdrop_command = concatenate(var_command_dir, "/postdrop", msg_verbose ? " -v" : (char *) 0, (char *) 0); if ((handle = mail_stream_command(postdrop_command)) == 0) - msg_fatal("%s(%ld): unable to execute %s: %m", - saved_sender, (long) uid, postdrop_command); + fatal_error(EX_UNAVAILABLE, "%s(%ld): unable to execute %s: %m", + saved_sender, (long) uid, postdrop_command); myfree(postdrop_command); } dst = handle->stream; @@ -452,8 +453,9 @@ static void enqueue(const int flags, const char *sender, const char *full_name, if (tp->type == TOK822_ADDR) { tok822_internalize(buf, tp->head, TOK822_STR_DEFL); if (REC_PUT_BUF(dst, REC_TYPE_RCPT, buf) < 0) - msg_fatal("%s(%ld): error writing queue file: %m", - saved_sender, (long) uid); + fatal_error(EX_TEMPFAIL, + "%s(%ld): error writing queue file: %m", + saved_sender, (long) uid); } } tok822_free_tree(tree); @@ -494,7 +496,7 @@ static void enqueue(const int flags, const char *sender, const char *full_name, if ((flags & SM_FLAG_AEOF) && VSTRING_LEN(buf) == 1 && *STR(buf) == '.') break; if (REC_PUT_BUF(dst, type, buf) < 0) - fatal_error(EX_CANTCREAT, "%s(%ld): error writing queue file: %m", + fatal_error(EX_TEMPFAIL, "%s(%ld): error writing queue file: %m", saved_sender, (long) uid); } @@ -519,7 +521,9 @@ static void enqueue(const int flags, const char *sender, const char *full_name, fatal_error(EX_DATAERR, "%s(%ld): error reading input: %m", saved_sender, (long) uid); if ((status = mail_stream_finish(handle, (VSTRING *) 0)) != 0) - fatal_error(EX_CANTCREAT, "%s(%ld): %s", saved_sender, + fatal_error((status & CLEANUP_STAT_BAD) ? EX_SOFTWARE : + (status & CLEANUP_STAT_WRITE) ? EX_TEMPFAIL : + EX_UNAVAILABLE, "%s(%ld): %s", saved_sender, (long) uid, cleanup_strerror(status)); if (sendmail_path) { myfree(sendmail_path); diff --git a/postfix/src/smtp/smtp.c b/postfix/src/smtp/smtp.c index b884e7b82..5c4196bc3 100644 --- a/postfix/src/smtp/smtp.c +++ b/postfix/src/smtp/smtp.c @@ -254,6 +254,7 @@ bool var_smtp_sasl_enable; char *var_smtp_bind_addr; bool var_smtp_rand_addr; bool var_smtp_break_lines; +int var_min_backoff_time; /* * Global variables. smtp_errno is set by the address lookup routines and by @@ -416,6 +417,7 @@ int main(int argc, char **argv) VAR_SMTP_DATA1_TMOUT, DEF_SMTP_DATA1_TMOUT, &var_smtp_data1_tmout, 1, 0, VAR_SMTP_DATA2_TMOUT, DEF_SMTP_DATA2_TMOUT, &var_smtp_data2_tmout, 1, 0, VAR_SMTP_QUIT_TMOUT, DEF_SMTP_QUIT_TMOUT, &var_smtp_quit_tmout, 1, 0, + VAR_MIN_BACKOFF_TIME, DEF_MIN_BACKOFF_TIME, &var_min_backoff_time, 1, 0, 0, }; static CONFIG_INT_TABLE int_table[] = { diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 3a8f4d1df..af7cafb23 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -179,11 +179,8 @@ int smtp_helo(SMTP_STATE *state) * does not span a packet boundary. This hurts performance so it is not * on by default. */ - if (resp->str[strspn(resp->str, "20 *\t\n")] == 0) { - msg_info("enabling PIX . workaround for %s", - session->namaddr); + if (resp->str[strspn(resp->str, "20 *\t\n")] == 0) state->features |= SMTP_FEATURE_MAYBEPIX; - } /* * See if we are talking to ourself. This should not be possible with the @@ -661,7 +658,11 @@ int smtp_xfer(SMTP_STATE *state) if (prev_type == REC_TYPE_CONT) /* missing newline at end */ smtp_fputs("", 0, session->stream); - if ((state->features & SMTP_FEATURE_MAYBEPIX) != 0) { + if ((state->features & SMTP_FEATURE_MAYBEPIX) != 0 + && request->arrival_time < vstream_ftime(session->stream) + - var_min_backoff_time) { + msg_info("%s: enabling PIX . workaround for %s", + request->queue_id, session->namaddr); vstream_fflush(session->stream);/* hurts performance */ sleep(10); /* not to mention this */ } diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 7eb4ee56d..0d2bc320a 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1713,7 +1713,11 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, msg_warn("%s: no @domain in address: %s", myname, CONST_STR(reply->recipient)); return (0); } - if (var_allow_untrust_route == 0 && (reply->flags & RESOLVE_FLAG_ROUTED)) + + /* + * Avoid surprise matches with source-routed, non-local addresses. + */ + if (!resolve_local(ratsign + 1) && (reply->flags & RESOLVE_FLAG_ROUTED)) return (SMTPD_CHECK_DUNNO); /* diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index e2e2af311..74b10ed0e 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -1,73 +1,77 @@ SHELL = /bin/sh -SRCS = argv.c argv_split.c basename.c binhash.c chroot_uid.c \ - close_on_exec.c concatenate.c dict.c dict_db.c dict_dbm.c \ - dict_env.c dict_ht.c dict_ldap.c dict_mysql.c dict_ni.c dict_nis.c \ - dict_nisplus.c dict_open.c dir_forest.c doze.c environ.c \ - events.c exec_command.c fifo_listen.c fifo_trigger.c file_limit.c \ - find_inet.c fsspace.c fullname.c get_domainname.c get_hostname.c \ - htable.c inet_addr_host.c inet_addr_list.c inet_addr_local.c \ - inet_connect.c inet_listen.c inet_trigger.c inet_util.c \ - line_wrap.c lowercase.c lstat_as.c mac_parse.c make_dirs.c \ - match_list.c match_ops.c msg.c msg_output.c msg_syslog.c \ - msg_vstream.c mvect.c myflock.c mymalloc.c mystrtok.c name_mask.c \ - non_blocking.c open_as.c open_limit.c open_lock.c peekfd.c \ - percentm.c posix_signals.c printable.c read_wait.c readable.c \ - readlline.c ring.c safe_getenv.c safe_open.c sane_accept.c \ - scan_dir.c set_eugid.c set_ugid.c sigdelay.c skipblanks.c \ - split_at.c stat_as.c sys_compat.c timed_connect.c timed_wait.c \ - translit.c trimblanks.c unix_connect.c unix_listen.c unix_trigger.c \ - unsafe.c username.c valid_hostname.c vbuf.c vbuf_print.c \ - vstream.c vstream_popen.c vstring.c vstring_vstream.c writable.c \ - write_buf.c write_wait.c dict_unix.c dict_pcre.c stream_listen.c \ - stream_connect.c stream_trigger.c dict_regexp.c mac_expand.c \ - clean_env.c watchdog.c spawn_command.c duplex_pipe.c sane_rename.c \ - sane_link.c unescape.c timed_read.c timed_write.c dict_tcp.c \ - hex_quote.c dict_alloc.c rand_sleep.c sane_time.c dict_debug.c \ - sane_socketpair.c myrand.c netstring.c ctable.c attr_print64.c intv.c \ - attr_scan64.c base64_code.c sock_empty_wait.c attr_print0.c attr_scan0.c -OBJS = argv.o argv_split.o basename.o binhash.o chroot_uid.o \ - close_on_exec.o concatenate.o dict.o dict_db.o dict_dbm.o \ - dict_env.o dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \ - dict_nisplus.o dict_open.o dir_forest.o doze.o environ.o \ - events.o exec_command.o fifo_listen.o fifo_trigger.o file_limit.o \ - find_inet.o fsspace.o fullname.o get_domainname.o get_hostname.o \ - htable.o inet_addr_host.o inet_addr_list.o inet_addr_local.o \ - inet_connect.o inet_listen.o inet_trigger.o inet_util.o \ - line_wrap.o lowercase.o lstat_as.o mac_parse.o make_dirs.o \ - match_list.o match_ops.o msg.o msg_output.o msg_syslog.o \ - msg_vstream.o mvect.o myflock.o mymalloc.o mystrtok.o name_mask.o \ - non_blocking.o open_as.o open_limit.o open_lock.o peekfd.o \ - percentm.o posix_signals.o printable.o read_wait.o readable.o \ - readlline.o ring.o safe_getenv.o safe_open.o sane_accept.o \ - scan_dir.o set_eugid.o set_ugid.o sigdelay.o skipblanks.o \ - split_at.o stat_as.o sys_compat.o timed_connect.o timed_wait.o \ - translit.o trimblanks.o unix_connect.o unix_listen.o unix_trigger.o \ - unsafe.o username.o valid_hostname.o vbuf.o vbuf_print.o \ - vstream.o vstream_popen.o vstring.o vstring_vstream.o writable.o \ - write_buf.o write_wait.o dict_unix.o dict_pcre.o stream_listen.o \ - stream_connect.o stream_trigger.o dict_regexp.o mac_expand.o \ - clean_env.o watchdog.o spawn_command.o duplex_pipe.o sane_rename.o \ - sane_link.o unescape.o timed_read.o timed_write.o dict_tcp.o \ - hex_quote.o dict_alloc.o rand_sleep.o sane_time.o dict_debug.o \ - sane_socketpair.o myrand.o netstring.o ctable.o attr_print64.o intv.o \ - attr_scan64.o base64_code.o sock_empty_wait.o attr_print0.o attr_scan0.o -HDRS = argv.h attr.h binhash.h chroot_uid.h connect.h dict.h dict_db.h \ - dict_dbm.h dict_env.h dict_ht.h dict_ldap.h dict_mysql.h \ - dict_ni.h dict_nis.h dict_nisplus.h dir_forest.h events.h \ - exec_command.h find_inet.h fsspace.h fullname.h get_domainname.h \ - get_hostname.h htable.h inet_addr_host.h inet_addr_list.h \ - inet_addr_local.h inet_util.h iostuff.h line_wrap.h listen.h lstat_as.h \ - mac_parse.h make_dirs.h match_list.h match_ops.h msg.h msg_output.h \ - msg_syslog.h msg_vstream.h mvect.h myflock.h mymalloc.h name_mask.h \ - open_as.h open_lock.h percentm.h posix_signals.h readlline.h ring.h \ - safe.h safe_open.h sane_accept.h scan_dir.h set_eugid.h set_ugid.h \ - sigdelay.h split_at.h stat_as.h stringops.h sys_defs.h \ - timed_connect.h timed_wait.h trigger.h username.h valid_hostname.h \ - vbuf.h vbuf_print.h vstream.h vstring.h vstring_vstream.h \ - dict_unix.h dict_pcre.h dict_regexp.h mac_expand.h clean_env.h \ - watchdog.h spawn_command.h sane_fsops.h dict_tcp.h hex_quote.h \ - sane_time.h sane_socketpair.h myrand.h netstring.h ctable.h \ - intv.h base64_code.h +SRCS = argv.c argv_split.c attr_print0.c attr_print64.c attr_scan0.c \ + attr_scan64.c base64_code.c basename.c binhash.c chroot_uid.c \ + clean_env.c close_on_exec.c concatenate.c ctable.c dict.c \ + dict_alloc.c dict_db.c dict_dbm.c dict_debug.c dict_env.c \ + dict_ht.c dict_ldap.c dict_mysql.c dict_ni.c dict_nis.c \ + dict_nisplus.c dict_open.c dict_pcre.c dict_regexp.c dict_static.c \ + dict_tcp.c dict_unix.c dir_forest.c doze.c duplex_pipe.c \ + environ.c events.c exec_command.c fifo_listen.c fifo_trigger.c \ + file_limit.c find_inet.c fsspace.c fullname.c get_domainname.c \ + get_hostname.c hex_quote.c htable.c inet_addr_host.c \ + inet_addr_list.c inet_addr_local.c inet_connect.c inet_listen.c \ + inet_trigger.c inet_util.c intv.c line_wrap.c lowercase.c \ + lstat_as.c mac_expand.c mac_parse.c make_dirs.c match_list.c \ + match_ops.c msg.c msg_output.c msg_syslog.c msg_vstream.c \ + mvect.c myflock.c mymalloc.c myrand.c mystrtok.c name_mask.c \ + netstring.c non_blocking.c open_as.c open_limit.c open_lock.c \ + peekfd.c percentm.c posix_signals.c printable.c rand_sleep.c \ + read_wait.c readable.c readlline.c ring.c safe_getenv.c \ + safe_open.c sane_accept.c sane_link.c sane_rename.c \ + sane_socketpair.c sane_time.c scan_dir.c set_eugid.c set_ugid.c \ + sigdelay.c skipblanks.c sock_empty_wait.c spawn_command.c \ + split_at.c stat_as.c stream_connect.c stream_listen.c \ + stream_trigger.c sys_compat.c timed_connect.c timed_read.c \ + timed_wait.c timed_write.c translit.c trimblanks.c unescape.c \ + unix_connect.c unix_listen.c unix_trigger.c unsafe.c username.c \ + valid_hostname.c vbuf.c vbuf_print.c vstream.c vstream_popen.c \ + vstring.c vstring_vstream.c watchdog.c writable.c write_buf.c \ + write_wait.c +OBJS = argv.o argv_split.o attr_print0.o attr_print64.o attr_scan0.o \ + attr_scan64.o base64_code.o basename.o binhash.o chroot_uid.o \ + clean_env.o close_on_exec.o concatenate.o ctable.o dict.o \ + dict_alloc.o dict_db.o dict_dbm.o dict_debug.o dict_env.o \ + dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \ + dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_static.o \ + dict_tcp.o dict_unix.o dir_forest.o doze.o duplex_pipe.o \ + environ.o events.o exec_command.o fifo_listen.o fifo_trigger.o \ + file_limit.o find_inet.o fsspace.o fullname.o get_domainname.o \ + get_hostname.o hex_quote.o htable.o inet_addr_host.o \ + inet_addr_list.o inet_addr_local.o inet_connect.o inet_listen.o \ + inet_trigger.o inet_util.o intv.o line_wrap.o lowercase.o \ + lstat_as.o mac_expand.o mac_parse.o make_dirs.o match_list.o \ + match_ops.o msg.o msg_output.o msg_syslog.o msg_vstream.o \ + mvect.o myflock.o mymalloc.o myrand.o mystrtok.o name_mask.o \ + netstring.o non_blocking.o open_as.o open_limit.o open_lock.o \ + peekfd.o percentm.o posix_signals.o printable.o rand_sleep.o \ + read_wait.o readable.o readlline.o ring.o safe_getenv.o \ + safe_open.o sane_accept.o sane_link.o sane_rename.o \ + sane_socketpair.o sane_time.o scan_dir.o set_eugid.o set_ugid.o \ + sigdelay.o skipblanks.o sock_empty_wait.o spawn_command.o \ + split_at.o stat_as.o stream_connect.o stream_listen.o \ + stream_trigger.o sys_compat.o timed_connect.o timed_read.o \ + timed_wait.o timed_write.o translit.o trimblanks.o unescape.o \ + unix_connect.o unix_listen.o unix_trigger.o unsafe.o username.o \ + valid_hostname.o vbuf.o vbuf_print.o vstream.o vstream_popen.o \ + vstring.o vstring_vstream.o watchdog.o writable.o write_buf.o \ + write_wait.o +HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \ + connect.h ctable.h dict.h dict_db.h dict_dbm.h dict_env.h \ + dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \ + dict_nisplus.h dict_pcre.h dict_regexp.h dict_static.h dict_tcp.h \ + dict_unix.h dir_forest.h events.h exec_command.h find_inet.h \ + fsspace.h fullname.h get_domainname.h get_hostname.h hex_quote.h \ + htable.h inet_addr_host.h inet_addr_list.h inet_addr_local.h \ + inet_util.h intv.h iostuff.h line_wrap.h listen.h lstat_as.h \ + mac_expand.h mac_parse.h make_dirs.h match_list.h match_ops.h \ + msg.h msg_output.h msg_syslog.h msg_vstream.h mvect.h myflock.h \ + mymalloc.h myrand.h name_mask.h netstring.h open_as.h open_lock.h \ + percentm.h posix_signals.h readlline.h ring.h safe.h safe_open.h \ + sane_accept.h sane_fsops.h sane_socketpair.h sane_time.h \ + scan_dir.h set_eugid.h set_ugid.h sigdelay.h spawn_command.h \ + split_at.h stat_as.h stringops.h sys_defs.h timed_connect.h \ + timed_wait.h trigger.h username.h valid_hostname.h vbuf.h \ + vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \ stream_test.c dup2_pass_on_exec.c WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \ @@ -588,6 +592,7 @@ dict_open.o: dict_ldap.h dict_open.o: dict_mysql.h dict_open.o: dict_pcre.h dict_open.o: dict_regexp.h +dict_open.o: dict_static.h dict_open.o: stringops.h dict_open.o: vstring.h dict_open.o: split_at.h @@ -608,6 +613,15 @@ dict_regexp.o: dict.h dict_regexp.o: argv.h dict_regexp.o: dict_regexp.h dict_regexp.o: mac_parse.h +dict_static.o: dict_static.c +dict_static.o: sys_defs.h +dict_static.o: mymalloc.h +dict_static.o: msg.h +dict_static.o: dict.h +dict_static.o: vstream.h +dict_static.o: vbuf.h +dict_static.o: argv.h +dict_static.o: dict_static.h dict_tcp.o: dict_tcp.c dict_tcp.o: sys_defs.h dict_tcp.o: msg.h diff --git a/postfix/src/util/dict_open.c b/postfix/src/util/dict_open.c index a13806f7f..3d24f5ff4 100644 --- a/postfix/src/util/dict_open.c +++ b/postfix/src/util/dict_open.c @@ -168,6 +168,7 @@ #include #include #include +#include #include #include #include @@ -214,6 +215,7 @@ static DICT_OPEN_INFO dict_open_info[] = { #ifdef HAS_POSIX_REGEXP DICT_TYPE_REGEXP, dict_regexp_open, #endif + DICT_TYPE_STATIC, dict_static_open, 0, }; diff --git a/postfix/src/util/dict_static.c b/postfix/src/util/dict_static.c new file mode 100644 index 000000000..1b06a89ab --- /dev/null +++ b/postfix/src/util/dict_static.c @@ -0,0 +1,72 @@ +/*++ +/* NAME +/* dict_static 3 +/* SUMMARY +/* dictionary manager interface to static variables +/* SYNOPSIS +/* #include +/* +/* DICT *dict_static_open(name, dummy, dict_flags) +/* const char *name; +/* int dummy; +/* int dict_flags; +/* DESCRIPTION +/* dict_static_open() implements a dummy dictionary that returns +/* as lookup result the dictionary name, regardless of the lookup +/* key value. +/* +/* The \fIdummy\fR argument is ignored. +/* SEE ALSO +/* dict(3) generic dictionary manager +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* jeffm +/* ghostgun.com +/*--*/ + +/* System library. */ + +#include "sys_defs.h" +#include /* sprintf() prototype */ +#include +#include +#include + +/* Utility library. */ + +#include "mymalloc.h" +#include "msg.h" +#include "dict.h" +#include "dict_static.h" + +/* dict_static_lookup - access static value*/ + +static const char *dict_static_lookup(DICT *dict, const char *name) +{ + dict_errno = 0; + + return (dict->name); +} + +/* dict_static_close - close static dictionary */ + +static void dict_static_close(DICT *dict) +{ + dict_free(dict); +} + +/* dict_static_open - make association with static variable */ + +DICT *dict_static_open(const char *name, int unused_flags, int dict_flags) +{ + DICT *dict; + + dict = dict_alloc(DICT_TYPE_STATIC, name, sizeof(*dict)); + dict->lookup = dict_static_lookup; + dict->close = dict_static_close; + dict->flags = dict_flags | DICT_FLAG_FIXED; + return (DICT_DEBUG (dict)); +} diff --git a/postfix/src/util/dict_static.h b/postfix/src/util/dict_static.h new file mode 100644 index 000000000..d4ad1cc11 --- /dev/null +++ b/postfix/src/util/dict_static.h @@ -0,0 +1,35 @@ +#ifndef _DICT_STATIC_H_INCLUDED_ +#define _DICT_STATIC_H_INCLUDED_ + +/*++ +/* NAME +/* dict_static 3h +/* SUMMARY +/* dictionary manager interface to static settings +/* SYNOPSIS +/* #include +/* DESCRIPTION +/* .nf + + /* + * Utility library. + */ +#include + + /* + * External interface. + */ +#define DICT_TYPE_STATIC "static" + +extern DICT *dict_static_open(const char *, int, int); + +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* jeffm +/* ghostgun.com +/*--*/ + +#endif diff --git a/postfix/src/util/sys_defs.h b/postfix/src/util/sys_defs.h index 0dae853af..e49013be9 100644 --- a/postfix/src/util/sys_defs.h +++ b/postfix/src/util/sys_defs.h @@ -909,7 +909,11 @@ typedef int pid_t; * doubles. */ #ifndef ALIGN_TYPE -#define ALIGN_TYPE double +# ifdef __ia64__ +# define ALIGN_TYPE long double +# else +# define ALIGN_TYPE double +# endif #endif /*