changeset 13598:423cf2ccd1f1

passdb vpopmail: Always prefer to lookup plaintext password if it exists. This is important when multiple auth mechanisms are used and the password is cached.
author Timo Sirainen <tss@iki.fi>
date Sun, 02 Oct 2011 20:26:02 +0300
parents 341174c093ee
children 6d1c20b1936c
files src/auth/passdb-vpopmail.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/passdb-vpopmail.c	Sun Oct 02 20:09:04 2011 +0300
+++ b/src/auth/passdb-vpopmail.c	Sun Oct 02 20:26:02 2011 +0300
@@ -75,8 +75,12 @@
 		password = NULL;
 		*result_r = PASSDB_RESULT_USER_DISABLED;
 	} else {
-		password = t_strdup_noconst(cleartext ? vpw->pw_clear_passwd :
-					   vpw->pw_passwd);
+		if (vpw->pw_clear_passwd != NULL)
+			password = t_strdup_noconst(vpw->pw_clear_passwd);
+		else if (!cleartext)
+			password = t_strdup_noconst(vpw->pw_passwd);
+		else
+			password = NULL;
 		*result_r = password != NULL ? PASSDB_RESULT_OK :
 			PASSDB_RESULT_SCHEME_NOT_AVAILABLE;
 	}