SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Mandrake Other ldap-devel-3.3-3.i386.rpm

LDAP_GETFILTER

Section: C Library Functions (3)
Updated: 28 November 1994
Index 

NAME

ldap_init_getfilter, ldap_init_getfilter_buf, ldap_getfilter_free,ldap_getfirstfilter, ldap_getnextfilter, ldap_build_filter - LDAP filter generating routines 

SYNOPSIS

#include <lber.h>#include <ldap.h>

#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;

LDAPFiltDesc *ldap_init_getfilter( file )char *file;

LDAPFiltDesc *ldap_init_getfilter_buf( buf, buflen )char *buf;long buflen;ldap_getfilter_free( lfdp )LDAPFiltDesc *lfdp;LDAPFiltInfo *ldap_getfirstfilter(lfdp, tagpat, value)LDAPFiltDesc *lfdp;char *tagpat;char *value;LDAPFiltInfo *ldap_getnextfilter(lfdp)LDAPFiltDesc *lfdp;void ldap_setfilteraffixes(lfdp, prefix, suffix)LDAPFiltDesc *lfdp;char *prefix;char *suffix;void ldap_build_filter( buf, buflen, pattern, prefix, suffix,        attr, value, valwords )char *buf;unsigned long buflen;char *pattern;char *prefix;char *suffix;char *attr;char *value;char **valwords;
 

DESCRIPTION

These 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.

ldap_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.

ldap_init_getfilter_buf()reads frombuf(whose length isbuflen)the LDAP filter configuration information.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.

ldap_getfilter_free()deallocates the memory consumed by ldap_init_getfilter. Once it iscalled, the LDAPFiltDesc is no longer valid and cannot be used again.

ldap_getfirstfilter()retrieves the first filter that is appropriate forvalue.Only filter sets that have tags that match the regular expessiontagpatare considered. ldap_getfirstfilter returns a pointer to anLDAPFiltInfo structure, which contains a filter withvalueinserted 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 ofLDAP_SCOPE_BASE,LDAP_SCOPE_ONELEVEL,orLDAP_SCOPE_SUBTREE.lfi_isexactwill be zero if the filter has any '~' or '*' characters in it andnon-zero otherwise.

ldap_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.

ldap_setfilteraffixes()sets aprefixto be prepended and asuffixto be appended to all filters returned in the future.

ldap_build_filter()constructs an LDAP search filter inbuf.buflenis the size, in bytes, of the largest filterbufcan hold. A pattern for the desired filter is passed inpattern.Where the string %a appears in the pattern it is replaced withattr.prefixis pre-pended to the resulting filter, andsuffixis appended. Either can be NULL (in which case they are not used).valueandvalwordsare used when the string %v appears inpattern.See ldapfilter.conf(5) for a description of how %v is handled.

 

ERRORS

NULL is returned by ldap_init_getfilter if there is an error readingfile.NULL is returned by ldap_getfirstfilter and ldap_getnextfilter when thereare no more appropriate filters to return. 

NOTES

The return values for all of these functions are declared in the<ldap.h> header file. Some routines may malloc memory. 

FILES

/etc/ldapfilter.conf 

SEE ALSO

ldap(3),ldapfilter.conf(5)


 

Index

NAME
SYNOPSIS
DESCRIPTION
ERRORS
NOTES
FILES
SEE ALSO

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector