Moodle
  1. Moodle
  2. MDL-37315

ldap paged results connection closing in find_ext_enrolments() is incorrect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.1
    • Component/s: Enrolments
    • Labels:
    • Rank:
      46922

      Description

      The trouble is that

      protected function find_ext_enrolments ($ldapconnection, $memberuid, $role) 

      closes connection and creates a new one, but the calling code continues to be using the CLOSED connection!

      PHP Warning: ldap_control_paged_result(): 90 is not a valid ldap link resource in moodle25/enrol/ldap/lib.php on line 732

      This may result in user unenrolment causing major data loss...

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          Adding some watchers, please review, thanks.

          Show
          Petr Škoda added a comment - Adding some watchers, please review, thanks.
          Hide
          Sam Hemelryk added a comment -

          Thanks Petr - this has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks Petr - this has been integrated now.
          Hide
          Iñaki Arenaza added a comment -

          Sorry for being so late at reviwing this

          While the fix is OK, I'd say we should fix the cause rather than the symptoms. We shouldn't be passing $ldapconnection around. We already have the active ldap connection in $this->ldapconnection, and we should use it everywhere. The $ldapconnection passing is a leftover from the old days when the auth and enrol LDAP plugins were not classes.

          The only places where we should pass $this->ldapconnection are to the lib/ldaplib.php functions calls.

          I guess this should go into a new bug.

          Saludos.
          Iñaki.

          Show
          Iñaki Arenaza added a comment - Sorry for being so late at reviwing this While the fix is OK, I'd say we should fix the cause rather than the symptoms. We shouldn't be passing $ldapconnection around. We already have the active ldap connection in $this->ldapconnection, and we should use it everywhere. The $ldapconnection passing is a leftover from the old days when the auth and enrol LDAP plugins were not classes. The only places where we should pass $this->ldapconnection are to the lib/ldaplib.php functions calls. I guess this should go into a new bug. Saludos. Iñaki.
          Hide
          Petr Škoda added a comment -

          I agree that we should not pass the connection around, I will create a new issue and fix it in master only, thanks a lot.

          Show
          Petr Škoda added a comment - I agree that we should not pass the connection around, I will create a new issue and fix it in master only, thanks a lot.
          Hide
          Frédéric Massart added a comment -

          Test successful on master. The user is correctly assigned the roles on the matching courses, even with a very low paging. No errors were found in the logs.

          Show
          Frédéric Massart added a comment - Test successful on master. The user is correctly assigned the roles on the matching courses, even with a very low paging. No errors were found in the logs.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And your fantastic code has met core, hope they become good friends for a long period.

          Closing, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - And your fantastic code has met core, hope they become good friends for a long period. Closing, thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: