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

Re: ldap_search_st weirdness



dustin sallings wrote:
> On Mon, 28 Dec 1998, Kurt D. Zeilenga wrote:
> // I suspect you are using OpenLDAP 1.1.x which support initialization
> // of LDAP session parameters (including SIZELIMIT) via ldap.conf(5).
> // For more information, see:
> 
> //      http://www.openldap.org/software/man.cgi?query=ldap.conf
> //
> // > Is this a bug, or am I doing something stupid?
> //
> // Actually, ldapsearch command has the bug.  It should have returned
> // only 12 entries as well.  This will be fixed in OpenLDAP 1.1.2.
> 
>         Oh yes, I see it now.  :)  I admit I am using a fairly
> bleeding-edge build (I did a cvs update and built right before I sent that
> mail).  It seemed like something that had to be intentional.

You picked up the pre-1.1.2 ldap.conf file before I updated it with
distribution defaults.  Just edit $sysconfdir/ldap.conf OR
cvs update; make install.

>         How do I programattically override this default?

Well, you can always set ld->ld_sizelimit.  I recommend you only override
the ldap.conf defaults based upon user input.  I do not recommend hardcoding
overrides unless you really enjoy having to edit code to change defaults.
I recommend you also use #ifdef in your code so that you can support both
U-Mich (OpenLDAP 1.x) and our newer API (your mileage here might vary).

>From the hip example:
	char *ldap_host = NULL; /* allow defaulting */
	int ldap_port = 0;	/* allow defaulting */
	int sizelimit = -1;	/* allow defaulting */

	switch(getopt(...)) {
		... ldap_host = argv[i]; ...		/* user override */
		... ldap_port = atoi(argv[i]); ...	/* user override */
		... sizelimit = atoi(argv[i]); ...	/* user override */
	}

	ld = ldap_init(ldap_host, ldap_port);

	if( sizelimit != -1 ) {
#ifdef	LDAP_OPT_SIZELIMIT
		ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
#else
		ld->ld_sizelimit = sizelimit
#endif
	}