$NetBSD: patch-ac,v 1.3 2007/08/27 22:33:19 jlam Exp $

--- maildrop/main.C.orig	2006-10-01 20:03:37.000000000 -0400
+++ maildrop/main.C
@@ -576,7 +576,7 @@ uid_t	my_u=getuid();
 	if (!found)
 	{
 #if HAVE_COURIER
-		if (!deliverymode)
+		if (!deliverymode || !getenv("COURIER_MTA"))
 #endif
 		{
 			my_pw=getpwuid(my_u);
@@ -628,6 +628,14 @@ Buffer	value;
 	{
 	const char *p;
 
+		/*
+		 * To allow one maildrop to be used by both courier MTA
+		 * and others, we require courier MTA to set COURIER_MTA
+		 * in the environment before running maildrop.
+		 */
+		if (getenv("COURIER_MTA"))
+		{	/* COURIER_MTA */
+
 		if ((p=getenv("HOME")) && *p)
 			maildrop.init_home=p;
 
@@ -652,6 +660,8 @@ Buffer	value;
 
 		if ((p=getenv("MAILDIRQUOTA")) && *p)
 			maildrop.init_quota=p;
+
+		}	/* COURIER_MTA */
 	}
 #endif
 
