📄 ldap_getfilter.3
字号:
.TH LDAP_GETFILTER 3 "22 September 1998" "OpenLDAP LDVERSION".\" $OpenLDAP: pkg/ldap/doc/man/man3/ldap_getfilter.3,v 1.3.8.1 2000/06/13 17:57:12 kurt Exp $.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved..\" Copying restrictions apply. See COPYRIGHT/LICENSE..SH NAMEldap_init_getfilter, ldap_init_getfilter_buf, ldap_getfilter_free,ldap_getfirstfilter, ldap_getnextfilter, ldap_build_filter \- LDAP filter generating routines.SH SYNOPSIS.nf.ft B#include <ldap.h>.ft.fi.LP.nf.ft B#define LDAP_FILT_MAXSIZ 1024typedef struct ldap_filt_info { char *lfi_filter; char *lfi_desc; int lfi_scope; int lfi_isexact; struct ldap_filt_info *lfi_next;} LDAPFiltInfo;typedef struct ldap_filt_list { char *lfl_tag; char *lfl_pattern; char *lfl_delims; LDAPFiltInfo *lfl_ilist; struct ldap_filt_list *lfl_next;} LDAPFiltList;typedef struct ldap_filt_desc { LDAPFiltList *lfd_filtlist; LDAPFiltInfo *lfd_curfip; LDAPFiltInfo lfd_retfi; char lfd_filter[ LDAP_FILT_MAXSIZ ]; char *lfd_curval; char *lfd_curvalcopy; char **lfd_curvalwords; char *lfd_filtprefix; char *lfd_filtsuffix;} LDAPFiltDesc;.ft.fi.LP.ft BLDAPFiltDesc *ldap_init_getfilter( file ).ftchar *file;.LP.nf.ft BLDAPFiltDesc *ldap_init_getfilter_buf( buf, buflen ).ftchar *buf;long buflen;.LP.ft Bldap_getfilter_free( lfdp ).ftLDAPFiltDesc *lfdp;.LP.nf.ft BLDAPFiltInfo *ldap_getfirstfilter(lfdp, tagpat, value).ftLDAPFiltDesc *lfdp;char *tagpat;char *value;.LP.nf.ft BLDAPFiltInfo *ldap_getnextfilter(lfdp).ftLDAPFiltDesc *lfdp;.LP.ft Bvoid ldap_setfilteraffixes(lfdp, prefix, suffix).ftLDAPFiltDesc *lfdp;char *prefix;char *suffix;.LP.ft Bvoid ldap_build_filter( buf, buflen, pattern, prefix, suffix, attr, value, valwords ).ftchar *buf;unsigned long buflen;char *pattern;char *prefix;char *suffix;char *attr;char *value;char **valwords;.SH DESCRIPTION.LPThese routines are used to generate filters to be used inldap_search(3) or ldap_search_s(3). Either ldap_init_getfilter orldap_init_getfilter_buf must be called prior to calling any ofthe other routines except ldap_build_filter..LPldap_init_getfilter()takes a file name as its only argument. The contents of the file mustbe a valid LDAP filter configuration file (see ldapfilter.conf(5)). Ifthe file is successfully read, a pointer to an LDAPFiltDesc isreturned. This is an opaque object that is passed in subsequent getfilter calls..LPldap_init_getfilter_buf()reads from.I buf(whose length is.I buflen)the LDAP filter configuration information..I bufmust point to the contents of a valid LDAP filter configuration file(see ldapfilter.conf(5)). If the filter configuration information issuccessfully read, a pointer to an LDAPFiltDesc is returned. This isan opaque object that is passed in subsequent get filter calls..LPldap_getfilter_free()deallocates the memory consumed by ldap_init_getfilter. Once it iscalled, the LDAPFiltDesc is no longer valid and cannot be used again..LPldap_getfirstfilter()retrieves the first filter that is appropriate for.I value.Only filter sets that have tags that match the regular expession.I tagpatare considered. ldap_getfirstfilter returns a pointer to anLDAPFiltInfo structure, which contains a filter with.I valueinserted as appropriate in lfi_filter, a text match description inlfi_desc, lfi_scope set to indicate the search scope, and lfi_isexactset to indicate the type of filter. NULL is returnedif no matching filters are found. lfi_scope will be one of.B LDAP_SCOPE_BASE,.B LDAP_SCOPE_ONELEVEL,or.B LDAP_SCOPE_SUBTREE.lfi_isexactwill be zero if the filter has any '~' or '*' characters in it andnon-zero otherwise..LPldap_getnextfilter()retrieves the next appropriate filter in the filter set that wasdetermined when ldap_getfirstfilter was called. It returns NULL whenthe list has been exhausted..LPldap_setfilteraffixes()sets a.I prefixto be prepended and a.I suffixto be appended to all filters returned in the future..LPldap_build_filter()constructs an LDAP search filter in.I buf..I buflenis the size, in bytes, of the largest filter.I bufcan hold. A pattern for the desired filter is passed in.I pattern.Where the string %a appears in the pattern it is replaced with.I attr..I prefixis pre-pended to the resulting filter, and.I suffixis appended. Either can be NULL (in which case they are not used)..I valueand.I valwordsare used when the string %v appears in.I pattern.See ldapfilter.conf(5) for a description of how %v is handled..LP.SH ERRORSNULL is returned by ldap_init_getfilter if there is an error reading.I file.NULL is returned by ldap_getfirstfilter and ldap_getnextfilter when thereare no more appropriate filters to return..SH NOTES.LPThe return values for all of these functions are declared in the<ldap.h> header file.Some routines may dynamically allocate memorywhich the caller must free using the supplied deallocator routines..SH FILESETCDIR/ldapfilter.conf.SH SEE ALSO.BR ldap (3),.BR ldapfilter.conf (5).SH ACKNOWLEDGEMENTS.B OpenLDAPis developed and maintained by The OpenLDAP Project (http://www.openldap.org/)..B OpenLDAPis derived from University of Michigan LDAP 3.3 Release.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -