Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48255

LDAP sync fails to add more than $page_size accounts

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      To test this issue we would have to setup a LDAP servers with few users and a moodle connecting to this server. However, this fix actually is quite simple. I don't think necessary, up to the tester.

      Simple Test
      • Run php auth/ldap/cli/sync_user.php and make sure no fatal errors is displayed.
      Extensive test
      • Setup a LDAP server and add few users. (Or use the Ubuntu 12.04 LDAP v1.2 VM)
      • Setup the moodle to connect to this LDAP server.
      • Run php auth/ldap/cli/sync_user.php and make sure it's syncronizing the users.
      Show
      To test this issue we would have to setup a LDAP servers with few users and a moodle connecting to this server. However, this fix actually is quite simple. I don't think necessary, up to the tester. Simple Test Run php auth/ldap/cli/sync_user.php and make sure no fatal errors is displayed. Extensive test Setup a LDAP server and add few users. (Or use the Ubuntu 12.04 LDAP v1.2 VM) Setup the moodle to connect to this LDAP server. Run php auth/ldap/cli/sync_user.php and make sure it's syncronizing the users.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48255-master

      Description

      In auth/ldap/auth.php, line 745, please replace

      } while ($ldap_pagedresults && !empty(ldap_cookie));

      by

      } while ($ldap_pagedresults && ($ldap_cookie !== null || $ldap_cookie != ''));

      as described in http://php.net/manual/fr/function.ldap-control-paged-result.php

      In the LDAP server distributed with Centos 7, $ldap_cookie value is string(1) "0". The sync stops at the first page.

      I have php 5.5.19.

      The result was for me the destruction of 8000 accounts...

        Attachments

          Activity

            People

            Assignee:
            moodle.com moodle.com
            Reporter:
            baptiste.desprez Baptiste DESPREZ
            Peer reviewer:
            Simey Lameze
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            David Monllaó
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/Jan/15