From 8996a310a8255f702e139f09dbb7fae697ba7841 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 2 Dec 2017 12:58:17 -0500 Subject: [PATCH] New site setting c_ldap_sync_email_addrs to toggle synchronization of email addresses from LDAP to Citadel. --- citadel/ldap.c | 11 +++++------ citadel/user_ops.c | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) 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 -- 2.30.2