Moodle
  1. Moodle
  2. MDL-11299

ldap field sync problem (prevents userdata to get from ldap)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.7.2, 1.8.2, 1.9
    • Component/s: Authentication
    • Labels:
      None
    • Environment:
      debian etch, apache
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      28577

      Description

      I'm using authldap module, and set up successfully. Can logon to ldap, and so on. But if I set the userdata fields to get from the ldap, it simply don't get down.

      I figured out that tha problem caused by an invalid (empty) search filter in auth.php (moodle/auth/ldap) at line 139 the original code:

      1. if (!$user_info_result = ldap_read($ldapconnection, $user_dn, $this->config->objectclass, $search_attribs)) { # return false; // error! # }

      It is commented out by me and hardcoded the following:
      if (!$user_info_result = ldap_read($ldapconnection, $user_dn, '(objectclass=VirtualMailAccount)', $search_attribs))

      { return false; // error! }

      this way data can come down, because objectclass is the correct value...

      Please correct the bug, so after I upgrade, there will be no need such hardcoded stuff...

        Activity

        Hide
        Petr Škoda added a comment -

        Seems like a configuration problem, not a bug - what do you think Iñaki?

        Show
        Petr Škoda added a comment - Seems like a configuration problem, not a bug - what do you think Iñaki?
        Hide
        Iñaki Arenaza added a comment -

        I'd say so. Éliás, have you specified 'VirtualMailAccount' as the objectClass configuration value in the LDAP settings page? If you are using a non-standard objectClass attribute, you need to specify it there.

        Saludos. Iñaki.

        Show
        Iñaki Arenaza added a comment - I'd say so. Éliás, have you specified 'VirtualMailAccount' as the objectClass configuration value in the LDAP settings page? If you are using a non-standard objectClass attribute, you need to specify it there. Saludos. Iñaki.
        Hide
        Éliás Tamás added a comment -

        Yeah, I'm using virtualMailAccount as the objectclass, since the usernames are the users' email address.

        I attach a screenshot, where you can see, that the objectclass (Objektumosztály line) is already and correctly specified in the config, and I haven't found any other way to set it. Authentication however ok, so moodle use the setting correctly previosuly.

        Show
        Éliás Tamás added a comment - Yeah, I'm using virtualMailAccount as the objectclass, since the usernames are the users' email address. I attach a screenshot, where you can see, that the objectclass (Objektumosztály line) is already and correctly specified in the config, and I haven't found any other way to set it. Authentication however ok, so moodle use the setting correctly previosuly.
        Hide
        Iñaki Arenaza added a comment -

        I think I have find the problem. You are specifying the objectClass attribute name in lowercase ('objectclass') and the code expects it as 'objectClass' (note the upper case 'C'). If you change line 59 of .../auth/ldap/auth.php from:

        } else if (strpos($this->config->objectclass, 'objectClass=') !== 0)

        { to }

        else if (stripos($this->config->objectclass, 'objectClass=') !== 0) {

        that should fix it. Please, confirm that it does so we can put the fix into CVS.

        Saludos. Iñaki.

        Show
        Iñaki Arenaza added a comment - I think I have find the problem. You are specifying the objectClass attribute name in lowercase ('objectclass') and the code expects it as 'objectClass' (note the upper case 'C'). If you change line 59 of .../auth/ldap/auth.php from: } else if (strpos($this->config->objectclass, 'objectClass=') !== 0) { to } else if (stripos($this->config->objectclass, 'objectClass=') !== 0) { that should fix it. Please, confirm that it does so we can put the fix into CVS. Saludos. Iñaki.
        Hide
        Éliás Tamás added a comment -

        Yeah, using "objectClass" instead of "objectclass" solved the problem, however ldap accepts both cases.

        Thank you for the fast answer!

        Show
        Éliás Tamás added a comment - Yeah, using "objectClass" instead of "objectclass" solved the problem, however ldap accepts both cases. Thank you for the fast answer!
        Hide
        Iñaki Arenaza added a comment -

        Fixed in CVS. Closing now. Thanks for the report.

        Saludos. Iñaki.

        Show
        Iñaki Arenaza added a comment - Fixed in CVS. Closing now. Thanks for the report. Saludos. Iñaki.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: