Bug #25916
$basedn must be a string
| Status: | On Hold | Start date: | 2011-04-12 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | Spent time: | - | |
| Target version: | - | |||
| Votes: | 0 |
Description
I found a bug in iglib with TYPO3 4.5 that I am reporting here as iglib does not seem to be versionned
The authentification fails if $basedn is given as an array in the method parameter. I don't know why but it happens to be an array in some cases for method "search" in class.iglib_ldap.php
function search ($basedn = null, $filter = null, $attributes = array(), $attributes_only = 0, $size_limit = 0, $time_limit = 0, $deref = 'LDAP_DEREF_NEVER') {
Index: class.iglib_ldap.php
===================================================================
--- class.iglib_ldap.php (revision 52)
+++ class.iglib_ldap.php (working copy)
@@ -164,6 +164,11 @@
if (!$basedn) {$this->status['search']['basedn'] = 'No valid base DN'; return false;}
if (!$filter) {$this->status['search']['filter'] = 'No valid filter'; return false;}
+ // fix bug when basedn is an array
+ if (is_array($basedn) && !empty($basedn[0])) {
+ $basedn = $basedn[0];
+ }
+
if ($this->cid) {
if (!($this->sid = @ldap_search($this->cid, $basedn, $filter, $attributes, $attributes_only, $size_limit, $time_limit, $deref))) {
Index: patch.diff
History
Updated by Fabien Udriot about 2 years ago
I did more testing here.
According to the PHP documentation, the second parameter "basedn" of function ldap_search() must get a string as input. Check out here: http://php.net/manual/en/function.ldap-search.php
For some reason it receive an array as input within iglib. Surprisingly enough, it seems to be working in most cases. However, I have tested on a server that fails with array as input. For that reason, I would prefer to stick to the documentation and transform the array into a string unless there would be good reasons not. Maybe you have some feedback here?
Updated by Michael Miousse about 2 years ago
Fabien Udriot wrote:
I did more testing here.
According to the PHP documentation, the second parameter "basedn" of function ldap_search() must get a string as input. Check out here: http://php.net/manual/en/function.ldap-search.php
For some reason it receive an array as input within iglib. Surprisingly enough, it seems to be working in most cases. However, I have tested on a server that fails with array as input. For that reason, I would prefer to stick to the documentation and transform the array into a string unless there would be good reasons not. Maybe you have some feedback here?
if i remember correctly, this was created in order to allow multiple basedn on a single ldap query.
Ill have to investigate, what kind of ldap did you try it on.
Updated by Fabien Udriot about 2 years ago
Ill have to investigate, what kind of ldap did you try it on.
OpenLDAP.
I just tested it again tonight and it seems to be working with an array though... Maybe we can put the ticket on hold until I am facing the bug again.
Updated by Michael Miousse about 2 years ago
- Status changed from New to On Hold