Since version 1.1.2, ejabberd includes the patch on this page that improves LDAP support. So, you do not need to apply this patch if you are using 1.1.2 or higher.
Text from the README file:
1. Support for RFC-2254 LDAP filter and UID attribute format. 2. Custom search xdata-form for mod_vcard_ldap. 3. Custom ldap-to-vcard mapping. 4. mod_vcard_ldap doesn't depend on auth method. 5. Virtual hosting support. 6. Compatibility with old configuration file. 7. Automatically reconnects to LDAP server after connection failure. Theoretically, this patch provides support for any LDAP-server with non-SSL connections: Active Directory, OpenLDAP, eDirectory, Lotus Domino, etc. At least it works great with OpenLDAP, but needs more testing with other LDAP servers.