LDAP Authentication ERROR: Bad Search Filter

Hello!

I successfully configured Phabricator on a local machine, and am trying to get LDAP working. The settings I have provided are:

Hostname : your.domain.com
Port : 389 (can be 3268)
Base Distinguished Name : dc=domain,dc=com
Search Attribute : (sAMAccountName=$(login))
Always Search : Yes
Anonymous Username : LDAPusername
Anonymous Password : LDAPpassword
Username Attributes :
Real Name attributes :
LDAP Version : 3
Referrals : No
Use TLS : No
Active Directory Domain : domain

I keep getting “LDAP Error -7: Bad Search Filter” error.

On running ./bin/auth ldap, I get:

Connecting to LDAP…
[2018-01-22 14:56:47] EXCEPTION: (Exception) LDAP Exception: LDAP search failed.
LDAP Error #-7: Bad search filter at [/src/auth/PhutilLDAPAuthAdapter.php:455]
arcanist(head=master, ref.master=2e02332216c6), phabricator(head=master, ref.master=c63768044559), phutil(head=master, ref.master=2d8cdda8cc4c)
#0 PhutilLDAPAuthAdapter::raiseConnectionException(resource, string) called at [/src/auth/PhutilLDAPAuthAdapter.php:415]
#1 PhutilLDAPAuthAdapter::searchLDAP(string, string) called at [/src/auth/PhutilLDAPAuthAdapter.php:377]
#2 PhutilLDAPAuthAdapter::searchLDAPForRecord(string) called at [/src/auth/PhutilLDAPAuthAdapter.php:225]
#3 PhutilLDAPAuthAdapter::loadLDAPUserData() called at [/src/auth/PhutilLDAPAuthAdapter.php:161]
#4 PhutilLDAPAuthAdapter::getLDAPUserData() called at [/src/auth/PhutilLDAPAuthAdapter.php:114]
#5 PhutilLDAPAuthAdapter::getAccountID() called at [/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php:59]
#6 PhabricatorAuthManagementLDAPWorkflow::execute(PhutilArgumentParser) called at [/src/parser/argument/PhutilArgumentParser.php:441]
#7 PhutilArgumentParser::parseWorkflowsFull(array) called at [/src/parser/argument/PhutilArgumentParser.php:333]
#8 PhutilArgumentParser::parseWorkflows(array) called at [/scripts/setup/manage_auth.php:21]

Any help would be greatly appreciated!