]> git.proxmox.com Git - pmg-api.git/blobdiff - PMG/LDAPSet.pm
fix bug 1707: use correct units for deferred mail queue (minutes)
[pmg-api.git] / PMG / LDAPSet.pm
index f35bbb685a5df62a040774eed0c6031008d0052f..e5b65cdbd826552cbb7eb635930c857cff3f4dc8 100755 (executable)
@@ -2,7 +2,6 @@ package PMG::LDAPSet;
 
 use strict;
 use warnings;
-use Carp;
 
 use PVE::SafeSyslog;
 
@@ -28,6 +27,7 @@ sub new_from_ldap_cfg {
        # fixme: does it work?
        my $data = $ldap_cfg->{ids}->{$id};
        next if !ref($data);
+       next if $data->{disable};
 
        $data->{syncmode} = $syncmode;
        $data->{id} = $id;
@@ -49,13 +49,23 @@ sub ldap_resync {
        my $msg = "start syncing ldap profile '${p}' (${server})";
        syslog('info', $msg);
        print STDERR "$msg\n" if $tostderr;
+
        $ldap->{$p}->update(2);
+
+       my $errors = $ldap->{$p}->{errors};
+       print STDERR $errors if $tostderr && $errors;
+
        my $gcount = $ldap->{$p}->{gcount};
        my $ucount = $ldap->{$p}->{ucount};
        my $mcount = $ldap->{$p}->{mcount};
 
-       $msg = "finished syncing ldap profile '${p}' (${server}): " .
-           "found $ucount accounts, $mcount addresses, $gcount groups";
+       if ($errors) {
+           $msg = "aborted syncing ldap profile '${p}' (${server}): " .
+               "keep old data, $ucount accounts, $mcount addresses, $gcount groups";
+       } else {
+           $msg = "finished syncing ldap profile '${p}' (${server}): " .
+               "found $ucount accounts, $mcount addresses, $gcount groups";
+       }
        syslog('info', $msg);
        print STDERR "$msg\n" if $tostderr;
     }