SAS 9.1.3 Integration Technologies » Developer's Guide


LDAP CALL Routine Interface
LDAPS_ADD
LDAPS_ATTRNAME
LDAPS_ATTRVALUE
LDAPS_CLOSE
LDAPS_DELETE
LDAPS_ENTRY
LDAPS_FREE
LDAPS_MODIFY
LDAPS_OPEN
LDAPS_SETOPTIONS
LDAPS_SEARCH
Coding Examples
Adding a Directory Entry to an LDAP Server
Searching an LDAP Directory
Directory Services

LDAPS_ATTRNAME

Returns the name and the number of values of an attribute in an LDAP entry.

Syntax

CALL LDAPS_ATTRNAME(sHandle, entryIndex, attributeIndex, attributeName, numValues, rc);

sHandle
Numeric, input.
Specifies the search handle returned by the LDAPS_SEARCH CALL routine. The search handle identifies the entry list returned in the search.

entryIndex
Numeric, input.
Specifies the index into the entry list. This index is 1-based.

attributeIndex
Numeric, input.
Specifies the index into the attribute list for the specified entry. This index is 1-based.

attributeName
Character, output.
Returns the name of the specified attribute.

numValues
Numeric, output.
Returns the number of values for the specified attribute.

rc
Numeric, output.
Receives a return code that indicates success or failure.

Example

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);
     put 'Attribute name is ' attribName;
     put 'Number of values for this attribute is ' numValues;

     do attrValueIndex = 1 to numValues;
       call ldaps_attrvalue(sHandle, entryIndex, attrindex, 
              attrValueIndex, value, rc);
       put "Attribute value is " value;
     end;
  end;
end;