New site setting c_ldap_sync_email_addrs to toggle synchronization of email addresses...
authorArt Cancro <ajc@citadel.org>
Sat, 2 Dec 2017 17:58:17 +0000 (12:58 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 2 Dec 2017 17:58:17 +0000 (12:58 -0500)
citadel/ldap.c
citadel/user_ops.c

index 904baf3897fb8e2f250cc79263b9cfc12ccbeb38..73e45ba23c2a777ee6072fe155b6a482c207edee 100644 (file)
@@ -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);
+                                               }
                                        }
                                }
                        }
index 191582b6e602a441c9e934ca73e985cca4906275..5dc4790a915ac1730a88e5be299cbb0ef3bced81 100644 (file)
@@ -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