Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-28402 LDAP configuration values being stored in lower case, causi…

…ng misconfiguration

It looks like array_change_key_case() does not work recursively, so we
were not actually lowercasing the expiration attribute key. As the
configuration setting is always lowercase they didn't match.
  • Loading branch information...
commit fa5f5c206f2739437d669987842e6237ef09b3eb 1 parent a014e3b
Iñaki Arenaza iarenaza authored stronk7 committed

Showing 1 changed file with 11 additions and 10 deletions. Show diff stats Hide diff stats

  1. +11 10 auth/ldap/auth.php
21 auth/ldap/auth.php
@@ -579,16 +579,17 @@ function password_expire($username) {
579 579 $sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
580 580 if ($sr) {
581 581 $info = ldap_get_entries_moodle($ldapconnection, $sr);
582   - $info = array_change_key_case($info, CASE_LOWER);
583   - if (!empty ($info) and !empty($info[0][$this->config->expireattr][0])) {
584   - $expiretime = $this->ldap_expirationtime2unix($info[0][$this->config->expireattr][0], $ldapconnection, $user_dn);
585   - if ($expiretime != 0) {
586   - $now = time();
587   - if ($expiretime > $now) {
588   - $result = ceil(($expiretime - $now) / DAYSECS);
589   - }
590   - else {
591   - $result = floor(($expiretime - $now) / DAYSECS);
  582 + if (!empty ($info)) {
  583 + $info = array_change_key_case($info[0], CASE_LOWER);
  584 + if (!empty($info[$this->config->expireattr][0])) {
  585 + $expiretime = $this->ldap_expirationtime2unix($info[$this->config->expireattr][0], $ldapconnection, $user_dn);
  586 + if ($expiretime != 0) {
  587 + $now = time();
  588 + if ($expiretime > $now) {
  589 + $result = ceil(($expiretime - $now) / DAYSECS);
  590 + } else {
  591 + $result = floor(($expiretime - $now) / DAYSECS);
  592 + }
592 593 }
593 594 }
594 595 }

0 comments on commit fa5f5c2

Please sign in to comment.
Something went wrong with that request. Please try again.