|
Lines 30-35
Link Here
|
| 30 |
*/ |
30 |
*/ |
| 31 |
protected $valid_attribute_values = array(); |
31 |
protected $valid_attribute_values = array(); |
| 32 |
|
32 |
|
|
|
33 |
/** |
| 34 |
* Array of case insensitive LDAP attribute names |
| 35 |
*/ |
| 36 |
protected $case_insensitive_attributes = array(); |
| 37 |
|
| 33 |
|
38 |
|
| 34 |
/** |
39 |
/** |
| 35 |
* Initialize this filter. |
40 |
* Initialize this filter. |
|
Lines 57-62
Link Here
|
| 57 |
unset($config['regex']); |
62 |
unset($config['regex']); |
| 58 |
} |
63 |
} |
| 59 |
|
64 |
|
|
|
65 |
if (isset($config['case_insensitive_attributes'])) { |
| 66 |
assert(is_array($config['case_insensitive_attributes'])); |
| 67 |
$this->case_insensitive_attributes = array_map('strtolower', $config['case_insensitive_attributes'])); |
| 68 |
unset($config['case_insensitive_attributes']); |
| 69 |
} |
| 70 |
|
| 60 |
foreach ($config as $attribute => $values) { |
71 |
foreach ($config as $attribute => $values) { |
| 61 |
if (is_string($values)) |
72 |
if (is_string($values)) |
| 62 |
$values = array($values); |
73 |
$values = array($values); |
|
Lines 90-100
Link Here
|
| 90 |
$values = $attributes[$name]; |
101 |
$values = $attributes[$name]; |
| 91 |
if (!is_array($values)) |
102 |
if (!is_array($values)) |
| 92 |
$values = array($values); |
103 |
$values = array($values); |
|
|
104 |
$casei = in_array(strtolower($name), $this->case_insensitive_attributes); |
| 93 |
foreach ($values as $value){ |
105 |
foreach ($values as $value){ |
| 94 |
if ($this->regex) { |
106 |
if ($this->regex) { |
| 95 |
$matched = preg_match($pattern, $value); |
107 |
$matched = $casei ? preg_match(strtolower($pattern), strtolower($value)) : preg_match($pattern, $value); |
| 96 |
} else { |
108 |
} else { |
| 97 |
$matched = ($value == $pattern); |
109 |
$matched = $casei ? strcasecmp($value, $pattern) === 0 : ($value == $pattern); |
| 98 |
} |
110 |
} |
| 99 |
if ($matched) { |
111 |
if ($matched) { |
| 100 |
$authorize = ($this->deny ? FALSE : TRUE); |
112 |
$authorize = ($this->deny ? FALSE : TRUE); |