1 .TH LDAP_GETFILTER 3 "22 September 1998" "OpenLDAP LDVERSION"
3 .\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_init_getfilter, ldap_init_getfilter_buf, ldap_getfilter_free,
7 ldap_getfirstfilter, ldap_getnextfilter, ldap_build_filter \- LDAP filter generating routines
17 #define LDAP_FILT_MAXSIZ 1024
19 typedef struct ldap_filt_info {
24 struct ldap_filt_info *lfi_next;
27 typedef struct ldap_filt_list {
31 LDAPFiltInfo *lfl_ilist;
32 struct ldap_filt_list *lfl_next;
35 typedef struct ldap_filt_desc {
36 LDAPFiltList *lfd_filtlist;
37 LDAPFiltInfo *lfd_curfip;
38 LDAPFiltInfo lfd_retfi;
39 char lfd_filter[ LDAP_FILT_MAXSIZ ];
42 char **lfd_curvalwords;
50 LDAPFiltDesc *ldap_init_getfilter( file )
56 LDAPFiltDesc *ldap_init_getfilter_buf( buf, buflen )
62 ldap_getfilter_free( lfdp )
68 LDAPFiltInfo *ldap_getfirstfilter(lfdp, tagpat, value)
76 LDAPFiltInfo *ldap_getnextfilter(lfdp)
81 void ldap_setfilteraffixes(lfdp, prefix, suffix)
88 void ldap_build_filter( buf, buflen, pattern, prefix, suffix,
89 attr, value, valwords )
101 These routines are used to generate filters to be used in
102 ldap_search(3) or ldap_search_s(3). Either ldap_init_getfilter or
103 ldap_init_getfilter_buf must be called prior to calling any of
104 the other routines except ldap_build_filter.
106 ldap_init_getfilter()
107 takes a file name as its only argument. The contents of the file must
108 be a valid LDAP filter configuration file (see ldapfilter.conf(5)). If
109 the file is successfully read, a pointer to an LDAPFiltDesc is
110 returned. This is an opaque object that is passed in subsequent get
113 ldap_init_getfilter_buf()
118 the LDAP filter configuration information.
120 must point to the contents of a valid LDAP filter configuration file
121 (see ldapfilter.conf(5)). If the filter configuration information is
122 successfully read, a pointer to an LDAPFiltDesc is returned. This is
123 an opaque object that is passed in subsequent get filter calls.
125 ldap_getfilter_free()
126 deallocates the memory consumed by ldap_init_getfilter. Once it is
127 called, the LDAPFiltDesc is no longer valid and cannot be used again.
129 ldap_getfirstfilter()
130 retrieves the first filter that is appropriate for
132 Only filter sets that have tags that match the regular expession
134 are considered. ldap_getfirstfilter returns a pointer to an
135 LDAPFiltInfo structure, which contains a filter with
137 inserted as appropriate in lfi_filter, a text match description in
138 lfi_desc, lfi_scope set to indicate the search scope, and lfi_isexact
139 set to indicate the type of filter. NULL is returned
140 if no matching filters are found. lfi_scope will be one of
142 .B LDAP_SCOPE_ONELEVEL,
144 .B LDAP_SCOPE_SUBTREE.
146 will be zero if the filter has any '~' or '*' characters in it and
150 retrieves the next appropriate filter in the filter set that was
151 determined when ldap_getfirstfilter was called. It returns NULL when
152 the list has been exhausted.
154 ldap_setfilteraffixes()
157 to be prepended and a
159 to be appended to all filters returned in the future.
162 constructs an LDAP search filter in
165 is the size, in bytes, of the largest filter
167 can hold. A pattern for the desired filter is passed in
169 Where the string %a appears in the pattern it is replaced with
172 is pre-pended to the resulting filter, and
174 is appended. Either can be NULL (in which case they are not used).
178 are used when the string %v appears in
180 See ldapfilter.conf(5) for a description of how %v is handled.
183 NULL is returned by ldap_init_getfilter if there is an error reading
185 NULL is returned by ldap_getfirstfilter and ldap_getnextfilter when there
186 are no more appropriate filters to return.
189 The return values for all of these functions are declared in the
190 <ldap.h> header file.
191 Some routines may dynamically allocate memory
192 which the caller must free using the supplied deallocator routines.
194 ETCDIR/ldapfilter.conf
197 .BR ldapfilter.conf (5)
200 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
202 is derived from University of Michigan LDAP 3.3 Release.