[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_init overwrites ldap version number to 2



Oops, I didn't have it quite right.  There's two problems dealing with setting options with ld=NULL.

1. The lines mentioned in libldap\open.c should not be deleted but should be replaced with

      /* Copy this ldap version from global options. */
      ld->ld_version = ld->ld_options.ldo_version;

2.  Correction to Steve Sonntags earlier message.
      In libldap\options.c, in ldap_set_options, case LDAP_OPT_PROTOCOL_VERSION, 
      both versions need to be set.  ie

      lo->ldo_version = vers;
      if (ld != NULL)
         ld->ld_version = vers;


>>> "Dave Steck" <DSTECK@novell.com> 02/17/00 04:56PM >>>
There's a line in open.c that get executed when ldap_init is called:

        /* we'll assume we're talking version 2 for now */
        ld->ld_version = LDAP_VERSION2;

This breaks the case where an application sets the ldap version to 3 in the global options before calling ldap_init().
i.e.
      version = LDAP_VERSION3;
      ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &version);

      ldap_init(...);
      < version number gets reset to 2>

The global options are already initialized to version 2 and get copied into the ld handle when ldap_init is called.
These two lines should be deleted from open.c.