| LDAP CALL Routine Interface |
| Syntax | |
| Arguments | |
| Details | |
| Examples |
Syntax |
| CALL LDAPS_SEARCH(lHandle, sHandle, filter, attributes, numEntries, rc); |
| Details |
The LDAPS_SEARCH CALL routine selects and retrieves entries from a specified LDAP directory. A search handle is returned so that information about specific entries and attributes can be obtained. The search information that is identified by the search handle can be used until it is explicitly freed using the LDAPS_FREE CALL routine or until the connection is closed using the LDAPS_CLOSE CALL routine.
Note: For Microsoft Active Directory servers, the maximum number of
attributes that can be returned is limited. You can use a technique called
range retrieval to work around this issue. For more information, see http://msdn.microsoft.com/en-us/library/aa367017.aspx in the
Microsoft Developer Network library. ![[cautionend]](../../../../common/61991/HTML/default/images/cautend.gif)
| Examples |
The following example returns a list of entries on the LDAP server that match the values of the specified filter. The list of entries returned from the search includes the values of two attributes for each matching entry.
filter=(&(saschannelcn=DeleteTest)(objectclass=*)); attrs=description objectclass; rc=0; numEntries=0; sHandle=0; call LDAPS_SEARCH(lhandle, sHandle, filter, attrs, numEntries, rc);
The following example prints to the SAS log the names and values of all attributes in all entries in a given LDAP directory.
call LDAPS_SEARCH(lhandle, sHandle, filter, attribs, numEntries, rc); do entryIndex = 1 to numEntries; numAttributes = 0; entryName=''; /* retrieve entry indexed by integer entryIndex */ call ldaps_entry(sHandle, entryIndex, entryName, numAttributes, rc); put 'Entry name is ' entryName; put 'Number of attributes returned is ' numAttributes; do attrIndex = 1 to numAttributes; call ldaps_attrname (sHandle,entryIndex, attrIndex, attribName, numValues, rc); do attrValueIndex = 1 to numValues; call ldaps_attrvalue (sHandle, entryIndex, attrindex, attrValueIndex, value, rc); put Attribute value is value; end; end; end;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.