+
+ /* LDAP auth mode */
+
+ int ldap_uid;
+ char ldap_cn[256];
+ char ldap_dn[256];
+
+ found_user = CtdlTryUserLDAP(username, ldap_dn, sizeof ldap_dn, ldap_cn, sizeof ldap_cn, &ldap_uid);
+ if (found_user != 0) {
+ return login_not_found;
+ }
+
+ found_user = getuserbyuid(&CC->user, ldap_uid);
+ if (found_user != 0) {
+ create_user(ldap_cn, 0);
+ found_user = getuserbyuid(&CC->user, ldap_uid);
+ }
+
+ if (found_user == 0) {
+ if (CC->ldap_dn != NULL) free(CC->ldap_dn);
+ CC->ldap_dn = strdup(ldap_dn);
+ }