[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

courier-ldap: userPassword with and without {crypt} [patch]



Package: courier-ldap
Version: 0.34.0-1
Severity: wishlist

I've got LDAP database with two accounts. The first has an userPassword in
plain text, the second has userPassword with {crypt} prefix.

dn: uid=dexter, ou=accounts, dc=test, dc=com
objectClass: top
userPassword: foobar

dn: uid=user, ou=accounts, dc=test, dc=com
objectClass: top
userPassword: {crypt}FyeKCIKPtftEk

The Courier authdaemon can't use plain and crypted password if they
are stored in the same field.

This is my patch for autodetection crypted password. The same behaviour
has pam_ldap.so module.


diff -ru2 courier-0.34.0.orig/authlib/authldaplib.c courier-0.34.0/authlib/authldaplib.c
--- courier-0.34.0.orig/authlib/authldaplib.c	Sun Apr 15 19:12:54 2001
+++ courier-0.34.0/authlib/authldaplib.c	Wed May 30 21:55:57 2001
@@ -743,6 +743,17 @@
 			if (auth.clearpasswd)
 			{
-				if (strcmp(pass,auth.clearpasswd))
-					rc= -1;
+			const char *p=auth.clearpasswd;
+
+				if (p && strncmp(p, "{crypt}", 7) == 0)
+				{
+					p += 7;
+					if (!p || authcheckpassword(pass, p))
+						rc= -1;
+				}
+				else
+				{
+					if (strcmp(pass,auth.clearpasswd))
+						rc= -1;
+				}
 			}
 			else


-- 
Piotr Roszatycki, Netia Telekom S.A.                    .''`.
mailto:Piotr_Roszatycki@netia.net.pl                   : :' :
mailto:dexter@debian.org                               `. `'
                                                         `-




Reply to: