Hi! I've been setting up DAViCal and ran into some problems with LDAP synchronization. The following patch got me up and running. The first couple of edits clean up the code and solve a problem with groups with no members at all getting the same members as the previous group with members. The last two changes format the timestamps in the right way. Note that I haven't looked at the else-parts following
$valid[$mapping['modified']] = "$Y-$m-$d $H:$M:$S";
as I don't understand why they are there at all, since in two other places in the code timestamps are converted in a similar manner without testing if $c->authenticate_hook['config']['format_updated'] is empty.
Best regards,
Rasmus
-----------------------------------------------------------------
Hansen, Rasmus Borup Intomics - from data to biology
System Administrator Diplomvej 377
Scientific Programmer DK-2800 Kgs. Lyngby
Denmark
E: rbh@intomics.com W: http://www.intomics.com/
P: +45 5167 7972 P: +45 8880 7979
---
inc/drivers_ldap.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php
index a784e48..c4eb46c 100644
--- a/inc/drivers_ldap.php
+++ b/inc/drivers_ldap.php
@@ -127,7 +127,6 @@ class ldapDrivers
join(', ', $attributes),
$baseDNUsers);
}
- $row = array();
for($i = ldap_first_entry($this->connect,$entry);
$i && $arr = ldap_get_attributes($this->connect,$i);
$i = ldap_next_entry($this->connect,$i) ) {
@@ -158,10 +157,10 @@ class ldapDrivers
join(', ', $attributes),
$baseDNGroups);
}
- $row = array();
for($i = ldap_first_entry($this->connect,$entry);
$i && $arr = ldap_get_attributes($this->connect,$i);
$i = ldap_next_entry($this->connect,$i) ) {
+ $row = array();
for ($j=0; $j < $arr['count']; $j++) {
$row[$arr[$j]] = count($arr[$arr[$j]])>2?$arr[$arr[$j]]:$arr[$arr[$j]][0];
}
@@ -549,6 +548,7 @@ function sync_LDAP(){
foreach($c->authenticate_hook['config']['format_updated'] as $k => $v)
$$k = substr($ldap_timestamp,$v[0],$v[1]);
$ldap_timestamp = $Y.$m.$d.$H.$M.$S;
+ $valid[$mapping['modified']] = "$Y-$m-$d $H:$M:$S";
}
else if ( preg_match('{^(\d{8})(\d{6})(Z)?$', $ldap_timestamp, $matches ) ) {
$ldap_timestamp = $matches[1].'T'.$matches[2].$matches[3];
@@ -556,7 +556,6 @@ function sync_LDAP(){
else if ( empty($ldap_timestamp) ) {
$ldap_timestamp = date('c');
}
- $valid[$mapping['modified']] = $ldap_timestamp;
sync_user_from_LDAP( $principal, $mapping, $valid );
}
--
1.7.9.5
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev
$valid[$mapping['modified']] = "$Y-$m-$d $H:$M:$S";
as I don't understand why they are there at all, since in two other places in the code timestamps are converted in a similar manner without testing if $c->authenticate_hook['config']['format_updated'] is empty.
Best regards,
Rasmus
-----------------------------------------------------------------
Hansen, Rasmus Borup Intomics - from data to biology
System Administrator Diplomvej 377
Scientific Programmer DK-2800 Kgs. Lyngby
Denmark
E: rbh@intomics.com W: http://www.intomics.com/
P: +45 5167 7972 P: +45 8880 7979
---
inc/drivers_ldap.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php
index a784e48..c4eb46c 100644
--- a/inc/drivers_ldap.php
+++ b/inc/drivers_ldap.php
@@ -127,7 +127,6 @@ class ldapDrivers
join(', ', $attributes),
$baseDNUsers);
}
- $row = array();
for($i = ldap_first_entry($this->connect,$entry);
$i && $arr = ldap_get_attributes($this->connect,$i);
$i = ldap_next_entry($this->connect,$i) ) {
@@ -158,10 +157,10 @@ class ldapDrivers
join(', ', $attributes),
$baseDNGroups);
}
- $row = array();
for($i = ldap_first_entry($this->connect,$entry);
$i && $arr = ldap_get_attributes($this->connect,$i);
$i = ldap_next_entry($this->connect,$i) ) {
+ $row = array();
for ($j=0; $j < $arr['count']; $j++) {
$row[$arr[$j]] = count($arr[$arr[$j]])>2?$arr[$arr[$j]]:$arr[$arr[$j]][0];
}
@@ -549,6 +548,7 @@ function sync_LDAP(){
foreach($c->authenticate_hook['config']['format_updated'] as $k => $v)
$$k = substr($ldap_timestamp,$v[0],$v[1]);
$ldap_timestamp = $Y.$m.$d.$H.$M.$S;
+ $valid[$mapping['modified']] = "$Y-$m-$d $H:$M:$S";
}
else if ( preg_match('{^(\d{8})(\d{6})(Z)?$', $ldap_timestamp, $matches ) ) {
$ldap_timestamp = $matches[1].'T'.$matches[2].$matches[3];
@@ -556,7 +556,6 @@ function sync_LDAP(){
else if ( empty($ldap_timestamp) ) {
$ldap_timestamp = date('c');
}
- $valid[$mapping['modified']] = $ldap_timestamp;
sync_user_from_LDAP( $principal, $mapping, $valid );
}
--
1.7.9.5
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev