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

ldap_initialize vs ldap_init



Hello!

I am having a problem with warnquota from quota-tools.  I apologize if
this is considered off topic but development seems to have slowed on
the quota-tools project (last release over a year ago) and they have no
mailing list.  Please let me know where to refer future questions if
this is the case.

Basically, by default warnquota will do mail recipient lookups via the
older ldap_init(host, port).  My problem is that I have set samba and
squid and a bunch of other things to do only ldaps and I have disabled
plain ldap.  I'm having trouble modifying the warnquota.c file with the
newer ldap_initialize via ldaps:// url.

default code:

#ifdef USE_LDAP_MAIL_LOOKUP
LDAP *ldapconn = NULL;
#endif

#ifdef USE_LDAP_MAIL_LOOKUP
static int setup_ldap(struct configparams *config)
{
	int ret;

	ldapconn = ldap_init(config->ldap_host, config->ldap_port);
	if(ldapconn == NULL) {
		ldap_perror(ldapconn, "ldap_init");
		return(-1);
	}

	ret = ldap_bind_s(ldapconn, config->ldap_binddn, config->ldap_bindpw, LDAP_AUTH_SIMPLE);
	if(ret < 0) {
		ldap_perror(ldapconn, "ldap_bind");
		return(-1);
	}
	return(0);
}
		
#endif


what I changed it to:

#ifdef USE_LDAP_MAIL_LOOKUP
LDAP *ldapconn = NULL;
LDAP	*ld;
#endif

#ifdef USE_LDAP_MAIL_LOOKUP
static int setup_ldap(struct configparams *config)
{
	int ret;

	ldapconn = ldap_initialize(&ld, config->ldap_url);
	if(ldapconn == NULL) {
		ldap_perror(ldapconn, "ldap_initialize");
		return(-1);
	}

	ret = ldap_bind_s(ldapconn, config->ldap_binddn, config->ldap_bindpw, LDAP_AUTH_SIMPLE);
	if(ret < 0) {
		ldap_perror(ldapconn, "ldap_bind");
		return(-1);
	}
	return(0);
}
		
#endif

everything compiles O.K. but I get this when trying to run the program:

warnquota: error.c:169: ldap_perror: Assertion `ld != ((void *)0)' failed.
Aborted


any help would be appreciated.

Thanks!


Mike Branda