a) If the LDAP server indicates in some way the correct unix username for that account then make sure pam_ldap is correctly setting PAM_USER it to this value (so other modules will use it).
b) If it is expected behaviour that the LDAP server ignores whitespace then libpam-ldap should pre-strip the whitespace itself and update the PAM_USER value.
Things worth checking:
a) If the LDAP server indicates in some way the correct unix username for that account then make sure pam_ldap is correctly setting PAM_USER it to this value (so other modules will use it).
b) If it is expected behaviour that the LDAP server ignores whitespace then libpam-ldap should pre-strip the whitespace itself and update the PAM_USER value.