Ldap APPLICATION ERROR #1401
Moderators: Developer, Contributor
Ldap APPLICATION ERROR #1401
Hello i have a problem when i try to connect to my AD with ldap it gives me the 1401 error.
I have seen a lot of posts with this error but none of the solutions they gave me works.
I checked that the firewall is not interfering so i know that the problem is in the config_inc.php
My configuration is like this:
$g_login_method = LDAP;
$g_ldap_server = 'ldap://IP:389';
$g_ldap_root_dn = 'OU=Name,DC=example,DC=com';
$g_ldap_uid_field = 'sAMAccountName';
$g_ldap_organization = '(objectClass=*)';
$g_ldap_realname_field = 'DisplayName';
$g_ldap_bind_dn = 'CN=UserName,OU=Name,OU=name,OU=name,DC=example,DC=com';
$g_ldap_bind_passwd = 'xxxx';
$g_log_level = LOG_LDAP;
$g_log_destination = '/var/log/mantisbt.log';
$g_use_ldap_email = ON;
$g_use_ldap_realname = ON;
$g_ldap_follow_referrals = OFF;
$g_ldap_use_starttls = OFF;
$g_show_realname = ON;
$g_ldap_protocol_version = 3;
PD:
OS: Ububtu 22.04
PHP 8.1
Mantis 2.22.1
Thanks
I have seen a lot of posts with this error but none of the solutions they gave me works.
I checked that the firewall is not interfering so i know that the problem is in the config_inc.php
My configuration is like this:
$g_login_method = LDAP;
$g_ldap_server = 'ldap://IP:389';
$g_ldap_root_dn = 'OU=Name,DC=example,DC=com';
$g_ldap_uid_field = 'sAMAccountName';
$g_ldap_organization = '(objectClass=*)';
$g_ldap_realname_field = 'DisplayName';
$g_ldap_bind_dn = 'CN=UserName,OU=Name,OU=name,OU=name,DC=example,DC=com';
$g_ldap_bind_passwd = 'xxxx';
$g_log_level = LOG_LDAP;
$g_log_destination = '/var/log/mantisbt.log';
$g_use_ldap_email = ON;
$g_use_ldap_realname = ON;
$g_ldap_follow_referrals = OFF;
$g_ldap_use_starttls = OFF;
$g_show_realname = ON;
$g_ldap_protocol_version = 3;
PD:
OS: Ububtu 22.04
PHP 8.1
Mantis 2.22.1
Thanks
Re: Ldap APPLICATION ERROR #1401
If you have enabled log_ldap, could you let me know the file content with logs? with this info and cofee break will probably we found the problem.
Re: Ldap APPLICATION ERROR #1401
the log info:
LDAP ldap_api.php:327 ldap_authenticate_by_username() Binding to LDAP server\n
LDAP ldap_api.php:63 ldap_connect_bind() Attempting connection to LDAP server/URI 'ldap://example.com:389'.\n
LDAP ldap_api.php:117 ldap_connect_bind() Connection to ldap server failed\n
It shows me only this three lines over and over.
LDAP ldap_api.php:327 ldap_authenticate_by_username() Binding to LDAP server\n
LDAP ldap_api.php:63 ldap_connect_bind() Attempting connection to LDAP server/URI 'ldap://example.com:389'.\n
LDAP ldap_api.php:117 ldap_connect_bind() Connection to ldap server failed\n
It shows me only this three lines over and over.
Re: Ldap APPLICATION ERROR #1401
I assume you replaced example.com with your domain? Just to be sure 

Re: Ldap APPLICATION ERROR #1401
I tried using ldapsearch and it works and shows me the information of the user i asked (connects with the AD well)
But when i try to connect via from web browser it gives me the #1401 error Connection to LDAP server failed.
But when i try to connect via from web browser it gives me the #1401 error Connection to LDAP server failed.
Re: Ldap APPLICATION ERROR #1401
To follow up also on https://www.mantisbt.org/bugs/view.php?id=32458
Re: Ldap APPLICATION ERROR #1401
Thanks i downgraded my php to 8.0 and updated my mantis to 2.25.7 and it works
1406 Error
Ok now i have another error #1406 that says 'Cannot initiate StartTLS on LDAP server.'
My config_inc.php is like this:
$g_login_method = LDAP;
$g_ldap_protocol_version = 3;
$g_ldap_server = 'ldap://example.com:389';
$g_ldap_root_dn = 'ou=name,dc=example,dc=com';
$g_ldap_organization = '';
$g_ldap_uid_field = 'sAMAccountName';
$g_ldap_realname_field = 'cn';
$g_use_ldap_realname = 'ON';
$g_ldap_follow_referrals = 'OFF';
$g_use_ldap_email = 'ON';
$g_ldap_bind_dn = 'CN=name,OU=name,OU=HQ,OU=name,DC=example,DC=com';
$g_ldap_bind_passwd = 'xxxx';
$g_ldap_use_starttls = 'OFF';
$g_log_level = LOG_LDAP;
#$g_log_destination = file:/var/log/mantisldap.log;
I tried to change it to ldaps and 636 but it doesnt matter it keeps giving me th 1406 error
My config_inc.php is like this:
$g_login_method = LDAP;
$g_ldap_protocol_version = 3;
$g_ldap_server = 'ldap://example.com:389';
$g_ldap_root_dn = 'ou=name,dc=example,dc=com';
$g_ldap_organization = '';
$g_ldap_uid_field = 'sAMAccountName';
$g_ldap_realname_field = 'cn';
$g_use_ldap_realname = 'ON';
$g_ldap_follow_referrals = 'OFF';
$g_use_ldap_email = 'ON';
$g_ldap_bind_dn = 'CN=name,OU=name,OU=HQ,OU=name,DC=example,DC=com';
$g_ldap_bind_passwd = 'xxxx';
$g_ldap_use_starttls = 'OFF';
$g_log_level = LOG_LDAP;
#$g_log_destination = file:/var/log/mantisldap.log;
I tried to change it to ldaps and 636 but it doesnt matter it keeps giving me th 1406 error