diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index c9307bd440d87f288b7a148a1c81f99db2266cab..a582d6334b52722c01d029daa8e62ce9842449bd 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -660,7 +660,7 @@ class AuthHandler(BaseHandler):
                 else:
                     logger.warn(
                         "ldap registration failed: unexpected (%d!=1) amount of results",
-                        len(result)
+                        len(conn.response)
                     )
                     defer.returnValue(False)