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.
# 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...
# 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.
# 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
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" && {
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...) || {
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
-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
* 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
#include <vstream.h>
#include <htable.h>
#include <open_as.h>
-#include <stat_as.h>
#include <lstat_as.h>
#include <iostuff.h>
#include <stringops.h>
#include <mail_params.h>
#include <mail_conf.h>
#include <ext_prop.h>
-#include <defer.h>
/* Application-specific. */
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.
+ * Skip this module if per-user forwarding is disabled.
*/
- if ((mypwd = mypwnam(state.msg_attr.user)) == 0)
+ if (*var_forward_path == 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.
+ * Skip non-existing users. The mailbox delivery routine will catch the
+ * error.
*/
- if (*var_forward_path == 0)
+ if ((mypwd = mypwnam(state.msg_attr.user)) == 0)
return (NO);
-
/*
* From here on no early returns or we have a memory leak.
*/
/* System library. */
#include <sys_defs.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <split_at.h>
#include <stringops.h>
#include <dict.h>
+#include <stat_as.h>
/* Global library. */
#include <bounce.h>
+#include <defer.h>
#include <mail_params.h>
#include <split_addr.h>
#include <ext_prop.h>
+#include <mypwd.h>
/* Application-specific. */
{
char *myname = "deliver_switch";
int status = 0;
+ struct stat st;
+ struct mypasswd *mypwd;
/*
* Make verbose logging easier to understand.
* 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++;
/*
* 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);
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);
deliver_status = eval_command_status(PIPE_STAT_BOUNCE, service,
request, request->fp, "message too large");
+ DELIVER_MSG_CLEANUP();
return (deliver_status);
}
/*
* Clean up.
*/
- vstring_free(why);
- argv_free(expanded_argv);
+ DELIVER_MSG_CLEANUP();
return (deliver_status);
}
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 */
*/
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);
}
#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