X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fldap.c;h=dfa52cfc1ab20bc2832fff5decae05c7a544eaad;hp=53e4816795cb7a457cee53bd1e9fd6904a0f8303;hb=1cf98031e3530393ec5fb753567bf496c6277ab3;hpb=e50a8a181e1cbd4aa0e8bc032fa8153040e66eea diff --git a/citadel/ldap.c b/citadel/ldap.c index 53e481679..dfa52cfc1 100644 --- a/citadel/ldap.c +++ b/citadel/ldap.c @@ -59,7 +59,6 @@ void derive_fullname_from_ldap_result(char *fullname, int fullname_size, LDAP *l ldap_value_free(values); } } - syslog(LOG_DEBUG, "\033[31mldap: display name: <%s> \033[0m", fullname); } @@ -90,13 +89,10 @@ uid_t derive_uid_from_ldap(LDAP *ldserver, LDAPMessage *entry) } } - syslog(LOG_DEBUG, "\033[31mldap: uid: <%d> \033[0m", uid); return(uid); } - - /* * Wrapper function for ldap_initialize() that consistently fills in the correct fields */ @@ -123,7 +119,7 @@ int ctdl_ldap_initialize(LDAP **ld) { int CtdlTryUserLDAP(char *username, char *found_dn, int found_dn_size, char *fullname, int fullname_size, - uid_t *uid, int lookup_based_on_username) + uid_t *uid) { LDAP *ldserver = NULL; int i; @@ -158,18 +154,11 @@ int CtdlTryUserLDAP(char *username, tv.tv_usec = 0; if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD) { - if (lookup_based_on_username != 0) - snprintf(searchstring, sizeof(searchstring), "(displayName=%s)",username); - else - snprintf(searchstring, sizeof(searchstring), "(sAMAccountName=%s)", username); + snprintf(searchstring, sizeof(searchstring), "(sAMAccountName=%s)", username); } else { - if (lookup_based_on_username != 0) { - snprintf(searchstring, sizeof(searchstring), "(cn=%s)",username); - } - else { - snprintf(searchstring, sizeof(searchstring), "(&(objectclass=posixAccount)(uid=%s))", username); - } + snprintf(searchstring, sizeof(searchstring), "(&(objectclass=posixAccount)(cn=%s))", username); + // snprintf(searchstring, sizeof(searchstring), "(&(objectclass=posixAccount)(uid=%s))", username); } syslog(LOG_DEBUG, "ldap: search: %s", searchstring); @@ -208,12 +197,7 @@ int CtdlTryUserLDAP(char *username, } derive_fullname_from_ldap_result(fullname, fullname_size, ldserver, search_result); - - /* If we know the username is the CN/displayName, we already set the uid*/ - // FIXME old skool crap , fix this - if (lookup_based_on_username == 0) { - *uid = derive_uid_from_ldap(ldserver, search_result); - } + *uid = derive_uid_from_ldap(ldserver, search_result); } /* free the results */ @@ -538,13 +522,12 @@ int extract_email_addresses_from_ldap(char *ldap_dn, char *emailaddrs) entry = ldap_first_entry(ldserver, search_result); if (entry) { syslog(LOG_DEBUG, "ldap: search got user details"); - mail=ldap_get_values(ldserver, search_result, "mail"); + mail = ldap_get_values(ldserver, search_result, "mail"); if (mail) { int q; for (q=0; q 512) { syslog(LOG_ERR, "ldap: can't fit all email addresses into user record"); }