summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-02-21 10:04:49 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-02-21 10:04:49 (GMT)
commit6b0d7f72d5676c1c2a721826b0f6e6199b00cc05 (patch)
treea7ee46abf331346ea5c6b24a366a622cf90a0e09
parent474486a544b779462ddf17c517569b3ae048f45b (diff)
downloadkolab-webadmin-6b0d7f72d5676c1c2a721826b0f6e6199b00cc05.tar.gz
kolab/issue3499 (Kolab web admin does not use LDAP escaping)
Found the actual issue I tried to fix last time which was the broken midair collision check. Now it also makes sense why the function broke with the later fixing I did. Basically countMail() was not aware of any LDAP escaping when counting objects with an excluded DN. Should now be fixed and I added a test for that problem.
-rw-r--r--ChangeLog5
-rw-r--r--lib/KolabAdmin/Ldap.php4
-rw-r--r--test/KolabAdmin/Unit/BaseTest.php13
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 48fe471..67ed24d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-21 Gunnar Wrobel <p@rdus.de>
+
+ * lib/KolabAdmin/Ldap.php: kolab/issue3499 (Kolab web admin does
+ not use LDAP escaping)
+
2010-01-15 Gunnar Wrobel <wrobel@pardus.de>
* www/admin/user/user.php.in: kolab/issue4025 (Users can not
diff --git a/lib/KolabAdmin/Ldap.php b/lib/KolabAdmin/Ldap.php
index cf4213f..5adf608 100644
--- a/lib/KolabAdmin/Ldap.php
+++ b/lib/KolabAdmin/Ldap.php
@@ -406,8 +406,8 @@ class KolabLDAP {
$entries = ldap_get_entries( $this->connection, $res );
if( $excludedn ) {
for ( $i = 0; $i < count( $entries ); $i++ ) {
- if( is_null( $entries[$i] ) ) continue;
- if( $entries[$i]['dn'] == $excludedn ) continue;
+ if( !isset($entries[$i]) || is_null( $entries[$i] ) ) continue;
+ if( KolabLDAP::unescape_dn_value($entries[$i]['dn']) == KolabLDAP::unescape_dn_value($excludedn) ) continue;
debug("found ".$entries[$i]['dn'] );
$count++;
}
diff --git a/test/KolabAdmin/Unit/BaseTest.php b/test/KolabAdmin/Unit/BaseTest.php
index 55e7f9b..f7b6f23 100644
--- a/test/KolabAdmin/Unit/BaseTest.php
+++ b/test/KolabAdmin/Unit/BaseTest.php
@@ -88,6 +88,19 @@ class KolabAdmin_Unit_BaseTest extends PHPUnit_Framework_TestCase
);
}
+ public function testCountmailReturnsZeroOnExistingMailWithEscapedDnCharactersIfDnExcluded()
+ {
+ $this->_add($this->_getTestUser(',=,'));
+ $this->assertEquals(
+ 0,
+ $this->ldap->countMail(
+ $_SESSION['base_dn'],
+ 'kolabadmin.test.,=,@' . $_SESSION['fqdnhostname'],
+ 'cn=' . $this->ldap->dn_escape('KolabAdmin TestUser,=,') . ',' . $_SESSION['base_dn']
+ )
+ );
+ }
+
public function testAddingObjectIsSuccessful()
{
$this->_add($this->_getTestUser());