Hi,

I couldn't find a similar issue. Also I'm not sure what additional information you need to recreate this problem.
This problem targets LDAP-Server.
I successfully connect to an LDAP-Server. when testing the server I get following warning

Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1552 of /drupal/includes/bootstrap.inc).

It displays all userdetails correctly though and seems to work fine.

My question is if this is a problem of LDAP or maybe even a problem of the Server-setup?

Thanks, Florian

CommentFileSizeAuthor
#3 ldap.multibyte.jpg69.18 KBufku
#3 ldap.multibyte.values.jpg108 KBufku

Comments

johnbarclay’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev
Assigned: Unassigned » johnbarclay
Priority: Normal » Major

Thanks. I can't replicate this, but can see how it is likely caused. I committed the fix to this. Please try head and see if it solves the problem.

Also...

All the direct calls to check_plain() in ldap modules are in ldap_servers/ldap_servers.functions.inc between line 198 and 256. They are mostly applying them to the ldap attributes for the tokenization process. So it could be any attribute. I changed the code to skip attribute values that don't pass the drupal check_plain() function since there is no point in tokenizing them anyway.

If you want to see the attribute that is causing the problem, turn on "Log Detailed LDAP Actions" at admin/config/people/ldap/settings and look in watchdog after trying the test user again. It should produce one record for each attribute value it can't deal with. These are likely images, hashed data, etc.

 foreach ($dn_parts as $pair) {
    list($attr_name, $attr_value) = explode('=', $pair);
    try {
      $attr_value = check_plain($attr_value);
    }
    catch (Exception $e) {
      if ($detailed_watchdog_log) {
        $watchdog_tokens = array('%attr_name' => $attr_name);
        watchdog('ldap_servers', 'skipped tokenization of attribute %attr_name because the value would not pass check_plain function.', $watchdog_tokens, WATCHDOG_DEBUG);
      }
       continue; // don't tokenize data that can't pass check_plain
    }
    if (!isset($parts_count[$attr_name])) {
      $tokens[$pre . strtolower($attr_name) . $post] = $attr_value;
      $parts_count[$attr_name] = 0;
    }
    $tokens[$pre . strtolower($attr_name) . LDAP_SERVERS_TOKEN_DEL . (int)$parts_count[$attr_name] . $post] = $attr_value;

    $parts_last_value[$attr_name] = $attr_value;
    $parts_count[$attr_name]++;
  }
johnbarclay’s picture

Title: Warning: htmlspecialchars(): Invalid multibyte sequence in argument » LDAP Server: Warning: htmlspecialchars(): Invalid multibyte sequence in argument
Priority: Major » Normal
Status: Active » Closed (fixed)
ufku’s picture

Status: Closed (fixed) » Active
StatusFileSize
new108 KB
new69.18 KB

In my Win2k8 AD these fields cause the issue
objectguid (type: OctetString)
logonhours (type: OctetString)
objectsid (type: Sid)

I think it is due to the data type as these are the only fields that are of type OctetString and Sid.

Original values seem ok(attached) when viewed with active directory explorer utility

vinmassaro’s picture

We get the same errors when testing a user at /admin/config/people/ldap/servers/test/server_name. These fields seem to be the problem:

objectguid
objectsid
msexchmailboxsecuritydescriptor

johnbarclay’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

this is expected because the test is bringing in data from all the fields, some of which are binary and not configured. There needs to be some text saying to expect this error. Patch is welcome. Otherwise just ignore this error on the server testing. If the error comes up outside of testing,

johnbarclay’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)