Table of Contents
LDAP4D at A Dog And His Boy

LDAP4D - Response Handling

   

About this section...

This section describes the methods used to handle data or errors received from a response from an LDAP server. The variables used internally by the methods are cleared/initialized when a search request is created.



LDAP_iNumAttributeTypes

Syntax:

iResult := LDAP_iNumAttributeTypes

Description:

Number of attribute types returned by a search request. For the names of the attribute types see the array referenced by LDAP_Pointer2AttributeTypes

Warning:

The attribute types are for all the directory tree entries returned by the search. Individual directory tree entries will not necessarily have every attribute type returned.

Note:

This is just an "accessor" function. It returns the current value of a process variable used internally by LDAP 4D.
The value is reset to size 0 when a search is begun.

Params:

In/Out

Parameter

Type

Description

Example or note

none

<-

result

Longint

Count of different attribute types in all directory tree entries returned in a search.

 

Example:

$iNumberOfAttributeTypes := LDAP_iNumAttributeTypes


LDAP_iNumResponses

Syntax:

iResult:= LDAP_iNumResponses

Description:

Number of responses returned by a search request.

Warning:

The size of attribute value arrays are all the same size as this value.

Note:

This is just an "accessor" function. It returns the current value of a process variable used internally by LDAP 4D.
The value is reset to size 0 when a search is begun.

Params:

In/Out

Parameter

Type

Description

Example or note

None
<-

result

Longint

Count of responses returned from a search.

 

Example:

$iNumberOfResponses := LDAP_iNumResponses


LDAP_Pointer2AttributeTypes

Syntax:

pResult := LDAP_Pointer2AttributeTypes

Description:

Pointer to array of attribute type names. This is the "union" of all attribute types returned in all responses from a search.

Warning:

 

Note:

This is just an "accessor" function. It returns a pointer to a process variable used internally by LDAP 4D.
The array is reset to size 0 when a search is begun.

Params:

In/Out

Parameter

Type

Description

Example or note

None
<-

result

Pointer

Pointer to a 2D array of attribute values.

 

Example:

$arraypointer:=LDAP_Pointer2AttributeTypes
COPY ARRAY($arraypointer->;$tA_AttributeTypes)



LDAP_Pointer2DistinguishedName

Syntax:

pResult := LDAP_Pointer2DistinguishedName

Description:

Pointer to array of distinguished names.

Warning:

None

Note:

The size of the array will be the same as the number returned by LDAP_iNumResponses.
This is just an "accessor" function. It returns a pointer to a process variable used internally by LDAP 4D.
The array is reset to size 0 when a search is begun.

Params:

In/Out

Parameter

Type

Description

Example or note

None
<-

result

pointer

Pointer to array of distinguished names.

 

Example:

$arraypointer:=LDAP_Pointer2DistinguishedName
COPY ARRAY($arraypointer->;$tA_DistinguishedNames)



LDAP_Pointer2ResponseAttributes

Syntax:

pResult := LDAP_Pointer2ResponseAttributes

Description:

Pointer to 2D array of attribute types returned for each response. There will be one row for each response, and multiple columns corresponding to the attributes returned for that response.

Warning:

There is a variable number of columns in each row, so you should always check the size of the row before referencing elements.

Note:

The number of rows will be the same as the number returned by LDAP_iNumResponses.
This is just an "accessor" function. It returns a pointer to a process variable used internally by LDAP 4D.
The array is reset to size 0 when a search is begun.

Params:

In/Out

Parameter

Type

Description

Example or note

None
<-

result

pointer

Pointer to array of distinguished names.

 

Example:

$arraypointer:=LDAP_Pointer2ResponseAttributes
COPY ARRAY($arraypointer->;$tA_ResponseAttributes)
FOR ($i;1;LDAP_iNumResponses)
   $iNumAttributesForThisResponse:=SIZE OF ARRAY($tA_ResponseAttributes->{$i})
END FOR



LDAP_ProtocolOp

Syntax:

tResult := LDAP_ProtocolOp ($iOperation)

Description:

Protocol operation of LDAPMessage per RFC 2251- sec 4.1.1

Warning:

none

Note:

Pass in a number to get the text response - it's a simple lookup table.
Values are:
bindRequest
bindResponse
unbindRequest
searchRequest
searchResEntry
searchResDone
searchResRef
modifyRequest
modifyResponse
addRequest
addResponse
delRequest
delResponse
modDNRequest
modDNResponse
compareRequest
compareResponse
abandonRequest
extendedReq
extendedResp

Params:

In/Out

Parameter

Type

Description

Example or note

->

protocolOperation

Longint

Choice of protocol operation read from result code.

 

<-

result

Text

Protocol operation per RFC 2251 - sec 4.1.1

"Not a recognized protocol operation" is returned if no valid code is passed.

Example:

$tText := LDAP_ProtocolOp($iOperation)
If ($tText # "Not a recognized protocol operation")
  ALERT("the LDAP message was " + $tText)
End If


LDAP_ResponseParse

Syntax:

iResult := LDAP_ResponseParse ($iLDAPSessionID )

Description:

Call this to read the response from LDAP server into arrays. The arrays can be referenced using the other methods (LDAP_iNumResponses,LDAP_tResultErrorMessage, LDAP_Pointer2AttributeTypes, etc. ) in this section.

Warning:

Check that the open returned a valid session or stream ID before calling this method!

Note:

Check LDAP_tResultErrorMessage for errors. If it is not empty, then something caused the parsing of the response to fail.

Params:

In/Out

Parameter

Type

Description

Example or note

->

session ID

Longint

Stream or session ID returned by LDAP_Open

 

<-

result

Longint

Status of response

0 = noErr

Example:

$iErr := LDAP_ResponseParse($iLDAPSessionID)
If ($iErr = 0)  
  `go  about the next step in process...
End If


LDAP_ResultCode

Syntax:

tResult := LDAP_ResultCode ($iResultCode )

Description:

Result code text value from an LDAPResult - see RFC 2251 sec 4.1.10

Warning:

none

Note:

Values are:
success (0)
operationsError (1)
protocolError (2)
timeLimitExceeded (3)
sizeLimitExceeded (4)
compareFalse (5)
compareTrue (6)
authMethodNotSupported (7)
strongAuthRequired (8)
-- 9 reserved --
referral (10)
adminLimitExceeded (11)
unavailableCriticalExtension (12)
confidentialityRequired (13)
saslBindInProgress (14)
noSuchAttribute (16)
undefinedAttributeType (17)
inappropriateMatching (18)
constraintViolation (19)
attributeOrValueExists (20)
invalidAttributeSyntax (21)
-- 22-31 unused --
noSuchObject (32)
aliasProblem (33)
invalidDNSyntax (34)
-- 35 reserved for undefined isLeaf --
aliasDereferencingProblem (36)
-- 37-47 unused --
inappropriateAuthentication (48)
invalidCredentials (49)
insufficientAccessRights (50)
busy (51)
unavailable (52)
unwillingToPerform (53)
loopDetect (54)
-- 55-63 unused --
namingViolation (64)
objectClassViolation (65)
notAllowedOnNonLeaf (66)
notAllowedOnRDN (67)
entryAlreadyExists (68)
objectClassModsProhibited (69)
-- 70 reserved for CLDAP
affectsMultipleDSAs (71)
-- 72-79 unused --
other (80) }
-- 81-90 reserved for APIs --

Params:

In/Out

Parameter

Type

Description

Example or note

->

resultCode

Longint

Text value of result code - see RFC 2251 sec 4.1.10

 

<-

result

Text

Text value of result code

"not an LDAP response code" is returned if no valid code is passed.

Example:

ALERT("Error on Bind: "+LDAP_ResultCode ($iErr)+Char(13)+LDAP_tResultErrorMessage )


LDAP_tFilterErrorMessage

Syntax:

tResult := LDAP_tFilterErrorMessage

Description:

Error message returned .

Warning:

Check this after passing a search filter to LDAP_SearchRequest and before using LDAP_Message_Send to communicate with an LDAP server. Otherwise, the only result you will receive will be a "protocolError".

Note:

This is just an "accessor" function. It returns the current value of a process variable used internally by LDAP 4D.
The value is blank if the filter passed to the search request was valid.

Params:

In/Out

Parameter

Type

Description

Example or note

None

<-

result

Text

Error message generated by LDAP_SearchRequest when it tries to create a search request.

 

Example:

$tText := LDAP_tFilterErrorMessage
If ($tText = "")  `could check result code also...
  ALERT("LDAP Bind failed")
End If


LDAP_tResultErrorMessage

Syntax:

tResult := LDAP_tResultErrorMessage

Description:

Error found during the parsing of a result (if any)

Warning:

The error message is set by calls to LDAP_Response_Parse.

Note:

This is just an "accessor" function. It returns the current value of a process variable used internally by LDAP 4D.

Params:

In/Out

Parameter

Type

Description

Example or note

None

<-

result

Text

Error message generated by LDAP_SearchRequest when it tries to create a search request.

0 = noErr

Example:

$tText := LDAP_tResultErrorMessage
If ($tText # "")  `could check result code also...
  ALERT("LDAP Bind failed")
End If


Back to top