---
name: "ldap_ufn_timeout"
section: "3"
platform: "linux"
package: "libldap2-dev"
version: "2.0.23-6.3"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/ldap_ufn"
---

# ldap\_ufn\_timeout(3)

Perform an LDAP user friendly search operation

Part of [ldap\_ufn(3)](/ldap_ufn/3.md).

## NAME

ldap\_ufn\_search\_s, ldap\_ufn\_search\_c, ldap\_ufn\_search\_ct, ldap\_ufn\_setfilter, ldap\_ufn\_setfilter, ldap\_ufn\_setprefix, ldap\_ufn\_timeout - Perform an LDAP user friendly search operation

## SYNOPSIS

```
#include <ldap.h>
```

**int ldap\_ufn\_search\_c(ld, ufn, attrs, attrsonly, res, cancelproc,**\
 			**cancelparm)** **LDAP \*ld;** **char \*ufn;** **char \*\*attrs;** **int attrsonly;** **LDAPMessage \*\*res;** **int (\*cancelproc)();** **void \*cancelparm;**

**int ldap\_ufn\_search\_ct(ld, ufn, attrs, attrsonly, res, cancelproc,**\
 			**cancelparm, tag1, tag2, tag3)** **LDAP \*ld;** **char \*ufn;** **char \*\*attrs;** **int attrsonly;** **LDAPMessage \*\*res;** **int (\*cancelproc)();** **void \*cancelparm;** **char \*tag1, \*tag2, \*tag3;**

**int ldap\_ufn\_search\_s(ld, ufn, attrs, attrsonly, res)** **LDAP \*ld;** **char \*ufn;** **char \*\*attrs;** **int attrsonly;** **LDAPMessage \*\*res;**

**LDAPFiltDesc \*ldap\_ufn\_setfilter(ld, fname)** **LDAP \*ld;** **char \*fname;**

**void ldap\_ufn\_setprefix(ld, prefix)** **LDAP \*ld;** **char \*prefix;**

**int ldap\_ufn\_timeout(tvparam)** **void \*tvparam;**

## DESCRIPTION

**These routines are used to perform LDAP user friendly search operations.** **ldap\_ufn\_search\_s()** **is the simplest form.  It does the search** **synchronously.  It takes** *ld* **to identify the the LDAP connection.** **The** *ufn* **parameter is the user friendly name for which to search.** **The** *attrs***,** *attrsonly* **and** *res* **parameters are the** **same as for** [**ldap\_search**(3)](/ldap_search/3.md).

**The** **ldap\_ufn\_search\_c()** **routine functions the same as** **ldap\_ufn\_search\_s()**, **except that it takes** *cancelproc***, a function to call periodicly** **during the search.  It should be a function taking a single void \*** **argument, given by** *calcelparm***.  If** *cancelproc* **returns a** **non-zero result, the search will be abandoned and no results returned.** **The purpose of this routine is to provide a way for the search to be** **cancelled, for example, by a user or because some other condition** **occurs.**

**The** **ldap\_ufn\_search\_ct()** **routine is like** **ldap\_ufn\_search\_c()**, **except that it takes three extra parameters.**  *tag1* **is passed to the** [**ldap\_init\_getfilter**(3)](/ldap_init_getfilter/3.md) **routine when resolving the first component of** **the UFN.**  *tag2* **is used when resolving intermediate components.** *tag3* **is used when resolving the last component.  By default,** **the tags used by the other UFN search routines during these three** **phases of the search are "ufn first", "ufn intermediate", and "ufn last".**

**The** **ldap\_ufn\_setfilter()** **routine is used to set the** [**ldapfilter.conf**(5)](/ldapfilter.conf/5.md) **file for use with the** [**ldap\_init\_getfilter**(3)](/ldap_init_getfilter/3.md) **routine to** *fname***.**

**The** **ldap\_ufn\_setprefix()** **routine is used to set the default prefix** **(actually, it's a suffix) appended to UFNs before searhing.  UFNs** **with fewer than three components have the prefix appended first,** **before searching.  If that fails, the UFN is tried with progressively** **shorter versions of the prefix, stripping off components.  If the UFN** **has three or more components, it is tried by itself first.  If that** **fails, a similar process is applied with the prefix appended.**

**The** **ldap\_ufn\_timeout()** **routine is used to set the timeout associated** **with** **ldap\_ufn\_search\_s()** **searches.  The** *timeout* **parameter** **should actually be a pointer to a struct timeval (this is so** **ldap\_ufn\_timeout()** **can be used as a cancelproc in the above routines).**

## NOTES

**These routines may dynamically allocate memory.  The caller is** **required to free such memory using the supplied deallocation routines.** **Return values are contained** **in \<ldap.h\>.**

## SEE ALSO

[**gettimeofday**(2)](/gettimeofday/2.md), [**ldap**(3)](/ldap/3.md), [**ldap\_search**(3)](/ldap_search/3.md), [**ldap\_getfilter**(3)](/ldap_getfilter/3.md), [**ldapfilter.conf**(5)](/ldapfilter.conf/5.md), [**ldap\_error**(3)](/ldap_error/3.md)

## ACKNOWLEDGEMENTS

**OpenLDAP** **is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).** **OpenLDAP** **is derived from University of Michigan LDAP 3.3 Release.**
