浏览代码

apply a contributed patch

Ralf S. Engelschall 21 年之前
父节点
当前提交
d4aa385e7e
共有 1 个文件被更改,包括 43 次插入0 次删除
  1. 43 0
      jabberd/jabberd.patch

+ 43 - 0
jabberd/jabberd.patch

@@ -175,3 +175,46 @@ Index: etc/sm.xml.dist.in
  
      <!-- Its also possible to explicitly list alternate drivers for
           specific data types. -->
+Index: c2s/authreg_ldap.c
+--- c2s/authreg_ldap.c.orig	2004-05-31 23:31:05 +0200
++++ c2s/authreg_ldap.c	2004-10-03 18:56:15 +0200
+@@ -70,6 +70,24 @@
+     return ld_errno;
+ }
+ 
++/** entry-point function to be called when following referrals.
++    this forces a re-bind, since Active Directory required you to
++    re-bind this makes it work with M$ Windows AD.
++                  -- Juan F Arjona (jfarjona at jfarjona.com). */
++static int rebindProc(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *mdata)
++{
++    moddata_t data = mdata;
++    data->ld = ld;
++    if (ldap_simple_bind_s(data->ld, data->binddn, data->bindpw)) {
++        log_write(data->ar->c2s->log, LOG_ERR, "ldap: bind failed(to %s): %s",
++                  url, ldap_err2string(_ldap_get_lderrno(data->ld)));
++        ldap_unbind_s(data->ld);
++        data->ld = NULL;
++        return NULL;
++    }
++    return LDAP_SUCCESS;
++}
++
+ /** connect to the ldap host */
+ static int _ldap_connect(moddata_t data)
+ {
+@@ -151,6 +169,14 @@
+ 
+     snprintf(filter, 1024, "(%s=%s)", data->uidattr, username);
+ 
++    if (ldap_set_rebind_proc(data->ld, &rebindProc,data) ) {
++        log_write(data->ar->c2s->log, LOG_ERR, "ldap: set_rebind_proc failed: %s",
++                  ldap_err2string(_ldap_get_lderrno(data->ld)));
++        ldap_unbind_s(data->ld);
++        data->ld = NULL;
++        return NULL;
++    }
++
+     if(ldap_search_s(data->ld, basedn, LDAP_SCOPE_SUBTREE, filter, no_attrs, 0, &result))
+     {
+         log_write(data->ar->c2s->log, LOG_ERR, "ldap: search %s failed: %s", filter, ldap_err2string(_ldap_get_lderrno(data->ld)));