From: Art Cancro Date: Sat, 2 Dec 2017 17:58:17 +0000 (-0500) Subject: New site setting c_ldap_sync_email_addrs to toggle synchronization of email addresses... X-Git-Tag: v939~491 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=8996a310a8255f702e139f09dbb7fae697ba7841 New site setting c_ldap_sync_email_addrs to toggle synchronization of email addresses from LDAP to Citadel. --- diff --git a/citadel/ldap.c b/citadel/ldap.c index 904baf389..73e45ba23 100644 --- a/citadel/ldap.c +++ b/citadel/ldap.c @@ -611,13 +611,12 @@ void CtdlSynchronizeUsersFromLDAP(void) } if (found_user == 0) { // user record exists - // now update the account email addresses if necessary - // FIXME make this a site configurable setting - - if (extract_email_addresses_from_ldap(user_dn, new_emailaddrs) == 0) { - if (strcmp(usbuf.emailaddrs, new_emailaddrs)) { // update only if changed - CtdlSetEmailAddressesForUser(usbuf.fullname, new_emailaddrs); + if (CtdlGetConfigInt("c_ldap_sync_email_addrs") > 0) { + if (extract_email_addresses_from_ldap(user_dn, new_emailaddrs) == 0) { + if (strcmp(usbuf.emailaddrs, new_emailaddrs)) { // update only if changed + CtdlSetEmailAddressesForUser(usbuf.fullname, new_emailaddrs); + } } } } diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 191582b6e..5dc4790a9 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -657,8 +657,10 @@ void do_login(void) #ifdef HAVE_LDAP if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { char new_emailaddrs[512]; - if (extract_email_addresses_from_ldap(CCC->ldap_dn, new_emailaddrs) == 0) { - CtdlSetEmailAddressesForUser(CCC->user.fullname, new_emailaddrs); + if (CtdlGetConfigInt("c_ldap_sync_email_addrs") > 0) { + if (extract_email_addresses_from_ldap(CCC->ldap_dn, new_emailaddrs) == 0) { + CtdlSetEmailAddressesForUser(CCC->user.fullname, new_emailaddrs); + } } } #endif