]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-19990904
authorWietse Venema <wietse@porcupine.org>
Sat, 4 Sep 1999 05:00:00 +0000 (00:00 -0500)
committerWietse Venema <wietse@porcupine.org>
Thu, 17 Jan 2013 23:09:43 +0000 (18:09 -0500)
99 files changed:
postfix/HISTORY
postfix/INSTALL
postfix/Makefile.in
postfix/conf/aliases
postfix/conf/main.cf
postfix/conf/sample-smtpd.cf
postfix/global/mail_params.h
postfix/global/mail_version.h
postfix/html/faq.html
postfix/html/uce.html
postfix/include/argv.h [new file with mode: 0644]
postfix/include/attr.h [new file with mode: 0644]
postfix/include/binhash.h [new file with mode: 0644]
postfix/include/chroot_uid.h [new file with mode: 0644]
postfix/include/connect.h [new file with mode: 0644]
postfix/include/dict.h [new file with mode: 0644]
postfix/include/dict_db.h [new file with mode: 0644]
postfix/include/dict_dbm.h [new file with mode: 0644]
postfix/include/dict_env.h [new file with mode: 0644]
postfix/include/dict_ht.h [new file with mode: 0644]
postfix/include/dict_ldap.h [new file with mode: 0644]
postfix/include/dict_mysql.h [new file with mode: 0644]
postfix/include/dict_ni.h [new file with mode: 0644]
postfix/include/dict_nis.h [new file with mode: 0644]
postfix/include/dict_nisplus.h [new file with mode: 0644]
postfix/include/dir_forest.h [new file with mode: 0644]
postfix/include/events.h [new file with mode: 0644]
postfix/include/exec_command.h [new file with mode: 0644]
postfix/include/find_inet.h [new file with mode: 0644]
postfix/include/fsspace.h [new file with mode: 0644]
postfix/include/fullname.h [new file with mode: 0644]
postfix/include/get_domainname.h [new file with mode: 0644]
postfix/include/get_hostname.h [new file with mode: 0644]
postfix/include/htable.h [new file with mode: 0644]
postfix/include/inet_addr_host.h [new file with mode: 0644]
postfix/include/inet_addr_list.h [new file with mode: 0644]
postfix/include/inet_addr_local.h [new file with mode: 0644]
postfix/include/inet_util.h [new file with mode: 0644]
postfix/include/iostuff.h [new file with mode: 0644]
postfix/include/line_wrap.h [new file with mode: 0644]
postfix/include/listen.h [new file with mode: 0644]
postfix/include/lstat_as.h [new file with mode: 0644]
postfix/include/mac_parse.h [new file with mode: 0644]
postfix/include/make_dirs.h [new file with mode: 0644]
postfix/include/match_list.h [new file with mode: 0644]
postfix/include/match_ops.h [new file with mode: 0644]
postfix/include/msg.h [new file with mode: 0644]
postfix/include/msg_output.h [new file with mode: 0644]
postfix/include/msg_syslog.h [new file with mode: 0644]
postfix/include/msg_vstream.h [new file with mode: 0644]
postfix/include/mvect.h [new file with mode: 0644]
postfix/include/myflock.h [new file with mode: 0644]
postfix/include/mymalloc.h [new file with mode: 0644]
postfix/include/name_mask.h [new file with mode: 0644]
postfix/include/open_as.h [new file with mode: 0644]
postfix/include/open_lock.h [new file with mode: 0644]
postfix/include/percentm.h [new file with mode: 0644]
postfix/include/posix_signals.h [new file with mode: 0644]
postfix/include/readlline.h [new file with mode: 0644]
postfix/include/ring.h [new file with mode: 0644]
postfix/include/safe.h [new file with mode: 0644]
postfix/include/safe_open.h [new file with mode: 0644]
postfix/include/sane_accept.h [new file with mode: 0644]
postfix/include/scan_dir.h [new file with mode: 0644]
postfix/include/set_eugid.h [new file with mode: 0644]
postfix/include/set_ugid.h [new file with mode: 0644]
postfix/include/sigdelay.h [new file with mode: 0644]
postfix/include/split_at.h [new file with mode: 0644]
postfix/include/stat_as.h [new file with mode: 0644]
postfix/include/stringops.h [new file with mode: 0644]
postfix/include/sys_defs.h [new file with mode: 0644]
postfix/include/timed_connect.h [new file with mode: 0644]
postfix/include/timed_wait.h [new file with mode: 0644]
postfix/include/trigger.h [new file with mode: 0644]
postfix/include/username.h [new file with mode: 0644]
postfix/include/valid_hostname.h [new file with mode: 0644]
postfix/include/vbuf.h [new file with mode: 0644]
postfix/include/vbuf_print.h [new file with mode: 0644]
postfix/include/vstream.h [new file with mode: 0644]
postfix/include/vstring.h [new file with mode: 0644]
postfix/include/vstring_vstream.h [new file with mode: 0644]
postfix/lib/.pure [new file with mode: 0644]
postfix/local/feature.c [new file with mode: 0644]
postfix/local/local.c
postfix/pickup/pickup.c
postfix/postalias/postalias.c
postfix/postconf/extract.sh [new file with mode: 0644]
postfix/postconf/postconf.c
postfix/postlock/postlock.c
postfix/postmap/postmap.c
postfix/qmgr/qmgr_active.c
postfix/qmgr/qmgr_message.c
postfix/sendmail/sendmail.c
postfix/smtp/smtp.c
postfix/smtp/smtp_addr.c
postfix/smtpd/smtpd_check.c
postfix/util/compat.c [new file with mode: 0644]
postfix/util/dict_dbm.c
postfix/util/sys_defs.h

index ef70ad097819b440f193180350286824d021d7e3..e248fed1af4ec79919109a78512553dcbd900ed7 100644 (file)
@@ -2993,5 +2993,18 @@ Apologies for any names omitted.
        that rejects destinations not in $relay_domains.  By Lamont
        Jones of Hewlett-Packard.  File: smtpd/smtpd_check.c.
 
-       Robustness: postconf now validates the syntax of all main.cf
-       parameters.
+       Security: do not allow weird characters in the expansion
+       of $names that appear in $forward_path. Just like with
+       shell commands, replace bad characters in expansions by
+       underscores.  Configuration parameter:  forward_expansion_filter.
+
+19990902
+
+       Documentation: added a sample postfix alias to the examples
+       in the INSTALL document and in the conf/aliases file.
+       Reminded by Simon J.  Mudd @ alltrading.com.
+
+19990903
+
+       Bugfix: in case of some error conditions the pickup daemon
+       could leak small amounts of memory.
index 9eabab10e026ef25f89352e8636a0e4540417f3f..f69202c9cb59cf9c8c3bca20d10d6e3a4925ff56 100644 (file)
@@ -389,6 +389,10 @@ like this:
 
     postfix:*:12345:12345:postfix:/no/where:/no/shell
 
+And there is a corresponding alias in /etc/aliases:
+
+    postfix: root
+
 Secondly, you must specify what domain will be appended to a
 local address. The "myorigin" parameter defaults to the local
 hostname, but that is probably OK only for very small sites.
index 008a183c27d9b91addd9219d596f0f300a48249b..af3c9ba81a9a5e9d368a075afd7ef892887d6f97 100644 (file)
@@ -20,6 +20,8 @@ update printfck:
         (set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@) || exit 1; \
        done
 
+printfck: update
+
 depend clean:
        set -e; for i in $(DIRS); do \
         (set -e; echo "[$$i]"; cd $$i; $(MAKE) $@) || exit 1; \
index a372b16550eb82f2e8cbf3162a698bcfbfa92a2a..9e2edc344943aa63377ede3eb4284419ce1a16eb 100644 (file)
@@ -16,6 +16,7 @@ nobody:               root
 uucp:          root
 www:           root
 ftp-bugs:      root
+postfix:       root
 
 # Put your local aliases here.
 
index 9c0e5ddcc74a5913bdcef75fd2a4146e16676da6..b686c373ac9a27f4a65542104c65d7beb16bd7fa 100644 (file)
@@ -290,7 +290,7 @@ program_directory = /some/where/postfix/bin
 # is built-in. Specify "/^header-name: stuff you do not want/ REJECT"
 # in the pattern file. Patterns are case-insensitive by default. Note:
 # specify only patterns ending in REJECT. Patterns ending in OK are
-# a waste of cycles.
+# mostly a waste of cycles.
 #
 #header_checks = regexp:/etc/postfix/filename
 #header_checks = pcre:/etc/postfix/filename
index 4381939fb2e2b72f442312bdda6959dddd843e22..99323fe9dd96e319dbfe8c12f14e224122e5f088 100644 (file)
@@ -169,8 +169,8 @@ smtpd_helo_restrictions =
 # Specify a list of restrictions, separated by commas and/or whitespace.
 # Continue long lines by starting the next line with whitespace.
 #
-# smtpd_sender_restrictions = reject_unknown_address
-# smtpd_sender_restrictions = reject_unknown_address, hash:/etc/postfix/access
+# smtpd_sender_restrictions = reject_unknown_sender_domain
+# smtpd_sender_restrictions = reject_unknown_sender_domain, hash:/etc/postfix/access
 smtpd_sender_restrictions = 
 
 # The smtpd_recipient_restrictions parameter specifies restrictions on
@@ -289,7 +289,8 @@ reject_code = 550
 relay_domains_reject_code = 550
 
 # The unknown_address_reject_code parameter specifies the SMTP server
-# response when a client violates the reject_unknown_address restriction.
+# response when a client violates the reject_unknown_sender_domain
+# or reject_unknown_recipient_domain restrictions.
 #
 # Do not change this unless you have a complete understanding of RFC 822.
 #
index cec982f929b3b262deedb2920cf88275a365dc9c..876f82e32fcfa801c615139da8fe637cf9d6dedd 100644 (file)
@@ -343,7 +343,7 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 extern char *var_cmd_exp_filter;
 
 #define VAR_FWD_EXP_FILTER     "forward_expansion_filter"
-#define DEF_FWD_EXP_FILTER     "1234567890!@%-_=+:,.\
+#define DEF_FWD_EXP_FILTER     "1234567890!@%-_=+:,./\
 abcdefghijklmnopqrstuvwxyz\
 ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 extern char *var_fwd_exp_filter;
index f2d3dfc06420d5cae5910d8144e44a4e7e86d8fc..0af7f54fc95eea9fe057ec77af38d563cd96e899 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-19990831"
+#define DEF_MAIL_VERSION       "Snapshot-19990904"
 extern char *var_mail_version;
 
 /* LICENSE
index cd2f6d58d5e90e309d4745828bf3cd3136eb89d9..634c5607903fe1dfef3868db0c81c4606359ef13 100644 (file)
@@ -327,8 +327,8 @@ that are disconnected most of the time)
 
 <i> When you disable DNS lookups, you must specify the</i>
 <b>relayhost</b> <i> as either a numeric IP address, or as a hostname
-that resolves to one or more IP addresses (Postfix does no</i>
-<b>MX</b> lookup).
+that resolves to one or more IP addresses (with DNS lookup disabled,
+Postfix does no</i> <b>MX</b> lookup).
 
 <p>
 
index 42a5ddbb147fe5808cc7b3e1bb4b898c81d8c174..a35d91f3b320ea88e8112299bf7172deb9854cbe 100644 (file)
@@ -103,9 +103,14 @@ is allowed in message headers.
 
 <dt>Syntax:
 
-<dd>Specify a list of zero or more lookup tables. Whenever a
-header matches a table, a REJECT result means reject the
-message; an OK result means pass.
+<dd>Specify a list of zero or more lookup tables. Whenever a header
+matches a table, a REJECT result means reject the message. 
+
+<p>
+
+<i>A rule ending in OK affects only the header being matched. The
+next header may still result in a REJECT match, causing the mail
+still to be rejected.</i>
 
 </dl>
 
@@ -797,7 +802,7 @@ subdomain under any of the domains listed in <b>$maps_rbl_domains.</b>
 <dt> <b>relay_domains</b>
 
 <dd> This parameter controls the behavior of the <a
-href="#check_relay_domains"> check_relay_domains</a> and a
+href="#check_relay_domains"> check_relay_domains</a> and <a
 href="#reject_unauth_destination"> reject_unauth_destination</a>
 restrictions that can appear as part of a recipient address
 restriction list.
diff --git a/postfix/include/argv.h b/postfix/include/argv.h
new file mode 100644 (file)
index 0000000..0d55623
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef _ARGV_H_INCLUDED_
+#define _ARGV_H_INCLUDED_
+
+/*++
+/* NAME
+/*     argv 3h
+/* SUMMARY
+/*     string array utilities
+/* SYNOPSIS
+/*     #include "argv.h"
+ DESCRIPTION
+ .nf
+
+ /*
+  * External interface.
+  */
+typedef struct ARGV {
+    int     len;                       /* number of array elements */
+    int     argc;                      /* array elements in use */
+    char  **argv;                      /* string array */
+} ARGV;
+
+extern ARGV *argv_alloc(int);
+extern void argv_add(ARGV *,...);
+extern void argv_terminate(ARGV *);
+extern ARGV *argv_free(ARGV *);
+
+extern ARGV *argv_split(const char *, const char *);
+extern ARGV *argv_split_append(ARGV *, const char *, const char *);
+
+#define ARGV_END       ((char *) 0)
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/attr.h b/postfix/include/attr.h
new file mode 100644 (file)
index 0000000..e81381e
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _ATTR_H_INCLUDED_
+#define _ATTR_H_INCLUDED_
+
+/*++
+/* NAME
+/*     attr 3h
+/* SUMMARY
+/*     attribute list manager
+/* SYNOPSIS
+/*     #include <attr.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern void attr_enter(HTABLE *, const char *, const char *);
+extern void attr_free(HTABLE *);
+
+#define attr_find(table, name) htable_find((table), (name))
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/binhash.h b/postfix/include/binhash.h
new file mode 100644 (file)
index 0000000..f94e35b
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef _BINHASH_H_INCLUDED_
+#define _BINHASH_H_INCLUDED_
+
+/*++
+/* NAME
+/*     binhash 3h
+/* SUMMARY
+/*     hash table manager
+/* SYNOPSIS
+/*     #include <binhash.h>
+/* DESCRIPTION
+/* .nf
+
+ /* Structure of one hash table entry. */
+
+typedef struct BINHASH_INFO {
+    char   *key;                       /* lookup key */
+    int     key_len;                   /* key length */
+    char   *value;                     /* associated value */
+    struct BINHASH_INFO *next;         /* colliding entry */
+    struct BINHASH_INFO *prev;         /* colliding entry */
+} BINHASH_INFO;
+
+ /* Structure of one hash table. */
+
+typedef struct BINHASH {
+    int     size;                      /* length of entries array */
+    int     used;                      /* number of entries in table */
+    BINHASH_INFO **data;               /* entries array, auto-resized */
+} BINHASH;
+
+extern BINHASH *binhash_create(int);
+extern BINHASH_INFO *binhash_enter(BINHASH *, const char *, int, char *);
+extern BINHASH_INFO *binhash_locate(BINHASH *, const char *, int);
+extern char *binhash_find(BINHASH *, const char *, int);
+extern void binhash_delete(BINHASH *, const char *, int, void (*) (char *));
+extern void binhash_free(BINHASH *, void (*) (char *));
+extern void binhash_walk(BINHASH *, void (*) (BINHASH_INFO *, char *), char *);
+extern BINHASH_INFO **binhash_list(BINHASH *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/* CREATION DATE
+/*     Thu Feb 20 16:54:29 EST 1997
+/* LAST MODIFICATION
+/*     %E% %U%
+/* VERSION/RELEASE
+/*     %I%
+/*--*/
+
+#endif
diff --git a/postfix/include/chroot_uid.h b/postfix/include/chroot_uid.h
new file mode 100644 (file)
index 0000000..f2a8399
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _CHROOT_UID_H_INCLUDED_
+#define _CHROOT_UID_H_INCLUDED_
+
+/*++
+/* NAME
+/*     chroot_uid 3h
+/* SUMMARY
+/*     limit possible damage a process can do
+/* SYNOPSIS
+/*     #include <chroot_uid.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern void chroot_uid(const char *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/connect.h b/postfix/include/connect.h
new file mode 100644 (file)
index 0000000..080b99c
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _CONNECT_H_INCLUDED_
+#define _CONNECT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     connect 3h
+/* SUMMARY
+/*     client interface file
+/* SYNOPSIS
+/*     #include <connect.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <iostuff.h>
+
+ /*
+  * Client external interface.
+  */
+extern int unix_connect(const char *, int, int);
+extern int inet_connect(const char *, int, int);
+extern int stream_connect(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict.h b/postfix/include/dict.h
new file mode 100644 (file)
index 0000000..3ec4e93
--- /dev/null
@@ -0,0 +1,100 @@
+#ifndef _DICT_H_INCLUDED_
+#define _DICT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict 3h
+/* SUMMARY
+/*     dictionary manager
+/* SYNOPSIS
+/*     #include <dict.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <fcntl.h>
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+
+ /*
+  * Generic dictionary interface - in reality, a dictionary extends this
+  * structure with private members to maintain internal state.
+  */
+typedef struct DICT {
+    int     flags;                     /* see below */
+    const char *(*lookup) (struct DICT *, const char *);
+    void    (*update) (struct DICT *, const char *, const char *);
+    int     (*delete) (struct DICT *, const char *);
+    int     (*sequence) (struct DICT *, int, const char **, const char **);
+    void    (*close) (struct DICT *);
+    int     fd;                                /* for dict_update() lock */
+    time_t  mtime;                     /* mod time at open */
+} DICT;
+
+#define DICT_FLAG_DUP_WARN     (1<<0)  /* if file, warn about dups */
+#define DICT_FLAG_DUP_IGNORE   (1<<1)  /* if file, ignore dups */
+#define DICT_FLAG_TRY0NULL     (1<<2)  /* do not append 0 to key/value */
+#define DICT_FLAG_TRY1NULL     (1<<3)  /* append 0 to key/value */
+#define DICT_FLAG_FIXED                (1<<4)  /* fixed key map */
+#define DICT_FLAG_PATTERN      (1<<5)  /* keys are patterns */
+#define DICT_FLAG_LOCK         (1<<6)  /* lock before access */
+#define DICT_FLAG_DUP_REPLACE  (1<<7)  /* if file, replace dups */
+
+extern int dict_unknown_allowed;
+extern int dict_errno;
+
+#define DICT_ERR_RETRY 1               /* soft error */
+
+ /*
+  * Sequence function types.
+  */
+#define DICT_SEQ_FUN_FIRST     0       /* set cursor to first record */
+#define DICT_SEQ_FUN_NEXT      1       /* set cursor to next record */
+
+ /*
+  * High-level interface, with logical dictionary names.
+  */
+extern void dict_register(const char *, DICT *);
+extern DICT *dict_handle(const char *);
+extern void dict_unregister(const char *);
+extern void dict_update(const char *, const char *, const char *);
+extern const char *dict_lookup(const char *, const char *);
+extern int dict_delete(const char *, const char *);
+extern int dict_sequence(const char *, const int, const char **, const char **);
+extern void dict_load_file(const char *, const char *);
+extern void dict_load_fp(const char *, VSTREAM *);
+extern const char *dict_eval(const char *, const char *, int);
+
+ /*
+  * Low-level interface, with physical dictionary handles.
+  */
+extern DICT *dict_open(const char *, int, int);
+extern DICT *dict_open3(const char *, const char *, int, int);
+extern void dict_open_register(const char *, DICT *(*) (const char *, int, int));
+
+#define dict_get(dp, key)      (dp)->lookup((dp), (key))
+#define dict_put(dp, key, val) (dp)->update((dp), (key), (val))
+#define dict_del(dp, key)      (dp)->delete((dp), (key))
+#define dict_seq(dp, f, key, val) (dp)->sequence((dp), (f), (key), (val))
+#define dict_close(dp)         (dp)->close(dp)
+typedef void (*DICT_WALK_ACTION) (const char *, DICT *, char *);
+extern void dict_walk(DICT_WALK_ACTION, char *);
+extern int dict_changed(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_db.h b/postfix/include/dict_db.h
new file mode 100644 (file)
index 0000000..43d7e35
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _DICT_DB_H_INCLUDED_
+#define _DICT_DB_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_db 3h
+/* SUMMARY
+/*     dictionary manager interface to DB files
+/* SYNOPSIS
+/*     #include <dict_db.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_hash_open(const char *, int, int);
+extern DICT *dict_btree_open(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_dbm.h b/postfix/include/dict_dbm.h
new file mode 100644 (file)
index 0000000..e15e8fb
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _DICT_DBN_H_INCLUDED_
+#define _DICT_DBN_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_dbm 3h
+/* SUMMARY
+/*     dictionary manager interface to DBM files
+/* SYNOPSIS
+/*     #include <dict_dbm.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_dbm_open(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_env.h b/postfix/include/dict_env.h
new file mode 100644 (file)
index 0000000..f49e105
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _DICT_ENV_H_INCLUDED_
+#define _DICT_ENV_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_env 3h
+/* SUMMARY
+/*     dictionary manager interface to environment variables
+/* SYNOPSIS
+/*     #include <dict_env.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_env_open(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_ht.h b/postfix/include/dict_ht.h
new file mode 100644 (file)
index 0000000..4f408bc
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _DICT_HT_H_INCLUDED_
+#define _DICT_HT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_ht 3h
+/* SUMMARY
+/*     dictionary manager interface to hash tables
+/* SYNOPSIS
+/*     #include <dict_ht.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <htable.h>
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_ht_open(HTABLE *, void (*) (char *));
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_ldap.h b/postfix/include/dict_ldap.h
new file mode 100644 (file)
index 0000000..818835d
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _DICT_LDAP_H_INCLUDED_
+#define _DICT_LDAP_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_ldap 3h
+/* SUMMARY
+/*     dictionary manager interface to LDAP maps
+/* SYNOPSIS
+/*     #include <dict_ldap.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_ldap_open(const char *, int, int);
+
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10532, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_mysql.h b/postfix/include/dict_mysql.h
new file mode 100644 (file)
index 0000000..601ccda
--- /dev/null
@@ -0,0 +1,46 @@
+#ifdef HAS_MYSQL
+
+#include <time.h>
+#include "mysql.h"
+
+#define STATACTIVE 0
+#define STATFAIL 1
+#define STATUNTRIED 2
+#define RETRY_CONN_INTV 300            /* 5 minutes */
+
+extern DICT *dict_mysql_open(const char *name, int unused_flags, int dict_flags);
+
+typedef struct {
+    char   *hostname;
+    int     stat;                      /* STATUNTRIED | STATFAIL | STATCUR */
+    time_t  ts;                                /* used for attempting reconnection
+                                        * every so often if a host is down */
+    MYSQL   db;
+} HOST;
+
+
+typedef struct {
+    char   *username;                  /* login for database */
+    char   *password;                  /* password for database */
+    char   *dbname;                    /* the name of the database on all
+                                        * the servers */
+    HOST   *db_hosts;                  /* the hosts on which the databases
+                                        * reside */
+    int     len_hosts;                 /* number of hosts */
+} PLMYSQL;
+
+extern PLMYSQL *plmysql_init(char *dbname, char *hostnames[], int len_hosts);
+
+extern int plmysql_connect(PLMYSQL *PLDB, char *username, char *password);
+
+MYSQL_RES *plmysql_query(PLMYSQL *PLDB, const char *query);
+
+void    plmysql_dealloc(PLMYSQL *PLDB);
+
+inline void plmysql_down_host(HOST *host);
+
+int     plmysql_connect_single(PLMYSQL *PLDB, int host);
+
+int     plmysql_ready_reconn(HOST host);
+
+#endif
diff --git a/postfix/include/dict_ni.h b/postfix/include/dict_ni.h
new file mode 100644 (file)
index 0000000..b0221a4
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _DICT_NI_H_INCLUDED_
+#define _DICT_NI_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_ni 3h
+/* SUMMARY
+/*     dictionary manager interface to NetInfo maps
+/* SYNOPSIS
+/*     #include <dict_ni.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_ni_open(const char *, int, int);
+
+/* AUTHOR(S)
+/*     Pieter Schoenmakers
+/*     Eindhoven University of Technology
+/*     P.O. Box 513
+/*     5600 MB Eindhoven
+/*     The Netherlands
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_nis.h b/postfix/include/dict_nis.h
new file mode 100644 (file)
index 0000000..ff2759b
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _DIST_NIS_H_INCLUDED_
+#define _DIST_NIS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_nis 3h
+/* SUMMARY
+/*     dictionary manager interface to NIS maps
+/* SYNOPSIS
+/*     #include <dict_nis.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_nis_open(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dict_nisplus.h b/postfix/include/dict_nisplus.h
new file mode 100644 (file)
index 0000000..f43b314
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _DICT_NISPLUS_H_INCLUDED_
+#define _DICT_NISPLUS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dict_nisplus 3h
+/* SUMMARY
+/*     dictionary manager interface to NIS+ maps
+/* SYNOPSIS
+/*     #include <dict_nisplus.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <dict.h>
+
+ /*
+  * External interface.
+  */
+extern DICT *dict_nisplus_open(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/dir_forest.h b/postfix/include/dir_forest.h
new file mode 100644 (file)
index 0000000..2c4c363
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _DIR_FOREST_H_INCLUDED_
+#define _DIR_FOREST_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dir_forest 3h
+/* SUMMARY
+/*     file name to directory forest
+/* SYNOPSIS
+/*     #include <dir_forest.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern char *dir_forest(VSTRING *, const char *, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/events.h b/postfix/include/events.h
new file mode 100644 (file)
index 0000000..bc39b47
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef _EVENTS_H_INCLUDED_
+#define _EVENTS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     events 3h
+/* SUMMARY
+/*     event manager
+/* SYNOPSIS
+/*     #include <events.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <time.h>
+
+ /*
+  * External interface.
+  */
+typedef void (*EVENT_NOTIFY_RDWR) (int, char *);
+typedef void (*EVENT_NOTIFY_TIME) (int, char *);
+
+extern time_t event_time(void);
+extern void event_enable_read(int, EVENT_NOTIFY_RDWR, char *);
+extern void event_enable_write(int, EVENT_NOTIFY_RDWR, char *);
+extern void event_disable_readwrite(int);
+extern time_t event_request_timer(EVENT_NOTIFY_TIME, char *, int);
+extern int event_cancel_timer(EVENT_NOTIFY_TIME, char *);
+extern void event_loop(int);
+
+ /*
+  * Event codes.
+  */
+#define EVENT_READ     (1<<0)          /* read event */
+#define EVENT_WRITE    (1<<1)          /* write event */
+#define EVENT_XCPT     (1<<2)          /* exception */
+#define EVENT_TIME     (1<<3)          /* timer event */
+
+#define EVENT_ERROR    EVENT_XCPT
+
+ /*
+  * Dummies.
+  */
+#define EVENT_NULL_TYPE        0
+#define EVENT_NULL_CONTEXT     ((char *) 0)
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/* CREATION DATE
+/*     Wed Jan 29 17:00:03 EST 1997
+/*--*/
+
+#endif
diff --git a/postfix/include/exec_command.h b/postfix/include/exec_command.h
new file mode 100644 (file)
index 0000000..4e77211
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _EXEC_COMMAND_H_INCLUDED_
+#define _EXEC_COMMAND_H_INCLUDED_
+
+/*++
+/* NAME
+/*     exec_command 3h
+/* SUMMARY
+/*     execute command
+/* SYNOPSIS
+/*     #include <exec_command.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern NORETURN exec_command(const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/find_inet.h b/postfix/include/find_inet.h
new file mode 100644 (file)
index 0000000..0e5ce72
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _FIND_INET_H_INCLUDED_
+#define _FIND_INET_H_INCLUDED_
+
+/*++
+/* NAME
+/*     find_inet 3h
+/* SUMMARY
+/*     inet-domain name services
+/* SYNOPSIS
+/*     #include <find_inet.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern unsigned find_inet_addr(const char *);
+extern int find_inet_port(const char *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/* LAST MODIFICATION
+/*     Thu Feb  6 12:46:36 EST 1997
+/*--*/
+
+#endif
diff --git a/postfix/include/fsspace.h b/postfix/include/fsspace.h
new file mode 100644 (file)
index 0000000..c118e50
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _FSSPACE_H_INCLUDED_
+#define _FSSPACE_H_INCLUDED_
+
+/*++
+/* NAME
+/*     fsspace 3h
+/* SUMMARY
+/*     determine available file system space
+/* SYNOPSIS
+/*     #include <fsspace.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+struct fsspace {
+    unsigned long block_size;          /* block size */
+    unsigned long block_free;          /* free space */
+};
+
+extern void fsspace(const char *, struct fsspace *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/fullname.h b/postfix/include/fullname.h
new file mode 100644 (file)
index 0000000..f24492a
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _FULLNAME_H_INCLUDED_
+#define _FULLNAME_H_INCLUDED_
+
+/*++
+/* NAME
+/*     fullname 3h
+/* SUMMARY
+/*     lookup personal name of invoking user
+/* SYNOPSIS
+/*     #include <fullname.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern const char *fullname(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/get_domainname.h b/postfix/include/get_domainname.h
new file mode 100644 (file)
index 0000000..177e3fd
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _GET_DOMAINNAME_H_INCLUDED_
+#define _GET_DOMAINNAME_H_INCLUDED_
+
+/*++
+/* NAME
+/*     get_domainname 3h
+/* SUMMARY
+/*     network domain name lookup
+/* SYNOPSIS
+/*     #include <get_domainname.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface */
+
+extern const char *get_domainname(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/get_hostname.h b/postfix/include/get_hostname.h
new file mode 100644 (file)
index 0000000..32d2ab2
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _GET_HOSTNAME_H_INCLUDED_
+#define _GET_HOSTNAME_H_INCLUDED_
+
+/*++
+/* NAME
+/*     get_hostname 3h
+/* SUMMARY
+/*     network name lookup
+/* SYNOPSIS
+/*     #include <get_hostname.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface */
+
+extern const char *get_hostname(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/htable.h b/postfix/include/htable.h
new file mode 100644 (file)
index 0000000..72eaa98
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef _HTABLE_H_INCLUDED_
+#define _HTABLE_H_INCLUDED_
+
+/*++
+/* NAME
+/*     htable 3h
+/* SUMMARY
+/*     hash table manager
+/* SYNOPSIS
+/*     #include <htable.h>
+/* DESCRIPTION
+/* .nf
+
+ /* Structure of one hash table entry. */
+
+typedef struct HTABLE_INFO {
+    char   *key;                       /* lookup key */
+    char   *value;                     /* associated value */
+    struct HTABLE_INFO *next;          /* colliding entry */
+    struct HTABLE_INFO *prev;          /* colliding entry */
+} HTABLE_INFO;
+
+ /* Structure of one hash table. */
+
+typedef struct HTABLE {
+    int     size;                      /* length of entries array */
+    int     used;                      /* number of entries in table */
+    HTABLE_INFO **data;                        /* entries array, auto-resized */
+} HTABLE;
+
+extern HTABLE *htable_create(int);
+extern HTABLE_INFO *htable_enter(HTABLE *, const char *, char *);
+extern HTABLE_INFO *htable_locate(HTABLE *, const char *);
+extern char *htable_find(HTABLE *, const char *);
+extern void htable_delete(HTABLE *, const char *, void (*) (char *));
+extern void htable_free(HTABLE *, void (*) (char *));
+extern void htable_walk(HTABLE *, void (*) (HTABLE_INFO *, char *), char *);
+extern HTABLE_INFO **htable_list(HTABLE *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/* CREATION DATE
+/*     Fri Feb 14 13:43:19 EST 1997
+/* LAST MODIFICATION
+/*     %E% %U%
+/* VERSION/RELEASE
+/*     %I%
+/*--*/
+
+#endif
diff --git a/postfix/include/inet_addr_host.h b/postfix/include/inet_addr_host.h
new file mode 100644 (file)
index 0000000..39d150a
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef INET_ADDR_HOST_H_INCLUDED_
+#define INET_ADDR_HOST_H_INCLUDED_
+
+/*++
+/* NAME
+/*     inet_addr_host 3h
+/* SUMMARY
+/*     determine all host internet interface addresses
+/* SYNOPSIS
+/*     #include <inet_addr_host.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <inet_addr_list.h>
+
+ /*
+  * External interface.
+  */
+extern int inet_addr_host(INET_ADDR_LIST *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/inet_addr_list.h b/postfix/include/inet_addr_list.h
new file mode 100644 (file)
index 0000000..48a4c97
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef _INET_ADDR_LIST_H_INCLUDED_
+#define _INET_ADDR_LIST_H_INCLUDED_
+
+/*++
+/* NAME
+/*     inet_addr_list 3h
+/* SUMMARY
+/*     internet address list manager
+/* SYNOPSIS
+/*     #include <inet_addr_list.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <netinet/in.h>
+
+ /*
+  * External interface.
+  */
+typedef struct INET_ADDR_LIST {
+    int     used;                      /* nr of elements in use */
+    int     size;                      /* actual list size */
+    struct in_addr *addrs;             /* payload */
+} INET_ADDR_LIST;
+
+extern void inet_addr_list_init(INET_ADDR_LIST *);
+extern void inet_addr_list_free(INET_ADDR_LIST *);
+extern void inet_addr_list_append(INET_ADDR_LIST *, struct in_addr *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/inet_addr_local.h b/postfix/include/inet_addr_local.h
new file mode 100644 (file)
index 0000000..f48ca1e
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _INET_ADDR_LOCAL_H_INCLUDED_
+#define _INET_ADDR_LOCAL_H_INCLUDED_
+
+/*++
+/* NAME
+/*     inet_addr_local 3h
+/* SUMMARY
+/*     determine if IP address is local
+/* SYNOPSIS
+/*     #include <inet_addr_local.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <inet_addr_list.h>
+
+ /*
+  * External interface.
+  */
+extern int inet_addr_local(INET_ADDR_LIST *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/inet_util.h b/postfix/include/inet_util.h
new file mode 100644 (file)
index 0000000..7eea602
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _INET_UTIL_H_INCLUDED_
+#define _INET_UTIL_H_INCLUDED_
+
+/*++
+/* NAME
+/*     inet_util 3h
+/* SUMMARY
+/*     INET-domain utilities
+/* SYNOPSIS
+/*     #include <inet_util.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern char *inet_parse(const char *, char **, char **);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/iostuff.h b/postfix/include/iostuff.h
new file mode 100644 (file)
index 0000000..909bffb
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef _IOSTUFF_H_INCLUDED_
+#define _IOSTUFF_H_INCLUDED_
+
+/*++
+/* NAME
+/*     iostuff 3h
+/* SUMMARY
+/*     miscellaneous I/O primitives
+/* SYNOPSIS
+/*     #include <iostuff.h>
+/* DESCRIPTION
+
+ /*
+  * External interface.
+  */
+extern int non_blocking(int, int);
+extern int close_on_exec(int, int);
+extern int open_limit(int);
+extern int readable(int);
+extern int writable(int);
+extern off_t get_file_limit(void);
+extern void set_file_limit(off_t);
+extern int peekfd(int);
+extern int read_wait(int, int);
+extern int write_wait(int, int);
+extern int write_buf(int, const char *, int, int);
+extern void doze(unsigned);
+
+#define BLOCKING       0
+#define NON_BLOCKING   1
+
+#define CLOSE_ON_EXEC  1
+#define PASS_ON_EXEC   0
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*      Wietse Venema
+/*      IBM T.J. Watson Research
+/*      P.O. Box 704
+/*      Yorktown Heights, NY 10598, USA
+/* CREATION DATE
+/*     Sat Jan 25 16:54:13 EST 1997
+/*--*/
+
+#endif
diff --git a/postfix/include/line_wrap.h b/postfix/include/line_wrap.h
new file mode 100644 (file)
index 0000000..b901c1f
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _LINE_WRAP_H_INCLUDED_
+#define _LINE_WRAP_H_INCLUDED_
+
+/*++
+/* NAME
+/*     line_wrap 3h
+/* SUMMARY
+/*     wrap long lines upon output
+/* SYNOPSIS
+/*     #include <line_wrap.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+typedef void (*LINE_WRAP_FN) (const char *, int, int, char *);
+extern void line_wrap(const char *, int, int, LINE_WRAP_FN, char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/listen.h b/postfix/include/listen.h
new file mode 100644 (file)
index 0000000..81c5389
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef _LISTEN_H_INCLUDED_
+#define _LISTEN_H_INCLUDED_
+
+/*++
+/* NAME
+/*     listen 3h
+/* SUMMARY
+/*     listener interface file
+/* SYNOPSIS
+/*     #include <listen.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <iostuff.h>
+
+ /*
+  * Listener external interface.
+  */
+extern int unix_listen(const char *, int, int);
+extern int inet_listen(const char *, int, int);
+extern int fifo_listen(const char *, int, int);
+extern int stream_listen(const char *, int, int);
+
+extern int inet_accept(int);
+extern int unix_accept(int);
+extern int stream_accept(int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/lstat_as.h b/postfix/include/lstat_as.h
new file mode 100644 (file)
index 0000000..824b321
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _LSTAT_AS_H_INCLUDED_
+#define _LSTAT_AS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     lstat_as 3h
+/* SUMMARY
+/*     lstat file as user
+/* SYNOPSIS
+/*     #include <sys/stat.h>
+/*     #include <lstat_as.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int lstat_as(const char *, struct stat *, uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/mac_parse.h b/postfix/include/mac_parse.h
new file mode 100644 (file)
index 0000000..1acbb60
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef _MAC_PARSE_H_INCLUDED_
+#define _MAC_PARSE_H_INCLUDED_
+
+/*++
+/* NAME
+/*     mac_parse 3h
+/* SUMMARY
+/*     locate macro references in string
+/* SYNOPSIS
+/*     #include <mac_parse.h>
+ DESCRIPTION
+ .nf
+
+ /*
+  * Utility library.
+  */
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+#define MAC_PARSE_LITERAL      1
+#define MAC_PARSE_VARNAME      2
+
+#define MAC_PARSE_ERROR                (1<<0)
+#define MAC_PARSE_UNDEF                (1<<1)
+#define MAC_PARSE_USER         2       /* start user definitions */
+
+typedef int (*MAC_PARSE_FN)(int, VSTRING *, char *);
+
+extern int mac_parse(const char *, MAC_PARSE_FN, char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/make_dirs.h b/postfix/include/make_dirs.h
new file mode 100644 (file)
index 0000000..0df6117
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef MAKE_DIRS_H_INCLUDED_
+#define MAKE_DIRS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     make_dirs 3h
+/* SUMMARY
+/*     create directory hierarchy
+/* SYNOPSIS
+/*     #include <make_dirs.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern int make_dirs(const char *, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/match_list.h b/postfix/include/match_list.h
new file mode 100644 (file)
index 0000000..aba88b8
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _MATCH_LIST_H_INCLUDED_
+#define _MATCH_LIST_H_INCLUDED_
+
+/*++
+/* NAME
+/*     match_list 3h
+/* SUMMARY
+/*     generic list-based pattern matching
+/* SYNOPSIS
+/*     #include <match_list.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+typedef struct MATCH_LIST MATCH_LIST;
+typedef int (*MATCH_LIST_FN) (const char *, const char *);
+
+extern MATCH_LIST *match_list_init(const char *, int,...);
+extern int match_list_match(MATCH_LIST *,...);
+extern void match_list_free(MATCH_LIST *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/match_ops.h b/postfix/include/match_ops.h
new file mode 100644 (file)
index 0000000..a938c04
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _MATCH_OPS_H_INCLUDED_
+#define _MATCH_OPS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     match_ops 3h
+/* SUMMARY
+/*     simple string or host pattern matching
+/* SYNOPSIS
+/*     #include <match_ops.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int match_string(const char *, const char *);
+extern int match_hostname(const char *, const char *);
+extern int match_hostaddr(const char *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/msg.h b/postfix/include/msg.h
new file mode 100644 (file)
index 0000000..2b62dec
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef _MSG_H_INCLUDED_
+#define _MSG_H_INCLUDED_
+
+/*++
+/* NAME
+/*     msg 3h
+/* SUMMARY
+/*     diagnostics interface
+/* SYNOPSIS
+/*     #include "msg.h"
+/* DESCRIPTION
+/*     .nf
+
+/*
+ * External interface.
+ */
+typedef void (*MSG_CLEANUP_FN) (void);
+
+extern int msg_verbose;
+
+extern void msg_info(const char *,...);
+extern void msg_warn(const char *,...);
+extern void msg_error(const char *,...);
+extern NORETURN msg_fatal(const char *,...);
+extern NORETURN msg_panic(const char *,...);
+
+extern int msg_error_limit(int);
+extern void msg_error_clear(void);
+extern MSG_CLEANUP_FN msg_cleanup(MSG_CLEANUP_FN);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*      Wietse Venema
+/*      IBM T.J. Watson Research
+/*      P.O. Box 704
+/*      Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/msg_output.h b/postfix/include/msg_output.h
new file mode 100644 (file)
index 0000000..b409e95
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _MSG_OUTPUT_FN_
+#define _MSG_OUTPUT_FN_
+
+/*++
+/* NAME
+/*     msg_output 3h
+/* SUMMARY
+/*     diagnostics output management
+/* SYNOPSIS
+/*     #include <msg_output.h>
+/* DESCRIPTION
+
+ /*
+  * System library.
+  */
+#include <stdarg.h>
+
+ /*
+  * External interface. Severity levels are documented to be monotonically
+  * increasing from 0 up to MSG_LAST.
+  */
+typedef void (*MSG_OUTPUT_FN) (int, const char *);
+extern void msg_output(MSG_OUTPUT_FN);
+extern void msg_printf(int, const char *,...);
+extern void msg_vprintf(int, const char *, va_list);
+extern void msg_text(int, const char *);
+
+#define MSG_INFO       0               /* informative */
+#define        MSG_WARN        1               /* warning (non-fatal) */
+#define MSG_ERROR      2               /* error (fatal) */
+#define MSG_FATAL      3               /* software error (fatal) */
+#define MSG_PANIC      4               /* software error (fatal) */
+
+#define MSG_LAST       4               /* highest-numbered severity level */
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*      Wietse Venema
+/*      IBM T.J. Watson Research
+/*      P.O. Box 704
+/*      Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/msg_syslog.h b/postfix/include/msg_syslog.h
new file mode 100644 (file)
index 0000000..94e1ea3
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _MSG_SYSLOG_H_INCLUDED_
+#define _MSG_SYSLOG_H_INCLUDED_
+
+/*++
+/* NAME
+/*     msg_syslog 3h
+/* SUMMARY
+/*     direct diagnostics to syslog daemon
+/* SYNOPSIS
+/*     #include <msg_syslog.h>
+/* DESCRIPTION
+
+ /*
+  * System library.
+  */
+#include <syslog.h>
+
+ /*
+  * External interface.
+  */
+extern void msg_syslog_init(const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*      Wietse Venema
+/*      IBM T.J. Watson Research
+/*      P.O. Box 704
+/*      Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/msg_vstream.h b/postfix/include/msg_vstream.h
new file mode 100644 (file)
index 0000000..a0dfc70
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _MSG_VSTREAM_H_INCLUDED_
+#define _MSG_VSTREAM_H_INCLUDED_
+
+/*++
+/* NAME
+/*     msg_vstream 3h
+/* SUMMARY
+/*     direct diagnostics to VSTREAM
+/* SYNOPSIS
+/*     #include <msg_vstream.h>
+/* DESCRIPTION
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+
+ /*
+  * External interface.
+  */
+extern void msg_vstream_init(const char *, VSTREAM *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*      Wietse Venema
+/*      IBM T.J. Watson Research
+/*      P.O. Box 704
+/*      Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/mvect.h b/postfix/include/mvect.h
new file mode 100644 (file)
index 0000000..23214d5
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef _MVECT_H_INCLUDED_
+#define _MVECT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     mvect 3h
+/* SUMMARY
+/*     memory vector management
+/* SYNOPSIS
+/*     #include <mvect.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Generic memory vector interface.
+  */
+typedef void (*MVECT_FN) (char *, int);
+
+typedef struct {
+    char   *ptr;
+    int     elsize;
+    int     nelm;
+    MVECT_FN init_fn;
+    MVECT_FN wipe_fn;
+} MVECT;
+
+extern char *mvect_alloc(MVECT *, int, int, MVECT_FN, MVECT_FN);
+extern char *mvect_realloc(MVECT *, int);
+extern char *mvect_free(MVECT *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/myflock.h b/postfix/include/myflock.h
new file mode 100644 (file)
index 0000000..7d43efe
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _MYFLOCK_H_INCLUDED_
+#define _MYFLOCK_H_INCLUDED_
+
+/*++
+/* NAME
+/*     myflock 3h
+/* SUMMARY
+/*     lock open file
+/* SYNOPSIS
+/*     #include <myflock.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern int myflock(int, int);
+extern int myflock_locked(int);
+
+#define MYFLOCK_NONE           0
+#define MYFLOCK_SHARED         1
+#define MYFLOCK_EXCLUSIVE      2
+#define MYFLOCK_LOCK_MASK      (MYFLOCK_SHARED | MYFLOCK_EXCLUSIVE)
+#define MYFLOCK_NOWAIT         4
+#define MYFLOCK_BITS           (MYFLOCK_LOCK_MASK | MYFLOCK_NOWAIT)
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/mymalloc.h b/postfix/include/mymalloc.h
new file mode 100644 (file)
index 0000000..9503bcd
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _MALLOC_H_INCLUDED_
+#define _MALLOC_H_INCLUDED_
+
+/*++
+/* NAME
+/*     mymalloc 3h
+/* SUMMARY
+/*     memory management wrappers
+/* SYNOPSIS
+/*     #include "mymalloc.h"
+ DESCRIPTION
+ .nf
+
+ /*
+  * External interface.
+  */
+extern char *mymalloc(int);
+extern char *myrealloc(char *, int);
+extern void myfree(char *);
+extern char *mystrdup(const char *);
+extern char *mystrndup(const char *, int len);
+extern char *mymemdup(const char *, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/name_mask.h b/postfix/include/name_mask.h
new file mode 100644 (file)
index 0000000..2387f39
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _NAME_MASK_H_INCLUDED_
+#define _NAME_MASK_H_INCLUDED_
+
+/*++
+/* NAME
+/*     name_mask 3h
+/* SUMMARY
+/*     map names to bit mask
+/* SYNOPSIS
+/*     #include <name_mask.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+typedef struct {
+    const char *name;
+    int     mask;
+} NAME_MASK;
+
+extern int name_mask(NAME_MASK *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/open_as.h b/postfix/include/open_as.h
new file mode 100644 (file)
index 0000000..308e009
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _OPEN_H_INCLUDED_
+#define _OPEN_H_INCLUDED_
+
+/*++
+/* NAME
+/*     open_as 3h
+/* SUMMARY
+/*     open file as user
+/* SYNOPSIS
+/*     #include <fcntl.h>
+/*     #include <open_as.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int open_as(const char *, int, int, uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/open_lock.h b/postfix/include/open_lock.h
new file mode 100644 (file)
index 0000000..869233f
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _OPEN_LOCK_H_INCLUDED_
+#define _OPEN_LOCK_H_INCLUDED_
+
+/*++
+/* NAME
+/*     open_lock 3h
+/* SUMMARY
+/*     open or create file and lock it for exclusive access
+/* SYNOPSIS
+/*     #include <open_lock.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <fcntl.h>
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern VSTREAM *open_lock(const char *, int, int, VSTRING *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/percentm.h b/postfix/include/percentm.h
new file mode 100644 (file)
index 0000000..d170e95
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _PERCENT_H_INCLUDED_
+#define _PERCENT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     percentm 3h
+/* SUMMARY
+/*     expand %m embedded in string to system error text
+/* SYNOPSIS
+/*     #include <percentm.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern char *percentm(const char *, int);
+
+/* HISTORY
+/* .ad
+/* .fi
+/*     A percentm() routine appears in the TCP Wrapper software
+/*     by Wietse Venema.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/posix_signals.h b/postfix/include/posix_signals.h
new file mode 100644 (file)
index 0000000..12c1664
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef _POSIX_SIGNALS_H_INCLUDED_
+#define _POSIX_SIGNALS_H_INCLUDED_
+/*++
+/* NAME
+/*     posix_signals 3h
+/* SUMMARY
+/*     POSIX signal handling compatibility
+/* SYNOPSIS
+/*     #include <posix_signals.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Compatibility interface.
+  */
+
+#ifdef MISSING_SIGSET_T
+
+typedef int sigset_t;
+
+enum {
+    SIG_BLOCK,
+    SIG_UNBLOCK,
+    SIG_SETMASK
+};
+
+extern int sigemptyset(sigset_t *);
+extern int sigaddset(sigset_t *, int);
+extern int sigprocmask(int, sigset_t *, sigset_t *);
+
+#endif
+
+#ifdef MISSING_SIGACTION
+
+struct sigaction {
+    void    (*sa_handler) ();
+    sigset_t sa_mask;
+    int     sa_flags;
+};
+
+ /* Possible values for sa_flags.  Or them to set multiple.  */
+enum {
+    SA_RESTART,
+    SA_NOCLDSTOP = 4                   /* drop the = 4.  */
+};
+
+extern int sigaction(int, struct sigaction *, struct sigaction *);
+
+#endif
+
+/* AUTHOR(S)
+/*     Pieter Schoenmakers
+/*     Eindhoven University of Technology
+/*     P.O. Box 513
+/*     5600 MB Eindhoven
+/*     The Netherlands
+/*--*/
+
+#endif
diff --git a/postfix/include/readlline.h b/postfix/include/readlline.h
new file mode 100644 (file)
index 0000000..8a8bd54
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _READLINE_H_INCLUDED_
+#define _READLINE_H_INCLUDED_
+
+/*++
+/* NAME
+/*     readlline 3h
+/* SUMMARY
+/*     read logical line
+/* SYNOPSIS
+/*     #include <readlline.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern VSTRING *readlline(VSTRING *, VSTREAM *, int *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/ring.h b/postfix/include/ring.h
new file mode 100644 (file)
index 0000000..a96fe26
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef _RING_H_INCLUDED_
+#define _RING_H_INCLUDED_
+
+/*++
+/* NAME
+/*     ring 3h
+/* SUMMARY
+/*     circular list management
+/* SYNOPSIS
+/*     #include <ring.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+typedef struct RING RING;
+
+struct RING {
+    RING   *succ;                      /* successor */
+    RING   *pred;                      /* predecessor */
+};
+
+extern void ring_init(RING *);
+extern void ring_prepend(RING *, RING *);
+extern void ring_append(RING *, RING *);
+extern void ring_detach(RING *);
+
+#define ring_succ(c) ((c)->succ)
+#define ring_pred(c) ((c)->pred)
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/* LAST MODIFICATION
+/*     Tue Jan 28 16:50:20 EST 1997
+/*--*/
+
+#endif
diff --git a/postfix/include/safe.h b/postfix/include/safe.h
new file mode 100644 (file)
index 0000000..8b75bf4
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _SAFE_H_INCLUDED_
+#define _SAFE_H_INCLUDED_
+
+/*++
+/* NAME
+/*     safe 3h
+/* SUMMARY
+/*     miscellaneous taint checks
+/* SYNOPSIS
+/*     #include <safe.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int unsafe(void);
+extern char *safe_getenv(const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/safe_open.h b/postfix/include/safe_open.h
new file mode 100644 (file)
index 0000000..02964f8
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _SAFE_OPEN_H_INCLUDED_
+#define _SAFE_OPEN_H_INCLUDED_
+
+/*++
+/* NAME
+/*     safe_open 3h
+/* SUMMARY
+/*     safely open or create regular file
+/* SYNOPSIS
+/*     #include <safe_open.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <fcntl.h>
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern VSTREAM *safe_open(const char *, int, int, uid_t, gid_t, VSTRING *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/sane_accept.h b/postfix/include/sane_accept.h
new file mode 100644 (file)
index 0000000..84cc360
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _SANE_ACCEPT_H_
+#define _SANE_ACCEPT_H_
+
+/*++
+/* NAME
+/*     sane_accept 3h
+/* SUMMARY
+/*     sanitize accept() error returns
+/* SYNOPSIS
+/*     #include <sane_accept.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int sane_accept(int, struct sockaddr *, SOCKADDR_SIZE *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/scan_dir.h b/postfix/include/scan_dir.h
new file mode 100644 (file)
index 0000000..8f3bf8b
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _SCAN_DIR_H_INCLUDED_
+#define _SCAN_DIR_H_INCLUDED_
+
+/*++
+/* NAME
+/*     scan_dir 3h
+/* SUMMARY
+/*     directory scanner
+/* SYNOPSIS
+/*     #include <scan_dir.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * The directory scanner interface.
+  */
+typedef struct SCAN_DIR SCAN_DIR;
+
+extern SCAN_DIR *scan_dir_open(const char *);
+extern char *scan_dir_next(SCAN_DIR *);
+extern char *scan_dir_path(SCAN_DIR *);
+extern void scan_dir_push(SCAN_DIR *, const char *);
+extern SCAN_DIR *scan_dir_pop(SCAN_DIR *);
+extern SCAN_DIR *scan_dir_close(SCAN_DIR *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/set_eugid.h b/postfix/include/set_eugid.h
new file mode 100644 (file)
index 0000000..e461cbf
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _SET_EUGID_H_INCLUDED_
+#define _SET_EUGID_H_INCLUDED_
+
+/*++
+/* NAME
+/*     set_eugid 3h
+/* SUMMARY
+/*     set effective user and group attributes
+/* SYNOPSIS
+/*     #include <set_eugid.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern void set_eugid(uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/set_ugid.h b/postfix/include/set_ugid.h
new file mode 100644 (file)
index 0000000..e752beb
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _SET_UGID_H_INCLUDED_
+#define _SET_UGID_H_INCLUDED_
+
+/*++
+/* NAME
+/*     set_ugid 3h
+/* SUMMARY
+/*     set real, effective and saved user and group attributes
+/* SYNOPSIS
+/*     #include <set_ugid.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern void set_ugid(uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/sigdelay.h b/postfix/include/sigdelay.h
new file mode 100644 (file)
index 0000000..d3b4ea3
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _SIGDELAY_H_INCLUDED_
+#define _SIGDELAY_H_INCLUDED_
+
+/*++
+/* NAME
+/*     sigdelay 3h
+/* SUMMARY
+/*     delay/resume signal delivery
+/* SYNOPSIS
+/*     #include <sigdelay.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern void sigdelay(void);
+extern void sigresume(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/split_at.h b/postfix/include/split_at.h
new file mode 100644 (file)
index 0000000..2d03ebb
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _SPLIT_AT_H_INCLUDED_
+#define _SPLIT_AT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     split_at 3h
+/* SUMMARY
+/*     trivial token splitter
+/* SYNOPSIS
+/*     #include <split_at.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern char *split_at(char *, int);
+extern char *split_at_right(char *, int);
+
+/* HISTORY
+/* .ad
+/* .fi
+/*     A split_at() routine appears in the TCP Wrapper software
+/*     by Wietse Venema.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/stat_as.h b/postfix/include/stat_as.h
new file mode 100644 (file)
index 0000000..aad37d3
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _STAT_AS_H_INCLUDED_
+#define _STAT_AS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     stat_as 3h
+/* SUMMARY
+/*     stat file as user
+/* SYNOPSIS
+/*     #include <sys/stat.h>
+/*     #include <stat_as.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern int stat_as(const char *, struct stat *, uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/stringops.h b/postfix/include/stringops.h
new file mode 100644 (file)
index 0000000..854c029
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _STRINGOPS_H_INCLUDED_
+#define _STRINGOPS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     stringops 3h
+/* SUMMARY
+/*     string operations
+/* SYNOPSIS
+/*     #include <stringops.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern char *printable(char *, int);
+extern char *lowercase(char *);
+extern char *skipblanks(const char *);
+extern char *trimblanks(char *, int);
+extern char *concatenate(const char *,...);
+extern char *mystrtok(char **, const char *);
+extern char *translit(char *, const char *, const char *);
+#ifndef HAVE_BASENAME
+extern char *basename(const char *);
+#endif
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/sys_defs.h b/postfix/include/sys_defs.h
new file mode 100644 (file)
index 0000000..6665f8d
--- /dev/null
@@ -0,0 +1,772 @@
+#ifndef _SYS_DEFS_H_INCLUDED_
+#define _SYS_DEFS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     sys_defs 3h
+/* SUMMARY
+/*     portability header
+/* SYNOPSIS
+/*     #include <sys_defs.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Specific platforms. Major release numbers differ for a good reason. So be
+  * a good girl, plan for the future, and at least include the major release
+  * number in the system type (for example, SUNOS5 or FREEBSD2). The system
+  * type is determined by the makedefs shell script in the top-level
+  * directory. Adding support for a new system type means updating the
+  * makedefs script, and adding a section below for the new system.
+  */
+#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
+    || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
+    || defined(OPENBSD2) || defined(NETBSD1) || defined(RHAPSODY5)
+#define SUPPORTED
+#include <sys/types.h>
+#define USE_PATHS_H
+#define USE_FLOCK_LOCK
+#define HAS_SUN_LEN
+#define HAS_FSYNC
+#define HAS_DB
+#define HAS_SA_LEN
+#define DEF_DB_TYPE    "hash"
+#define ALIAS_DB_MAP   "hash:/etc/aliases"
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin"
+#define USE_STATFS
+#define STATFS_IN_SYS_MOUNT_H
+#define HAS_POSIX_REGEXP
+#endif
+
+#if defined(OPENBSD2)
+#define HAS_ISSETUGID
+#endif
+
+#if defined(NETBSD1)
+#define USE_DOT_LOCK
+#endif
+
+#if defined(RHAPSODY5)
+#define NORETURN       void
+#define HAS_NETINFO
+#endif
+
+#ifdef ULTRIX4
+#define SUPPORTED
+/* Ultrix by default has only 64 descriptors per process */
+#ifndef FD_SETSIZE
+#define FD_SETSIZE     96
+#endif
+#include <sys/types.h>
+#define UNSAFE_CTYPE                   /* XXX verify */
+#define _PATH_MAILDIR  "/var/spool/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/etc:/usr/ucb"
+#define USE_FLOCK_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+/* might be set by makedef */
+#ifdef HAS_DB
+#define DEF_DB_TYPE    "hash"
+#define ALIAS_DB_MAP   "hash:/etc/aliases"
+#else
+#define HAS_DBM
+#define        DEF_DB_TYPE     "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#endif
+extern int optind;
+extern char *optarg;
+extern int opterr;
+
+#define MISSING_STRFTIME_E
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
+#define USE_STATFS
+#define USE_STRUCT_FS_DATA
+#define STATFS_IN_SYS_MOUNT_H
+/* Ultrix misses just S_ISSOCK, the others are there */
+#define S_ISSOCK(mode) (((mode) & (S_IFMT)) == (S_IFSOCK))
+#define DUP2_DUPS_CLOSE_ON_EXEC
+#define MISSING_USLEEP
+#endif
+
+#ifdef OSF1
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define USE_PATHS_H
+#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
+#define USE_FLOCK_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAVE_BASENAME
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/var/adm/sendmail/aliases"
+extern int optind;                     /* XXX use <getopt.h> */
+extern char *optarg;                   /* XXX use <getopt.h> */
+extern int opterr;                     /* XXX use <getopt.h> */
+
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define USE_STATFS
+#define STATFS_IN_SYS_MOUNT_H
+#define HAS_POSIX_REGEXP
+#endif
+
+#ifdef SUNOS4
+#define SUPPORTED
+#include <sys/types.h>
+#define UNSAFE_CTYPE
+#define fpos_t long
+#define MISSING_SETENV
+#define MISSING_STRERROR
+#define _PATH_MAILDIR  "/var/spool/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/etc:/usr/ucb"
+#define USE_FLOCK_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/aliases"
+extern int optind;
+extern char *optarg;
+extern int opterr;
+
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
+#define USE_STATFS
+#define STATFS_IN_SYS_VFS_H
+#define memmove(d,s,l) bcopy(s,d,l)
+#endif
+
+#ifdef SUNOS5
+#define SUPPORTED
+#define _SVID_GETTOD                   /* Solaris 2.5, XSH4.2 versus SVID */
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_MAILDIR  "/var/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/sbin:/usr/ucb"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#define HAS_NIS
+#define USE_SYS_SOCKIO_H               /* Solaris 2.5, changed sys/ioctl.h */
+#define GETTIMEOFDAY(t)        gettimeofday(t)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define FIONREAD_IN_SYS_FILIO_H
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define STREAM_CONNECTIONS             /* avoid UNIX-domain sockets */
+#define LOCAL_LISTEN   stream_listen
+#define LOCAL_ACCEPT   stream_accept
+#define LOCAL_CONNECT  stream_connect
+#define LOCAL_TRIGGER  stream_trigger
+#define HAS_VOLATILE_LOCKS
+#endif
+
+#ifdef UW7                             /* UnixWare 7 */
+#define SUPPORTED
+#include <sys/types.h>
+#define _PATH_MAILDIR  "/var/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/sbin:/usr/ucb"
+#define MISSING_SETENV
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#define HAS_NIS
+#define USE_SYS_SOCKIO_H
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define FIONREAD_IN_SYS_FILIO_H
+#define DBM_NO_TRAILING_NULL
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
+#endif
+
+#ifdef UW21                            /* UnixWare 2.1.x */
+#define SUPPORTED
+#include <sys/types.h>
+#define _PATH_MAILDIR   "/var/mail"
+#define _PATH_BSHELL    "/bin/sh"
+#define _PATH_DEFPATH   "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH   "/usr/bin:/usr/sbin:/usr/ucb"
+#define MISSING_SETENV
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE     "dbm"
+#define ALIAS_DB_MAP    "dbm:/etc/mail/aliases"
+/* Uncomment the following line if you have NIS package installed
+#define HAS_NIS */
+#define USE_SYS_SOCKIO_H
+#define GETTIMEOFDAY(t) gettimeofday(t,NULL)
+#define ROOT_PATH       "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define FIONREAD_IN_SYS_FILIO_H
+#define DBM_NO_TRAILING_NULL
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
+#endif
+
+#ifdef AIX4
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR   "/var/spool/mail"      /* paths.h lies */
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/sbin:/usr/ucb"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define USE_SYS_SELECT_H
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#define HAS_NIS
+#define HAS_SA_LEN
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define RESOLVE_H_NEEDS_STDIO_H
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define SOCKADDR_SIZE  size_t
+#define SOCKOPT_SIZE   size_t
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define STRCASECMP_IN_STRINGS_H
+extern time_t time(time_t *);
+extern int seteuid(uid_t);
+extern int setegid(gid_t);
+extern int initgroups(const char *, int);
+
+#endif
+
+#ifdef AIX3
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR   "/var/spool/mail"      /* paths.h lies */
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/usr/bin:/usr/sbin:/usr/ucb"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define USE_SYS_SELECT_H
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#define HAS_NIS
+#define HAS_SA_LEN
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define RESOLVE_H_NEEDS_STDIO_H
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define SOCKADDR_SIZE  size_t
+#define SOCKOPT_SIZE   size_t
+#define USE_STATFS
+#define STATFS_IN_SYS_STATFS_H
+#define STRCASECMP_IN_STRINGS_H
+extern time_t time(time_t *);
+extern int seteuid(uid_t);
+extern int setegid(gid_t);
+extern int initgroups(const char *, int);
+
+#endif
+
+#if defined(IRIX5) || defined(IRIX6)
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_MAILDIR  "/var/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/usr/bin:/usr/bsd"
+#define _PATH_STDPATH  "/usr/bin:/usr/sbin:/usr/bsd"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/aliases"
+#define HAS_NIS
+#define USE_SYS_SOCKIO_H               /* XXX check */
+#define GETTIMEOFDAY(t)        gettimeofday(t)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/bsd"
+#define FIONREAD_IN_SYS_FILIO_H                /* XXX check */
+#define DBM_NO_TRAILING_NULL           /* XXX check */
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#endif
+
+#if defined(IRIX5)
+#define MISSING_USLEEP
+#endif
+
+#ifdef LINUX2
+#define SUPPORTED
+#include <sys/types.h>
+#define USE_PATHS_H
+#define USE_FLOCK_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define HAS_DB
+#define DEF_DB_TYPE    "hash"
+#define ALIAS_DB_MAP   "hash:/etc/aliases"
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin"
+#define FIONREAD_IN_TERMIOS_H
+#define USE_STATFS
+#define STATFS_IN_SYS_VFS_H
+#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
+#define PREPEND_PLUS_TO_OPTSTRING
+#define HAS_POSIX_REGEXP
+#endif
+
+ /*
+  * HPUX11 was copied from HPUX10, but can perhaps be trimmed down a bit.
+  */
+#ifdef HPUX11
+#define SUPPORTED
+#define USE_SIG_RETURN
+#include <sys/types.h>
+#define HAS_DBM
+#define USE_FCNTL_LOCK
+#define HAS_FSYNC
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#define ROOT_PATH      "/usr/bin:/sbin:/usr/sbin"
+#define MISSING_SETENV
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR  "/var/mail"
+#define _PATH_DEFPATH  "/usr/bin"
+#define _PATH_STDPATH  "/usr/bin:/sbin:/usr/sbin"
+#define MISSING_SETEUID
+#define HAVE_SETRESUID
+#define MISSING_SETEGID
+#define HAVE_SETRESGID
+extern int h_errno;                    /* <netdb.h> imports too much stuff */
+
+#define USE_STATFS
+#define STATFS_IN_SYS_VFS_H
+#define HAS_POSIX_REGEXP
+#endif
+
+#ifdef HPUX10
+#define SUPPORTED
+#define USE_SIG_RETURN
+#include <sys/types.h>
+#define HAS_DBM
+#define USE_FCNTL_LOCK
+#define HAS_FSYNC
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
+#define ROOT_PATH      "/usr/bin:/sbin:/usr/sbin"
+#define MISSING_SETENV
+#define HAS_NIS
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR  "/var/mail"
+#define _PATH_DEFPATH  "/usr/bin"
+#define _PATH_STDPATH  "/usr/bin:/sbin:/usr/sbin"
+#define MISSING_SETEUID
+#define HAVE_SETRESUID
+#define MISSING_SETEGID
+#define HAVE_SETRESGID
+extern int h_errno;                    /* <netdb.h> imports too much stuff */
+
+#define USE_STATFS
+#define STATFS_IN_SYS_VFS_H
+#define HAS_POSIX_REGEXP
+#endif
+
+#ifdef HPUX9
+#define SUPPORTED
+#define USE_SIG_RETURN
+#include <sys/types.h>
+#define HAS_DBM
+#define USE_FCNTL_LOCK
+#define HAS_FSYNC
+#define HAS_NIS
+#define MISSING_SETENV
+#define MISSING_RLIMIT_FSIZE
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/usr/lib/aliases"
+#define ROOT_PATH      "/bin:/usr/bin:/etc"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR  "/usr/mail"
+#define _PATH_DEFPATH  "/bin:/usr/bin"
+#define _PATH_STDPATH  "/bin:/usr/bin:/etc"
+#define MISSING_SETEUID
+#define HAVE_SETRESUID
+#define MISSING_SETEGID
+#define HAVE_SETRESGID
+extern int h_errno;
+
+#define USE_ULIMIT                     /* no setrlimit() */
+#define USE_STATFS
+#define STATFS_IN_SYS_VFS_H
+#define HAS_POSIX_REGEXP
+#endif
+
+ /*
+  * NEXTSTEP3, without -lposix, because its naming service is broken.
+  */
+#ifdef NEXTSTEP3
+#define SUPPORTED
+#include <sys/types.h>
+#define HAS_DBM
+#define USE_FLOCK_LOCK
+#define USE_STATFS
+#define HAVE_SYS_DIR_H
+#define STATFS_IN_SYS_VFS_H
+#define HAS_FSYNC
+#define HAS_NIS
+#define HAS_NETINFO
+#define MISSING_SETENV_PUTENV
+#define MISSING_MKFIFO
+#define MISSING_SIGSET_T
+#define MISSING_SIGACTION
+#define MISSING_STD_FILENOS
+#define MISSING_SETSID
+#define MISSING_WAITPID
+#define MISSING_UTIMBUF
+#define HAS_WAIT4
+#define WAIT_STATUS_T union wait
+#define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define _PATH_MAILDIR  "/usr/spool/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/bin:/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/bin:/usr/bin:/usr/ucb"
+#define ROOT_PATH      "/bin:/usr/bin:/usr/etc:/usr/ucb"
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "netinfo:/aliases"
+#include <libc.h>
+#define MISSING_POSIX_S_IS
+#define MISSING_POSIX_S_MODES
+/* It's amazing what is all missing... */
+#define isascii(c)     ((unsigned)(c)<=0177)
+extern int opterr;
+
+#define MISSING_PID_T
+#define MISSING_STRFTIME_E
+#define FD_CLOEXEC     1
+#define O_NONBLOCK     O_NDELAY
+#define WEXITSTATUS(x) ((x).w_retcode)
+#define WTERMSIG(x)    ((x).w_termsig)
+#endif
+
+ /*
+  * OPENSTEP does not have posix (some fix...)
+  */
+#ifdef OPENSTEP4
+#define SUPPORTED
+#include <sys/types.h>
+#define HAS_DBM
+#define USE_FLOCK_LOCK
+#define USE_STATFS
+#define HAVE_SYS_DIR_H
+#define STATFS_IN_SYS_VFS_H
+#define HAS_FSYNC
+#define HAS_NIS
+#define HAS_NETINFO
+#define MISSING_SETENV_PUTENV
+#define MISSING_MKFIFO
+#define MISSING_SIGSET_T
+#define MISSING_SIGACTION
+#define MISSING_STD_FILENOS
+#define MISSING_SETSID
+#define MISSING_WAITPID
+#define MISSING_UTIMBUF
+#define HAS_WAIT4
+#define WAIT_STATUS_T union wait
+#define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
+#define GETTIMEOFDAY(t)        gettimeofday(t,(struct timezone *) 0)
+#define _PATH_MAILDIR  "/usr/spool/mail"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_DEFPATH  "/bin:/usr/bin:/usr/ucb"
+#define _PATH_STDPATH  "/bin:/usr/bin:/usr/ucb"
+#define ROOT_PATH      "/bin:/usr/bin:/usr/etc:/usr/ucb"
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "netinfo:/aliases"
+#include <libc.h>
+#define MISSING_POSIX_S_IS
+#define MISSING_POSIX_S_MODES
+/* It's amazing what is all missing... */
+#define isascii(c)     ((unsigned)(c)<=0177)
+extern int opterr;
+
+#define MISSING_PID_T
+#define MISSING_STRFTIME_E
+#define FD_CLOEXEC     1
+#define O_NONBLOCK     O_NDELAY
+#define WEXITSTATUS(x) ((x).w_retcode)
+#define WTERMSIG(x)    ((x).w_termsig)
+#define NORETURN                       /* the native compiler */
+#endif
+
+#ifdef ReliantUnix543
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_DEFPATH  "/usr/bin:/usr/ucb"
+#define _PATH_BSHELL   "/bin/sh"
+#define _PATH_MAILDIR  "/var/spool/mail"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define FIONREAD_IN_SYS_FILIO_H
+#define USE_SYS_SOCKIO_H
+#define HAS_DBM
+#define DEF_DB_TYPE    "dbm"
+#define ALIAS_DB_MAP   "dbm:/var/adm/sendmail/aliases"
+extern int optind;                     /* XXX use <getopt.h> */
+extern char *optarg;                   /* XXX use <getopt.h> */
+extern int opterr;                     /* XXX use <getopt.h> */
+
+#define HAS_NIS
+#define GETTIMEOFDAY(t) gettimeofday(t)
+#define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define MISSING_USLEEP
+#endif
+
+ /*
+  * We're not going to try to guess like configure does.
+  */
+#ifndef SUPPORTED
+#error "unsupported platform"
+#endif
+
+#ifdef DUP2_DUPS_CLOSE_ON_EXEC
+/* dup2_pass_on_exec() can be found in util/sys_compat.c */
+extern int dup2_pass_on_exec(int oldd, int newd);
+
+#define DUP2 dup2_pass_on_exec
+#else
+#define DUP2 dup2
+#endif
+
+#ifdef PREPEND_PLUS_TO_OPTSTRING
+#define GETOPT(argc, argv, str)        getopt((argc), (argv), "+" str)
+#else
+#define GETOPT(argc, argv, str) getopt((argc), (argv), (str))
+#endif
+#define OPTIND  (optind > 0 ? optind : 1)
+
+#if defined(USE_FCNTL_LOCK) && defined(USE_FLOCK_LOCK)
+#error "define USE_FCNTL_LOCK or USE_FLOCK_LOCK, not both"
+#endif
+
+#if !defined(USE_FCNTL_LOCK) && !defined(USE_FLOCK_LOCK)
+#error "define USE_FCNTL_LOCK or USE_FLOCK_LOCK"
+#endif
+
+#if defined(USE_STATFS) && defined(USE_STATVFS)
+#error "define USE_STATFS or USE_STATVFS, not both"
+#endif
+
+#if !defined(USE_STATFS) && !defined(USE_STATVFS)
+#error "define USE_STATFS or USE_STATVFS"
+#endif
+
+ /*
+  * Defaults for normal systems.
+  */
+#ifndef SOCKADDR_SIZE
+#define SOCKADDR_SIZE  int
+#endif
+
+#ifndef SOCKOPT_SIZE
+#define SOCKOPT_SIZE   int
+#endif
+
+#ifndef LOCAL_LISTEN
+#define LOCAL_LISTEN   unix_listen
+#define LOCAL_ACCEPT   unix_accept
+#define LOCAL_CONNECT  unix_connect
+#define LOCAL_TRIGGER  unix_trigger
+#endif
+
+#if !defined (HAVE_SYS_NDIR_H) && !defined (HAVE_SYS_DIR_H) \
+       && !defined (HAVE_NDIR_H)
+#define HAVE_DIRENT_H
+#endif
+
+#ifndef WAIT_STATUS_T
+typedef int WAIT_STATUS_T;
+
+#define NORMAL_EXIT_STATUS(status)     ((status) == 0)
+#endif
+
+ /*
+  * Turn on the compatibility stuff.
+  */
+#ifdef MISSING_UTIMBUF
+struct utimbuf {
+    time_t  actime;
+    time_t  modtime;
+};
+
+#endif
+
+#ifdef MISSING_STRERROR
+extern const char *strerror(int);
+
+#endif
+
+#if defined (MISSING_SETENV) || defined (MISSING_SETENV_PUTENV)
+extern int setenv(const char *, const char *, int);
+
+#endif
+
+#ifdef MISSING_SETEUID
+extern int seteuid(uid_t euid);
+
+#endif
+
+#ifdef MISSING_SETEGID
+extern int setegid(gid_t egid);
+
+#endif
+
+#ifdef MISSING_MKFIFO
+extern int mkfifo(char *, int);
+
+#endif
+
+#ifdef MISSING_WAITPID
+extern int waitpid(int, WAIT_STATUS_T *status, int options);
+
+#endif
+
+#ifdef MISSING_SETSID
+extern int setsid(void);
+
+#endif
+
+#ifdef MISSING_STD_FILENOS
+#define STDIN_FILENO   0
+#define STDOUT_FILENO  1
+#define STDERR_FILENO  2
+#endif
+
+#ifdef MISSING_PID_T
+typedef int pid_t;
+
+#endif
+
+#ifdef MISSING_POSIX_S_IS
+#define S_ISBLK(mode)  (((mode) & (_S_IFMT)) == (_S_IFBLK))
+#define S_ISCHR(mode)  (((mode) & (_S_IFMT)) == (_S_IFCHR))
+#define S_ISDIR(mode)  (((mode) & (_S_IFMT)) == (_S_IFDIR))
+#define S_ISSOCK(mode) (((mode) & (_S_IFMT)) == (_S_IFSOCK))
+#define S_ISFIFO(mode) (((mode) & (_S_IFMT)) == (_S_IFIFO))
+#define S_ISREG(mode)  (((mode) & (_S_IFMT)) == (_S_IFREG))
+#endif
+
+#ifdef MISSING_POSIX_S_MODES
+#define S_IRUSR        _S_IRUSR
+#define S_IRGRP        0000040
+#define S_IROTH        0000004
+#define S_IWUSR        _S_IWUSR
+#define S_IWGRP        0000020
+#define S_IWOTH        0000002
+#define S_IXUSR        _S_IXUSR
+#define S_IXGRP        0000010
+#define S_IXOTH        0000001
+#define        S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#endif
+
+ /*
+  * Need to specify what functions never return, so that the compiler can
+  * warn for missing initializations and other trouble. However, OPENSTEP4
+  * gcc 2.7.x cannot handle this so we define this only if NORETURN isn't
+  * already defined above.
+  */
+#ifndef NORETURN
+#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ >= 3
+#define NORETURN       void __attribute__((__noreturn__))
+#endif
+#endif
+
+#ifndef NORETURN
+#define NORETURN       void
+#endif
+
+ /*
+  * Making the ctype.h macros not more expensive than necessary. On some
+  * systems, ctype.h misbehaves badly with signed characters.
+  */
+#define _UCHAR_(c)     ((unsigned char)(c))
+#ifdef UNSAFE_CTYPE
+#define ISASCII(c)     isascii(_UCHAR_(c))
+#define ISALNUM(c)     (ISASCII(c) && isalnum(c))
+#define ISALPHA(c)     (ISASCII(c) && isalpha(c))
+#define ISCNTRL(c)     (ISASCII(c) && iscntrl(c))
+#define ISDIGIT(c)     (ISASCII(c) && isdigit(c))
+#define ISGRAPH(c)     (ISASCII(c) && isgraph(c))
+#define ISLOWER(c)     (ISASCII(c) && islower(c))
+#define ISPRINT(c)     (ISASCII(c) && isprint(c))
+#define ISPUNCT(c)     (ISASCII(c) && ispunct(c))
+#define ISSPACE(c)     (ISASCII(c) && isspace(c))
+#define ISUPPER(c)     (ISASCII(c) && isupper(c))
+#define TOLOWER(c)     (ISUPPER(c) ? tolower(c) : (c))
+#define TOUPPER(c)     (ISLOWER(c) ? toupper(c) : (c))
+#else
+#define ISASCII(c)     isascii(_UCHAR_(c))
+#define ISALNUM(c)     isalnum(_UCHAR_(c))
+#define ISALPHA(c)     isalpha(_UCHAR_(c))
+#define ISCNTRL(c)     iscntrl(_UCHAR_(c))
+#define ISDIGIT(c)     isdigit(_UCHAR_(c))
+#define ISGRAPH(c)     isgraph(_UCHAR_(c))
+#define ISLOWER(c)     islower(_UCHAR_(c))
+#define ISPRINT(c)     isprint(_UCHAR_(c))
+#define ISPUNCT(c)     ispunct(_UCHAR_(c))
+#define ISSPACE(c)     isspace(_UCHAR_(c))
+#define ISUPPER(c)     isupper(_UCHAR_(c))
+#define TOLOWER(c)     tolower(_UCHAR_(c))
+#define TOUPPER(c)     toupper(_UCHAR_(c))
+#endif
+
+ /*
+  * Scaffolding. I don't want to lose messages while the program is under
+  * development.
+  */
+extern int REMOVE(const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/timed_connect.h b/postfix/include/timed_connect.h
new file mode 100644 (file)
index 0000000..76ac715
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _TIMED_CONNECT_H_INCLUDED_
+#define _TIMED_CONNECT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     timed_connect 3h
+/* SUMMARY
+/*     connect operation with timeout
+/* SYNOPSIS
+/*     #include <sys/socket.h>
+/*     #include <timed_connect.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern int timed_connect(int, struct sockaddr *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/timed_wait.h b/postfix/include/timed_wait.h
new file mode 100644 (file)
index 0000000..bdbc270
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef _TIMED_WAIT_H_INCLUDED_
+#define _TIMED_WAIT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     timed_wait 3h
+/* SUMMARY
+/*     wait operations with timeout
+/* SYNOPSIS
+/*     #include <timed_wait.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern int timed_waitpid(pid_t, WAIT_STATUS_T *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/trigger.h b/postfix/include/trigger.h
new file mode 100644 (file)
index 0000000..ffcf63c
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TRIGGER_H_INCLUDED_
+#define _TRIGGER_H_INCLUDED_
+
+/*++
+/* NAME
+/*     trigger 3h
+/* SUMMARY
+/*     client interface file
+/* SYNOPSIS
+/*     #include <trigger.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+extern int unix_trigger(const char *, const char *, int, int);
+extern int inet_trigger(const char *, const char *, int, int);
+extern int fifo_trigger(const char *, const char *, int, int);
+extern int stream_trigger(const char *, const char *, int, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/username.h b/postfix/include/username.h
new file mode 100644 (file)
index 0000000..648be45
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _USERNAME_H_INCLUDED_
+#define _USERNAME_H_INCLUDED_
+
+/*++
+/* NAME
+/*     username 3h
+/* SUMMARY
+/*     lookup name of real user
+/* SYNOPSIS
+/*     #include <username.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface. */
+
+extern const char *username(void);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/valid_hostname.h b/postfix/include/valid_hostname.h
new file mode 100644 (file)
index 0000000..69db140
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _VALID_HOSTNAME_H_INCLUDED_
+#define _VALID_HOSTNAME_H_INCLUDED_
+
+/*++
+/* NAME
+/*     valid_hostname 3h
+/* SUMMARY
+/*     validate hostname
+/* SYNOPSIS
+/*     #include <valid_hostname.h>
+/* DESCRIPTION
+/* .nf
+
+ /* External interface */
+
+#define VALID_HOSTNAME_LEN     255     /* RFC 1035 */
+#define VALID_LABEL_LEN                63      /* RFC 1035 */
+
+extern int valid_hostname(const char *);
+extern int valid_hostaddr(const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/vbuf.h b/postfix/include/vbuf.h
new file mode 100644 (file)
index 0000000..57aa6f6
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef _VBUF_H_INCLUDED_
+#define _VBUF_H_INCLUDED_
+
+/*++
+/* NAME
+/*     vbuf 3h
+/* SUMMARY
+/*     generic buffer
+/* SYNOPSIS
+/*     #include <vbuf.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * The VBUF buffer is defined by 1) its structure, by 2) the VBUF_GET() and
+  * 3) VBUF_PUT() operations that automatically handle buffer empty and
+  * buffer full conditions, and 4) by the VBUF_SPACE() operation that allows
+  * the user to reserve buffer space ahead of time, to allow for situations
+  * where calling VBUF_PUT() is not possible or desirable.
+  *
+  * The VBUF buffer does not specify primitives for memory allocation or
+  * deallocation. The purpose is to allow different applications to have
+  * different strategies: a memory-resident buffer; a memory-mapped file; or
+  * a stdio-like window to an open file. Each application provides its own
+  * get(), put() and space() methods that perform the necessary magic.
+  *
+  * This interface is pretty normal. With one exception: the number of bytes
+  * left to read is negated. This is done so that we can change direction
+  * between reading and writing on the fly.
+  */
+typedef struct VBUF VBUF;
+typedef int (*VBUF_GET_READY_FN) (VBUF *);
+typedef int (*VBUF_PUT_READY_FN) (VBUF *);
+typedef int (*VBUF_SPACE_FN) (VBUF *, int);
+
+struct VBUF {
+    int     flags;                     /* status, see below */
+    unsigned char *data;               /* variable-length buffer */
+    int     len;                       /* buffer length */
+    int     cnt;                       /* bytes left to read/write */
+    unsigned char *ptr;                        /* read/write position */
+    VBUF_GET_READY_FN get_ready;       /* read buffer empty action */
+    VBUF_PUT_READY_FN put_ready;       /* write buffer full action */
+    VBUF_SPACE_FN space;               /* request for buffer space */
+};
+
+ /*
+  * Typically, an application will embed a VBUF structure into a larger
+  * structure that also contains application-specific members. This approach
+  * gives us the best of both worlds. The application can still use the
+  * generic VBUF primitives for reading and writing VBUFs. The macro below
+  * transforms a pointer from VBUF structure to the structure that contains
+  * it.
+  */
+#define VBUF_TO_APPL(vbuf_ptr,app_type,vbuf_member) \
+    ((app_type *) (((char *) (vbuf_ptr)) - offsetof(app_type,vbuf_member)))
+
+ /*
+  * Buffer status management.
+  */
+#define        VBUF_FLAG_ERR   (1<<0)          /* some I/O error */
+#define VBUF_FLAG_EOF  (1<<1)          /* end of data */
+#define VBUF_FLAG_BAD  (VBUF_FLAG_ERR | VBUF_FLAG_EOF)
+#define VBUF_FLAG_FIXED        (1<<2)          /* fixed-size buffer */
+
+#define vbuf_error(v)  ((v)->flags & VBUF_FLAG_ERR)
+#define vbuf_eof(v)    ((v)->flags & VBUF_FLAG_EOF)
+#define vbuf_clearerr(v) ((v)->flags &= ~VBUF_FLAG_BAD)
+
+ /*
+  * Buffer I/O-like operations and results.
+  */
+#define VBUF_GET(v)    ((v)->cnt < 0 ? ++(v)->cnt, \
+                               (int) *(v)->ptr++ : vbuf_get(v))
+#define VBUF_PUT(v,c)  ((v)->cnt > 0 ? --(v)->cnt, \
+                               (int) (*(v)->ptr++ = (c)) : vbuf_put((v),(c)))
+#define VBUF_SPACE(v,n) ((v)->space((v),(n)))
+
+#define VBUF_EOF       (-1)            /* no more space or data */
+
+extern int vbuf_get(VBUF *);
+extern int vbuf_put(VBUF *, int);
+extern int vbuf_unget(VBUF *, int);
+extern int vbuf_read(VBUF *, char *, int);
+extern int vbuf_write(VBUF *, const char *, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/vbuf_print.h b/postfix/include/vbuf_print.h
new file mode 100644 (file)
index 0000000..32549c1
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _VBUF_PRINT_H_INCLUDED_
+#define _VBUF_PRINT_H_INCLUDED_
+
+/*++
+/* NAME
+/*     vbuf_print 3h
+/* SUMMARY
+/*     formatted print to generic buffer
+/* SYNOPSIS
+/*     #include <vbuf_print.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <stdarg.h>
+
+ /*
+  * Utility library.
+  */
+#include <vbuf.h>
+
+ /*
+  * External interface.
+  */
+extern VBUF *vbuf_print(VBUF *, const char *, va_list);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/vstream.h b/postfix/include/vstream.h
new file mode 100644 (file)
index 0000000..d67ee23
--- /dev/null
@@ -0,0 +1,135 @@
+#ifndef _VSTREAM_H_INCLUDED_
+#define _VSTREAM_H_INCLUDED_
+
+/*++
+/* NAME
+/*     vstream 3h
+/* SUMMARY
+/*     simple buffered I/O package
+/* SYNOPSIS
+/*     #include <vstream.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <fcntl.h>
+#include <stdarg.h>
+
+ /*
+  * Utility library.
+  */
+#include <vbuf.h>
+
+ /*
+  * Simple buffered stream. The members of this structure are not part of the
+  * official interface and can change without prior notice.
+  */
+typedef int (*VSTREAM_FN) (int, void *, unsigned);
+typedef int (*VSTREAM_WAITPID_FN) (pid_t, WAIT_STATUS_T *, int);
+
+typedef struct VSTREAM {
+    VBUF    buf;                       /* generic intelligent buffer */
+    int     fd;                                /* file handle, no 256 limit */
+    VSTREAM_FN read_fn;                        /* buffer fill action */
+    VSTREAM_FN write_fn;               /* buffer fill action */
+    long    offset;                    /* cached seek info */
+    char   *path;                      /* give it at least try */
+    int     read_fd;                   /* read channel (double-buffered) */
+    int     write_fd;                  /* write channel (double-buffered) */
+    VBUF    read_buf;                  /* read buffer (double-buffered) */
+    VBUF    write_buf;                 /* write buffer (double-buffered) */
+    pid_t   pid;                       /* vstream_popen/close() */
+    VSTREAM_WAITPID_FN waitpid_fn;     /* vstream_popen/close() */
+} VSTREAM;
+
+extern VSTREAM vstream_fstd[];         /* pre-defined streams */
+
+#define VSTREAM_IN             (&vstream_fstd[0])
+#define VSTREAM_OUT            (&vstream_fstd[1])
+#define VSTREAM_ERR            (&vstream_fstd[2])
+
+#define        VSTREAM_FLAG_ERR        VBUF_FLAG_ERR   /* some I/O error */
+#define VSTREAM_FLAG_EOF       VBUF_FLAG_EOF   /* end of file */
+#define VSTREAM_FLAG_FIXED     VBUF_FLAG_FIXED /* fixed-size buffer */
+#define VSTREAM_FLAG_BAD       VBUF_FLAG_BAD
+
+#define VSTREAM_FLAG_READ      (1<<8)  /* read buffer */
+#define VSTREAM_FLAG_WRITE     (1<<9)  /* write buffer */
+#define VSTREAM_FLAG_SEEK      (1<<10) /* seek info valid */
+#define VSTREAM_FLAG_NSEEK     (1<<11) /* can't seek this file */
+#define VSTREAM_FLAG_DOUBLE    (1<<12) /* double buffer */
+
+#define VSTREAM_BUFSIZE                4096
+
+extern VSTREAM *vstream_fopen(const char *, int, int);
+extern int vstream_fclose(VSTREAM *);
+extern long vstream_fseek(VSTREAM *, long, int);
+extern long vstream_ftell(VSTREAM *);
+extern int vstream_fflush(VSTREAM *);
+extern int vstream_fputs(const char *, VSTREAM *);
+extern VSTREAM *vstream_fdopen(int, int);
+
+#define vstream_fread(v, b, n) vbuf_read(&(v)->buf, (b), (n))
+#define vstream_fwrite(v, b, n)        vbuf_write(&(v)->buf, (b), (n))
+
+#define VSTREAM_PUTC(ch, vp)   VBUF_PUT(&(vp)->buf, (ch))
+#define VSTREAM_GETC(vp)       VBUF_GET(&(vp)->buf)
+#define vstream_ungetc(vp, ch) vbuf_unget(&(vp)->buf, (ch))
+#define VSTREAM_EOF            VBUF_EOF
+
+#define VSTREAM_PUTCHAR(ch)    VSTREAM_PUTC((ch), VSTREAM_OUT)
+#define VSTREAM_GETCHAR()      VSTREAM_GETC(VSTREAM_IN)
+
+#define vstream_fileno(vp)     ((vp)->fd)
+#define vstream_ferror(vp)     vbuf_error(&(vp)->buf)
+#define vstream_feof(vp)       vbuf_eof(&(vp)->buf)
+#define vstream_clearerr(vp)   vbuf_clearerr(&(vp)->buf)
+#define VSTREAM_PATH(vp)       ((vp)->path ? (vp)->path : "unknown_stream")
+
+extern void vstream_control(VSTREAM *, int,...);
+
+#define VSTREAM_CTL_END                0
+#define VSTREAM_CTL_READ_FN    1
+#define VSTREAM_CTL_WRITE_FN   2
+#define VSTREAM_CTL_PATH       3
+#define VSTREAM_CTL_DOUBLE     4
+#define VSTREAM_CTL_READ_FD    5
+#define VSTREAM_CTL_WRITE_FD   6
+#define VSTREAM_CTL_WAITPID_FN 7
+
+extern VSTREAM *vstream_printf(const char *,...);
+extern VSTREAM *vstream_fprintf(VSTREAM *, const char *,...);
+
+extern VSTREAM *vstream_popen(const char *, int);
+extern VSTREAM *vstream_popen_vargs(int,...);
+extern int vstream_pclose(VSTREAM *);
+
+#define vstream_ispipe(vp)     ((vp)->pid != 0)
+
+#define VSTREAM_POPEN_END      0       /* terminator */
+#define VSTREAM_POPEN_COMMAND  1       /* command is string */
+#define VSTREAM_POPEN_ARGV     2       /* command is array */
+#define VSTREAM_POPEN_UID      3       /* privileges */
+#define VSTREAM_POPEN_GID      4       /* privileges */
+#define VSTREAM_POPEN_ENV      5       /* extra environment */
+#define VSTREAM_POPEN_SHELL    6       /* alternative shell */
+#define VSTREAM_POPEN_WAITPID_FN 7     /* child catcher, waitpid() compat. */
+
+extern VSTREAM *vstream_vfprintf(VSTREAM *, const char *, va_list);
+
+extern int vstream_peek(VSTREAM *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/vstring.h b/postfix/include/vstring.h
new file mode 100644 (file)
index 0000000..4d4a972
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef _VSTRING_H_INCLUDED_
+#define _VSTRING_H_INCLUDED_
+
+/*++
+/* NAME
+/*     vstring 3h
+/* SUMMARY
+/*     arbitrary-length string manager
+/* SYNOPSIS
+/*     #include "vstring.h"
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * System library.
+  */
+#include <stdarg.h>
+
+ /*
+  * Utility library.
+  */
+#include <vbuf.h>
+
+ /*
+  * We can't allow bare VBUFs in the interface, because VSTRINGs have a
+  * specific initialization and destruction sequence.
+  */
+typedef struct VSTRING {
+    VBUF    vbuf;
+    int     maxlen;
+} VSTRING;
+
+extern void vstring_init(VSTRING *, int);
+extern void vstring_wipe(VSTRING *);
+extern VSTRING *vstring_alloc(int);
+extern void vstring_ctl(VSTRING *,...);
+extern VSTRING *vstring_truncate(VSTRING *, int);
+extern VSTRING *vstring_free(VSTRING *);
+extern VSTRING *vstring_strcpy(VSTRING *, const char *);
+extern VSTRING *vstring_strncpy(VSTRING *, const char *, int);
+extern VSTRING *vstring_strcat(VSTRING *, const char *);
+extern VSTRING *vstring_strncat(VSTRING *, const char *, int);
+extern VSTRING *vstring_sprintf(VSTRING *, const char *,...);
+extern VSTRING *vstring_sprintf_append(VSTRING *, const char *,...);
+extern char *vstring_export(VSTRING *);
+extern VSTRING *vstring_import(char *);
+
+#define VSTRING_CTL_MAXLEN     1
+#define VSTRING_CTL_END                0
+
+ /*
+  * Macros. Unsafe macros have UPPERCASE names.
+  */
+#define VSTRING_SPACE(vp, len) ((vp)->vbuf.space(&(vp)->vbuf, len))
+#define vstring_str(vp)                ((char *) (vp)->vbuf.data)
+#define VSTRING_LEN(vp)                ((vp)->vbuf.ptr - (vp)->vbuf.data)
+#define vstring_end(vp)                ((char *) (vp)->vbuf.ptr)
+#define VSTRING_TERMINATE(vp)  { if ((vp)->vbuf.cnt <= 0) \
+                                       VSTRING_SPACE((vp),1); \
+                                 *(vp)->vbuf.ptr = 0; }
+#define VSTRING_RESET(vp)      { (vp)->vbuf.ptr = (vp)->vbuf.data; \
+                                 (vp)->vbuf.cnt = (vp)->vbuf.len; }
+#define        VSTRING_ADDCH(vp, ch)   VBUF_PUT(&(vp)->vbuf, ch)
+#define VSTRING_SKIP(vp)       { while ((vp)->vbuf.cnt > 0 && *(vp)->vbuf.ptr) \
+                                 (vp)->vbuf.ptr++, (vp)->vbuf.cnt--; }
+#define vstring_avail(vp)      ((vp)->vbuf.cnt)
+
+ /*
+  * The following macro is not part of the public interface, because it can
+  * really screw up a buffer by positioning past allocated memory.
+  */
+#define VSTRING_AT_OFFSET(vp, offset) { \
+       (vp)->vbuf.ptr = (vp)->vbuf.data + (offset); \
+       (vp)->vbuf.cnt = (vp)->vbuf.len - (offset); \
+    }
+
+extern VSTRING *vstring_vsprintf(VSTRING *, const char *, va_list);
+extern VSTRING *vstring_vsprintf_append(VSTRING *, const char *, va_list);
+
+/* BUGS
+/*     Auto-resizing may change the address of the string data in
+/*     a vstring structure. Beware of dangling pointers.
+/* HISTORY
+/* .ad
+/* .fi
+/*     A vstring module appears in the UNPROTO software by Wietse Venema.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/include/vstring_vstream.h b/postfix/include/vstring_vstream.h
new file mode 100644 (file)
index 0000000..897167c
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _VSTRING_VSTREAM_H_INCLUDED_
+#define _VSTRING_VSTREAM_H_INCLUDED_
+
+/*++
+/* NAME
+/*     vstring_vstream 3h
+/* SUMMARY
+/*     auto-resizing string library
+/* SYNOPSIS
+/*     #include <vstring_vstream.h>
+/* DESCRIPTION
+
+ /*
+  * Utility library.
+  */
+#include <vstream.h>
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern int vstring_get(VSTRING *, VSTREAM *);
+extern int vstring_get_nonl(VSTRING *, VSTREAM *);
+extern int vstring_get_null(VSTRING *, VSTREAM *);
+extern int vstring_get_bound(VSTRING *, VSTREAM *, int);
+extern int vstring_get_nonl_bound(VSTRING *, VSTREAM *, int);
+
+ /*
+  * Backwards compatibility for code that still uses the vstring_fgets()
+  * interface. Unfortunately we can't change the macro name to upper case.
+  */
+#define vstring_fgets(s, p) \
+       (vstring_get((s), (p)) == VSTREAM_EOF ? 0 : (s))
+#define vstring_fgets_nonl(s, p) \
+       (vstring_get_nonl((s), (p)) == VSTREAM_EOF ? 0 : (s))
+#define vstring_fgets_null(s, p) \
+       (vstring_get_null((s), (p)) == VSTREAM_EOF ? 0 : (s))
+#define vstring_fgets_bound(s, p, l) \
+       (vstring_get_bound((s), (p), (l)) == VSTREAM_EOF ? 0 : (s))
+#define vstring_fgets_nonl_bound(s, p, l) \
+       (vstring_get_nonl_bound((s), (p), (l)) == VSTREAM_EOF ? 0 : (s))
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
diff --git a/postfix/lib/.pure b/postfix/lib/.pure
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/postfix/local/feature.c b/postfix/local/feature.c
new file mode 100644 (file)
index 0000000..1a1db60
--- /dev/null
@@ -0,0 +1,91 @@
+/*++
+/* NAME
+/*     feature 3
+/* SUMMARY
+/*     toggle features depending on address
+/* SYNOPSIS
+/*     #include "local.h"
+/*
+/*     int     feature_control(state)
+/*     LOCAL_STATE state;
+/* DESCRIPTION
+/*     feature_control() breaks the localpart of the recipient
+/*     address up into fields, according to the recipient feature
+/*     delimiter, and turns on/off the features as encountered.
+/*
+/*     Arguments:
+/* .IP state
+/*     The attributes that specify the message, recipient and more.
+/*     Attributes describing the alias, include or forward expansion.
+/*     A table with the results from expanding aliases or lists.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <string.h>
+
+#ifdef STRCASECMP_IN_STRINGS_H
+#include <strings.h>
+#endif
+
+/* Utility library. */
+
+#include <msg.h>
+#include <stringops.h>
+#include <mymalloc.h>
+
+/* Global library. */
+
+#include <mail_params.h>
+
+/* Application-specific. */
+
+#include "local.h"
+
+struct feature_map {
+    char   *name;
+    int     mask;
+};
+
+static struct feature_map feature_map[] = {
+    "nodelivered", FEATURE_NODELIVERED,
+    0,
+};
+
+/* feature_control - extract delivery options from recipient localpart */
+
+int     feature_control(const char *localpart)
+{
+    struct feature_map *mp;
+    char   *saved_localpart;
+    char   *ptr;
+    int     mask = 0;
+    char   *cp;
+
+    if (*var_rcpt_fdelim) {
+       ptr = saved_localpart = mystrdup(localpart);
+       while ((cp = mystrtok(&ptr, var_rcpt_fdelim)) != 0) {
+           for (mp = feature_map; mp->name; mp++)
+               if (strcasecmp(mp->name, cp) == 0) {
+                   if (msg_verbose)
+                       msg_info("feature: %s", mp->name);
+                   mask |= mp->mask;
+                   break;
+               }
+       }
+       myfree(saved_localpart);
+    }
+    if (msg_verbose)
+       msg_info("features: 0x%x", mask);
+    return (mask);
+}
index d42223b5193c0db2fae9a50b0222bc66600d30b8..90c6ff84d3d3a9df964abbb4a0ed859f8595c253 100644 (file)
@@ -43,6 +43,7 @@
 /*     Characters that may have special meaning to the shell or file system
 /*     are replaced by underscores.  The list of acceptable characters
 /*     is specified with the \fBforward_expansion_filter\fR configuration
+/*     parameter.
 /*
 /*     An alias or ~/.\fBforward\fR file may list any combination of external
 /*     commands, destination file names, \fB:include:\fR directives, or
index c074ae27bc01158f2f1c0c4638d80659e9cad8b2..cbcd8ec54b4ec81290102a9760d8cadaccaadf0d 100644 (file)
@@ -231,8 +231,6 @@ static int pickup_copy(VSTREAM *qfile, VSTREAM *cleanup,
      * If the segment contains a recipient address, include the optional
      * always_bcc recipient.
      */
-    info->sender = 0;
-    info->rcpt = 0;
     if ((status = copy_segment(qfile, cleanup, info, buf, REC_TYPE_ENVELOPE)) != 0)
        return (status);
     if (info->sender == 0) {
@@ -241,12 +239,10 @@ static int pickup_copy(VSTREAM *qfile, VSTREAM *cleanup,
     }
     msg_info("%s: uid=%d from=<%s>", info->id,
             (int) info->st.st_uid, info->sender);
-    myfree(info->sender);
 
     if (info->rcpt) {
        if (*var_always_bcc)
            rec_fputs(cleanup, REC_TYPE_RCPT, var_always_bcc);
-       myfree(info->rcpt);
     }
 
     /*
@@ -361,10 +357,31 @@ static int pickup_file(PICKUP_INFO *info)
     vstream_fclose(qfile);
     vstream_fclose(cleanup);
     vstring_free(buf);
-    myfree(info->id);
     return (status);
 }
 
+/* pickup_init - init info structure */
+
+static void pickup_init(PICKUP_INFO *info)
+{
+    info->id = 0;
+    info->path = 0;
+    info->sender = 0;
+    info->rcpt = 0;
+}
+
+/* pickup_free - wipe info structure */
+
+static void pickup_free(PICKUP_INFO *info)
+{
+#define SAFE_FREE(x) { if (x) myfree(x); }
+
+    SAFE_FREE(info->id);
+    SAFE_FREE(info->path);
+    SAFE_FREE(info->sender);
+    SAFE_FREE(info->rcpt);
+}
+
 /* pickup_service - service client */
 
 static void pickup_service(char *unused_buf, int unused_len,
@@ -395,6 +412,7 @@ static void pickup_service(char *unused_buf, int unused_len,
        scan = scan_dir_open(queue_name);
        while ((id = scan_dir_next(scan)) != 0) {
            if (mail_open_ok(queue_name, id, &info.st, &path) == MAIL_OPEN_YES) {
+               pickup_init(&info);
                info.path = mystrdup(path);
                if (pickup_file(&info) == REMOVE_MESSAGE_FILE) {
                    if (REMOVE(info.path))
@@ -402,7 +420,7 @@ static void pickup_service(char *unused_buf, int unused_len,
                    else
                        file_count++;
                }
-               myfree(info.path);
+               pickup_free(&info);
            }
        }
        scan_dir_close(scan);
index a80d8262d1367f2f88d5c30d33a2390483b21853..5a305453f52ca2dd7edbd88f1701ad2309bb67b1 100644 (file)
@@ -276,7 +276,7 @@ static void postalias(char *map_type, char *path_name,
 
 static NORETURN usage(char *myname)
 {
-    msg_fatal("usage: %s [-c config_directory] [-i] [-v] [-w] [output_type:]file...",
+    msg_fatal("usage: %s [-c config_dir] [-i] [-v] [-w] [output_type:]file...",
              myname);
 }
 
diff --git a/postfix/postconf/extract.sh b/postfix/postconf/extract.sh
new file mode 100644 (file)
index 0000000..69323b4
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Extract initialization tables from actual source code.
+
+awk '
+/static CONFIG_INT_TABLE/,/};/ { 
+    if ($1 ~ /VAR/) {
+       print "int " substr($3,2,length($3)-2) ";" > "int_vars.h"
+       print | "sort -u >int_table.h" 
+    }
+}
+/static CONFIG_STR_TABLE/,/};/ { 
+    if ($1 ~ /VAR/) {
+       print "char *" substr($3,2,length($3)-2) ";" > "str_vars.h"
+       print | "sort -u >str_table.h" 
+    }
+}
+/static CONFIG_BOOL_TABLE/,/};/ { 
+    if ($1 ~ /VAR/) {
+       print "int " substr($3,2,length($3)-2) ";" > "bool_vars.h"
+       print | "sort -u >bool_table.h" 
+    }
+}
+' $*
index 762f23b39cbb1460e3a57771edb670228e1f7607..b8cb48fa9f5cdc4b23fca3f24578253a8d1ee289 100644 (file)
@@ -18,7 +18,7 @@
 /* .IP \fB-d\fR
 /*     Print default parameter settings instead of actual settings.
 /* .IP \fB-h\fR
-/*     Show parameter values only, not the ``name ='' label
+/*     Show parameter values only, not the ``name = '' label
 /*     that normally precedes the value.
 /* .IP \fB-n\fR
 /*     Print non-default parameter settings only.
@@ -27,8 +27,6 @@
 /*     options make the software increasingly verbose.
 /* DIAGNOSTICS
 /*     Problems are reported to the standard error stream.
-/*     Fatal error: out of memory, file not found, invalid \fBmain.cf\fR
-/*     parameter syntax.
 /* LICENSE
 /* .ad
 /* .fi
@@ -293,8 +291,6 @@ static void print_bool(int mode, CONFIG_BOOL_TABLE *cbt)
        show_strval(mode, cbt->name, cbt->defval ? "yes" : "no");
     } else {
        value = dict_lookup(CONFIG_DICT, cbt->name);
-       if (value)
-           (void) get_mail_conf_bool(cbt->name, cbt->defval);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_strval(mode, cbt->name, cbt->defval ? "yes" : "no");
@@ -318,8 +314,6 @@ static void print_int(int mode, CONFIG_INT_TABLE *cit)
        show_intval(mode, cit->name, cit->defval);
     } else {
        value = dict_lookup(CONFIG_DICT, cit->name);
-       if (value)
-           (void) get_mail_conf_int(cit->name, cit->defval, cit->min, cit->max);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_intval(mode, cit->name, cit->defval);
@@ -343,8 +337,6 @@ static void print_str(int mode, CONFIG_STR_TABLE *cst)
        show_strval(mode, cst->name, cst->defval);
     } else {
        value = dict_lookup(CONFIG_DICT, cst->name);
-       if (value)
-           (void) get_mail_conf_str(cst->name, cst->defval, cst->min, cst->max);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_strval(mode, cst->name, cst->defval);
@@ -520,7 +512,7 @@ int     main(int argc, char **argv)
            msg_verbose++;
            break;
        default:
-           msg_fatal("usage: %s [-c config_directory] [-d (defaults)] [-h (no names)] [-n (non-defaults)] [-v] name...", argv[0]);
+           msg_fatal("usage: %s [-c config_dir] [-d (defaults)] [-h (no names)] [-n (non-defaults)] [-v] name...", argv[0]);
        }
     }
 
index 44b2ad14293e461073c1fec7aa97326e2133dcdf..a4ac5ff7bce359e14eb16c4d4282ab1362ed2f8a 100644 (file)
@@ -200,21 +200,21 @@ int     main(int argc, char **argv)
 #ifdef USE_DOT_LOCK
     if (dot_lockfile(folder, why) < 0) {
        if (errno == EEXIST) {
-           msg_warn("dotlock file %s: %s", folder, vstring_str(why));
+           msg_warn("%s", vstring_str(why));
            exit(EX_TEMPFAIL);
        }
-       msg_fatal("dotlock file %s: %s", folder, vstring_str(why));
+       msg_fatal("%s", vstring_str(why));
     }
 #endif
     if (deliver_flock(fd, why) < 0) {
        if (errno == EAGAIN) {
-           msg_warn("lock %s: %s", folder, vstring_str(why));
+           msg_warn("file %s: %s", folder, vstring_str(why));
 #ifdef USE_DOT_LOCK
            dot_unlockfile(folder);
 #endif
            exit(EX_TEMPFAIL);
        }
-       msg_fatal("lock %s: %s", folder, vstring_str(why));
+       msg_fatal("file %s: %s", folder, vstring_str(why));
     }
 
     /*
index 5227bece2c20eb05c0bc6dcb3a8aad32134a11c3..72ddfa44ae9d3607c4da4981a8584fd85594b271 100644 (file)
@@ -230,7 +230,7 @@ static void postmap(char *map_type, char *path_name,
 
 static NORETURN usage(char *myname)
 {
-    msg_fatal("usage: %s [-c config_directory] [-i] [-v] [-w] [output_type:]file...",
+    msg_fatal("usage: %s [-c config_dir] [-i] [-v] [-w] [output_type:]file...",
              myname);
 }
 
index d023ae31a51015a178a12178119293a5444d2a32..257dbc4aa0daa4f396d7502c6b1e2e38c7eafac5 100644 (file)
@@ -127,29 +127,28 @@ static void qmgr_active_corrupt(const char *queue_id)
 
 /* qmgr_active_defer - defer queue file */
 
-static void qmgr_active_defer(QMGR_MESSAGE *message, time_t delay)
+static void qmgr_active_defer(const char *queue_name, const char *queue_id,
+                                     int delay)
 {
     char   *myname = "qmgr_active_defer";
     const char *path;
     struct utimbuf tbuf;
 
     if (msg_verbose)
-       msg_info("wakeup %s after %ld secs", message->queue_id, (long) delay);
+       msg_info("wakeup %s after %ld secs", queue_id, (long) delay);
 
     tbuf.actime = tbuf.modtime = event_time() + delay;
-    path = mail_queue_path((VSTRING *) 0, message->queue_name,
-                          message->queue_id);
+    path = mail_queue_path((VSTRING *) 0, queue_name, queue_id);
     if (utime(path, &tbuf) < 0)
        msg_fatal("%s: update %s time stamps: %m", myname, path);
-    if (mail_queue_rename(message->queue_id, message->queue_name,
-                         MAIL_QUEUE_DEFERRED)) {
+    if (mail_queue_rename(queue_id, queue_name, MAIL_QUEUE_DEFERRED)) {
        if (errno != ENOENT)
            msg_fatal("%s: rename %s from %s to %s: %m", myname,
-              message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
+                     queue_id, queue_name, MAIL_QUEUE_DEFERRED);
        msg_warn("%s: rename %s from %s to %s: %m", myname,
-              message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
+                queue_id, queue_name, MAIL_QUEUE_DEFERRED);
     } else if (msg_verbose) {
-       msg_info("%s: defer %s", myname, message->queue_id);
+       msg_info("%s: defer %s", myname, queue_id);
     }
 }
 
@@ -218,7 +217,7 @@ void    qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id)
                                      scan_info->flags)) == 0) {
        qmgr_active_corrupt(queue_id);
     } else if (message == QMGR_MESSAGE_LOCKED) {
-       qmgr_active_defer(message, (time_t) var_min_backoff_time);
+       qmgr_active_defer(MAIL_QUEUE_ACTIVE, queue_id, var_min_backoff_time);
     } else {
 
        /*
@@ -245,7 +244,7 @@ void    qmgr_active_done(QMGR_MESSAGE *message)
     char   *myname = "qmgr_active_done";
     struct stat st;
     const char *path;
-    time_t  delay;
+    int     delay;
 
     if (msg_verbose)
        msg_info("%s: %s", myname, message->queue_id);
@@ -359,7 +358,7 @@ void    qmgr_active_done(QMGR_MESSAGE *message)
        } else {
            delay = var_min_backoff_time;
        }
-       qmgr_active_defer(message, delay);
+       qmgr_active_defer(message->queue_name, message->queue_id, delay);
     }
 
     /*
index 1e6ec2e25b844996d4cb54d10e8e1bb778741bd8..e47527a621a52e938a9a75ede6a8d59e84fe8e60 100644 (file)
@@ -672,6 +672,7 @@ QMGR_MESSAGE *qmgr_message_alloc(const char *queue_name, const char *queue_id,
        return (0);
     }
     if (myflock(vstream_fileno(message->fp), QMGR_LOCK_MODE) < 0) {
+       msg_info("%s: skipped, still being delivered", queue_id);
        qmgr_message_close(message);
        qmgr_message_free(message);
        return (QMGR_MESSAGE_LOCKED);
index ae44fb041c2a2d766d4e8c590e63bce241bd6fd2..865483f8273af0a9301a5f0a4303e3de835644fc 100644 (file)
 #include <safe.h>
 #include <iostuff.h>
 #include <stringops.h>
+#include <set_ugid.h>
 
 /* Global library. */
 
@@ -596,17 +597,18 @@ int     main(int argc, char **argv)
     set_mail_conf_str(VAR_PROCNAME, var_procname = mystrdup(argv[0]));
 
     /*
-     * Do not set[e]uid(getuid()). This allows the real user to manipulate
-     * the process, which is dangerous, because some systems do not reset the
-     * saved set-userid unless euid == 0.
+     * Some sites mistakenly install Postfix sendmail as set-uid root. Drop
+     * set-uid privileges only when root, otherwise some systems will not
+     * reset the saved set-userid, which would be a security vulnerability.
      */
-#ifdef WARN_SETXID_SENDMAIL
-    if (geteuid() != getuid())
-       msg_warn("sendmail is set-uid or is run from a set-uid process");
-    if (getegid() != getgid())
-       msg_warn("sendmail is set-gid or is run from a set-gid process");
-#endif
+    if (geteuid() == 0 && getuid() != 0) {
+       msg_warn("sendmail is set-uid root, or is run from a set-uid root process");
+       set_ugid(getuid(), getgid());
+    }
 
+    /*
+     * Further initialization...
+     */
     mail_conf_read();
     if (chdir(var_queue_dir))
        msg_fatal("chdir %s: %m", var_queue_dir);
index 801d1820fb07366c8661a25f0a25843824cbe8a2..1e6c46a51d9e02b5fdc7ece8c78ead80f4775c85 100644 (file)
@@ -215,7 +215,6 @@ int     smtp_errno;
 
 static int deliver_message(DELIVER_REQUEST *request)
 {
-    char   *myname = "deliver_message";
     VSTRING *why;
     SMTP_STATE *state;
     int     result;
index 86e257268f6d9245f5ba716233594692183b8681..08a88b4831dc3018eaa6c56dfd27bb97909bfeba 100644 (file)
@@ -324,8 +324,7 @@ static DNS_RR *smtp_find_self(DNS_RR *addr_list)
 
 /* smtp_truncate_self - truncate address list at self and equivalents */
 
-static DNS_RR *smtp_truncate_self(DNS_RR *addr_list, unsigned pref,
-                                         char *name, VSTRING *why)
+static DNS_RR *smtp_truncate_self(DNS_RR *addr_list, unsigned pref, char *name)
 {
     DNS_RR *addr;
     DNS_RR *last;
@@ -336,11 +335,6 @@ static DNS_RR *smtp_truncate_self(DNS_RR *addr_list, unsigned pref,
                smtp_print_addr("truncated", addr);
            dns_rr_free(addr);
            if (last == 0) {
-               if (*var_bestmx_transp == 0) {
-                   vstring_sprintf(why, "mail for %s loops back to myself",
-                                   name);
-                   smtp_errno = SMTP_FAIL;
-               }
                addr_list = 0;
            } else {
                last->next = 0;
@@ -368,6 +362,11 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
     unsigned best_pref;
     unsigned best_found;
 
+    /*
+     * Preferences from DNS use 0..32767, fall-backs use 32768+.
+     */
+#define IMPOSSIBLE_PREFERENCE  (~0)
+
     /*
      * Sanity check.
      */
@@ -381,8 +380,19 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
      * preferred than myself. When no MX resource records exist, look up the
      * addresses listed for this name.
      * 
+     * Normally it is OK if an MX host cannot be found in the DNS; we'll just
+     * use a backup one, and silently ignore the better MX host. However, if
+     * the best backup that we can find in the DNS is the local machine, then
+     * we must remember that the local machine is not the primary MX host, or
+     * else we will claim that mail loops back.
+     * 
      * XXX Optionally do A lookups even when the MX lookup didn't complete.
      * Unfortunately with some DNS servers this is not a transient problem.
+     * 
+     * XXX Ideally we would perform A lookups only as far as needed. But as long
+     * as we're looking up all the hosts, it would be better to look up the
+     * least preferred host first, so that DNS lookup error messages make
+     * more sense.
      */
     switch (dns_lookup(name, T_MX, 0, &mx_names, (VSTRING *) 0, why)) {
     default:
@@ -397,20 +407,29 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
        break;
     case DNS_OK:
        mx_names = dns_rr_sort(mx_names, smtp_compare_mx);
-       best_pref = (mx_names ? mx_names->pref : ~0);
+       best_pref = (mx_names ? mx_names->pref : IMPOSSIBLE_PREFERENCE);
        addr_list = smtp_addr_list(mx_names, why);
        dns_rr_free(mx_names);
-       best_found = (addr_list ? addr_list->pref : ~0);
+       best_found = (addr_list ? addr_list->pref : IMPOSSIBLE_PREFERENCE);
        if (*var_fallback_relay)
            addr_list = smtp_addr_fallback(addr_list);
        if (msg_verbose)
            smtp_print_addr(name, addr_list);
-       if ((self = smtp_find_self(addr_list)) != 0)
-           addr_list = smtp_truncate_self(addr_list, self->pref, name, why);
-       if (addr_list == 0 && best_pref < best_found) {
-           vstring_sprintf(why, "unable to find primary mail relay for %s",
-                           name);
-           smtp_errno = SMTP_RETRY;
+       if ((self = smtp_find_self(addr_list)) != 0) {
+           addr_list = smtp_truncate_self(addr_list, self->pref, name);
+           if (addr_list == 0) {
+               if (best_pref != best_found) {
+                   vstring_sprintf(why, "unable to find primary relay for %s",
+                                   name);
+                   smtp_errno = SMTP_RETRY;
+               } else if (*var_bestmx_transp != 0) {   /* we're best MX */
+                   smtp_errno = SMTP_OK;
+               } else {
+                   vstring_sprintf(why, "mail for %s loops back to myself",
+                                   name);
+                   smtp_errno = SMTP_FAIL;
+               }
+           }
        }
        break;
     case DNS_NOTFOUND:
index 7a091d2c68ca8f5750aab2c715f0aedb04f78c96..7f101a5a86c8ec3d7f0e4812f91722fdd07553d0 100644 (file)
 /*     The \fIrelay_domains_reject_code\fR configuration parameter specifies
 /*     the reject status code (default: 554).
 /* .IP reject_unauth_destination
-/*     Allow the request when the resolved recipient domain matches the
-/*     \fIrelay_domains\fR configuration parameter.  Reject the request
-/*     otherwise.  Same error code as check_relay_domains.
+/*     Reject the request when the resolved recipient domain does not match
+/*     the \fIrelay_domains\fR configuration parameter.  Same error code as
+/*     check_relay_domains.
 /* .IP permit_mx_backup
 /*     Allow the request when the local mail system is mail exchanger
 /*     for the recipient domain (this includes the case where the local
@@ -688,7 +688,7 @@ static int reject_unauth_destination(SMTPD_STATE *state, char *recipient)
     resolve_clnt_query(STR(query), &reply);
 
     /*
-     * Permit if destination is local. XXX This must be generalized for
+     * Pass if destination is local. XXX This must be generalized for
      * per-domain user tables and for non-UNIX local delivery agents.
      */
     if (STR(reply.nexthop)[0] == 0
@@ -697,13 +697,13 @@ static int reject_unauth_destination(SMTPD_STATE *state, char *recipient)
     domain += 1;
 
     /*
-     * Permit if the destination matches the relay_domains list.
+     * Pass if the destination matches the relay_domains list.
      */
     if (domain_list_match(relay_domains, domain))
        return (SMTPD_CHECK_DUNNO);
 
     /*
-     * Deny relaying between sites that both are not in relay_domains.
+     * Reject relaying to sites that are not listed in relay_domains.
      */
     return (smtpd_check_reject(state, MAIL_ERROR_POLICY,
                               "%d <%s>: Relay access denied",
diff --git a/postfix/util/compat.c b/postfix/util/compat.c
new file mode 100644 (file)
index 0000000..e69de29
index 46d9aea3db109af520273ccf0253a6f28d233cad..e626881772448c3525d8892ec6106ca8e834c2e3 100644 (file)
@@ -166,7 +166,7 @@ static void dict_dbm_update(DICT *dict, const char *name, const char *value)
      * Do the update.
      */
     if ((status = dbm_store(dict_dbm->dbm, dbm_key, dbm_value,
-       (dict->flags & DICT_FLAG_DUP_REPLACE) ? DBM_REPLACE : DBM_INSERT)) < 0)
+     (dict->flags & DICT_FLAG_DUP_REPLACE) ? DBM_REPLACE : DBM_INSERT)) < 0)
        msg_fatal("error writing DBM database %s: %m", dict_dbm->path);
     if (status) {
        if (dict->flags & DICT_FLAG_DUP_IGNORE)
@@ -385,6 +385,8 @@ DICT   *dict_dbm_open(const char *path, int open_flags, int dict_flags)
     if (fstat(dict_dbm->dict.fd, &st) < 0)
        msg_fatal("dict_dbm_open: fstat: %m");
     dict_dbm->dict.mtime = st.st_mtime;
+    close_on_exec(dbm_pagfno(dbm), CLOSE_ON_EXEC);
+    close_on_exec(dbm_dirfno(dbm), CLOSE_ON_EXEC);
     dict_dbm->dict.flags = dict_flags | DICT_FLAG_FIXED;
     if ((dict_flags & (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL)) == 0)
        dict_dbm->dict.flags |= (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL);
index 7a956383b2365bd8a084162dcc7eca3460088862..6665f8d39e10ff6336c4163659162fa2dae6e4a8 100644 (file)
@@ -339,7 +339,6 @@ extern int initgroups(const char *, int);
 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
 #define PREPEND_PLUS_TO_OPTSTRING
 #define HAS_POSIX_REGEXP
-#define WARN_SETXID_SENDMAIL
 #endif
 
  /*