NULL, // clientctrls (none)
&tv, // timeout
1, // sizelimit (1 result max)
- &search_result // res
+ &search_result // put the result here
)));
// Ignore the return value of ldap_search_ext_s(). Sometimes it returns an error even when
}
+// This is an extension of CtdlTryPassword() which gets called when using LDAP authentication.
int CtdlTryPasswordLDAP(char *user_dn, const char *password) {
LDAP *ldserver = NULL;
int i = (-1);
}
+// Remember that a particular user exists in the Citadel database.
+// As we scan the LDAP tree we will remove users from this list when we find them.
+// At the end of the scan, any users remaining in this list are stale and should be deleted.
+void ldap_note_user_in_citadel(char *username, void *data) {
+ return;
+}
+
+
// Scan LDAP for users and populate Citadel's user database with everyone
//
// POSIX schema: All objects of class "inetOrgPerson"
struct timeval tv;
if ((CtdlGetConfigInt("c_auth_mode") != AUTHMODE_LDAP) && (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_LDAP_AD)) {
- return; // This site is not running LDAP. Stop here.
+ return; // If this site is not running LDAP, stop here.
}
syslog(LOG_INFO, "ldap: synchronizing Citadel user database from LDAP");
+ // first, scan the existing Citadel user list
+ // ForEachUser(ldap_note_user_in_citadel, NULL); // FIXME finish this
+
ldserver = ctdl_ldap_bind();
if (!ldserver) return;
NULL, // clientctrls (none)
&tv, // timeout
INT_MAX, // sizelimit (max)
- &search_result // result
+ &search_result // put the result here
)));
// Ignore the return value of ldap_search_ext_s(). Sometimes it returns an error even when
syslog(LOG_DEBUG, "ldap: %d entries returned", ldap_count_entries(ldserver, search_result));
for (entry=ldap_first_entry(ldserver, search_result); entry!=NULL; entry=ldap_next_entry(ldserver, entry)) {
- TRACE;
user_dn = ldap_get_dn(ldserver, entry);
if (user_dn) {
syslog(LOG_DEBUG, "ldap: found %s", user_dn);
}
ldap_memfree(user_dn);
}
- TRACE;
}
// free the results