Seth Woolley's Man Viewer

ldap_search_st(3) - ldap_search, ldap_search_s, ldap_search_st - Perform an LDAP search operation - man 3 ldap_search_st

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

LDAP_SEARCH(3)                                                  LDAP_SEARCH(3)



NAME
       ldap_search,  ldap_search_s,  ldap_search_st  -  Perform an LDAP search
       operation

LIBRARY
       OpenLDAP LDAP (libldap, -lldap)

SYNOPSIS
       #include <sys/time.h> /* for struct timeval definition */
       #include <ldap.h>

       int ldap_search(ld(1,8), base, scope, filter(1,3x,3x curs_util), attrs, attrsonly)
       LDAP *ld(1,8);
       char *base;
       int scope;
       char *filter(1,3x,3x curs_util), *attrs[];
       int attrsonly;

       int ldap_search_s(ld(1,8), base, scope, filter(1,3x,3x curs_util), attrs, attrsonly, res)
       LDAP *ld(1,8);
       char *base;
       int scope;
       char *filter(1,3x,3x curs_util), *attrs[]
       int attrsonly;
       LDAPMessage **res;

       int ldap_search_st(ld(1,8), base, scope, filter(1,3x,3x curs_util), attrs, attrsonly, timeout(1,3x,3x cbreak), res)
       LDAP *ld(1,8);
       char *base;
       int scope;
       char *filter(1,3x,3x curs_util), *attrs[]
       int attrsonly;
       struct timeval *timeout(1,3x,3x cbreak);
       LDAPMessage **res;

DESCRIPTION
       These  routines  are  used   to   perform   LDAP   search   operations.
       ldap_search_s()  does  the  search  synchronously  (i.e., not returning
       until the operation completes).  ldap_search_st() does  the  same,  but
       allows  a  timeout(1,3x,3x cbreak)  to be specified.  ldap_search() is the asynchronous
       version(1,3,5), initiating the search and returning  the  message  id  of  the
       operation  it initiated.  Base is the DN of the entry at which to start
       the search.  Scope is the scope of the search  and  should  be  one  of
       LDAP_SCOPE_BASE,  to  search the object itself, LDAP_SCOPE_ONELEVEL, to
       search the  object's  immediate  children,  or  LDAP_SCOPE_SUBTREE,  to
       search the object and all its descendents.

       Filter is a string(3,n) representation of the filter(1,3x,3x curs_util) to apply in(1,8) the search.
       Simple filters  can  be  specified  as  (attributetype=attributevalue).
       More complex filters are specified using a prefix notation according to
       the following BNF:

               <filter(1,3x,3x curs_util)> ::= '(' <filtercomp> ')'
               <filtercomp> ::= <and> | <or> | <not> | <simple>
               <and> ::= '&' <filterlist>
               <or> ::= '|' <filterlist>
               <not> ::= '!' <filter(1,3x,3x curs_util)>
               <filterlist> ::= <filter(1,3x,3x curs_util)> | <filter(1,3x,3x curs_util)> <filterlist>
               <simple> ::= <attributetype> <filtertype> <attributevalue>
               <filtertype> ::= '=' | '~=' | '<=' | '>='

       The '~=' construct is used to specify approximate matching.  The repre-
       sentation  for <attributetype> and <attributevalue> are as described in(1,8)
       RFC 2254.  In addition, <attributevalue> can be a single *  to  achieve
       an  attribute  existence test, or can contain text and *'s interspersed
       to achieve substring matching.

       For example, the filter(1,3x,3x curs_util) "(mail(1,8)=*)" will find any entries  that  have  a
       mail(1,8) attribute.  The filter(1,3x,3x curs_util) "(mail(1,8)=*@terminator.rs.itd.umich.edu)" will
       find any entries that have a mail(1,8) attribute  ending  in(1,8)  the  specified
       string.   To  put parentheses in(1,8) a filter(1,3x,3x curs_util), escape them with a backslash
       '\' character.  See RFC 2254 for a more complete description of  allow-
       able filters.

       Attrs  is  a  null-terminated  array  of attribute types to return from
       entries that match filter(1,3x,3x curs_util).  If NULL is specified,  the  return  of  all
       user  attributes is requested.  The type "*" (LDAP_ALL_USER_ATTRIBUTES)
       may be used to request all user attributes to be  returned.   The  type
       "+"(LDAP_ALL_OPERATIONAL_ATTRIBUTES)  may be used to request all opera-
       tional attributes to be returned.  To request no attributes,  the  type
       "1.1" (LDAP_NO_ATTRS) should be listed by itself.

       Attrsonly  should  be  set(7,n,1 builtins) to 1 if(3,n) only attribute types are wanted.  It
       should be set(7,n,1 builtins) to 0 if(3,n) both attributes types and  attribute  values  are
       wanted.

ERRORS
       ldap_search_s()  and  ldap_search_st()  will return the LDAP error(8,n) code
       resulting from the search operation.  See  ldap_error(3)  for  details.
       ldap_search() returns -1 in(1,8) case of trouble.

NOTES
       Note  that  both read(2,n,1 builtins) and list functionality are subsumed by these rou-
       tines, by  using  a  filter(1,3x,3x curs_util)  like  "(objectclass=*)"  and  a  scope  of
       LDAP_SCOPE_BASE  (to  emulate  read(2,n,1 builtins)) or LDAP_SCOPE_ONELEVEL (to emulate
       list).

       These routines may dynamically allocate memory.  The caller is  respon-
       sible  for  freeing  such  memory using supplied deallocation routines.
       Return values are contained in(1,8) <ldap.h>.

SEE ALSO
       ldap(3,5,n)(3), ldap_result(3), ldap_getfilter(3), ldap_error(3)

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.



OpenLDAP 2.2.15                   2004/07/27                    LDAP_SEARCH(3)

References for this manual (incoming links)