summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2009-04-24 17:38:28 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2009-04-24 17:38:28 (GMT)
commit50bb4b2dff95ef80c7dd33cce9b1132c1968fdf2 (patch)
treee887c3e190170100f80c450a4fd533909a2d49c1
parent1ae971baca1d9c2b4ed5ada37538edfcd0e9c3f0 (diff)
downloadserver-50bb4b2dff95ef80c7dd33cce9b1132c1968fdf2.tar.gz
Additional fixes for configurable mapping of LDAP attributes.
-rw-r--r--php-kolab/Kolab_Server/ChangeLog5
-rw-r--r--php-kolab/Kolab_Server/Kolab_Server.spec2
-rw-r--r--php-kolab/Kolab_Server/mapping.patch67
3 files changed, 65 insertions, 9 deletions
diff --git a/php-kolab/Kolab_Server/ChangeLog b/php-kolab/Kolab_Server/ChangeLog
index 99165db..f3368b2 100644
--- a/php-kolab/Kolab_Server/ChangeLog
+++ b/php-kolab/Kolab_Server/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-24 Gunnar Wrobel <p@rdus.de>
+
+ * Kolab_Server.spec: Additional fixes for configurable mapping of
+ LDAP attributes.
+
2009-04-23 Gunnar Wrobel <p@rdus.de>
* Kolab_Server.spec: Support for configurable mapping of LDAP
diff --git a/php-kolab/Kolab_Server/Kolab_Server.spec b/php-kolab/Kolab_Server/Kolab_Server.spec
index c4a2b5c..3aa7ad0 100644
--- a/php-kolab/Kolab_Server/Kolab_Server.spec
+++ b/php-kolab/Kolab_Server/Kolab_Server.spec
@@ -1,7 +1,7 @@
# Variables
%define V_package Kolab_Server
%define V_version 0.4.0
-%define V_release 20090423suc01
+%define V_release 20090424suc01
%define V_sourceurl http://pear.horde.org/get
# Package Information
diff --git a/php-kolab/Kolab_Server/mapping.patch b/php-kolab/Kolab_Server/mapping.patch
index 3f19ab5..cdb82f1 100644
--- a/php-kolab/Kolab_Server/mapping.patch
+++ b/php-kolab/Kolab_Server/mapping.patch
@@ -382,7 +382,7 @@ index a02b7fe..c648f65 100644
*
* @param string $attrs The attributes to return.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/ldap.php
-index eee8f52..ddc953f 100644
+index eee8f52..ea73b4f 100644
--- a/framework/Kolab_Server/lib/Horde/Kolab/Server/ldap.php
+++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/ldap.php
@@ -210,6 +210,7 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
@@ -393,10 +393,21 @@ index eee8f52..ddc953f 100644
$result = @ldap_read($this->_connection, $dn, '(objectclass=*)', $attrs);
} else {
$result = @ldap_read($this->_connection, $dn, '(objectclass=*)');
-@@ -230,6 +231,9 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+@@ -220,7 +221,7 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+ }
+ $entry = $this->_firstEntry($result);
+ if (!$entry) {
+- ldap_free_result($result);
++ @ldap_free_result($result);
+ return PEAR::raiseError(sprintf(_("LDAP Error: Empty result for: %s."),
+ $dn));
+ }
+@@ -229,7 +230,10 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+ return PEAR::raiseError(sprintf(_("LDAP Error: No such dn: %s: %s"),
$dn, $this->_error()));
}
- ldap_free_result($result);
+- ldap_free_result($result);
++ @ldap_free_result($result);
+
+ $this->unmapAttributes($object);
+
@@ -530,7 +541,47 @@ index eee8f52..ddc953f 100644
return $this->_dnForFilter($filter);
}
-@@ -874,7 +944,13 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+@@ -788,8 +858,17 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+ function uidForAttr($attr, $value,
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ {
+- $filter = '(&(objectClass=kolabInetOrgPerson)(' . $attr .
+- '=' . Horde_LDAP::quote($value) . '))';
++ $criteria = array('AND' =>
++ array(
++ array('field' => KOLAB_ATTR_OC,
++ 'op' => '=',
++ 'test' => KOLAB_OC_KOLABINETORGPERSON),
++ array('field' => $attr,
++ 'op' => '=',
++ 'test' => $value),
++ ),
++ );
++ $filter = $this->searchQuery($criteria);
+ return $this->_dnForFilter($filter, $restrict);
+ }
+
+@@ -806,8 +885,17 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+ function gidForAttr($attr, $value,
+ $restrict = KOLAB_SERVER_RESULT_SINGLE)
+ {
+- $filter = '(&(objectClass=kolabGroupOfNames)(' . $attr .
+- '=' . Horde_LDAP::quote($value) . '))';
++ $criteria = array('AND' =>
++ array(
++ array('field' => KOLAB_ATTR_OC,
++ 'op' => '=',
++ 'test' => KOLAB_OC_KOLABGROUPOFNAMES),
++ array('field' => $attr,
++ 'op' => '=',
++ 'test' => $value),
++ ),
++ );
++ $filter = $this->searchQuery($criteria);
+ return $this->_dnForFilter($filter, $restrict);
+ }
+
+@@ -874,7 +962,13 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
return $result;
}
$vars = get_class_vars($type);
@@ -545,7 +596,7 @@ index eee8f52..ddc953f 100644
$sort = $vars['sort_by'];
if (isset($params['sort'])) {
-@@ -993,4 +1069,176 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
+@@ -993,4 +1087,176 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server {
}
}
@@ -696,9 +747,9 @@ index eee8f52..ddc953f 100644
+ {
+ if (!empty($this->_params['map'])) {
+ foreach ($this->_params['map'] as $attribute => $map) {
-+ if (in_array($attribute, $keys)) {
-+ $keys = array_diff($keys, array($attribute));
-+ $keys[] = $map;
++ $key = array_search($attribute, $keys);
++ if ($key !== false) {
++ $keys[$key] = $map;
+ }
+ }
+ }