diff --git a/ecrire/inc/auth_ldap.php b/ecrire/inc/auth_ldap.php
index fa045544c131bb654bc834bacd011e51f2d8308b..4335d5d44546e2562bbd2e8e89ae42c4cecf9fb2 100644
--- a/ecrire/inc/auth_ldap.php
+++ b/ecrire/inc/auth_ldap.php
@@ -65,6 +65,7 @@ function auth_ldap_search($login, $pass)
 		// Si echec, essayer de deviner le DN
 		reset($atts);
 		while (list(, $att) = each($atts)) {
+			$dn = "$att=$login_search, $ldap_base";
 			if (@ldap_bind($ldap_link, $dn, $pass))
 				return "$att=$login_search, $ldap_base";
 		}