2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 13:48:06 +00:00

snapshot-20020110

This commit is contained in:
Wietse Venema 2002-01-10 00:00:00 -05:00 committed by Viktor Dukhovni
parent 5781e7fbc6
commit a41bbe4770
20 changed files with 1026 additions and 568 deletions

View File

@ -5926,6 +5926,24 @@ Apologies for any names omitted.
queue directory, did not set group ownership of the public
directory.
20020109
Cleanup: rewrote the Postfix installation procedure again.
It is now separated into 1) a primary installation script
(postfix-install) that installs files locally or that builds
a package for distribution and that stores file owner and
permission information in /etc/postfix/post-files, and 2)
a post-installation script (/etc/postfix/post-install) that
creates missing directories, that sets file/directory
ownership and permissions, and that upgrades existing
configuration files if necessary.
20020110
Workaround: AIX null read() return on an empty but open
non-blocking pipe. File: master/master_flow.c. Report:
Hamish Marson.
Open problems:
Low: don't do user@domain and @domain lookups in

View File

@ -1,472 +0,0 @@
#!/bin/sh
# Postfix installation script. Run from the top-level Postfix source directory.
#
# Usage: sh INSTALL.sh [-non-interactive] name=value ...
#
# Non-interective mode uses settings from /etc/postfix/main.cf (or
# from /etc/postfix/install.cf when upgrading from a < 2002 release).
PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
umask 022
# Process command-line settings
for arg
do
case $arg in
*=*) IFS= eval $arg;;
-non-interactive) non_interactive=1;;
*) echo Error: usage: $0 [-non-interactive] name=value ... 1>&2
exit 1;;
esac
done
# Discourage old habits.
test -z "$non_interactive" -a ! -t 0 && {
echo Error: for non-interactive installation, run: \"$0 -non-interactive\" 1>&2
exit 1
}
test -z "$non_interactive" && cat <<EOF
Warning: this script replaces existing sendmail or Postfix programs.
Make backups if you want to be able to recover.
Before installing files, this script prompts you for some definitions.
Most definitions will be remembered, so you have to specify them
only once. All definitions have a reasonable default value.
EOF
# By now, shells must have functions. Ultrix users must use sh5 or lose.
# The following shell functions replace files/symlinks while minimizing
# 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...
rm -f $tempdir/junk || exit 1
cp $2 $tempdir/junk || exit 1
chmod $1 $tempdir/junk || exit 1
mv -f $tempdir/junk $3 || exit 1
chmod $1 $3 || exit 1
}
}
compare_or_symlink() {
(cmp $1 $2 >/dev/null 2>&1 && echo Skipping $2...) || {
echo Updating $2...
rm -f $tempdir/junk || exit 1
dest=`echo $1 | sed '
s;^'$install_root';;
s;/\./;/;g
s;//*;/;g
s;^/;;
'`
link=`echo $2 | sed '
s;^'$install_root';;
s;/\./;/;g
s;//*;/;g
s;^/;;
s;/[^/]*$;/;
s;[^/]*/;../;g
s;$;'$dest';
'`
ln -s $link $tempdir/junk || exit 1
mv -f $tempdir/junk $2 || {
echo Error: your mv command is unable to rename symlinks. 1>&2
echo If you run Linux, upgrade to GNU fileutils-4.0 or better, 1>&2
echo or choose a tempdir that is in the same file system as $2. 1>&2
exit 1
}
}
}
compare_or_move() {
(cmp $2 $3 >/dev/null 2>&1 && echo Skipping $3...) || {
echo Updating $3...
mv -f $2 $3 || exit 1
chmod $1 $3 || exit 1
}
}
# How to supress newlines in echo
case `echo -n` in
"") n=-n; c=;;
*) n=; c='\c';;
esac
# Prompts.
install_root_prompt="the prefix for installed file names. This is
useful only if you are building ready-to-install packages for other
machines."
tempdir_prompt="directory for scratch files while installing Postfix.
You must must have write permission in this directory."
config_directory_prompt="the directory with Postfix configuration
files. For security reasons this directory must be owned by the
super-user."
daemon_directory_prompt="the directory with Postfix daemon programs.
This directory should not be in the command search path of any
users."
command_directory_prompt="the directory with Postfix administrative
commands. This directory should be in the command search path of
adminstrative users."
queue_directory_prompt="the directory with Postfix queues."
sendmail_path_prompt="the full pathname of the Postfix sendmail
command. This is the Sendmail-compatible mail posting interface."
newaliases_path_prompt="the full pathname of the Postfix newaliases
command. This is the Sendmail-compatible command to build alias
databases."
mailq_path_prompt="the full pathname of the Postfix mailq command.
This is the Sendmail-compatible mail queue listing command."
mail_owner_prompt="the owner of the Postfix queue. Specify a user
account with numerical user ID and group ID values that are not
used by any other user accounts."
setgid_group_prompt="the group for mail submission and for queue
management commands. Specify a group name with a numerical group
ID that is not shared with other accounts, not even with the Postfix
account."
manpage_path_prompt="where to install the Postfix on-line manual
pages."
# Default settings, just to get started.
: ${install_root=/}
: ${tempdir=`pwd`}
: ${config_directory=`bin/postconf -c conf -h -d config_directory`}
# Find out the location of configuration files.
test -z "$non_interactive" && for name in install_root tempdir config_directory
do
while :
do
echo
eval echo Please specify \$${name}_prompt | fmt
eval echo \$n "$name: [\$$name]\ \$c"
read ans
case $ans in
"") break;;
*) case $ans in
/*) eval $name=\$ans; break;;
*) echo; echo Error: $name should be an absolute path name. 1>&2;;
esac;;
esac
done
done
# In case some systems special-case pathnames beginning with //.
case $install_root in
/) install_root=
esac
# Load defaults from existing installation or from template main.cf file.
CONFIG_DIRECTORY=$install_root$config_directory
if [ -f $CONFIG_DIRECTORY/main.cf ]
then
conf="-c $CONFIG_DIRECTORY"
else
conf="-d"
fi
# Do not destroy parameter settings from environment or command line.
for name in daemon_directory command_directory queue_directory mail_owner \
setgid_group sendmail_path newaliases_path mailq_path manpage_path
do
eval : \${$name=\`bin/postconf $conf -h $name\`} || kill $$
done
# Grandfathering: if not in main.cf, get defaults from obsolete install.cf file.
grep setgid_group $CONFIG_DIRECTORY/main.cf >/dev/null 2>&1 || {
if [ -f $CONFIG_DIRECTORY/install.cf ]
then
. $CONFIG_DIRECTORY/install.cf
setgid_group=${setgid-$setgid_group}
manpage_path=${manpages-$manpage_path}
elif [ -n "$non_interactive" ]
then
echo Error: \"make upgrade\" requires the $CONFIG_DIRECTORY/main.cf 1>&2
echo file from a sufficiently recent Postfix installation. 1>&2
echo 1>&2
echo Use \"make install\" instead. 1>&2
exit 1
fi
}
# Override default settings.
test -z "$non_interactive" && for name in daemon_directory command_directory \
queue_directory sendmail_path newaliases_path mailq_path mail_owner \
setgid_group manpage_path
do
while :
do
echo
eval echo Please specify \$${name}_prompt | fmt
eval echo \$n "$name: [\$$name]\ \$c"
read ans
case $ans in
"") break;;
*) eval $name=\$ans; break;;
esac
done
done
# Sanity checks
case $manpage_path in
no) echo Error: manpage_path no longer accepts \"no\" values. 1>&2
echo Error: re-run this script with \"make install\". 1>&2; exit 1;;
esac
case $setgid_group in
no) echo Error: setgid_group no longer accepts \"no\" values. 1>&2
echo Error: re-run this script with \"make install\". 1>&2; exit 1;;
esac
for path in $daemon_directory $command_directory \
$queue_directory $sendmail_path $newaliases_path $mailq_path $manpage_path
do
case $path in
/*) ;;
*) echo Error: $path should be an absolute path name. 1>&2; exit 1;;
esac
done
test -d $tempdir || mkdir -p $tempdir || exit 1
( rm -f $tempdir/junk && touch $tempdir/junk ) || {
echo Error: you have no write permission to $tempdir. 1>&2
echo Specify an alternative directory for scratch files. 1>&2
exit 1
}
chown root $tempdir/junk >/dev/null 2>&1 || {
echo Error: you have no permission to change file ownership. 1>&2
exit 1
}
chown "$mail_owner" $tempdir/junk >/dev/null 2>&1 || {
echo Error: $mail_owner needs an entry in the passwd file. 1>&2
echo Remember, $mail_owner must have a dedicated user id and group id. 1>&2
exit 1
}
chgrp "$setgid_group" $tempdir/junk >/dev/null 2>&1 || {
echo Error: $setgid_group needs an entry in the group file. 1>&2
echo Remember, $setgid_group must have a dedicated group id. 1>&2
exit 1
}
rm -f $tempdir/junk
# Avoid clumsiness.
DAEMON_DIRECTORY=$install_root$daemon_directory
COMMAND_DIRECTORY=$install_root$command_directory
QUEUE_DIRECTORY=$install_root$queue_directory
SENDMAIL_PATH=$install_root$sendmail_path
NEWALIASES_PATH=$install_root$newaliases_path
MAILQ_PATH=$install_root$mailq_path
MANPAGE_PATH=$install_root$manpage_path
# Create any missing directories.
test -d $CONFIG_DIRECTORY || mkdir -p $CONFIG_DIRECTORY || exit 1
test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1
test -d $COMMAND_DIRECTORY || mkdir -p $COMMAND_DIRECTORY || exit 1
test -d $QUEUE_DIRECTORY || mkdir -p $QUEUE_DIRECTORY || exit 1
for path in $SENDMAIL_PATH $NEWALIASES_PATH $MAILQ_PATH
do
dir=`echo $path|sed -e 's/[/][/]*[^/]*$//' -e 's/^$/\//'`
test -d $dir || mkdir -p $dir || exit 1
done
# Install files. Be careful to not copy over running programs.
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 `censored_ls bin | grep '^post'`
do
compare_or_replace a+x,go-w bin/$file $COMMAND_DIRECTORY/$file || exit 1
done
test -f bin/sendmail && {
compare_or_replace a+x,go-w bin/sendmail $SENDMAIL_PATH || exit 1
compare_or_symlink $SENDMAIL_PATH $NEWALIASES_PATH
compare_or_symlink $SENDMAIL_PATH $MAILQ_PATH
}
if [ -f $CONFIG_DIRECTORY/main.cf ]
then
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
for file in `cd conf; censored_ls * | grep -v postfix-script`
do
compare_or_replace a+r,go-w conf/$file $CONFIG_DIRECTORY/$file || exit 1
done
test -z "$install_root" && need_config=1
fi
# Save settings.
bin/postconf -c $CONFIG_DIRECTORY -e \
"daemon_directory = $daemon_directory" \
"command_directory = $command_directory" \
"queue_directory = $queue_directory" \
"mail_owner = $mail_owner" \
"setgid_group = $setgid_group" \
"sendmail_path = $sendmail_path" \
"mailq_path = $mailq_path" \
"newaliases_path = $newaliases_path" \
"manpage_path = $manpage_path" \
|| exit 1
compare_or_replace a+x,go-w conf/postfix-script $CONFIG_DIRECTORY/postfix-script ||
exit 1
# Install manual pages.
(cd man || exit 1
for dir in man?
do test -d $MANPAGE_PATH/$dir || mkdir -p $MANPAGE_PATH/$dir || exit 1
done
for file in `censored_ls man?/*`
do
(test -f $MANPAGE_PATH/$file && cmp -s $file $MANPAGE_PATH/$file &&
echo Skipping $MANPAGE_PATH/$file...) || {
echo Updating $MANPAGE_PATH/$file...
rm -f $MANPAGE_PATH/$file
cp $file $MANPAGE_PATH/$file || exit 1
chmod 644 $MANPAGE_PATH/$file || exit 1
}
done)
# Tighten access of existing directories.
for directory in pid
do
test -d $QUEUE_DIRECTORY/$directory && {
chown root $QUEUE_DIRECTORY/$directory || exit 1
}
done
# Apply set-gid/group privileges for restricted access.
for directory in maildrop
do
test -d $QUEUE_DIRECTORY/$directory || {
mkdir -p $QUEUE_DIRECTORY/$directory || exit 1
chown $mail_owner $QUEUE_DIRECTORY/$directory || exit 1
}
# Fix group and permissions if upgrading from world-writable maildrop.
chgrp $setgid_group $QUEUE_DIRECTORY/$directory || exit 1
chmod 730 $QUEUE_DIRECTORY/$directory || exit 1
done
for directory in public
do
test -d $QUEUE_DIRECTORY/$directory || {
mkdir -p $QUEUE_DIRECTORY/$directory || exit 1
chown $mail_owner $QUEUE_DIRECTORY/$directory || exit 1
}
# Fix group and permissions if upgrading from world-accessible directory.
chgrp $setgid_group $QUEUE_DIRECTORY/$directory || exit 1
chmod 710 $QUEUE_DIRECTORY/$directory || exit 1
done
chgrp $setgid_group $COMMAND_DIRECTORY/postdrop $COMMAND_DIRECTORY/postqueue || exit 1
chmod g+s $COMMAND_DIRECTORY/postdrop $COMMAND_DIRECTORY/postqueue || exit 1
grep 'flush.*flush' $CONFIG_DIRECTORY/master.cf >/dev/null || {
echo adding missing entry for flush service to master.cf
cat >>$CONFIG_DIRECTORY/master.cf <<EOF
flush unix - - n 1000? 0 flush
EOF
}
grep "^pickup[ ]*fifo[ ]*n[ ]*n" \
$CONFIG_DIRECTORY/master.cf >/dev/null && {
echo changing master.cf, making the pickup service unprivileged
ed $CONFIG_DIRECTORY/master.cf <<EOF
/^pickup[ ]*fifo[ ]*n[ ]*n/
s/\(n[ ]*\)n/\1-/
p
w
q
EOF
}
for name in cleanup flush
do
grep "^$name[ ]*unix[ ]*-" \
$CONFIG_DIRECTORY/master.cf >/dev/null && {
echo changing master.cf, making the $name service public
ed $CONFIG_DIRECTORY/master.cf <<EOF
/^$name[ ]*unix[ ]*-/
s/-/n/
p
w
q
EOF
}
done
found=`bin/postconf -c $CONFIG_DIRECTORY -h hash_queue_names`
missing=
(echo "$found" | grep active >/dev/null) || missing="$missing active"
(echo "$found" | grep bounce >/dev/null) || missing="$missing bounce"
(echo "$found" | grep defer >/dev/null) || missing="$missing defer"
(echo "$found" | grep flush >/dev/null) || missing="$missing flush"
(echo "$found" | grep incoming>/dev/null)|| missing="$missing incoming"
(echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
test -n "$missing" && {
echo fixing main.cf hash_queue_names for missing $missing
bin/postconf -c $CONFIG_DIRECTORY -e hash_queue_names="$found$missing"
}
test "$need_config" = 1 || exit 0
ALIASES=`bin/postconf -h alias_database | sed 's/^[^:]*://'`
cat <<EOF 1>&2
Warning: you still need to edit myorigin/mydestination/mynetworks
in $CONFIG_DIRECTORY/main.cf. See also html/faq.html for dialup
sites or for sites inside a firewalled network.
BTW: Check your $ALIASES file and be sure to set up aliases
for root and postmaster that direct mail to a real person, then
run $NEWALIASES_PATH.
EOF
exit 0

View File

@ -31,10 +31,10 @@ manpages:
printfck: update
install: update
sh INSTALL.sh
$(SHELL) postfix-install
upgrade: update
sh INSTALL.sh -non-interactive
$(SHELL) postfix-install -non-interactive
depend clean:
set -e; for i in $(DIRS); do \

View File

@ -1,3 +1,15 @@
Incompatible changes with snapshot-20020110
===========================================
The INSTALL.sh installation procedure is replaced by a postfix-install
script that either installs Postfix on the local system (as root)
or that builds a package (as non-root) for distribution to other
systems. This script creates a file $config_directory/postfix-files
with ownership and permissions of Postfix files/directories. The
$config_directory/post-install script applies the finishing touch:
it sets file/directory ownership and permissions, edits existing
configuration files, and creates missing queue directories.
Incompatible changes with snapshot-20020106
===========================================
@ -38,9 +50,10 @@ Simplification of the local Postfix security model.
the set-gid postdrop command for local mail submissions. The
local mail pickup daemon is now an unprivileged process.
- No world-accessible pickup and queue manager server FIFOs. Postfix
now uses a new set-gid postqueue command for the queue operations
that used to implemented by the Postfix sendmail command.
- No world-accessible pickup and queue manager server FIFOs.
- A new set-gid postqueue command for the queue operations that
used to implemented by the Postfix sendmail command.
Simplification of Postfix installation.

276
postfix/conf/post-install Normal file
View File

@ -0,0 +1,276 @@
#!/bin/sh
# To view the formatted manual page of this file, type:
# POSTFIXSOURCE/mantools/srctoman - post-install | nroff -man
#++
# NAME
# post-install
# SUMMARY
# Postfix post-installation script
# SYNOPSIS
# post-install [options] config_directory
# DESCRIPTION
# The post-install script performs the finishing touch of a Postfix
# installation, after the executable programs and configuration
# files are installed. Usage is one of the following:
# .IP o
# While installing Postfix from source code on the local machine, the
# script is run by the postfix-install script to update selected file
# or directory permissions and to update selected configuration files.
# .IP o
# While installing Postfix from a pre-built package, the script is run
# by the package management procedure to set all file or directory
# permissions and to update existing Postfix configuration files.
# .IP o
# At Postfix start-up time, the script is run from "postfix check" to
# create missing queue directories.
# .PP
# Arguments
# .IP -create
# Create missing queue directories with ownerships and permissions
# according to the contents of $config_directory/postfix-files.
#
# This is required at Postfix start-up time.
# .IP -set-permissions
# Set all file/directory ownerships and permissions according to the
# contents of $config_directory/postfix-files. Implies -create.
#
# This is required when installing Postfix from a pre-built package.
# .IP -upgrade-permissions
# Update ownership and permission of selected files/directories as
# specified in $config_directory/postfix-files. Implies -create.
#
# This is required when installing Postfix from source code, while
# Postfix was already installed on the machine.
# .IP -upgrade-configuration
# Edit the installed main.cf and master.cf files, in order to account
# for missing services and to fix deprecated parameter settings.
#
# This is required when Postfix was already installed on the machine.
# .IP -upgrade-source
# Short-hand for -upgrade-permissions -upgrade-configuration.
#
# This is recommended when upgrading Postfix from source code.
# .IP -upgrade-package
# Short-hand for -set-permissions -upgrade-configuration.
#
# This is recommended when upgrading Postfix from a pre-built package.
# .IP -first-install-reminder
# Remind the user that they still need to configure main.cf and the
# aliases file, and that newaliases needs to be run.
#
# This is recommended when Postfix is installed for the first time.
# .IP config_directory
# Directory with Postfix configuration files. This must be an absolute
# pathname.
# SEE ALSO
# postfix-install(1) Postfix primary installation script for installation
# from source code, or for building a package for distribution to other
# systems.
# FILES
# $config_directory/main.cf, Postfix installation configuration.
# $config_directory/postfix-files, permissions and ownerships.
# This file is created by postfix-install.
# 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
#--
umask 022
PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
SHELL=/bin/sh
USAGE="usage: $0 [options] config_directory
-upgrade-source Use when upgrading from source.
-upgrade-package Use when upgrading from pre-built package.
-first-install-reminder Remind of mandatory configuration steps.
config_directory Must be an absolute path name."
# Process command-line settings
for arg
do
case $arg in
-create) create=1;;
-set-perm*) create=1; set_perms=1;;
-upgrade-perm*) create=1; upgrade_perms=1;;
-upgrade-conf*) upgrade_conf=1;;
-upgrade-source) create=1; upgrade_conf=1; upgrade_perms=1;;
-upgrade-package) create=1; upgrade_conf=1; set_perms=1;;
-first-install*) first_install_reminder=1;;
/*) config_dir=$1;;
"") break;;
*) echo "Error: $USAGE" 1>&2; exit 1;;
esac
shift
done
# Sanity checks.
test -n "$create$upgrade_conf$first_install_reminder" || {
echo "Error: $USAGE" 1>&2
exit 1
}
test -n "$config_dir" || {
echo "Error: $USAGE" 1>&2
exit 1
}
test -d "$config_dir" || {
echo Error: $config_dir is not a directory. 1>&2
exit 1
}
test -f $config_dir/postfix-files || {
Error: $config_dir/postfix-files is not a file. 1>&2
exit 1
}
#
# LINUX by default does not synchronously update directories -
# that's dangerous for mail.
#
if [ -f /usr/bin/chattr ]
then
CHATTR="/usr/bin/chattr +S"
else
CHATTR=echo
fi
# Use file/directory status information in $config_dir/postfix-files.
test -n "$create" && {
IFS=:
while read path type owner group mode upgrade_flag create_flag junk
do
set_permission=
case $path in
/*) # Create missing directories with proper owner/group/mode settings.
if [ -n "$create" -a "$type" = "d" -a -n "$create_flag" -a ! -d "$path" ]
then
mkdir $path || exit 1
$CHATTR $path >/dev/null 2>/dev/null
set_permission=1
# Update all owner/group/mode settings.
elif [ -n "$set_perms" ]
then
set_permission=1
# Update obsolete owner/group/mode settings.
elif [ -n "$upgrade_perms" -a -n "$upgrade_flag" ]
then
set_permission=1
fi
test -n "$set_permission" && {
chown $owner $path || exit 1
test -z "$group" || chgrp $group $path || exit 1
chmod $mode $path || exit 1
}
;;
esac
done <$config_dir/postfix-files
}
# Upgrade existing Postfix configuration files if necessary.
test -n "$upgrade_conf" && {
# Add missing flush service to master.cf.
grep 'flush.*flush' $config_dir/master.cf >/dev/null || {
echo Editing $config_dir/master.cf, adding missing entry for flush service
cat >>$config_dir/master.cf <<EOF
flush unix - - n 1000? 0 flush
EOF
}
# Change privileged pickup service into unprivileged.
grep "^pickup[ ]*fifo[ ]*n[ ]*n" \
$config_dir/master.cf >/dev/null && {
echo Editing $config_dir/master.cf, making the pickup service unprivileged
ed $config_dir/master.cf <<EOF
/^pickup[ ]*fifo[ ]*n[ ]*n/
s/\(n[ ]*\)n/\1-/
p
w
q
EOF
}
# Change private cleanup and flush services into public.
for name in cleanup flush
do
grep "^$name[ ]*unix[ ]*-" \
$config_dir/master.cf >/dev/null && {
echo Editing $config_dir/master.cf, making the $name service public
ed $config_dir/master.cf <<EOF
/^$name[ ]*unix[ ]*-/
s/-/n/
p
w
q
EOF
}
done
# With 10000 active queue files, the active queue directory should
# be hashed, and so should the other directories, because they
# can contain even more mail.
#
# Unfortunately, this sucks mailq performance on unloaded systems.
#
# If you don't want slow mailq, be sure to hash defer and deferred,
# because those two directories can contain lots of files.
found=`bin/postconf -c $config_dir -h hash_queue_names`
missing=
(echo "$found" | grep active >/dev/null) || missing="$missing active"
(echo "$found" | grep bounce >/dev/null) || missing="$missing bounce"
(echo "$found" | grep defer >/dev/null) || missing="$missing defer"
(echo "$found" | grep flush >/dev/null) || missing="$missing flush"
(echo "$found" | grep incoming>/dev/null)|| missing="$missing incoming"
(echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
test -n "$missing" && {
echo fixing main.cf hash_queue_names for missing $missing
bin/postconf -c $config_dir -e hash_queue_names="$found$missing"
}
}
# A reminder if this is the first time Postfix is being installed.
test -n "$first_install_reminder" && {
ALIASES=`postconf -h alias_database | sed 's/^[^:]*://'`
NEWALIASES_PATH=`postconf -h newaliases_path`
cat <<EOF 1>&2
Warning: you still need to edit myorigin/mydestination/mynetworks
parameter settings in $config_dir/main.cf.
See also http://www.postfix.org/faq.html for information about
dialup sites or about sites inside a firewalled network.
BTW: Check your $ALIASES file and be sure to set up aliases
that send mail for root and postmaster to a real person, then
run $NEWALIASES_PATH.
EOF
}
exit 0

View File

@ -8,8 +8,8 @@
# SYNOPSIS
# \fBpostfix-script\fR \fIcommand\fR
# DESCRIPTION
# The \fBfBpostfix-script\fR script executes Postfix administrative
# commands in an environtment that is set up by the \fBpostfix\fR(1)
# The \fBpostfix-script\fR script executes Postfix administrative
# commands in an environment that is set up by the \fBpostfix\fR(1)
# command.
# SEE ALSO
# master(8) Postfix master program
@ -43,17 +43,7 @@ FATAL="$LOGGER -p fatal"
PANIC="$LOGGER -p panic"
umask 022
#
# LINUX by default does not synchronously update directories -
# that's dangerous for mail.
#
if [ -f /usr/bin/chattr ]
then
CHATTR="/usr/bin/chattr +S"
else
CHATTR=:
fi
SHELL=/bin/sh
#
# Can't do much without these in place.
@ -174,40 +164,11 @@ check)
\( -perm -020 -o -perm -002 \) -type f \
-exec $WARN group or other writable: {} \;
test -d maildrop || {
$WARN creating missing Postfix maildrop directory
mkdir maildrop || exit 1
chmod 730 maildrop || exit 1
chown $mail_owner maildrop || exit 1
chgrp $setgid_group maildrop || exit 1
}
test -d pid || {
$WARN creating missing Postfix pid directory
mkdir pid || exit 1
chmod 755 pid || exit 1
}
for dir in incoming active bounce defer deferred flush saved corrupt; do
test -d $dir || {
$WARN creating missing Postfix $dir directory
mkdir $dir || exit 1
chmod 700 $dir || exit 1
$CHATTR $dir 2>/dev/null
chown $mail_owner $dir || exit 1
}
done
test -d public || {
$WARN creating missing Postfix public directory
mkdir public || exit 1
chmod 710 public || exit 1
chown $mail_owner public || exit 1
chgrp $setgid_group public || exit 1
}
test -d private || {
$WARN creating missing Postfix private directory
mkdir private || exit 1
chmod 700 private || exit 1
chown $mail_owner private || exit 1
$SHELL $config_directory/post-install -create $config_directory || {
$WARN unable to create missing queue directories
exit 1
}
find `ls -d $queue_directory/* | \
egrep '/(incoming|active|defer|deferred|bounce|saved|corrupt|public|private|flush)$'` \
! \( -type p -o -type s \) ! -user $mail_owner \
@ -235,7 +196,7 @@ check)
done
done
# Look for incomplete upgrades.
# Look for incomplete installations.
test -f $config_directory/master.cf || {
$FATAL no $config_directory/master.cf file found

View File

@ -4,26 +4,28 @@
# This file contains example settings of Postfix parameters that
# control the fast flush service, which is the code that implements
# fast ETRN and fast "sendmail -qR".
# The fast_flush_domains parameter specifies what destinations are
# eligible for per-destination logfiles with mail that is queued to
# those destinations.
#
# When a destination is eligible for "fast flush" logfiles, ETRN and
# When a destination is eligible for "fast flush" service, ETRN and
# "sendmail -qR" are implemented by delivering only messages that
# are listed in the logfile for that destination (in fact, Postfix
# will deliver to all recipients of those messages, regardless of
# their destination, but that is not an issue when you relay mail
# for an eligible site).
#
# When a destination is not eligible for "fast flush" logfiles, ETRN
# and "sendmail -qR" are implemented simply by attempting to deliver
# all queued mail. That's the slow service that Postfix used to
# implement before 20001005.
# The fast_flush_domains parameter specifies what destinations are
# eligible for per-destination logfiles with mail that is queued to
# those destinations.
#
# By default, Postfix maintains "fast flush" logfiles only for
# destinations that the Postfix SMTP server is willing to relay to
# (see the relay_domains parameter in sample-smtpd.cf).
# (i.e. the default is: "fast_flush_domains = $relay_domains"; see
# the relay_domains parameter in sample-smtpd.cf).
#
# Specify a list of hosts or domains, /file/name patterns or type:name
# lookup tables, separated by commas and/or whitespace. Continue
# long lines by starting the next line with whitespace. A file name
# is replaced by its contents; a type:name table is matched when a
# (parent) domain appears as lookup key.
#
# Specify "fast_flush_domains =" to disable the feature altogether.
#

View File

@ -82,25 +82,25 @@ POSTFIX(1) POSTFIX(1)
This is set when the -D command-line option is pre-
sent.
The following configuration parameters are made available
as process environment variables with the same names:
The following <b>main.cf</b> configuration parameters are made
available as process environment variables with the same
names:
<b>command</b><i>_</i><b>directory</b>
Directory with Postfix support commands (default:
<b>$program</b><i>_</i><b>directory</b>).
Directory with Postfix administrative commands.
<b>daemon</b><i>_</i><b>directory</b>
Directory with Postfix daemon programs (default:
<b>$program</b><i>_</i><b>directory</b>).
Directory with Postfix daemon programs.
<b>config</b><i>_</i><b>directory</b>
Directory with Postfix configuration files and with
administrative shell scripts.
<b>queue</b><i>_</i><b>directory</b>
The directory with the Postfix queue directory (and
with some files needed for programs running in a
chrooted environment).
The directory with Postfix queue files, with local
inter-process communication endpoints, and with
files needed for daemon programs that run in the
optional chrooted environment.
<b>mail</b><i>_</i><b>owner</b>
The owner of Postfix queue files and of most Post-
@ -112,6 +112,8 @@ POSTFIX(1) POSTFIX(1)
<b>FILES</b>
$<b>config</b><i>_</i><b>directory/postfix-script</b>, administrative commands
$<b>config</b><i>_</i><b>directory/main.cf</b>, configuration parameters
$<b>config</b><i>_</i><b>directory/master.cf</b>, Postfix daemon processes
<b>SEE</b> <b>ALSO</b>
<a href="master.8.html">master(8)</a> Postfix master program

View File

@ -76,20 +76,19 @@ This is set when the -v command-line option is present.
.IP \fBMAIL_DEBUG\fR
This is set when the -D command-line option is present.
.PP
The following configuration parameters are made available
as process environment variables with the same names:
The following \fBmain.cf\fR configuration parameters are made
available as process environment variables with the same names:
.IP \fBcommand_directory\fR
Directory with Postfix support commands (default:
\fB$program_directory\fR).
Directory with Postfix administrative commands.
.IP \fBdaemon_directory\fR
Directory with Postfix daemon programs (default:
\fB$program_directory\fR).
Directory with Postfix daemon programs.
.IP \fBconfig_directory\fR
Directory with Postfix configuration files and with administrative
shell scripts.
.IP \fBqueue_directory\fR
The directory with the Postfix queue directory (and with some
files needed for programs running in a chrooted environment).
The directory with Postfix queue files, with local inter-process
communication endpoints, and with files needed for daemon programs
that run in the optional chrooted environment.
.IP \fBmail_owner\fR
The owner of Postfix queue files and of most Postfix processes.
.IP \fBsetgid_group\fR
@ -98,6 +97,8 @@ The group for mail submission and queue management commands.
.na
.nf
$\fBconfig_directory/postfix-script\fR, administrative commands
$\fBconfig_directory/main.cf\fR, configuration parameters
$\fBconfig_directory/master.cf\fR, Postfix daemon processes
.SH SEE ALSO
.na
.nf

648
postfix/postfix-install Normal file
View File

@ -0,0 +1,648 @@
#!/bin/sh
# To view the formatted manual page of this file, type:
# POSTFIXSOURCE/mantools/srctoman - postfix-install | nroff -man
#++
# NAME
# postfix-install 1
# SUMMARY
# Postfix installation procedure
# SYNOPSIS
# sh postfix-install [-non-interactive] [name=value] ...
# DESCRIPTION
# The postfix-install script is to be run from the top-level
# Postfix source directory. It implements the following operations:
# .IP o
# Install or upgrade Postfix from source code. This mode requires
# super-user privileges.
# .IP o
# Build a package that can be distributed to other systems, in order
# to install or upgrade Postfix elsewhere. This requires no super-user
# privileges. To complete the installation after unpacking the
# package, execute as super-user the post-install script in the Postfix
# configuration directory.
# .PP
# The postfix-install script is controlled by installation parameters.
# Specific parameters are described at the end of this document.
#
# By default, postfix-install asks the user for installation
# parameter settings. Settings are stored in the installed
# main.cf file. These settings are used as site-specific defaults
# when the postfix-install script is run later.
#
# The names of Postfix files and directories, as well as their
# ownerships and permissions, are stored in the postfix-files file
# in the Postfix configuration directory. This information is used
# by the post-install script (also in the configuration directory)
# for creating missing queue directories when Postfix is started,
# and for setting correct ownership and permissions when Postfix
# is installed from a pre-built package or from source code.
#
# Arguments
# .IP -non-interactive
# Do not ask the user for parameter settings. This is useful for
# upgrading an existing Postfix installation from source code,
# or for preparing a pre-built package for distribution to other
# systems. Installation parameters must be specified via one of
# the non-interactive methods described below.
# INSTALLATION PARAMETER INPUT METHODS
# .ad
# .fi
# Parameter settings can be specified through a variety of
# mechanisms. In order of decreasing precedence these are:
# .IP "interactive mode"
# By default, postfix-install will ask the user for
# installation parameter settings. These settings have the highest
# precedence.
# .IP "command line"
# Parameter settings can be given as name=value arguments on
# the postfix-install command line.
# .IP "process environment"
# Parameter settings can be given as name=value environment
# variables. Environment parameters can also be specified on the
# make(1) command line as "make install name=value ...".
# .IP "installed configuration files"
# If a parameter is not specified via the command line or via the
# process environment, postfix-install will attempt to extract its
# value from an already installed Postfix main.cf configuration file.
# .IP "built-in defaults"
# These settings have the lowest precedence.
# INSTALLATION PARAMETER DESCRIPTION
# .ad
# .fi
# The description of installation parameters and their built-in
# default settings is as follows:
# .IP install_root
# Prefix that is prepended to the pathnames of installed files.
# This is useful for creating a pre-built package for distribution to
# other systems. The built-in default is "/", the local root directory.
# .IP tempdir
# Directory for scratch files while installing Postfix.
# You must must have write permission in this directory.
# The built-in default directory name is the current directory.
# .IP config_directory
# Destination directory for Postfix configuration files. The
# built-in default directory name is /etc/postfix.
# .IP daemon_directory
# Destination directory for Postfix daemon programs. This directory
# should not be in the command search path of any users. The built-in
# default directory name is /usr/libexec/postfix.
# .IP command_directory
# Destination directory for Postfix administrative commands. This
# directory should be in the command search path of adminstrative users.
# The built-in default directory name is system dependent.
# .IP queue_directory
# The destination directory for Postfix queues. The built-in default
# directory name is /var/spool/postfix.
# .IP sendmail_path
# The full destination pathname for the Postfix sendmail command.
# This is the Sendmail-compatible mail posting interface.
# The built-in default pathname is system dependent.
# .IP newaliases_path
# The full destination pathname for the Postfix newaliases command.
# This is the Sendmail-compatible command to build alias databases
# for the Postfix local delivery agent.
# The built-in default pathname is system dependent.
# .IP mailq_path
# The full destination pathname for the Postfix mailq command.
# This is the Sendmail-compatible command to list the mail queue.
# The built-in default pathname is system dependent.
# .IP mail_owner
# The owner of the Postfix queue. Its numerical user ID and group ID
# must not be used by any other accounts on the system. The built-in
# default account name is postfix.
# .IP setgid_group
# The group for mail submission and for queue management commands.
# Its numerical group ID must not be used by any other accounts on the
# system, not even by the mail_owner account. The built-in default group
# name is postdrop.
# .IP manpage_path
# The destination directory for the Postfix on-line manual pages.
# SEE ALSO
# post-install(1) post-installation procedure
# FILES
# $config_directory/main.cf, Postfix installation configuration.
# $config_directory/postfix-files, permissions and ownerships.
# This file is created by postfix-install.
# 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
#--
# Initialize.
# By now, shells must have functions. Ultrix users must use sh5 or lose.
umask 022
PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
SHELL=/bin/sh
# Process command-line options and parameter settings.
for arg
do
case $arg in
*=*) IFS= eval $arg;;
-non-interactive) non_interactive=1;;
*) echo Error: usage: $0 [-non-interactive] name=value ... 1>&2
exit 1;;
esac
shift
done
# Sanity checks.
test -z "$non_interactive" -a ! -t 0 && {
echo Error: for non-interactive use, run: \"$0 -non-interactive\" 1>&2
exit 1
}
test -x bin/postconf || {
echo Error: no bin/postconf file. Did you forget to run \"make\"? 1>&2
exit 1
}
case `uname -s` in
HP-UX*) FMT=cat;;
*) FMT=fmt;;
esac
# Disclaimer.
test -z "$non_interactive" && cat <<EOF | ${FMT}
Warning: if you use this script to install Postfix locally,
this script will replace existing sendmail or Postfix programs.
Make backups if you want to be able to recover.
Before installing files, this script prompts you for some
definitions. Most definitions will be remembered, so you have
to specify them only once. All definitions should have a
reasonable default value.
EOF
# The following shell functions replace files/symlinks while minimizing
# the time that a file does not exist, and avoid copying over files
# in order to not disturb running programs. That is certainly desirable
# when upgrading Postfix on a live machine. It also avoids surprises
# when building a Postfix package for distribution to other systems.
censored_ls() {
ls "$@" | egrep -v '^\.|/\.|CVS|RCS|SCCS'
}
compare_or_replace() {
(cmp $2 $3 >/dev/null 2>&1 && echo Skipping $3...) || {
echo Updating $3...
rm -f $tempdir/junk || exit 1
cp $2 $tempdir/junk || exit 1
test -z "$4" || chgrp $4 $tempdir/junk || exit 1
chmod $1 $tempdir/junk || exit 1
mv -f $tempdir/junk $3 || exit 1
test -z "$4" || chgrp $4 $3 || exit 1
chmod $1 $3 || exit 1
}
}
compare_or_symlink() {
(cmp $1 $2 >/dev/null 2>&1 && echo Skipping $2...) || {
echo Updating $2...
rm -f $tempdir/junk || exit 1
dest=`echo $1 | sed '
s;^'$install_root';;
s;/\./;/;g
s;//*;/;g
s;^/;;
'`
link=`echo $2 | sed '
s;^'$install_root';;
s;/\./;/;g
s;//*;/;g
s;^/;;
s;/[^/]*$;/;
s;[^/]*/;../;g
s;$;'$dest';
'`
ln -s $link $tempdir/junk || exit 1
mv -f $tempdir/junk $2 || {
echo Error: your mv command is unable to rename symlinks. 1>&2
echo If you run Linux, upgrade to GNU fileutils-4.0 or better, 1>&2
echo or choose a tempdir that is in the same file system as $2. 1>&2
exit 1
}
}
}
compare_or_move() {
(cmp $2 $3 >/dev/null 2>&1 && echo Skipping $3...) || {
echo Updating $3...
mv -f $2 $3 || exit 1
chmod $1 $3 || exit 1
}
}
# How to supress newlines in echo.
case `echo -n` in
"") n=-n; c=;;
*) n=; c='\c';;
esac
# Prompts.
install_root_prompt="the prefix for installed file names. This is
useful if you are building ready-to-install packages for distribution
to other machines."
tempdir_prompt="a directory for scratch files while installing
Postfix. You must must have write permission in this directory."
config_directory_prompt="the destination directory for installed
Postfix configuration files."
daemon_directory_prompt="the destination directory for installed
Postfix daemon programs. This directory should not be in the
command search path of any users."
command_directory_prompt="the destination directory for installed
Postfix administrative commands. This directory should be in the
command search path of adminstrative users."
queue_directory_prompt="the destination directory for Postfix
queues."
sendmail_path_prompt="the full destination pathname for the installed
Postfix sendmail command. This is the Sendmail-compatible mail
posting interface."
newaliases_path_prompt="the full destination pathname for the
installed Postfix newaliases command. This is the Sendmail-compatible
command to build alias databases for the Postfix local delivery
agent."
mailq_path_prompt="the full destination pathname for the installed
Postfix mailq command. This is the Sendmail-compatible mail queue
listing command."
mail_owner_prompt="the owner of the Postfix queue. Specify an
account with numerical user ID and group ID values that are not
used by any other accounts on the system."
setgid_group_prompt="the group for mail submission and for queue
management commands. Specify a group name with a numerical group
ID that is not shared with other accounts, not even with the Postfix
mail_owner account."
manpage_path_prompt="the destination directory for the Postfix on-line
manual pages."
# Default settings, just to get started.
: ${install_root=/}
: ${tempdir=`pwd`}
: ${config_directory=`bin/postconf -h -d config_directory`}
# Find out the location of installed configuration files.
test -z "$non_interactive" && for name in install_root tempdir config_directory
do
while :
do
echo
eval echo Please specify \$${name}_prompt | ${FMT}
eval echo \$n "$name: [\$$name]\ \$c"
read ans
case $ans in
"") break;;
*) case $ans in
/*) eval $name=\$ans; break;;
*) echo; echo Error: $name should be an absolute path name. 1>&2;;
esac;;
esac
done
done
# In case some systems special-case pathnames beginning with //.
case $install_root in
/) install_root=
esac
CONFIG_DIRECTORY=$install_root$config_directory
# If a parameter is not set via the command line or environment,
# try to use settings from installed configuration files.
# Extract parameter settings from the installed main.cf file.
test -f $CONFIG_DIRECTORY/main.cf && {
for name in daemon_directory command_directory queue_directory mail_owner \
setgid_group sendmail_path newaliases_path mailq_path manpage_path
do
eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -h $name\`} || kill $$
done
}
# Grandfathering: some parameters used to be stored in install.cf.
# They are now part of main.cf. Some names have changed as well.
grep setgid_group $CONFIG_DIRECTORY/main.cf >/dev/null 2>&1 || {
test -f $CONFIG_DIRECTORY/install.cf && {
for name in sendmail_path newaliases_path mailq_path setgid manpages
do
eval : \${$name=`. $CONFIG_DIRECTORY/install.cf; echo \$name`}
done
: ${setgid_group=$setgid}
: ${manpage_path=$manpages}
}
}
# Find out what parameters were not specified via command line,
# via environment, or via installed configuration files.
missing=
for name in daemon_directory command_directory queue_directory mail_owner \
setgid_group sendmail_path newaliases_path mailq_path manpage_path
do
eval test -n \"\$$name\" || missing="$missing $name"
done
# In the case of non-interactive installation, all parameters must
# be specified at this point.
test -n "$non_interactive" -a -n "$missing" && {
cat <<EOF | ${FMT} 1>&2
Error: non-interactive installation requires that all parameters
be specified ahead of time.
- Either the parameters must be given in the $CONFIG_DIRECTORY/main.cf
file from a recent Postfix installation,
- Or the parameters need to be specified as name=value arguments
on the $0 command line,
- Or the parameters need to be specified through the process
environment.
The following parameters were missing:
$missing
For interactive installation use "make install".
EOF
exit 1
}
# Use built-in defaults for parameters that weren't set via the
# environment, via the command line, or via installed configuration
# files.
for name in $missing
do
eval : \${$name=\`bin/postconf -d -h $name\`} || kill $$
done
# Override default settings.
test -z "$non_interactive" && for name in daemon_directory command_directory \
queue_directory sendmail_path newaliases_path mailq_path mail_owner \
setgid_group manpage_path
do
while :
do
echo
eval echo Please specify \$${name}_prompt | ${FMT}
eval echo \$n "$name: [\$$name]\ \$c"
read ans
case $ans in
"") break;;
*) eval $name=\$ans; break;;
esac
done
done
# Sanity checks
case $manpage_path in
no) echo Error: manpage_path no longer accepts \"no\" values. 1>&2
echo Re-run this script with \"make install\". 1>&2; exit 1;;
esac
case $setgid_group in
no) echo Error: setgid_group no longer accepts \"no\" values. 1>&2
echo Re-run this script with \"make install\". 1>&2; exit 1;;
esac
for path in $daemon_directory $command_directory \
$queue_directory $sendmail_path $newaliases_path $mailq_path $manpage_path
do
case $path in
/*) ;;
*) echo Error: $path should be an absolute path name. 1>&2; exit 1;;
esac
done
test -d $tempdir || mkdir -p $tempdir || exit 1
( rm -f $tempdir/junk && touch $tempdir/junk ) || {
echo Error: you have no write permission to $tempdir. 1>&2
echo Specify an alternative directory for scratch files. 1>&2
exit 1
}
rm -f $tempdir/junk
# Avoid clumsiness.
DAEMON_DIRECTORY=$install_root$daemon_directory
COMMAND_DIRECTORY=$install_root$command_directory
QUEUE_DIRECTORY=$install_root$queue_directory
SENDMAIL_PATH=$install_root$sendmail_path
NEWALIASES_PATH=$install_root$newaliases_path
MAILQ_PATH=$install_root$mailq_path
MANPAGE_PATH=$install_root$manpage_path
# Create any missing directories.
test -d $CONFIG_DIRECTORY || mkdir -p $CONFIG_DIRECTORY || exit 1
test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1
test -d $COMMAND_DIRECTORY || mkdir -p $COMMAND_DIRECTORY || exit 1
test -d $QUEUE_DIRECTORY || mkdir -p $QUEUE_DIRECTORY || exit 1
for path in $SENDMAIL_PATH $NEWALIASES_PATH $MAILQ_PATH
do
dir=`echo $path|sed -e 's/[/][/]*[^/]*$//' -e 's/^$/\//'`
test -d $dir || mkdir -p $dir || exit 1
done
# Install files. Keep a record of pathnames, ownerships and permissions
# so that "postfix check" and "post-install" can do the right thing.
# If building a package for distribution to other systems, don't
# enable execute permission.
if [ -n "$install_root" ]
then
EXE=644
else
EXE=755
fi
cat <<EOF >$CONFIG_DIRECTORY/postfix-files || exit 1
#
# Do not edit. This file was generated by $0.
#
# Do not list \$command_directory here, or it will be blown
# away by a future Postfix uninstallation procedure.
#
# File format:
# name:type:owner:group:permission:upgrade:create
# No group means don't change group ownership.
#
# File flags:
# No flag means the flag is not active.
# update=update owner/group/mode (upgrade mode).
# create=create missing directory.
#
$config_directory:d:root::755:u
$daemon_directory:d:root::755:u
$queue_directory:d:root::755:u
EOF
# Generate instructions only for queue subdirectories.
for dir in active bounce corrupt defer deferred flush incoming private saved
do
echo $queue_directory/$dir:d:$mail_owner::700:u:c \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
echo $queue_directory/maildrop:d:$mail_owner:$setgid_group:730:u:c \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
echo $queue_directory/public:d:$mail_owner:$setgid_group:710:u:c \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
echo $queue_directory/pid:d:root::755:u:c \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
# Install daemon programs.
for file in `censored_ls libexec`
do
compare_or_replace $EXE libexec/$file $DAEMON_DIRECTORY/$file || exit 1
echo $daemon_directory/$file:f:root::755 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
# Install administrative commands.
for file in `censored_ls bin | grep '^post' | egrep -v '^post(drop|queue)$'`
do
compare_or_replace $EXE bin/$file $COMMAND_DIRECTORY/$file || exit 1
echo $command_directory/$file:f:root::755 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
# Don't set privilege bits when building a package for distribution
# to other systems.
if [ -n "$install_root" ]
then
for file in postdrop postqueue
do
compare_or_replace $EXE bin/$file $COMMAND_DIRECTORY/$file || exit 1
echo $command_directory/$file:f:root:postdrop:1755 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
else
for file in postdrop postqueue
do
compare_or_replace 2$EXE bin/$file $COMMAND_DIRECTORY/$file postdrop \
|| exit 1
echo $command_directory/$file:f:root:postdrop:1755 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
fi
# Install the Sendmail-compatible user interface.
test -f bin/sendmail && {
compare_or_replace $EXE bin/sendmail $SENDMAIL_PATH || exit 1
compare_or_symlink $SENDMAIL_PATH $NEWALIASES_PATH
compare_or_symlink $SENDMAIL_PATH $MAILQ_PATH
cat <<EOF >>$CONFIG_DIRECTORY/postfix-files || exit 1
$sendmail_path:f:root::755
$newaliases_path:f:root::755
$mailq_path:f:root::755
EOF
}
# Preserve installed configuration files. Update scripts, license, samples.
if [ -f $CONFIG_DIRECTORY/main.cf ]
then
for file in LICENSE `cd conf; censored_ls sample*` main.cf.default
do
compare_or_replace 644 conf/$file $CONFIG_DIRECTORY/$file || exit 1
done
else
for file in `censored_ls conf | egrep -v '^(postfix-script|post-install)$'`
do
compare_or_replace 644 conf/$file $CONFIG_DIRECTORY/$file || exit 1
done
test -z "$install_root" && need_config="-create -first-install"
fi
for file in `censored_ls conf | egrep -v 'postfix-script|post-install'`
do
echo $config_directory/$file:f:root::644 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
for file in postfix-script post-install
do
compare_or_replace $EXE conf/$file $CONFIG_DIRECTORY/$file || exit 1
echo $config_directory/$file:f:root::755 \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done
# Save settings.
bin/postconf -c $CONFIG_DIRECTORY -e \
"daemon_directory = $daemon_directory" \
"command_directory = $command_directory" \
"queue_directory = $queue_directory" \
"mail_owner = $mail_owner" \
"setgid_group = $setgid_group" \
"sendmail_path = $sendmail_path" \
"mailq_path = $mailq_path" \
"newaliases_path = $newaliases_path" \
"manpage_path = $manpage_path" \
|| exit 1
# Install manual pages.
(cd man || exit 1
for dir in man?
do test -d $MANPAGE_PATH/$dir || mkdir -p $MANPAGE_PATH/$dir || exit 1
done
for file in `censored_ls man?/*`
do
compare_or_replace 644 $file $MANPAGE_PATH/$file || exit 1
echo "$manpage_path/$file:f:root::644" \
>>$CONFIG_DIRECTORY/postfix-files || exit 1
done)
# If Postfix is being installed locally from source code, as opposed to
# being packaged for distribution to other systems, do the post-install
# processing now.
test -n "$install_root" && exit 0
${SHELL} conf/post-install ${need_config-"-upgrade-source"} $config_directory

View File

@ -75,6 +75,7 @@
#include <sys_defs.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
/* Utility library. */

View File

@ -15,7 +15,7 @@
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-20020107"
#define DEF_MAIL_VERSION "Snapshot-20020110"
extern char *var_mail_version;
/* LICENSE

View File

@ -78,11 +78,12 @@ int mail_flow_get(int len)
msg_panic("%s: bad length %d", myname, len);
/*
* Read and discard N bytes.
* Read and discard N bytes. XXX AIX read() returns 0 when the pipe is
* empty.
*/
for (count = len; count > 0; count -= n)
if ((n = read(MASTER_FLOW_READ, buf, count > BUFFER_SIZE ?
BUFFER_SIZE : count)) < 0)
BUFFER_SIZE : count)) <= 0)
return (-1);
if (msg_verbose)
msg_info("%s: %d %d", myname, len, len - count);

View File

@ -13,9 +13,9 @@
/*
/* The \fBpostfix\fR command controls the operation of the Postfix
/* mail system: start or stop the \fBmaster\fR daemon, do a health
/* check, and other maintenance.
/* check, and other maintenance.
/*
/* The \fBpostfix\fR command sets up a standardized environment and
/* The \fBpostfix\fR command sets up a standardized environment and
/* runs the \fBpostfix-script\fR shell script to do the actual work.
/*
/* The following commands are implemented:
@ -68,26 +68,27 @@
/* .IP \fBMAIL_DEBUG\fR
/* This is set when the -D command-line option is present.
/* .PP
/* The following configuration parameters are made available
/* as process environment variables with the same names:
/* The following \fBmain.cf\fR configuration parameters are made
/* available as process environment variables with the same names:
/* .IP \fBcommand_directory\fR
/* Directory with Postfix support commands (default:
/* \fB$program_directory\fR).
/* Directory with Postfix administrative commands.
/* .IP \fBdaemon_directory\fR
/* Directory with Postfix daemon programs (default:
/* \fB$program_directory\fR).
/* Directory with Postfix daemon programs.
/* .IP \fBconfig_directory\fR
/* Directory with Postfix configuration files and with administrative
/* shell scripts.
/* .IP \fBqueue_directory\fR
/* The directory with the Postfix queue directory (and with some
/* files needed for programs running in a chrooted environment).
/* The directory with Postfix queue files, with local inter-process
/* communication endpoints, and with files needed for daemon programs
/* that run in the optional chrooted environment.
/* .IP \fBmail_owner\fR
/* The owner of Postfix queue files and of most Postfix processes.
/* .IP \fBsetgid_group\fR
/* The group for mail submission and queue management commands.
/* FILES
/* $\fBconfig_directory/postfix-script\fR, administrative commands
/* $\fBconfig_directory/main.cf\fR, configuration parameters
/* $\fBconfig_directory/master.cf\fR, Postfix daemon processes
/* SEE ALSO
/* master(8) Postfix master program
/* LICENSE

View File

@ -80,6 +80,7 @@
#include <sys_defs.h>
#include <stdarg.h>
#include <string.h>
/* Utility library. */

View File

@ -80,6 +80,7 @@
#include <sys_defs.h>
#include <stdarg.h>
#include <string.h>
/* Utility library. */

View File

@ -134,6 +134,7 @@
#include <sys_defs.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
/* Utility library. */

View File

@ -137,6 +137,7 @@
#include <sys_defs.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
/* Utility library. */

View File

@ -40,6 +40,7 @@
#include "sys_defs.h"
#include <ctype.h>
#include <string.h>
/* Utility library. */

View File

@ -111,14 +111,15 @@
/* of at least "len" bytes. The minimal length is 1. The result
/* is a null-terminated string of length zero.
/*
/* vstring_ctl() gives control over memory management policy.
/* vstring_ctl() gives additional control over vstring behavior.
/* The function takes a VSTRING pointer and a list of zero
/* or more (name,value) pairs. The expected valye type of the
/* value depends on the specified name. The name codes are:
/* or more (name,value) pairs. The expected value type
/* depends on the specified name. The value name codes are:
/* .IP "VSTRING_CTL_MAXLEN (int)"
/* Specifies a hard upper limit on a string's length. When the
/* length would be exceeded, the program simulates a memory
/* allocation problem (i.e. it terminates through msg_fatal()).
/* This fuctionality is currently unimplemented.
/* .IP "VSTRING_CTL_END (no value)"
/* Specifies the end of the argument list. Forgetting to terminate
/* the argument list may cause the program to crash.