As promised, I finished the patch to add SMTPS support to Courier.

Most of the files changed/added are config or scripts only.  The only 
source code modification was in courier/module.esmtp/courieresmtpd.c, 
which will not initialize the STARTTLS feature if it appears that the 
server was started with TLS already running.

In addition to sending the patch, I've made packages for Red Hat Linux 7.2 
available at:
ftp://phantom.dragonsdawn.net/pub/linux/redhat-7.x-mycontrib/

Additional testing and comments are appreciated.

-- 
If I had a dollar for every brain that you don't have,
        I'd have one dollar. - Squidward to SpongeBob
diff -ruN courier-0.36.1/courier/imapd-ssl.rc.in 
courier-0.36.1-smtps/courier/imapd-ssl.rc.in
--- courier-0.36.1/courier/imapd-ssl.rc.in      Thu Mar 15 19:39:41 2001
+++ courier-0.36.1-smtps/courier/imapd-ssl.rc.in        Mon Dec 10 10:19:43 2001
@@ -5,39 +5,58 @@
 # See COPYING for distribution information.
 
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+sysconfdir="@sysconfdir@"
+bindir="@bindir@"
+sbindir="@sbindir@"
+libexecdir="@libexecdir@"
 
-. @sysconfdir@/imapd
-. @sysconfdir@/imapd-ssl
+. ${sysconfdir}/imapd
+. ${sysconfdir}/imapd-ssl
 
-case $1 in
+export PATH
+export SHELL
+
+case "$1" in
 start)
-       LIBAUTHMODULES=""
-       for f in `echo $AUTHMODULES`
-       do
-               LIBAUTHMODULES="$LIBAUTHMODULES @libexecdir@/authlib/$f"
-       done
-
-       ulimit -d $IMAP_ULIMITD
-       @SETENV@ - @SHELL@ -c " . @sysconfdir@/imapd ; \
-               . @sysconfdir@/imapd-ssl ; \
-               IMAP_TLS=1; export IMAP_TLS; \
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/imapd | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/imapd-ssl | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               @sbindir@/couriertcpd -address=$SSLADDRESS \
-                       -stderrlogger=@sbindir@/logger \
-                       -stderrloggername=imapd-ssl \
-                       -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
-                       -pid=$SSLPIDFILE $TCPDOPTS \
-                       $SSLPORT $COURIERTLS -server -tcpd \
-                               @libexecdir@/courier/imaplogin $LIBAUTHMODULES \
-                               @bindir@/imapd Maildir"
        ;;
 stop)
-       @sbindir@/couriertcpd -pid=$SSLPIDFILE -stop
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -stop
+       exit 0
+       ;;
+restart)
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -restart
+       exit 0
+       ;;
+*)
+       exit 0
        ;;
 esac
-exit 0
+
+cd ${prefix}
+
+AUTHMODULELIST=""
+for f in `echo $AUTHMODULES`
+do
+       AUTHMODULELIST="$AUTHMODULELIST ${libexecdir}/authlib/$f"
+done
+AUTHMODULELIST="`echo $AUTHMODULELIST`"
+
+ulimit -d $IMAP_ULIMITD
+@SETENV@ - @SHELL@ -c " . ${sysconfdir}/imapd ; \
+                       . ${sysconfdir}/imapd-ssl ; \
+       IMAP_TLS=1; export IMAP_TLS; \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/imapd | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/imapd-ssl | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       ${sbindir}/couriertcpd \
+               -stderrlogger=${sbindir}/logger \
+               -stderrloggername=imapd-ssl \
+               -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+               -pid=$SSLPIDFILE $TCPDOPTS \
+               -address=$SSLADDRESS $SSLPORT \
+               $COURIERTLS -server -tcpd \
+                       ${libexecdir}/courier/imaplogin $AUTHMODULELIST \
+                       ${bindir}/imapd Maildir"
diff -ruN courier-0.36.1/courier/imapd.rc.in courier-0.36.1-smtps/courier/imapd.rc.in
--- courier-0.36.1/courier/imapd.rc.in  Sun Jul 29 17:13:39 2001
+++ courier-0.36.1-smtps/courier/imapd.rc.in    Mon Dec 10 10:19:31 2001
@@ -5,42 +5,58 @@
 # See COPYING for distribution information.
 
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+sysconfdir="@sysconfdir@"
+bindir="@bindir@"
+sbindir="@sbindir@"
+libexecdir="@libexecdir@"
 
-. @sysconfdir@/imapd-ssl
-. @sysconfdir@/imapd
+. ${sysconfdir}/imapd-ssl
+. ${sysconfdir}/imapd
 
-case $1 in
+export PATH
+export SHELL
+
+case "$1" in
 start)
-       LIBAUTHMODULES=""
-       for f in `echo $AUTHMODULES`
-       do
-               LIBAUTHMODULES="$LIBAUTHMODULES @libexecdir@/authlib/$f"
-       done
-
-       ulimit -d $IMAP_ULIMITD
-       @SETENV@ - @SHELL@ -c " . @sysconfdir@/imapd ; \
-                               . @sysconfdir@/imapd-ssl ; \
-               IMAP_STARTTLS=$IMAPDSTARTTLS ; export IMAP_STARTTLS ; \
-               TLS_PROTOCOL=$TLS_STARTTLS_PROTOCOL ; \
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/imapd | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/imapd-ssl | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               @sbindir@/couriertcpd -address=$ADDRESS \
-                       -stderrlogger=@sbindir@/logger \
-                       -stderrloggername=imapd \
-                       -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
-                       -pid=$PIDFILE $TCPDOPTS \
-                       $PORT @libexecdir@/courier/imaplogin $LIBAUTHMODULES \
-                               @bindir@/imapd Maildir"
        ;;
 stop)
-       @sbindir@/couriertcpd -pid=$PIDFILE -stop
+       ${sbindir}/couriertcpd -pid=$PIDFILE -stop
+       exit 0
        ;;
 restart)
-       @sbindir@/couriertcpd -pid=$PIDFILE -restart
+       ${sbindir}/couriertcpd -pid=$PIDFILE -restart
+       exit 0
+       ;;
+*)
+       exit 0
        ;;
 esac
-exit 0
+
+cd ${prefix}
+
+AUTHMODULELIST=""
+for f in `echo $AUTHMODULES`
+do
+       AUTHMODULELIST="$AUTHMODULELIST ${libexecdir}/authlib/$f"
+done
+AUTHMODULELIST="`echo $AUTHMODULELIST`"
+
+ulimit -d $IMAP_ULIMITD
+@SETENV@ - @SHELL@ -c " . ${sysconfdir}/imapd ; \
+                       . ${sysconfdir}/imapd-ssl ; \
+       IMAP_STARTTLS=$IMAPDSTARTTLS ; export IMAP_STARTTLS ; \
+       TLS_PROTOCOL=$TLS_STARTTLS_PROTOCOL ; \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/imapd | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/imapd-ssl | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       ${sbindir}/couriertcpd \
+               -stderrlogger=${sbindir}/logger \
+               -stderrloggername=imapd \
+               -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+               -pid=$PIDFILE $TCPDOPTS \
+               -address=$ADDRESS $PORT \
+               ${libexecdir}/courier/imaplogin $AUTHMODULELIST \
+                       ${bindir}/imapd Maildir"
diff -ruN courier-0.36.1/courier/module.esmtp/Makefile.am 
courier-0.36.1-smtps/courier/module.esmtp/Makefile.am
--- courier-0.36.1/courier/module.esmtp/Makefile.am     Sat Aug 18 15:20:53 2001
+++ courier-0.36.1-smtps/courier/module.esmtp/Makefile.am       Mon Dec 10 11:08:55 
+2001
@@ -10,10 +10,11 @@
 moduledir=$(libexecdir)/courier/modules/$(NAME)
 
 databindir=$(datadir)
-databin_SCRIPTS=esmtpd makesmtpaccess makeacceptmailfor makepercentrelay \
-       mkesmtpdcert
+databin_SCRIPTS=esmtpd esmtpd-ssl makesmtpaccess makeacceptmailfor \
+       makepercentrelay mkesmtpdcert
 
-sysconf_DATA=esmtpd.cnf esmtpd.dist esmtpd-msa.dist esmtp.authpam module.@NAME@
+sysconf_DATA=esmtpd.cnf esmtpd.dist esmtpd-msa.dist esmtpd-ssl.dist \
+       esmtp.authpam module.@NAME@
 
 module.@NAME@: config
        cp config module.@NAME@
@@ -188,6 +189,7 @@
        @echo $(sbindir)/makesmtpaccess-msa 555 @mailuser@ @mailgroup@ 
>>permissions.dat
        @echo $(sysconfdir)/esmtpd.dist 644 @mailuser@ @mailgroup@ config 
>>permissions.dat
        @echo $(sysconfdir)/esmtpd-msa.dist 644 @mailuser@ @mailgroup@ config 
>>permissions.dat
+       @echo $(sysconfdir)/esmtpd-ssl.dist 644 @mailuser@ @mailgroup@ config 
+>>permissions.dat
        @echo $(sysconfdir)/esmtpacceptmailfor.dir 755 @mailuser@ @mailgroup@ 
>>permissions.dat
        @echo $(sysconfdir)/esmtppercentrelay.dir 755 @mailuser@ @mailgroup@ 
>>permissions.dat
        @echo $(sysconfdir)/esmtp.authpam 644 @mailuser@ @mailgroup@ config 
>>permissions.dat
diff -ruN courier-0.36.1/courier/module.esmtp/configure.in 
courier-0.36.1-smtps/courier/module.esmtp/configure.in
--- courier-0.36.1/courier/module.esmtp/configure.in    Sat Nov 17 19:00:32 2001
+++ courier-0.36.1-smtps/courier/module.esmtp/configure.in      Mon Dec 10 11:09:54 
+2001
@@ -304,6 +304,7 @@
 certdir=$dir
 AC_SUBST(certdir)
 
-AC_OUTPUT(Makefile esmtpd esmtpd.dist esmtpd-msa.dist \
-       makesmtpaccess makeacceptmailfor
+AC_OUTPUT(Makefile esmtpd esmtpd-ssl \
+       esmtpd.dist esmtpd-msa.dist esmtpd-ssl.dist  \
+       makesmtpaccess makeacceptmailfor \
        makepercentrelay staticlist.c mkesmtpdcert esmtpd.cnf)
diff -ruN courier-0.36.1/courier/module.esmtp/courieresmtpd.c 
courier-0.36.1-smtps/courier/module.esmtp/courieresmtpd.c
--- courier-0.36.1/courier/module.esmtp/courieresmtpd.c Wed Sep  5 20:02:51 2001
+++ courier-0.36.1-smtps/courier/module.esmtp/courieresmtpd.c   Sun Dec 16 01:12:28 
+2001
@@ -865,20 +865,29 @@
 
                clog_open_syslog("courieresmtpd");
 
-               if ((p=getenv("COURIERTLS")) != 0 && *p
-                       && access(p, X_OK) == 0 &&
-                       (p=getenv("TLS_CERTFILE")) != 0 && *p &&
-                       access(p, R_OK) == 0)
-                       starttls=1;
-
-               if ((p=getenv("ESMTP_TLS_REQUIRED")) && atoi(p))
+               if ((p=getenv("ESMTP_TLS")) && atoi(p))
+               {
+                       tls=1;
+                       /* This is the smtps service, and we don't need to
+                        * initialize the STARTTLS feature. */
+               }
+               else
                {
-                       tls_required=1;
-                       if (!starttls)
+                       if ((p=getenv("COURIERTLS")) != 0 && *p
+                               && access(p, X_OK) == 0 &&
+                               (p=getenv("TLS_CERTFILE")) != 0 && *p &&
+                               access(p, R_OK) == 0)
+                               starttls=1;
+
+                       if ((p=getenv("ESMTP_TLS_REQUIRED")) && atoi(p))
                        {
-                               addiovec_error(NULL, "440 TLS not available,  but"
-                                       " it's required for this connection.");
-                               return (1);
+                               tls_required=1;
+                               if (!starttls)
+                               {
+                                       addiovec_error(NULL, "440 TLS not available,  
+but"
+                                               " it's required for this 
+connection.");
+                                       return (1);
+                               }
                        }
                }
        }
diff -ruN courier-0.36.1/courier/module.esmtp/esmtpd-ssl.dist.in 
courier-0.36.1-smtps/courier/module.esmtp/esmtpd-ssl.dist.in
--- courier-0.36.1/courier/module.esmtp/esmtpd-ssl.dist.in      Wed Dec 31 16:00:00 
1969
+++ courier-0.36.1-smtps/courier/module.esmtp/esmtpd-ssl.dist.in        Mon Dec 10 
+14:08:49 2001
@@ -0,0 +1,151 @@
+##VERSION: $Id: esmtpd-ssl.dist.in,v 1.6 2001/07/04 19:32:37 uid26639 Exp $
+#
+# esmtpd-ssl created from esmtpd-ssl.dist by sysconftool
+#
+# Do not alter lines that begin with ##, they are used when upgrading
+# this configuration.
+#
+#  Copyright 2000-2001 Double Precision, Inc.  See COPYING for
+#  distribution information.
+#
+#  This configuration file sets various options for the Courier-SMTP server
+#  when used to handle SSL ESMTP connections.
+#
+#  SSL and non-SSL connections are handled by a dedicated instance of the
+#  couriertcpd daemon.  If you are accepting both SSL and non-SSL ESMTP
+#  connections, you will start two instances of couriertcpd, one on the
+#  ESMTP port 25, and another one on the ESMTP-SSL port 465.
+#
+#  Download OpenSSL from http://www.openssl.org/
+#
+##NAME: install_prefix:0
+#
+# Do not change the following settings.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+
+##NAME: SSLPORT:0
+#
+#  Options in the esmtpd-ssl configuration file AUGMENT the options in the
+#  esmtpd configuration file.  First the esmtpd configuration file is read,
+#  then the esmtpd-ssl configuration file, so we do not have to redefine
+#  anything.
+#
+#  However, some things do have to be redefined.  The port number is
+#  specified by SSLPORT, instead of PORT.  The default port is port 465.
+#
+#  Multiple port numbers can be separated by commas.  When multiple port
+#  numbers are used it is possibly to select a specific IP address for a
+#  given port as "ip.port".  For example, "127.0.0.1.900,192.68.0.1.900"
+#  accepts connections on port 900 on IP addresses 127.0.0.1 and 192.68.0.1
+#  The SSLADDRESS setting is a default for ports that do not have
+#  a specified IP address.
+
+SSLPORT=465
+
+##NAME: SSLADDRESS:0
+#
+#  Address to listen on, can be set to a single IP address.
+#
+# SSLADDRESS=127.0.0.1
+
+SSLADDRESS=0
+
+##NAME: SSLPIDFILE:0
+#
+# You can also redefine AUTHMODULES, although I can't
+# think of why you'd want to do that.
+#
+#
+
+SSLPIDFILE=@localstatedir@/tmp/esmtpd-ssl.pid
+
+##NAME: ESMTPDSSLSTART:0
+#
+#  Whether or not to start ESMTP over SSL on esmtps port:
+
+ESMTPDSSLSTART=NO
+
+##NAME: COURIERTLS:0
+#
+# The following variables configure ESMTP over SSL.  If OpenSSL is available
+# during configuration, the couriertls helper gets compiled, and upon
+# installation a dummy TLS_CERTFILE gets generated.  courieresmtpd will
+# automatically advertise the ESMTP STARTTLS extension if both TLS_CERTFILE
+# and COURIERTLS exist.
+#
+# WARNING: Peer certificate verification has NOT yet been tested.  Proceed
+# at your own risk.  Only the basic SSL/TLS functionality is known to be
+# working. Keep this in mind as you play with the following variables.
+
+COURIERTLS=@bindir@/couriertls
+
+##NAME: TLS_PROTOCOL:0
+#
+# TLS_PROTOCOL sets the protocol version.  The possible versions are:
+#
+# SSL2 - SSLv2
+# SSL3 - SSLv3
+# TLS1 - TLS1
+
+TLS_PROTOCOL=SSL3
+
+##NAME: TLS_CIPHER_LIST:0
+#
+# TLS_CIPHER_LIST optionally sets the list of ciphers to be used by the
+# OpenSSL library.  In most situations you can leave TLS_CIPHER_LIST
+# undefined
+#
+# TLS_CIPHER_LIST="ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH"
+
+##NAME: TLS_TIMEOUT:0
+# TLS_TIMEOUT is currently not implemented, and reserved for future use.
+# This is supposed to be an inactivity timeout, but its not yet implemented.
+#
+
+##NAME: TLS_DHCERTFILE:0
+#
+# TLS_DHCERTFILE - PEM file that stores our Diffie-Hellman cipher pair.
+# When OpenSSL is compiled to use Diffie-Hellman ciphers instead of RSA
+# you must generate a DH pair that will be used.  In most situations the
+# DH pair is to be treated as confidential, and the file specified by
+# TLS_DHCERTFILE must not be world-readable.
+#
+# TLS_DHCERTFILE=
+
+##NAME: TLS_CERTFILE:0
+#
+# TLS_CERTFILE - certificate to use.  TLS_CERTFILE is required for SSL/TLS
+# servers, and is optional for SSL/TLS clients.  TLS_CERTFILE is usually
+# treated as confidential, and must not be world-readable.
+#
+TLS_CERTFILE=@datadir@/esmtpd.pem
+
+##NAME: TLS_TRUSTCERTS:0
+#
+# TLS_TRUSTCERTS=pathname - load trusted certificates from pathname.
+# pathname can be a file or a directory. If a file, the file should
+# contain a list of trusted certificates, in PEM format. If a
+# directory, the directory should contain the trusted certificates,
+# in PEM format, one per file and hashed using OpenSSL's c_rehash
+# script. TLS_TRUSTCERTS is used by SSL/TLS clients (by specifying
+# the -domain option) and by SSL/TLS servers (TLS_VERIFYPEER is set
+# to PEER or REQUIREPEER).
+#
+#
+# TLS_TRUSTCERTS=
+
+##NAME: TLS_VERIFYPEER:0
+#
+# TLS_VERIFYPEER - how to verify client certificates.  The possible values of
+# this setting are:
+#
+# NONE - do not verify anything
+#
+# PEER - verify the client certificate, if one's presented
+#
+# REQUIREPEER - require a client certificate, fail if one's not presented
+#
+#
+TLS_VERIFYPEER=NONE
diff -ruN courier-0.36.1/courier/module.esmtp/esmtpd-ssl.in 
courier-0.36.1-smtps/courier/module.esmtp/esmtpd-ssl.in
--- courier-0.36.1/courier/module.esmtp/esmtpd-ssl.in   Wed Dec 31 16:00:00 1969
+++ courier-0.36.1-smtps/courier/module.esmtp/esmtpd-ssl.in     Sun Dec 16 00:58:23 
+2001
@@ -0,0 +1,85 @@
+#! @SHELL@
+#
+#  $Id: esmtpd.in,v 1.15 2001/08/05 20:34:11 mrsam Exp $
+#
+#  Copyright 1998 - 2000 Double Precision, Inc.  See COPYING for
+#  distribution information.
+#
+#  This is a simple script to start/stop the smtp port daemon, courieresmtpd.
+#
+#  Argument "start" starts the daemon.
+#  Argument "stop" stops the daemon (just the listening daemon).
+#  Argument "restart" rereads the smtpaccess.dat file.
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+sysconfdir="@sysconfdir@"
+sbindir="@sbindir@"
+libexecdir="@libexecdir@"
+
+. ${sysconfdir}/esmtpd
+. ${sysconfdir}/esmtpd-ssl
+
+export PATH
+export SHELL
+
+case $1 in
+start)
+       ;;
+stop)
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -stop
+       exit 0
+       ;;
+restart)
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -restart
+       exit 0
+       ;;
+*)
+       exit 0
+       ;;
+esac
+
+cd ${prefix}
+
+if test "$AUTHMODULES" != ""
+then
+       authstart="${libexecdir}/courier/modules/esmtp/authstart"
+       if test -x "$authstart"
+       then
+               AUTHMODULES="$authstart $AUTHMODULES"
+       else
+       # not installed/disabled
+               ESMTPAUTH=""
+               AUTHMODULES=""
+       fi
+fi
+
+if test "$ACCESSFILE" != ""
+then
+       if test ! -f "${ACCESSFILE}.dat"
+       then
+               ACCESSFILE=""
+       else
+               ACCESSFILE="-access=${ACCESSFILE}.dat"
+       fi
+fi
+
+ulimit -d "$ULIMIT"
+@SETENV@ - @SHELL@ -c " . ${sysconfdir}/esmtpd ; \
+                       . ${sysconfdir}/esmtpd-ssl ; \
+       ESMTP_TLS=1; export ESMTP_TLS; \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/esmtpd | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/esmtpd-ssl | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       ${sbindir}/couriertcpd \
+               -stderrlogger=${sbindir}/logger \
+               -stderrloggername=esmtpd-ssl \
+               -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+               -maxperc=$MAXPERC \
+               -pid=$SSLPIDFILE $TCPDOPTS \
+               -user=$MAILUSER -group=$MAILGROUP \
+               $BLACKLISTS $ACCESSFILE \
+               -address=$SSLADDRESS $SSLPORT \
+               $COURIERTLS -server -tcpd \
+                       ${sbindir}/courieresmtpd $AUTHMODULES"
diff -ruN courier-0.36.1/courier/pop3d-ssl.in 
courier-0.36.1-smtps/courier/pop3d-ssl.in
--- courier-0.36.1/courier/pop3d-ssl.in Tue Jan 23 21:30:14 2001
+++ courier-0.36.1-smtps/courier/pop3d-ssl.in   Mon Dec 10 10:19:15 2001
@@ -5,43 +5,56 @@
 # See COPYING for distribution information.
 
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libexecdir=@libexecdir@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+sysconfdir="@sysconfdir@"
+sbindir="@sbindir@"
+libexecdir="@libexecdir@"
 
-. @sysconfdir@/pop3d
-. @sysconfdir@/pop3d-ssl
+. ${sysconfdir}/pop3d
+. ${sysconfdir}/pop3d-ssl
 
-case $1 in
+export PATH
+export SHELL
+
+case "$1" in
 start)
-       LIBAUTHMODULES=""
-       for f in `echo $AUTHMODULES`
-       do
-               LIBAUTHMODULES="$LIBAUTHMODULES $libexecdir/authlib/$f"
-       done
-
-       exec @SETENV@ - PATH="$PATH" SHELL="$SHELL" \
-               @SHELL@ -c " . @sysconfdir@/pop3d ; \
-               . @sysconfdir@/pop3d-ssl ; \
-               POP3_TLS=1; export POP3_TLS; \
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/pop3d | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               `sed -n '/^#/d;/=/p' <@sysconfdir@/pop3d-ssl | \
-                       sed 's/=.*//;s/^/export /;s/$/;/'`
-               @sbindir@/couriertcpd -address=$SSLADDRESS \
-                       -stderrlogger=@sbindir@/logger \
-                       -stderrloggername=pop3d-ssl \
-                       -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
-                       -pid=$SSLPIDFILE $TCPDOPTS \
-                       $SSLPORT $COURIERTLS -server -tcpd \
-                               $libexecdir/courier/courierpop3login $LIBAUTHMODULES \
-                               $libexecdir/courier/courierpop3d Maildir"
        ;;
 stop)
-       @sbindir@/couriertcpd -pid=$SSLPIDFILE -stop
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -stop
+       exit 0
        ;;
 restart)
-       @sbindir@/couriertcpd -pid=$SSLPIDFILE -restart
+       ${sbindir}/couriertcpd -pid=$SSLPIDFILE -restart
+       exit 0
+       ;;
+*)
+       exit 0
        ;;
 esac
-exit 0
+
+cd ${prefix}
+
+AUTHMODULELIST=""
+for f in `echo $AUTHMODULES`
+do
+       AUTHMODULELIST="$AUTHMODULELIST ${libexecdir}/authlib/$f"
+done
+AUTHMODULELIST="`echo $AUTHMODULELIST`"
+
+@SETENV@ - @SHELL@ -c " . ${sysconfdir}/pop3d ; \
+                       . ${sysconfdir}/pop3d-ssl ; \
+       POP3_TLS=1; export POP3_TLS; \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/pop3d | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/pop3d-ssl | \
+               sed 's/=.*//;s/^/export /;s/$/;/'`
+       ${sbindir}/couriertcpd \
+               -stderrlogger=${sbindir}/logger \
+               -stderrloggername=pop3d-ssl \
+               -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+               -pid=$SSLPIDFILE $TCPDOPTS \
+               -address=$SSLADDRESS $SSLPORT \
+               $COURIERTLS -server -tcpd \
+                       ${libexecdir}/courier/courierpop3login $AUTHMODULELIST \
+                       ${libexecdir}/courier/courierpop3d Maildir"
diff -ruN courier-0.36.1/courier/pop3d.in courier-0.36.1-smtps/courier/pop3d.in
--- courier-0.36.1/courier/pop3d.in     Sun Jul 29 17:13:39 2001
+++ courier-0.36.1-smtps/courier/pop3d.in       Mon Dec 10 10:19:06 2001
@@ -40,27 +40,28 @@
        ;;
 esac
 
-cd @prefix@
+cd ${prefix}
 
 AUTHMODULELIST=""
-for f in $AUTHMODULES
+for f in `echo $AUTHMODULES`
 do
-       AUTHMODULELIST="$AUTHMODULELIST $libexecdir/authlib/$f"
+       AUTHMODULELIST="$AUTHMODULELIST ${libexecdir}/authlib/$f"
 done
 AUTHMODULELIST="`echo $AUTHMODULELIST`"
 
-@SETENV@ - @SHELL@ -c " . @sysconfdir@/pop3d ; \
-                       . @sysconfdir@/pop3d-ssl ; \
+@SETENV@ - @SHELL@ -c " . ${sysconfdir}/pop3d ; \
+                       . ${sysconfdir}/pop3d-ssl ; \
        POP3_STARTTLS=$POP3DSTARTTLS ; export POP3_STARTTLS ; \
        TLS_PROTOCOL=$TLS_STARTTLS_PROTOCOL ; \
-       `sed -n '/^#/d;/=/p' <@sysconfdir@/pop3d | \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/pop3d | \
                sed 's/=.*//;s/^/export /;s/$/;/'`
-       `sed -n '/^#/d;/=/p' <@sysconfdir@/pop3d-ssl | \
+       `sed -n '/^#/d;/=/p' <${sysconfdir}/pop3d-ssl | \
                sed 's/=.*//;s/^/export /;s/$/;/'`
-       @sbindir@/couriertcpd -address=$ADDRESS \
+       ${sbindir}/couriertcpd \
                -stderrlogger=${sbindir}/logger \
                -stderrloggername=pop3d \
                -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
-               -pid=$PIDFILE $TCPDOPTS -address=$ADDRESS $PORT \
-               @libexecdir@/courier/courierpop3login $AUTHMODULELIST \
-                       @libexecdir@/courier/courierpop3d Maildir"
+               -pid=$PIDFILE $TCPDOPTS \
+               -address=$ADDRESS $PORT \
+               ${libexecdir}/courier/courierpop3login $AUTHMODULELIST \
+                       ${libexecdir}/courier/courierpop3d Maildir"
diff -ruN courier-0.36.1/courier.sysvinit.in courier-0.36.1-smtps/courier.sysvinit.in
--- courier-0.36.1/courier.sysvinit.in  Thu Jan 25 15:50:30 2001
+++ courier-0.36.1-smtps/courier.sysvinit.in    Mon Dec 10 14:22:15 2001
@@ -96,7 +96,21 @@
                echo -n " esmtpd-msa"
                ;;
        esac
-       
+
+       if test -f ${sysconfdir}/esmtpd-ssl
+       then
+               . ${sysconfdir}/esmtpd-ssl
+       fi
+       case x$ESMTPDSSLSTART in
+       x[yY]*)
+               if test -x $COURIERTLS
+               then
+                       ${sbindir}/esmtpd-ssl start
+                       echo -n " esmtpd-ssl"
+               fi
+               ;;
+       esac
+
        if test -x ${sbindir}/pop3d
        then
                POP3DSTART=""
@@ -182,6 +196,9 @@
                ${sbindir}/imapd-ssl stop
                echo -n " imapd-ssl"
        fi
+
+       ${sbindir}/esmtpd-ssl stop
+       echo -n " esmtpd-ssl"
 
        ${sbindir}/esmtpd-msa stop
        echo -n " esmtpd-msa"

Reply via email to