---
name: "ldap_searchprefs"
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_searchprefs"
---

# ldap\_searchprefs(3)

LDAP search preference configuration routeines

## NAME

ldap\_init\_searchprefs, ldap\_init\_searchprefs\_buf, ldap\_free\_searchprefs, ldap\_first\_searchobj, ldap\_next\_searchobj - LDAP search preference configuration routeines

## SYNOPSIS

```
#include <srchpref.h>
```

```
struct ldap_searchattr {
	char				*sa_attrlabel;
	char				*sa_attr;
					/* max 32 matchtypes for now */
	u_long				sa_matchtypebitmap;
	char				*sa_selectattr;
	char				*sa_selecttext;
	struct ldap_searchattr		*sa_next;
};
struct ldap_searchmatch {
	char				*sm_matchprompt;
	char				*sm_filter;
	struct ldap_searchmatch		*sm_next;
};
struct ldap_searchobj {
	char				*so_objtypeprompt;
	unsigned long			so_options;
	char				*so_prompt;
	short				so_defaultscope;
	char				*so_filterprefix;
	char				*so_filtertag;
	char				*so_defaultselectattr;
	char				*so_defaultselecttext;
	struct ldap_searchattr		*so_salist;
	struct ldap_searchmatch		*so_smlist;
	struct ldap_searchobj		*so_next;
};
```

```
int ldap_init_searchprefs( file, solistp )
	char		∗file;
	struct ldap_searchobj	∗*solistp;
```

```
int ldap_init_searchprefs_buf( buf, buflen, solistp )
	char		∗buf;
	unsigned long	len;
	struct ldap_searchobj	∗*solistp;
```

```
struct ldap_searchobj ∗ldap_free_searchprefs( solist )
	struct ldap_searchobj	∗solist;
```

```
struct ldap_searchobj ∗ldap_first_searchobj( solist )
	struct ldap_seachobj	∗solist;
```

```
struct ldap_searchobj ∗ldap_next_searchobj( solist, so )
	struct ldap_searchobj	∗solist;
	struct ldap_searchobj	∗so;
```

## DESCRIPTION

**These functions provide a standard way to access LDAP search preference** **configuration data.  LDAP search preference configurations are typically** **used by LDAP client programs to specify which attributes a user may** **search by, labels for the attributes, and LDAP filters and scopes** **associated with those searches.  Client software presents these choices** **to a user, who can then specify the type of search to be performed.**

**ldap\_init\_searchprefs()** **reads a sequence of search preference configurations from a valid LDAP**  **searchpref configuration file** **(see [ldapsearchprefs.conf(5)](/ldapsearchprefs.conf/5.md))** *Zero* **is returned upon success, and**  *solistp* **is set to point to a list of search preference data structures.**

**ldap\_init\_searchprefs\_buf()** **reads a sequence of search preference configurations from** *buf* **(whose size is** *buflen).* *buf* **should point to the data in the format defined for an LDAP search preference**  **configuration file (see [ldapsearchprefs.conf(5)](/ldapsearchprefs.conf/5.md))** *Zero* **is returned upon success, and**  *solistp* **is set to point to a list of search preference data structures.**

**ldap\_free\_searchprefs()** **disposes of the data structures allocated by** **ldap\_init\_searchprefs().**

**ldap\_first\_searchpref()** **returns the first search preference data structure in the list** *solist.* **The** *solist* **is typically obtained by calling** **ldap\_init\_searchprefs().**

**ldap\_next\_searchpref()** **returns the search preference after** *so* **in the template list** *solist. A* NULL **pointer is returned if** *so* **is the last entry in the list.**

## ERRORS

**The init preferences functions return** **LDAP\_SEARCHPREF\_ERR\_VERSION** **if buf points to data that is newer than can be handled, and** **LDAP\_SEARCHPREF\_ERR\_MEM** **if there is a memory allocation problem.**

## NOTES

## SEE ALSO

[**ldap**(3)](/ldap/3.md), [**ldapsearchprefs.conf**(5)](/ldapsearchprefs.conf/5.md), [**ldapd**(8)](/ldapd/8.md)

**Yeong, W., Howes, T., and Hardcastle-Kille, S., "Lightweight Directory Access** **Protocol", OSI-DS-26, April 1992.**

**Howes, T., Hardcastle-Kille, S., Yeong, W., and Robbins, C., "Lightweight** **Directory Access Protocol", OSI-DS-26, April 1992.**

**Hardcastle-Kille, S., "A String Representation of Distinguished Names",** **OSI-DS-23, April 1992.**

**Information Processing - Open Systems Interconnection - The Directory,** **International Organization for Standardization.  International Standard** **9594, (1988).**

## 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.**
