This bug is essentially the same as
MDL-3992 but concerns the username not the password.
To summarise: LDAP authentication fails for users with quotes (') or other special charactors in their usernames.
MDL-3992 a solution is to add a stripslashes() call.
In auth_user_login() in auth/ldap/lib.php after the check for blank username || password add the following:
$username = stripslashes( $username );