[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LDAP patch, and questions




Without fully understanding what I did (not being a C programmer), the
following patch allows for LDAPv3 connections, as an option, in the ldap
config file. (its from, I think, the last tarball, but I dont beleive
much has changed in ldap.c) 

While testing this with 'router -i' I notice that it isnt very falult
tollerent. If the server goes away, then it gives up and dies, without
any retries. Non-interactivly would this be different? Would that
relation be broken for ever, or at least untill router restarted? Or
would it only fail on that one address/message?

Unless this is being worked on, I may get ambitious and fire up my
copy/paste fingers a bit more :P

--- ldap.c-DIST Wed Oct 22 18:31:18 2003
+++ ldap.c      Wed Oct 22 20:41:35 2003
@@ -27,6 +27,7 @@
        char *filter;
        char *attr;
        int  wildcards;
+       int  protocol;
          /* Bound state */
        LDAP *ld;
        int simple_bind_result;
@@ -35,7 +36,6 @@
 extern int deferit;
 extern void v_set();
  
-
 static LDAPMAP *
 open_ldap(sip, caller)
        search_info *sip;
@@ -130,6 +130,15 @@
                                        continue;
                                lmap->filter = strdup(p);
                        }
+                       else if (strncasecmp(p, "protocol", 8) == 0) {
+                               p += 8;
+                               while (isascii(*++p) && isspace(*p))
+                                       continue;
+                               if (strncasecmp(p, "3", 1) == 0)
+                                       lmap->protocol = LDAP_VERSION3;
+                               else if (strncasecmp(p, "2", 1) == 0)
+                                       lmap->protocol = LDAP_VERSION2;
+                       }
                        else if (strncasecmp(p, "scope", 5) == 0) {
                                p += 5;
                                while (isascii(*++p) && isspace(*p))
@@ -151,6 +160,12 @@
                }
                fclose(fp);
  
+               if (lmap->protocol == -1) lmap->protocol =
LDAP_VERSION3;
+                if( ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION,
&lmap->protocol )
+                       != LDAP_OPT_SUCCESS ){
+                        fprintf( stderr, "Could not set
LDAP_OPT_PROTOCOL_VERSION %d\n", lmap->protocol );
+                }
+
                if (lmap->ldaphost)
                  lmap->ld = ldap_open(lmap->ldaphost, lmap->ldapport);

-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi