Ticket #28: patch-ldap-referral.patch
| File patch-ldap-referral.patch, 1.2 KB (added by smoku, 20 months ago) |
|---|
-
c2s/authreg_ldap.c
old new 70 70 return ld_errno; 71 71 } 72 72 73 /** entry-point function for following referrals, required in some cases by Active Directory */ 74 static int rebindProc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *mdata) 75 { 76 moddata_t data = mdata; 77 data->ld = ld; 78 if(ldap_simple_bind_s(data->ld, data->binddn, data->bindpw)) { 79 log_write(data->ar->c2s->log, LOG_ERR, "ldap: bind failed (to %s): %s", url, ldap_err2string(_ldap_get_lderrno(data->ld))); 80 ldap_unbind_s(data->ld); 81 data->ld = NULL; 82 return NULL; 83 } 84 85 return LDAP_SUCCESS; 86 } 87 73 88 /** connect to the ldap host */ 74 89 static int _ldap_connect(moddata_t data) 75 90 { … … 151 166 } 152 167 153 168 snprintf(filter, 1024, "(%s=%s)", data->uidattr, username); 169 170 if(ldap_set_rebind_proc(data->ld, &rebindProc,data)) { 171 log_write(data->ar->c2s->log, LOG_ERR, "ldap: set_rebind_proc failed: %s", ldap_err2string(_ldap_get_lderrno(data->ld))); 172 ldap_unbind_s(data->ld); 173 data->ld = NULL; 174 return NULL; 175 } 154 176 155 177 if(ldap_search_s(data->ld, basedn, LDAP_SCOPE_SUBTREE, filter, no_attrs, 0, &result)) 156 178 {
