diff -urP cyrus-sasl-2.1.22/saslauthd/auth_getpwlike.c cyrus-sasl-2.1.22.bak/saslauthd/auth_getpwlike.c
--- cyrus-sasl-2.1.22/saslauthd/auth_getpwlike.c	1970-01-01 01:00:00.000000000 +0100
+++ cyrus-sasl-2.1.22.bak/saslauthd/auth_getpwlike.c	2008-02-05 22:22:51.000000000 +0100
@@ -0,0 +1,114 @@
+/* MODULE: auth_getpwlike */
+
+/* COPYRIGHT
+ * Copyright (c) 1997-2000 Messaging Direct Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MESSAGING DIRECT LTD. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL MESSAGING DIRECT LTD. OR
+ * ITS EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * END COPYRIGHT */
+
+/* SYNOPSIS
+ * crypt(3) based passwd file validation
+ * END SYNOPSIS */
+
+#ifdef __GNUC__
+#ident "$Id: auth_getpwent.c,v 1.7 2005/01/27 04:39:52 shadow Exp $"
+#endif
+
+/* PUBLIC DEPENDENCIES */
+#include "mechanisms.h"
+#include <unistd.h>
+#include <string.h>
+#include <pwd.h>
+
+# ifdef WITH_DES
+#  ifdef WITH_SSL_DES
+#   include <openssl/des.h>
+#  else
+#   include <des.h>
+#  endif /* WITH_SSL_DES */
+# endif /* WITH_DES */
+
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
+/* END PUBLIC DEPENDENCIES */
+
+#define RETURN(x) return strdup(x)
+#define PWLIKE_FILE "/etc/passwd-mail"
+
+
+struct passwd* getpwlike(const char* name) {
+	struct passwd *p = NULL;
+	FILE *f = NULL;
+
+	if(!name) return NULL;
+
+	if(!(f = fopen(PWLIKE_FILE,"r")))
+		return NULL;
+	while(!feof(f)) {
+		p = fgetpwent(f);
+		if(!p) continue;
+		if(p->pw_name && !strcmp(p->pw_name,name)) {
+			fclose(f);
+			return p;
+		}	
+	}
+	if(f) 
+		fclose(f);
+	return NULL;
+}
+
+
+
+/* FUNCTION: auth_getpwlike */
+
+char *					/* R: allocated response string */
+auth_getpwlike (
+  /* PARAMETERS */
+  const char *login,			/* I: plaintext authenticator */
+  const char *password,			/* I: plaintext password */
+  const char *service __attribute__((unused)),
+  const char *realm __attribute__((unused))
+  /* END PARAMETERS */
+  )
+{
+    /* VARIABLES */
+    struct passwd *pw;			/* pointer to passwd file entry */
+    /* END VARIABLES */
+    pw = getpwlike(login);
+
+    if (pw == NULL) {
+	RETURN("NO");
+    }
+
+    if (strcmp(pw->pw_passwd, (const char *)crypt(password, pw->pw_passwd))) {
+	RETURN("NO");
+    }
+
+    RETURN("OK");
+}
+
+/* END FUNCTION: auth_getpwlike */
+
+/* END MODULE: auth_getpwlike */
diff -urP cyrus-sasl-2.1.22/saslauthd/auth_getpwlike.h cyrus-sasl-2.1.22.bak/saslauthd/auth_getpwlike.h
--- cyrus-sasl-2.1.22/saslauthd/auth_getpwlike.h	1970-01-01 01:00:00.000000000 +0100
+++ cyrus-sasl-2.1.22.bak/saslauthd/auth_getpwlike.h	2008-02-05 22:14:13.000000000 +0100
@@ -0,0 +1,28 @@
+/* COPYRIGHT
+ * Copyright (c) 1997 Messaging Direct Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MESSAGING DIRECT LTD. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL MESSAGING DIRECT LTD. OR
+ * ITS EMPLOYEES OR AGENTS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * END COPYRIGHT */
+
+char *auth_getpwlike(const char *, const char *, const char *, const char *);
diff -urP cyrus-sasl-2.1.22/saslauthd/Makefile.am cyrus-sasl-2.1.22.bak/saslauthd/Makefile.am
--- cyrus-sasl-2.1.22/saslauthd/Makefile.am	2006-05-17 18:46:17.000000000 +0200
+++ cyrus-sasl-2.1.22.bak/saslauthd/Makefile.am	2008-02-05 22:25:18.000000000 +0100
@@ -4,7 +4,7 @@
 
 saslauthd_SOURCES = mechanisms.c globals.h \
 		    mechanisms.h auth_dce.c auth_dce.h auth_getpwent.c \
-		    auth_getpwent.h auth_krb5.c auth_krb5.h auth_krb4.c \
+		    auth_getpwent.h auth_getpwlike.c auth_getpwlike.h auth_krb5.c auth_krb5.h auth_krb4.c \
 		    auth_krb4.h auth_pam.c auth_pam.h auth_rimap.c auth_httpform.c \
 		    auth_rimap.h auth_shadow.c auth_shadow.h auth_sia.c auth_httpform.h \
 		    auth_sia.h auth_sasldb.c auth_sasldb.h lak.c lak.h \
diff -urP cyrus-sasl-2.1.22/saslauthd/Makefile.in cyrus-sasl-2.1.22.bak/saslauthd/Makefile.in
--- cyrus-sasl-2.1.22/saslauthd/Makefile.in	2006-05-18 21:30:21.000000000 +0200
+++ cyrus-sasl-2.1.22.bak/saslauthd/Makefile.in	2008-02-05 22:25:00.000000000 +0100
@@ -137,7 +137,7 @@
 
 saslauthd_SOURCES = mechanisms.c globals.h \
 		    mechanisms.h auth_dce.c auth_dce.h auth_getpwent.c \
-		    auth_getpwent.h auth_krb5.c auth_krb5.h auth_krb4.c \
+		    auth_getpwent.h auth_getpwlike.c auth_getpwlike.h auth_krb5.c auth_krb5.h auth_krb4.c \
 		    auth_krb4.h auth_pam.c auth_pam.h auth_rimap.c auth_httpform.c \
 		    auth_rimap.h auth_shadow.c auth_shadow.h auth_sia.c auth_httpform.h \
 		    auth_sia.h auth_sasldb.c auth_sasldb.h lak.c lak.h \
@@ -172,7 +172,7 @@
 PROGRAMS = $(sbin_PROGRAMS)
 
 am_saslauthd_OBJECTS = mechanisms.$(OBJEXT) auth_dce.$(OBJEXT) \
-	auth_getpwent.$(OBJEXT) auth_krb5.$(OBJEXT) auth_krb4.$(OBJEXT) \
+	auth_getpwent.$(OBJEXT) auth_getpwlike.$(OBJECT) auth_krb5.$(OBJEXT) auth_krb4.$(OBJEXT) \
 	auth_pam.$(OBJEXT) auth_rimap.$(OBJEXT) auth_httpform.$(OBJEXT) \
 	auth_shadow.$(OBJEXT) auth_sia.$(OBJEXT) auth_sasldb.$(OBJEXT) \
 	lak.$(OBJEXT) auth_ldap.$(OBJEXT) cache.$(OBJEXT) \
@@ -197,6 +197,7 @@
 @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/getaddrinfo.Plo \
 @AMDEP_TRUE@	$(DEPDIR)/getnameinfo.Plo ./$(DEPDIR)/auth_dce.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/auth_getpwent.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/auth_getpwlike.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/auth_httpform.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/auth_krb4.Po ./$(DEPDIR)/auth_krb5.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/auth_ldap.Po ./$(DEPDIR)/auth_pam.Po \
@@ -306,6 +307,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getnameinfo.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_dce.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_getpwent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_getpwlike.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_httpform.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_krb4.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_krb5.Po@am__quote@
diff -urP cyrus-sasl-2.1.22/saslauthd/mechanisms.c cyrus-sasl-2.1.22.bak/saslauthd/mechanisms.c
--- cyrus-sasl-2.1.22/saslauthd/mechanisms.c	2006-03-13 21:17:09.000000000 +0100
+++ cyrus-sasl-2.1.22.bak/saslauthd/mechanisms.c	2008-02-05 22:23:33.000000000 +0100
@@ -49,6 +49,7 @@
 #include "auth_krb4.h"
 #include "auth_krb5.h"
 #include "auth_getpwent.h"
+#include "auth_getpwlike.h"
 #include "auth_sasldb.h"
 #include "auth_rimap.h"
 #ifdef AUTH_PAM
@@ -71,6 +72,7 @@
     {	"dce",		0,			auth_dce },
 #endif /* AUTH_DCE */
     {	"getpwent",	0,			auth_getpwent },
+    {	"getpwlike", 	0,			auth_getpwlike },
 #ifdef AUTH_KRB4
     {	"kerberos4",	auth_krb4_init,		auth_krb4 },
 #endif /* AUTH_KRB4 */
