diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-04-11 13:50:11 (GMT) |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-04-11 13:50:11 (GMT) |
commit | 4849d5b5ad3395161c58d12715c66f6d10bee633 (patch) | |
tree | af71c8a2d0634e174f6b0c92baa0029aecc2b684 /lib | |
parent | 429570902bb0f4dd6a16a2b3a4952d3b1a7c1129 (diff) | |
download | perl-Kolab-4849d5b5ad3395161c58d12715c66f6d10bee633.tar.gz |
First steps to fixing the FDS backend
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kolab/LDAP.pm | 14 | ||||
-rw-r--r-- | lib/Kolab/LDAP/Backend/fds.pm | 35 |
2 files changed, 29 insertions, 20 deletions
diff --git a/lib/Kolab/LDAP.pm b/lib/Kolab/LDAP.pm index e6c2ae5..866f19b 100644 --- a/lib/Kolab/LDAP.pm +++ b/lib/Kolab/LDAP.pm @@ -379,12 +379,18 @@ sub isObject my $class = shift; my $classes = $object->get_value('objectClass', asref => 1); - return 0 if !defined($classes); - foreach my $oc (@$classes) { - if ($oc =~ /$class/i) { - return 1; + if !defined($classes) { + Kolab::log('L', 'No attribute objectClass for object', KOLAB_DEBUG); + return 0; + } else { + # Loop through the object classes and see which one matches + foreach my $oc (@$classes) { + if ($oc =~ /$class/i) { + return 1; + } } } + # Ultimately, pretend nothing happened return 0; } diff --git a/lib/Kolab/LDAP/Backend/fds.pm b/lib/Kolab/LDAP/Backend/fds.pm index 16044d7..9d35610 100644 --- a/lib/Kolab/LDAP/Backend/fds.pm +++ b/lib/Kolab/LDAP/Backend/fds.pm @@ -99,26 +99,31 @@ sub changeCallback return; } - if (!Kolab::LDAP::isObject($entry, $Kolab::config{'user_object_class'}) && - !Kolab::LDAP::isObject($entry, 'kolab')) { - Kolab::log('FDS', "Entry is not a `" . $Kolab::config{'user_object_class'} . "' or kolab configuration object, returning", KOLAB_DEBUG); - return; - } + # The entry is the parent object in case of a deletion. +# if (!Kolab::LDAP::isObject($entry, $Kolab::config{'user_object_class'}) && +# !Kolab::LDAP::isObject($entry, 'kolab')) { +# Kolab::log('FDS', "Entry is not a `" . $Kolab::config{'user_object_class'} . "' or kolab configuration object, returning", KOLAB_DEBUG); +# return; +# } FOO: Kolab::log('FDS', "Calling Kolab::LDAP::sync", KOLAB_DEBUG); Kolab::LDAP::sync; + system($Kolab::config{'kolabconf_script'}) == 0 || Kolab::log('SD', "Failed to run kolabconf: $?", KOLAB_ERROR); - Kolab::log('FDS', "Finished Kolab::LDAP::sync sleeping 1s", KOLAB_DEBUG); - sleep 1; # we get too many bogus change notifications! - -# my $deleted = $entry->get_value($Kolab::config{'user_field_deleted'}) || 0; -# if ($deleted) { -# Kolab::LDAP::deleteObject($ldap, $cyrus, $entry); -# return; -# } + + Kolab::log('FDS', "Finished Kolab::LDAP::sync, sleeping for 5 seconds", KOLAB_DEBUG); + + sleep 5; # we get too many bogus change notifications! + +# my $deleted = $entry->get_value($Kolab::config{'user_field_deleted'}) || 0; +# if ($deleted) { +# Kolab::LDAP::deleteObject($ldap, $cyrus, $entry); +# return; +# } # -# Kolab::LDAP::createObject($ldap, $cyrus, $entry); +# Kolab::LDAP::createObject($ldap, $cyrus, $entry); + } sub run { @@ -199,8 +204,6 @@ sub run { ], ); -# $status = ldap_create_persistentsearch_control($ld,$changetypes,$changesonly,$return_echg_ctrls,$ctrl_iscritical,$ctrlp); - Kolab::log('FDS', "Change notification registered on `$userdn'"); } |