diff --git a/postfix/HISTORY b/postfix/HISTORY index 35cdcb3f3..31031695d 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -4206,3 +4206,11 @@ Apologies for any names omitted. Gross hack: prevent looping a bad recipient by always forwarding recipients in :include: files, even when owner-listname is not set. File: local/recipient.c. + +20000919 + + Convenience: INSTALL.sh now imports default settings from + the process environment, in order to make scripting easier. + + Portability: another fix for NEXTSTEP (Masaki MURASE). + File: util/spawn_command.h. diff --git a/postfix/INSTALL.sh b/postfix/INSTALL.sh index 545dbb934..e281467d4 100644 --- a/postfix/INSTALL.sh +++ b/postfix/INSTALL.sh @@ -45,6 +45,10 @@ EOF # the time that a file does not exist, and avoid copying over programs # in order to not disturb running programs. +censored_ls() { + ls "$@" | egrep -v '^\.|/\.|CVS|RCS|SCCS' +} + compare_or_replace() { (cmp $2 $3 >/dev/null 2>&1 && echo Skipping $3...) || { echo Updating $3... @@ -102,21 +106,21 @@ esac # Default settings. Most are clobbered by remembered settings. -install_root=/ -tempdir=`pwd` -config_directory=/etc/postfix -daemon_directory=/usr/libexec/postfix -command_directory=/usr/sbin -queue_directory=/var/spool/postfix +: ${install_root=/} +: ${tempdir=`pwd`} +: ${config_directory=/etc/postfix} +: ${daemon_directory=/usr/libexec/postfix} +: ${command_directory=/usr/sbin} +: ${queue_directory=/var/spool/postfix} if [ -f /usr/lib/sendmail ] - then sendmail_path=/usr/lib/sendmail - else sendmail_path=/usr/sbin/sendmail + then : ${sendmail_path=/usr/lib/sendmail} + else : ${sendmail_path=/usr/sbin/sendmail} fi -newaliases_path=/usr/bin/newaliases -mailq_path=/usr/bin/mailq -mail_owner=postfix -setgid=no -manpages=/usr/local/man +: ${newaliases_path=/usr/bin/newaliases} +: ${mailq_path=/usr/bin/mailq} +: ${mail_owner=postfix} +: ${setgid=no} +: ${manpages=/usr/local/man} # Find out the location of configuration files. @@ -245,12 +249,12 @@ done # Install files. Be careful to not copy over running programs. -for file in `ls libexec | grep -v '^\.'` +for file in `censored_ls libexec` do compare_or_replace a+x,go-w libexec/$file $DAEMON_DIRECTORY/$file || exit 1 done -for file in `ls bin | grep '^post'` +for file in `censored_ls bin | grep '^post'` do compare_or_replace a+x,go-w bin/$file $COMMAND_DIRECTORY/$file || exit 1 done @@ -263,12 +267,12 @@ test -f bin/sendmail && { if [ -f $CONFIG_DIRECTORY/main.cf ] then - for file in LICENSE `cd conf; echo sample*` main.cf.default + for file in LICENSE `cd conf; censored_ls sample*` main.cf.default do compare_or_replace a+r,go-w conf/$file $CONFIG_DIRECTORY/$file || exit 1 done else - cp conf/* $CONFIG_DIRECTORY || exit 1 + cp `censored_ls conf/*` $CONFIG_DIRECTORY || exit 1 chmod a+r,go-w $CONFIG_DIRECTORY/* || exit 1 test -z "$install_root" && { @@ -332,7 +336,7 @@ no) ;; for dir in man? do test -d $MANPAGES/$dir || mkdir -p $MANPAGES/$dir || exit 1 done - for file in man?/* + for file in `censored_ls man?/*` do (test -f $MANPAGES/$file && cmp -s $file $MANPAGES/$file && echo Skipping $MANPAGES/$file...) || { diff --git a/postfix/Makefile.in b/postfix/Makefile.in index 4fa822d0f..a23a48682 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -4,7 +4,7 @@ OPTS = "CC=$(CC)" DIRS = util global dns master postfix smtpstone sendmail error \ pickup cleanup smtpd local lmtp trivial-rewrite qmgr smtp bounce pipe \ showq postalias postcat postconf postdrop postkick postlock postlog \ - postmap postsuper nqmgr # spawn base64 proto man html + postmap postsuper nqmgr spawn # base64 proto man html default: update diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index ff73e4d12..5a92053cf 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -1,4 +1,27 @@ -Incompatible changes with snapshot-20000625 +Incompatible changes with snapshot-20000919 +=========================================== + +The queue manager to delivery agent protocol has changed. This does +not affect the format of queue files, but means that you cannot +use this software with queue managers or delivery agents of prior +Postfix versions. + +Change in address rewriting: Errors-To:, Reply-To: and Return-Receipt: +are now rewritten as a sender address (was: recipient). + +Major changes with snapshot-20000919 +==================================== + +Postfix now strips out the Content-Length: header to avoid confusion +with mail user agents. + +The header_checks and body_checks features can now be used to strip +out unwanted data. Specify IGNORE and the data will go disappear. + +Postfix no longer inserts a Sender: message header when the +From: address differs from the envelope sender address. + +Incompatible changes with snapshot-20000625 (never released) =========================================== The local delivery agent no longer appends a blank line to mail diff --git a/postfix/base64/base64decode b/postfix/base64/base64decode deleted file mode 100755 index 67cbb9b3d..000000000 Binary files a/postfix/base64/base64decode and /dev/null differ diff --git a/postfix/base64/base64encode b/postfix/base64/base64encode deleted file mode 100755 index 8f1869c0d..000000000 Binary files a/postfix/base64/base64encode and /dev/null differ diff --git a/postfix/global/mail_version.h b/postfix/global/mail_version.h index 8830407cf..24ecdf683 100644 --- a/postfix/global/mail_version.h +++ b/postfix/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20000918" +#define DEF_MAIL_VERSION "Snapshot-20000919" extern char *var_mail_version; /* LICENSE diff --git a/postfix/local/dotforward.c b/postfix/local/dotforward.c index 12ae1241d..e3131d3f8 100644 --- a/postfix/local/dotforward.c +++ b/postfix/local/dotforward.c @@ -64,7 +64,6 @@ #include #include #include -#include #include #include #include @@ -79,7 +78,6 @@ #include #include #include -#include /* Application-specific. */ @@ -114,36 +112,18 @@ int deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) if (msg_verbose) MSG_LOG_STATE(myname, state); - /* - * Skip non-existing users. The mailbox delivery routine will catch the - * error. - * - * Defer delivery to recipients whose home directory is not accessible. - * - * XXX This code should be one level up. The caller should pass the - * recipient's password file info along with the call. - * - * XXX This code should also be executed for \user deliveries that bypass - * aliasing and .forward processing. Said code is currently broken after - * a revision of the RFC822 address parser. - */ - if ((mypwd = mypwnam(state.msg_attr.user)) == 0) - return (NO); - if (var_stat_home_dir - && stat_as(mypwd->pw_dir, &st, mypwd->pw_uid, mypwd->pw_gid) < 0) { - *statusp = defer_append(BOUNCE_FLAG_KEEP, - BOUNCE_ATTR(state.msg_attr), - "cannot access %s home directory %s: %m", - mypwd->pw_name, mypwd->pw_dir); - return (YES); - } - /* * Skip this module if per-user forwarding is disabled. */ if (*var_forward_path == 0) return (NO); + /* + * Skip non-existing users. The mailbox delivery routine will catch the + * error. + */ + if ((mypwd = mypwnam(state.msg_attr.user)) == 0) + return (NO); /* * From here on no early returns or we have a memory leak. diff --git a/postfix/local/recipient.c b/postfix/local/recipient.c index dbc7bc0f6..badf887ec 100644 --- a/postfix/local/recipient.c +++ b/postfix/local/recipient.c @@ -60,6 +60,7 @@ /* System library. */ #include +#include #include #include @@ -75,13 +76,16 @@ #include #include #include +#include /* Global library. */ #include +#include #include #include #include +#include /* Application-specific. */ @@ -93,6 +97,8 @@ static int deliver_switch(LOCAL_STATE state, USER_ATTR usr_attr) { char *myname = "deliver_switch"; int status = 0; + struct stat st; + struct mypasswd *mypwd; /* * Make verbose logging easier to understand. @@ -108,6 +114,8 @@ static int deliver_switch(LOCAL_STATE state, USER_ATTR usr_attr) * XXX This code currently does not work due to revision of the RFC822 * address parser. \user should be permitted only in locally specified * aliases, includes or forward files. + * + * XXX Should test for presence of user home directory. */ if (state.msg_attr.recipient[0] == '\\') { state.msg_attr.recipient++, state.msg_attr.local++, state.msg_attr.user++; @@ -161,13 +169,22 @@ static int deliver_switch(LOCAL_STATE state, USER_ATTR usr_attr) /* * Always forward recipients in :include: files. */ - if (state.msg_attr.exp_type = EXPAND_TYPE_INCL) + if (state.msg_attr.exp_type == EXPAND_TYPE_INCL) return (deliver_indirect(state)); /* * Delivery to local user. First try expansion of the recipient's - * $HOME/.forward file, then mailbox delivery. + * $HOME/.forward file, then mailbox delivery. Back off when the user's + * home directory does not exist. */ + if ((mypwd = mypwnam(state.msg_attr.user)) == 0) + return (deliver_unknown(state, usr_attr)); + if (var_stat_home_dir + && stat_as(mypwd->pw_dir, &st, mypwd->pw_uid, mypwd->pw_gid) < 0) + return (defer_append(BOUNCE_FLAG_KEEP, + BOUNCE_ATTR(state.msg_attr), + "cannot access home directory %s: %m", + mypwd->pw_dir)); if (deliver_dotforward(state, usr_attr, &status) == 0 && deliver_mailbox(state, usr_attr, &status) == 0) status = deliver_unknown(state, usr_attr); diff --git a/postfix/pipe/pipe.c b/postfix/pipe/pipe.c index 2a777833e..a06552cca 100644 --- a/postfix/pipe/pipe.c +++ b/postfix/pipe/pipe.c @@ -626,10 +626,15 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv) RECIPIENT_LIST *rcpt_list = &request->rcpt_list; VSTRING *why = vstring_alloc(100); VSTRING *buf; - ARGV *expanded_argv; + ARGV *expanded_argv = 0; int deliver_status; int command_status; +#define DELIVER_MSG_CLEANUP() { \ + vstring_free(why); \ + if (expanded_argv) argv_free(expanded_argv); \ + } + if (msg_verbose) msg_info("%s: from <%s>", myname, request->sender); @@ -674,6 +679,7 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv) deliver_status = eval_command_status(PIPE_STAT_BOUNCE, service, request, request->fp, "message too large"); + DELIVER_MSG_CLEANUP(); return (deliver_status); } @@ -706,8 +712,7 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv) /* * Clean up. */ - vstring_free(why); - argv_free(expanded_argv); + DELIVER_MSG_CLEANUP(); return (deliver_status); } diff --git a/postfix/postmap/postmap.c b/postfix/postmap/postmap.c index da51ceb06..49dc87893 100644 --- a/postfix/postmap/postmap.c +++ b/postfix/postmap/postmap.c @@ -281,7 +281,7 @@ static int postmap_delete(const char *map_type, const char *map_name, dict = dict_open3(map_type, map_name, O_RDWR, DICT_FLAG_LOCK); status = dict_del(dict, key); dict_close(dict); - return (status); + return (status == 0); } /* usage - explain */ diff --git a/postfix/util/spawn_command.c b/postfix/util/spawn_command.c index 3f009d36e..f20a66bd8 100644 --- a/postfix/util/spawn_command.c +++ b/postfix/util/spawn_command.c @@ -286,8 +286,8 @@ WAIT_STATUS_T spawn_command(int key,...) */ if ((err = timed_waitpid(pid, &wait_status, 0, args.time_limit)) < 0 && errno == ETIMEDOUT) { - msg_warn("%s: process id %d: command time limit exceeded", - args.command, pid); + msg_warn("%s: process id %lu: command time limit exceeded", + args.command, (unsigned long) pid); kill(-pid, SIGKILL); err = waitpid(pid, &wait_status, 0); } diff --git a/postfix/util/spawn_command.h b/postfix/util/spawn_command.h index a6addf53f..b89887ede 100644 --- a/postfix/util/spawn_command.h +++ b/postfix/util/spawn_command.h @@ -26,7 +26,7 @@ #define SPAWN_CMD_ENV 9 /* extra environment */ #define SPAWN_CMD_SHELL 10 /* alternative shell */ -extern int spawn_command(int,...); +extern WAIT_STATUS_T spawn_command(int,...); /* LICENSE /* .ad