View Issue Details

IDProjectCategoryView StatusLast Update
0023390mantisbtldappublic2020-11-25 14:20
ReporterMr.Bricodage Assigned Toatrol  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product Version1.3.12 
Summary0023390: Unable to auth user through SOAP API if special char in LDAP realname
Description

LDAP Realname content (CN) in my company AD sometimes contains special French chars. I haven't access to AD to modify this information. For example, the char é has hexa code \xe9.

This is a "little" problem when displaying data in Mantis GUI ( Gérard is displayed G? ) and a big problem when using SOAP to log in (exception Exception with message "SOAP-ERROR: Encoding: string 'G\xe9...' is not a valid utf-8 string - thrown by method : mc_login"),
==> SOAP cannot be used to authenticate some users.

Additional Information

To partially fix this problem, I modified ldap_api.php, function ldap_realname_from_username on row 186

$t_realname = ldap_get_field_from_username( $p_username, $t_ldap_realname_field );
is now
$t_realname = utf8_decode(ldap_get_field_from_username( $p_username, $t_ldap_realname_field ));

The result is now G?rard in Mantis GUI ( better than G? ) and we can log in through SOAP API.

$t_realname = ldap_escape_string(ldap_get_field_from_username( $p_username, $t_ldap_realname_field )); seems to bypass the problem too but not to display french chars.

TagsNo tags attached.

Relationships

related to 0027420 closeddregad Cannot login due to UTF8 character using LDAP 
related to 0020809 closedatrol Auth with AD KO when UTF-8 chars in password 

Activities

Mr.Bricodage

Mr.Bricodage

2018-03-02 17:35

reporter   ~0059071

based on note 0020809:0059069, I'll try ASAP

$t_realname = use iconv( "UTF-8", "Windows-1252", ldap_get_field_from_username( $p_username, $t_ldap_realname_field ));

Mr.Bricodage

Mr.Bricodage

2018-06-13 04:04

reporter   ~0060083

Confirmed, by replacing utf-8 decode() by iconv() , special chars are now well displayed

atrol

atrol

2020-11-01 04:59

developer   ~0064600

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?

atrol

atrol

2020-11-15 14:16

developer   ~0064656

Without feedback, assuming the solution to set $g_ldap_protocol_version = 3; addresses the issue.