$NetBSD: patch-ac,v 1.4 2010/06/15 23:14:47 pettai Exp $

--- maildrop/main.C.orig	2006-10-01 20:03:37.000000000 -0400
+++ maildrop/main.C
@@ -575,7 +575,7 @@ uid_t	my_u=getuid();
 	if (!found)
 	{
 #if HAVE_COURIER
-		if (!deliverymode)
+		if (!deliverymode || !getenv("COURIER_MTA"))
 #endif
 		{
 			my_pw=getpwuid(my_u);
@@ -635,6 +635,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;
 
@@ -659,6 +667,8 @@ Buffer	value;
 
 		if ((p=getenv("MAILDIRQUOTA")) && *p)
 			maildrop.init_quota=p;
+
+		}	/* COURIER_MTA */
 	}
 #endif
 
