pkgsrc/mail/relay-ctrl/files/ifrelayclient.sh
schmonz 32bcbd10f1 Initial import of relay-ctrl 3.1.1.
This set of programs controls access to relaying for users that
authenticate using either POP3 using the qmail-popup/qmail-pop3d
or pop3front servers, or IMAP using Courier IMAP or Dovecot.
2007-02-28 14:12:40 +00:00

39 lines
700 B
Bash

#!@SH@
#
# Wrapper for qmail-smtpd command chain that runs the first command
# only if RELAYCLIENT is set, running the remaining commands
# regardless. End the first command with "--".
#
# Useful for e.g. setting RBLSMTPD="" to avoid RBL-blocking an
# authenticated user.
relayclient_isset()
{
@SETENV@ | @GREP@ -q '^RELAYCLIENT=' >/dev/null 2>&1
}
main()
{
local cmd1 arg
cmd1=""
while [ $# -gt 0 ]; do
arg="$1"; shift
if [ "${arg}" = '--' ]; then
break
else
cmd1="${cmd1} ${arg}"
fi
done
if [ $# -eq 0 ]; then
@ECHO@ >&2 "usage: $0 command args -- command args"
exit 111
fi
if relayclient_isset; then
exec ${cmd1} "$@"
else
exec "$@"
fi
}
main "$@"
exit $?