|
|
@ -129,10 +129,8 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { |
|
|
|
my $domain_entry = ldap2hashref( $zim_domain_search, 'zimbraDomainName' )->{$domain}; |
|
|
|
my $domain_entry = ldap2hashref( $zim_domain_search, 'zimbraDomainName' )->{$domain}; |
|
|
|
|
|
|
|
|
|
|
|
# Check if auth is set to ad or ldap |
|
|
|
# Check if auth is set to ad or ldap |
|
|
|
if ( |
|
|
|
if ( not defined $domain_entry->{zimbraAuthMech} or |
|
|
|
not defined $domain_entry->{zimbraAuthMech} or |
|
|
|
$domain_entry->{zimbraAuthMech} !~ m/^ad|ldap$/i ) { |
|
|
|
$domain_entry->{zimbraAuthMech} !~ m/^ad|ldap$/i |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
if ( yaml_bool( $conf->{domains}->{$domain}->{zimbra}->{setup_ldap_auth} ) ) { |
|
|
|
if ( yaml_bool( $conf->{domains}->{$domain}->{zimbra}->{setup_ldap_auth} ) ) { |
|
|
|
send_zmprov_cmd( "modifyDomain $domain " . build_domain_attrs( $conf->{domains}->{$domain} ) ); |
|
|
|
send_zmprov_cmd( "modifyDomain $domain " . build_domain_attrs( $conf->{domains}->{$domain} ) ); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -165,7 +163,7 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log_verbose( "Trying to connect to " . |
|
|
|
log_verbose( "Trying to connect to " . |
|
|
|
join( ' or ', @{ $conf->{domains}->{$domain}->{ldap}->{servers} } ) ); |
|
|
|
join( ' or ', @{ $conf->{domains}->{$domain}->{ldap}->{servers} } ) ); |
|
|
|
|
|
|
|
|
|
|
|
my $ext_ldap = Net::LDAP->new( [ @{ $conf->{domains}->{$domain}->{ldap}->{servers} } ] ); |
|
|
|
my $ext_ldap = Net::LDAP->new( [ @{ $conf->{domains}->{$domain}->{ldap}->{servers} } ] ); |
|
|
|
if ( not $ext_ldap ) { |
|
|
|
if ( not $ext_ldap ) { |
|
|
@ -186,7 +184,8 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { |
|
|
|
log_verbose( "StartTLS succeeded" ); |
|
|
|
log_verbose( "StartTLS succeeded" ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( defined $conf->{domains}->{$domain}->{ldap}->{bind_dn} and defined $conf->{domains}->{$domain}->{ldap}->{bind_pass} ) { |
|
|
|
if ( defined $conf->{domains}->{$domain}->{ldap}->{bind_dn} and |
|
|
|
|
|
|
|
defined $conf->{domains}->{$domain}->{ldap}->{bind_pass} ) { |
|
|
|
log_verbose( "Trying to bind as " . $conf->{domains}->{$domain}->{ldap}->{bind_dn} ); |
|
|
|
log_verbose( "Trying to bind as " . $conf->{domains}->{$domain}->{ldap}->{bind_dn} ); |
|
|
|
my $bind = $ext_ldap->bind( |
|
|
|
my $bind = $ext_ldap->bind( |
|
|
|
$conf->{domains}->{$domain}->{ldap}->{bind_dn}, |
|
|
|
$conf->{domains}->{$domain}->{ldap}->{bind_dn}, |
|
|
@ -267,7 +266,7 @@ DOMAIN: foreach my $domain ( keys $conf->{domains} ) { |
|
|
|
my $zim_user_search = $zim_ldap->ldap->search( |
|
|
|
my $zim_user_search = $zim_ldap->ldap->search( |
|
|
|
base => 'ou=people,' . $domain_entry->{dn}, |
|
|
|
base => 'ou=people,' . $domain_entry->{dn}, |
|
|
|
filter => '(&(objectClass=zimbraAccount)(!(zimbraIsSystemAccount=TRUE))(!(zimbraIsSystemResource=TRUE)))', |
|
|
|
filter => '(&(objectClass=zimbraAccount)(!(zimbraIsSystemAccount=TRUE))(!(zimbraIsSystemResource=TRUE)))', |
|
|
|
attrs => [ |
|
|
|
attrs => [ |
|
|
|
( map { $conf->{domains}->{$domain}->{users}->{attr_map}->{$_} } |
|
|
|
( map { $conf->{domains}->{$domain}->{users}->{attr_map}->{$_} } |
|
|
|
keys $conf->{domains}->{$domain}->{users}->{attr_map} ), |
|
|
|
keys $conf->{domains}->{$domain}->{users}->{attr_map} ), |
|
|
|
( 'uid', |
|
|
|
( 'uid', |
|
|
|