Attached patches allow to start more than two (one for pop3 and one for pop3s) 
instances of courier-imap-pop3. This may be useful when you have more than 
one IP address and so you need diffrent certificates for diffrent domains. 
Propably part of courier-imap-pop3drc.patch should be directly applied to 
courier-imap-pop3.init but it was easier to test it in current form. Imap is 
not done for now, chances are that I will do it but if somebody wants to 
finish the job feel free to do so. Now it is being built on my machine, I 
hope it will be ok. If correct please apply.

Tomek
POP3_CONFIG_FILES="/etc/courier-imap/pop3 /etc/courier-imap/pop3s"
IMAP_CONFIG_FILES="/etc/courier-imap/imap /etc/courier-imap/imaps"
diff -u old/courier-pop3.in new/courier-pop3.in
--- old/courier-pop3.in	2004-09-18 20:37:01.000000000 +0200
+++ new/courier-pop3.in	2004-09-18 22:19:03.000000000 +0200
@@ -31,49 +31,24 @@
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/courier-pop3 ]; then
 
-        POP3DSTART=""
-        POP3DSSLSTART=""
-
-        if test -f $sysconfdir/pop3d
-        then
-            . $sysconfdir/pop3d
-        fi
-
-        case x$POP3DSTART in
-        x[yY]*)
-        # Start daemons.
-	msg_starting pop3d
-        $libexecdir/pop3d.rc start
-	RETVAL=$?
-        if [ $RETVAL -eq 0 ]; then ok; else fail; fi
-        ;;
-        esac
-
-        if test -f $sysconfdir/pop3d-ssl
-        then
-        . $sysconfdir/pop3d-ssl
-        fi
-
-        case x$POP3DSSLSTART in
-	x[yY]*)
-        if test -x $COURIERTLS
-	then
-	# First time we start this, generate a dummy SSL certificate.
-	if test ! -f $TLS_CERTFILE
-	then
-	echo -n " generating-SSL-certificate..."
-	$sbindir/mkpop3dcert >/dev/null 2>&1
-	fi
-	msg_starting pop3d-ssl
-        $libexecdir/pop3d-ssl.rc start
-	RETVAL=$?
-    	if [ $RETVAL -eq 0 ]; then ok; else fail; fi
-
-	fi
-	;;
-	esac
-
-	touch /var/lock/subsys/courier-pop3
+	. /etc/sysconfig/courier
+	for i in $POP3_CONFIG_FILES; do
+		. $i
+		if [ -x $COURIERTLS ]; then
+		# First time we start this, generate a dummy SSL certificate
+			if [ ! -f $TLS_CERTFILE ]; then
+				echo -n " generating-SSL-certificate..."
+				$sbindir/mkpop3dcert >/dev/null 2>&1
+			fi
+		fi
+		if [ `echo $START|grep "^[yY1]"|wc -l` -eq 1 ]; then
+			msg_starting $i
+			$libexecdir/pop3d.rc start $i
+			RETVAL=$?
+			if [ $RETVAL -eq 0 ]; then ok; else fail; fi
+		fi
+	done
+	touch /var/lock/subsys/courier-pop3;
 	else
 		msg_already_running "Courier POP3"
 	fi
@@ -81,32 +56,22 @@
   stop)
 	if [ -f /var/lock/subsys/courier-pop3 ]; then
 
-        . $sysconfdir/pop3d
-        if [ -f $PIDFILE ]; then
-	    msg_stopping pop3d
-    	    $libexecdir/pop3d.rc stop
-	    RETVAL=$?
-    	    if [ $RETVAL -eq 0 ]; then
-		ok
-		rm -f $PIDFILE
-	    else
-		fail
-	    fi
-	fi
-
-        . $sysconfdir/pop3d-ssl
-        if [ -f $SSLPIDFILE ]; then
-	    msg_stopping pop3d-ssl
-    	    $libexecdir/pop3d-ssl.rc stop
-	    RETVAL=$?
-    	    if [ $RETVAL -eq 0 ]; then
-		ok
-		rm -f $SSLPIDFILE
-	    else 
-		fail
-	    fi
-	fi
-
+	. /etc/sysconfig/courier
+	for i in $POP3_CONFIG_FILES; do
+		. $i
+		if [ -f $PIDFILE ]; then
+			msg_stopping $i
+			$libexecdir/pop3d.rc stop $i
+			RETVAL=$?
+			if [ $RETVAL -eq 0 ]; then
+				ok
+				rm -f $PIDFILE
+			else
+				fail
+			fi
+		fi
+	done
+	
 	rm -f /var/lock/subsys/courier-pop3
 	else
 		msg_not_running "Courier POP3"
Common subdirectories: old/imap and new/imap
diff -u old/pop3d.rc.in new/pop3d.rc.in
--- old/pop3d.rc.in	2004-06-09 00:44:16.000000000 +0200
+++ new/pop3d.rc.in	2004-09-18 22:16:33.000000000 +0200
@@ -2,6 +2,7 @@
 # $Id: pop3d.rc.in,v 1.12 2004/04/18 15:54:38 mrsam Exp $
 #
 # Copyright 1998 - 2002 Double Precision, Inc.
+# Copyright 2004 Tomasz Grobelny <[EMAIL PROTECTED]>
 # See COPYING for distribution information.
 
 
@@ -10,20 +11,13 @@
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 
-if test ! -f @sysconfdir@/pop3d
+if test ! -f $2
 then
-	echo "@sysconfdir@/pop3d does not exist, forgot make install-configure?"
+	echo "$2 does not exist, forgot to configure?"
 	exit 1
 fi
 
-if test ! -f @sysconfdir@/pop3d-ssl
-then
-	echo "@sysconfdir@/pop3d-ssl does not exist, forgot make install-configure?"
-	exit 1
-fi
-
-. @sysconfdir@/pop3d-ssl
-. @sysconfdir@/pop3d
+. $2
 
 case $1 in
 start)
@@ -43,17 +37,19 @@
 		[EMAIL PROTECTED]@ ;
 		[EMAIL PROTECTED]@ ;
 		[EMAIL PROTECTED]@ ;
-		. @sysconfdir@/pop3d ; \
-				. @sysconfdir@/pop3d-ssl ; \
-		TLS_PROTOCOL=$TLS_STARTTLS_PROTOCOL ; \
-		export TLS_PROTOCOL ;
+		. $2 ; \
+		if [[ -n \"$TLS_STARTTLS_PROTO\" ]]; then \
+			TLS_PROTOCOL=$TLS_STARTTLS_PROTO; \
+			export TLS_PROTOCOL; \
+		fi; \
 		@libexecdir@/couriertcpd -address=$ADDRESS \
 			[EMAIL PROTECTED]@/courierlogger \
-			-stderrloggername=pop3d \
+			-stderrloggername=$ERRLOGGERNAME \
 			-maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
 			-pid=$PIDFILE $TCPDOPTS \
-			$PORT @sbindir@/pop3login $LIBAUTHMODULES \
-				@bindir@/pop3d ${MAILDIRPATH}"
+			$PORT $COURIERTLS $COURIERTLS_OPTIONS \
+				/usr/sbin/pop3login $LIBAUTHMODULES \
+				/usr/bin/pop3d ${MAILDIRPATH}"
 	;;
 stop)
 	@libexecdir@/couriertcpd -pid=$PIDFILE -stop
Index: courier-imap.spec
===================================================================
RCS file: /cvsroot/SPECS/courier-imap.spec,v
retrieving revision 1.132
diff -u -3 -p -r1.132 courier-imap.spec
--- courier-imap.spec	3 Aug 2004 21:31:23 -0000	1.132
+++ courier-imap.spec	18 Sep 2004 20:30:56 -0000
@@ -9,7 +9,7 @@ Summary:	Courier-IMAP server
 Summary(pl):	Serwer Courier-IMAP
 Name:		courier-imap
 Version:	3.0.7
-Release:	2
+Release:	3
 License:	GPL
 Group:		Networking/Daemons
 Source0:	http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
@@ -18,9 +18,11 @@ Source1:	%{name}.init
 Source2:	%{name}-pop3.init
 Source3:	%{name}.pamd
 Source4:	%{name}-pop3.pamd
+Source5:	%{name}-sysconfig
 Patch0:		%{name}-dirs.patch
 Patch1:		%{name}-certsdir.patch
 Patch2:		%{name}-maildir.patch
+Patch3:		%{name}-pop3drc.patch
 URL:		http://www.inter7.com/courierimap/
 BuildRequires:	autoconf >= 2.54
 BuildRequires:	automake
@@ -174,6 +176,7 @@ IMAP.
 
 install %{SOURCE1} courier-imap.in
 install %{SOURCE2} courier-pop3.in
+%patch3 -p1
 
 %build
 cp -f /usr/share/automake/config.sub .
@@ -219,6 +222,7 @@ install courier-imap $RPM_BUILD_ROOT/etc
 install courier-pop3 $RPM_BUILD_ROOT/etc/rc.d/init.d/courier-pop3
 install %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/imap
 install %{SOURCE4} $RPM_BUILD_ROOT/etc/pam.d/pop3
+install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/courier
 
 rm -rf	$RPM_BUILD_ROOT%{_mandir}/man8/{authcram,authpam,authpwd,authshadow,authuserdb,authvchkpw,pw2userdb,vchkpw2userdb,authdaemon,authdaemond,authldap,authmysql}.8 \
 	$RPM_BUILD_ROOT%{_sbindir}/{*db,mk*cert}
@@ -266,6 +270,9 @@ touch $RPM_BUILD_ROOT/etc/security/black
 sed -i 's/^POP3DSTART.*/POP3DSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/pop3d
 sed -i 's/^IMAPDSTART.*/IMAPDSTART=YES/' $RPM_BUILD_ROOT%{_sysconfdir}/imapd
 
+mv -f $RPM_BUILD_ROOT%{_sysconfdir}/pop3d $RPM_BUILD_ROOT%{_sysconfdir}/pop3
+mv -f $RPM_BUILD_ROOT%{_sysconfdir}/pop3d-ssl $RPM_BUILD_ROOT%{_sysconfdir}/pop3s
+
 # remove unpackaged files
 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.dist
 
@@ -339,6 +346,53 @@ echo - config files has been splited and
 echo - certificates directory has changed to %{_certsdir}
 echo
 
+%triggerin -- %{name}-pop3 < 3.0.7-2
+if [ ! -f /etc/courier-imap/pop3 ]; then
+
+#pop3d
+cat > /etc/courier-imap/pop3 <<EOF
+###################################
+# begin of pop3d-ssl
+EOF
+cat /etc/courier-imap/pop3d-ssl >> /etc/courier-imap/pop3
+cat >> /etc/courier-imap/pop3 <<EOF
+# end of pop3d-ssl
+###################################
+EOF
+cat /etc/courier-imap/pop3d >> /etc/courier-imap/pop3
+cat >> /etc/courier-imap/pop3 <<EOF
+COURIERTLS=""
+COURIERTLS_OPTIONS=""
+ERRLOGGERNAME="pop3d"
+TLS_STARTTLS_PROTO="\$TLS_STARTTLS_PROTOCOL"
+START="\$POP3DSTART"
+EOF
+fi
+
+if [ ! -f /etc/courier-imap/pop3s ]; then
+#pop3d-ssl
+cat > /etc/courier-imap/pop3s <<EOF
+###################################
+# begin of pop3d
+EOF
+cat /etc/courier-imap/pop3d >> /etc/courier-imap/pop3s
+cat >> /etc/courier-imap/pop3s <<EOF
+# end of pop3d
+###################################
+EOF
+cat /etc/courier-imap/pop3d-ssl >> /etc/courier-imap/pop3s
+cat >> /etc/courier-imap/pop3s <<EOF
+COURIERTLS_OPTIONS="-server -tcpd"
+PIDFILE="\$SSLPIDFILE"
+PORT="\$SSLPORT"
+ADDRESS="\$SSLADDRESS"
+POP3_STARTTLS=NO
+POP3_TLS_REQUIRED=0
+ERRLOGGERNAME="pop3d-ssl"
+START="\$POP3DSSLSTART"
+EOF
+fi
+
 %post pop3
 /sbin/chkconfig --add courier-pop3
 /sbin/chkconfig --del courier-imap-pop3 >/dev/null 2>&1 || :
@@ -509,15 +563,14 @@ fi
 %defattr(644,root,root,755)
 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/pam.d/pop3
 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/security/blacklist.pop3
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/pop3d
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/pop3d-ssl
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/pop3
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/pop3s
 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/pop3d.cnf
 %attr(754,root,root) /etc/rc.d/init.d/courier-pop3
 %attr(755,root,root) %{_bindir}/pop3d
 %attr(755,root,root) %{_sbindir}/mkpop3dcert
 %attr(755,root,root) %{_sbindir}/pop3login
 %attr(755,root,root) %{_libexecdir}/pop3d.rc
-%attr(755,root,root) %{_libexecdir}/pop3d-ssl.rc
 %{_mandir}/man8/courierpop*
 
 %if %{with ldap}
_______________________________________________
pld-devel-en mailing list
[EMAIL PROTECTED]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en

Reply via email to