Finish LDAP implementation

Seems that LDAP implementation was not really "not tested", but "not finished". As it was needed pretty much in one of our projects - here comes the implementation. Have been tested with OpenLDAP server and works pretty fine, also in production.