1 .TH LDAP_GETFILTER 3 "22 September 1998" "OpenLDAP LDVERSION"
3 ldap_init_getfilter, ldap_init_getfilter_buf, ldap_getfilter_free,
4 ldap_getfirstfilter, ldap_getnextfilter, ldap_build_filter \- LDAP filter generating routines
15 #define LDAP_FILT_MAXSIZ 1024
17 typedef struct ldap_filt_info {
22 struct ldap_filt_info *lfi_next;
25 typedef struct ldap_filt_list {
29 LDAPFiltInfo *lfl_ilist;
30 struct ldap_filt_list *lfl_next;
33 typedef struct ldap_filt_desc {
34 LDAPFiltList *lfd_filtlist;
35 LDAPFiltInfo *lfd_curfip;
36 LDAPFiltInfo lfd_retfi;
37 char lfd_filter[ LDAP_FILT_MAXSIZ ];
40 char **lfd_curvalwords;
48 LDAPFiltDesc *ldap_init_getfilter( file )
54 LDAPFiltDesc *ldap_init_getfilter_buf( buf, buflen )
60 ldap_getfilter_free( lfdp )
66 LDAPFiltInfo *ldap_getfirstfilter(lfdp, tagpat, value)
74 LDAPFiltInfo *ldap_getnextfilter(lfdp)
79 void ldap_setfilteraffixes(lfdp, prefix, suffix)
86 void ldap_build_filter( buf, buflen, pattern, prefix, suffix,
87 attr, value, valwords )
99 These routines are used to generate filters to be used in
100 ldap_search(3) or ldap_search_s(3). Either ldap_init_getfilter or
101 ldap_init_getfilter_buf must be called prior to calling any of
102 the other routines except ldap_build_filter.
104 ldap_init_getfilter()
105 takes a file name as its only argument. The contents of the file must
106 be a valid LDAP filter configuration file (see ldapfilter.conf(5)). If
107 the file is successfully read, a pointer to an LDAPFiltDesc is
108 returned. This is an opaque object that is passed in subsequent get
111 ldap_init_getfilter_buf()
116 the LDAP filter configuration information.
118 must point to the contents of a valid LDAP filter configuration file
119 (see ldapfilter.conf(5)). If the filter configuration information is
120 successfully read, a pointer to an LDAPFiltDesc is returned. This is
121 an opaque object that is passed in subsequent get filter calls.
123 ldap_getfilter_free()
124 deallocates the memory consumed by ldap_init_getfilter. Once it is
125 called, the LDAPFiltDesc is no longer valid and cannot be used again.
127 ldap_getfirstfilter()
128 retrieves the first filter that is appropriate for
130 Only filter sets that have tags that match the regular expession
132 are considered. ldap_getfirstfilter returns a pointer to an
133 LDAPFiltInfo structure, which contains a filter with
135 inserted as appropriate in lfi_filter, a text match description in
136 lfi_desc, lfi_scope set to indicate the search scope, and lfi_isexact
137 set to indicate the type of filter. NULL is returned
138 if no matching filters are found. lfi_scope will be one of
140 .B LDAP_SCOPE_ONELEVEL,
142 .B LDAP_SCOPE_SUBTREE.
144 will be zero if the filter has any '~' or '*' characters in it and
148 retrieves the next appropriate filter in the filter set that was
149 determined when ldap_getfirstfilter was called. It returns NULL when
150 the list has been exhausted.
152 ldap_setfilteraffixes()
155 to be prepended and a
157 to be appended to all filters returned in the future.
160 constructs an LDAP search filter in
163 is the size, in bytes, of the largest filter
165 can hold. A pattern for the desired filter is passed in
167 Where the string %a appears in the pattern it is replaced with
170 is pre-pended to the resulting filter, and
172 is appended. Either can be NULL (in which case they are not used).
176 are used when the string %v appears in
178 See ldapfilter.conf(5) for a description of how %v is handled.
181 NULL is returned by ldap_init_getfilter if there is an error reading
183 NULL is returned by ldap_getfirstfilter and ldap_getnextfilter when there
184 are no more appropriate filters to return.
187 The return values for all of these functions are declared in the
188 <ldap.h> header file.
189 Some routines may dynamically allocate memory
190 which the caller must free using the supplied deallocator routines.
192 ETCDIR/ldapfilter.conf
195 .BR ldapfilter.conf (5)
198 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
200 is derived from University of Michigan LDAP 3.3 Release.