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

Apostrophes preventing any users in course being unenrolled via LDAP

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2, 1.9
    • Fix Version/s: 1.8.6, 1.9.2
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      MS Active Directory
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      If any member of a course has an ID number containing an apostrophe (eg. CN=Paddy O'Brien,OU=Students,DC=etc...), no other members will ever be unenrolled via LDAP.

      In enrol/ldap/enrol.php, this is due to the array $ldapmembers not accounting for apostrophes and therefore get_records_sql($sql) fails to return any members due to the resultant syntax error.

      It doesn't just affect the name with an apostrophe - it affects any members of the same course.

      We fixed by replacing the following code around line 264 (v1.8.2)

      $sql .= 'AND usr.idnumber NOT IN (\''. join('\',\'', $ldapmembers).'\')';

      with...

      $sql .= 'AND usr.idnumber NOT IN (\''. join('\',\'', str_replace("'", "\'",$ldapmembers)).'\')';

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Jul/08