View Issue Details

IDProjectCategoryView StatusLast Update
0020809mantisbtauthenticationpublic2021-01-07 07:27
ReporterMr.Bricodage Assigned Toatrol  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.17 
Summary0020809: Auth with AD KO when UTF-8 chars in password
Description

Mantis send wrong password to active directory when UTF-8 char (at least french accents) are present in password value.

Steps To Reproduce

1) Set a password with utf-8 char in your AD
2) Link a Mantis to this AD
3) Try to connect => connection refused

Additional Information

Workaround on 1.2.17 :
function ldap_authenticate_by_username( $p_username, $p_password )
[...]
$c_username = ldap_escape_string( $p_username );
$t_ldap_organization = config_get( 'ldap_organization' );
[...]

changed to
[...]
$c_username = ldap_escape_string( $p_username );
$p_password = utf8_decode( $p_password );
$t_ldap_organization = config_get( 'ldap_organization' );
[...]

TagsNo tags attached.

Relationships

related to 0023390 closedatrol Unable to auth user through SOAP API if special char in LDAP realname 
related to 0027420 closeddregad Cannot login due to UTF8 character using LDAP 
related to 0027848 resolvedcommunity Changed default $g_ldap_protocol_version from 0 to 3. 

Activities

Mr.Bricodage

Mr.Bricodage

2018-03-02 09:42

reporter   ~0059069

Just found that the workaround was wrong in one case :
if the password contains '€', login is impossible. That's because the password encoding is not UTF-8 but Windows-1252.
'€' char is coded 0x80 with Windows-1252, 0xE2 0x82 0xAC with UTF-8.

The workaround is now :

[...]
$c_username = ldap_escape_string( $p_username );
$p_password = iconv( "UTF-8", "Windows-1252", $p_password );
$t_ldap_organization = config_get( 'ldap_organization' );
[...]

atrol

atrol

2020-11-01 05:00

developer   ~0064601

There was a similar issue 0027420

The final solution was to set $g_ldap_protocol_version = 3; without any other source tweaks.
See also https://www.mantisbt.org/forums/viewtopic.php?p=70838#p70838

Can you confirm that this works for you?

dregad

dregad

2020-11-13 02:45

developer   ~0064650

Without feedback, assuming the solution outlined by @atrol addresses the issue.