Lines Matching defs:ld

57 static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, 
61 static LDAPMessage *ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b );
62 static LDAPMessage *ldap_ufn_expand( LDAP *ld, cancelptype cancelproc,
65 LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
78 * ld LDAP descriptor
96 * error = ldap_ufn_search_ctx( ld, ufncomp, 3, NULL, attrs, attrsonly,
102 ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
130 LOCK_LDAP(ld);
171 UNLOCK_LDAP(ld);
173 return( ld->ld_errno = LDAP_NO_MEMORY );
186 if ( (dn = ldap_get_dn( ld, tmpcand )) == NULL )
192 ld->ld_errno = LDAP_NO_MEMORY;
194 UNLOCK_LDAP(ld);
204 ld->ld_errno = LDAP_NO_MEMORY;
206 UNLOCK_LDAP(ld);
221 for ( fi = ldap_getfirstfilter( ld->ld_filtd, ftag,
223 fi = ldap_getnextfilter( ld->ld_filtd ) )
225 if ( (candidates = ldap_ufn_expand( ld, cancelproc,
239 UNLOCK_LDAP(ld);
255 UNLOCK_LDAP(ld);
272 UNLOCK_LDAP(ld);
278 ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
287 LOCK_LDAP(ld);
290 if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
293 UNLOCK_LDAP(ld);
295 return( ld->ld_errno = LDAP_LOCAL_ERROR );
301 UNLOCK_LDAP(ld);
303 return( ld->ld_errno = LDAP_LOCAL_ERROR );
309 if ( ncomp > 2 || ld->ld_ufnprefix == NULL ) {
310 err = ldap_ufn_search_ctx( ld, ufncomp, ncomp, NULL, attrs,
313 if ( ldap_count_entries( ld, *res ) > 0 ) {
316 UNLOCK_LDAP(ld);
325 if ( ld->ld_ufnprefix == NULL ) {
328 UNLOCK_LDAP(ld);
334 if ( (prefixcomp = ldap_explode_dn( ld->ld_ufnprefix, 0 )) == NULL ) {
337 UNLOCK_LDAP(ld);
339 return( ld->ld_errno = LDAP_LOCAL_ERROR );
343 if ( (pbuf = (char *) malloc( strlen( ld->ld_ufnprefix ) + 1 ))
348 UNLOCK_LDAP(ld);
350 return( ld->ld_errno = LDAP_NO_MEMORY );
362 err = ldap_ufn_search_ctx( ld, ufncomp, ncomp, pbuf, attrs,
365 if ( ldap_count_entries( ld, *res ) > 0 ) {
378 UNLOCK_LDAP(ld);
388 ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly,
391 return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, cancelproc,
399 ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, int attrsonly,
404 tv.tv_sec = ld->ld_timelimit;
406 return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res,
407 ld->ld_timelimit ? ldap_ufn_timeout : NULL,
408 ld->ld_timelimit ? (void *) &tv : NULL,
419 ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b )
438 if ( ldap_result2error( ld, aend, 0 ) != LDAP_SUCCESS ) {
483 ldap_ufn_expand( LDAP *ld, cancelptype cancelproc, void *cancelparm,
501 if (( msgid = ldap_search( ld, dn, scope, filter, attrs,
504 *err = ld->ld_errno;
512 *err = ldap_result( ld, msgid, 1, &tv, &tmpres );
515 ldap_abandon( ld, msgid );
517 ld->ld_errno = LDAP_USER_CANCELLED;
522 ( *err = ldap_result2error( ld, tmpres, 0 )) == -1 ) {
527 tmpcand = ldap_msg_merge( ld, tmpcand, tmpres );
532 if ( ldap_count_entries( ld, tmpcand ) > 0 ) {
545 ldap_ufn_setfilter( LDAP *ld, char *fname )
550 LOCK_LDAP(ld);
552 if ( ld->ld_filtd != NULL )
553 ldap_getfilter_free( ld->ld_filtd );
556 ld->ld_filtd = ldap_init_getfilter( fname );
557 rv = ld->ld_filtd;
558 UNLOCK_LDAP(ld);
561 return( ld->ld_filtd = ldap_init_getfilter( fname ) );
566 ldap_ufn_setprefix( LDAP *ld, char *prefix )
569 LOCK_LDAP(ld);
571 if ( ld->ld_ufnprefix != NULL )
572 free( ld->ld_ufnprefix );
574 ld->ld_ufnprefix = strdup( prefix );
576 UNLOCK_LDAP(ld);