`LDAP_Authorize
`copyright, A Dog And His Boy`simple authentication - bind with username and password
`
`$0 -> (TRUE = success, FALSE = failure)
`$1 = server name
`$2 = user name
`$3 = password
C_TEXT($1;$tServerName;$2;$3)
C_TEXT($tText;$tUserName;$tPassword)
C_BOOLEAN($0)
C_LONGINT($iLDAPStream;$iErr;$i;$iMessageID;$iSizeLimit;$iTimeLimit;$iNumResponses)
`other parms are directly in call to LDAP_Search below
$tServerName:=$1
`LDAP_SetPlugin ("ITK")
`LDAP_SetTimeout (30)
`how long LDAP4D waits on sends and recieves
C_TIME(×tiLDAP_TimetoQuit)
C_DATE(×dLDAP_DatetoQuit)
C_LONGINT(×iLDAP_Timeout)
<>tiLDAP_TimetoQuit:=Current time+120
<>dLDAP_DatetoQuit:=Current date+10
<>iLDAP_Timeout:=30
LDAP_DeclareVars `call this before performing operations, it initializes variables used internally
`set these vars so that LDAP_BindRequest will work
$0:=False
$iLDAPStream:=LDAP_Open ($tServerName;389) `standard LDAP port is 389
If ($iLDAPStream#0)
$iMessageID:=1
`many public LDAP servers don't require a bind
`they just send back results from search!
$tUserName:=$2
$tPassword:=$3
`anonymous bind - no user or password, version 2
Case of
: (0#LDAP_Message_Send ($iLDAPStream;$iMessageID;LDAP_BindRequest ($tUserName;$tPassword;3))) `send the bind
$iErr:=-1 `some kind of error
: (0#LDAP_ResponseParse ($iLDAPStream)) `get the BindResponse > 0 = success
$iErr:=-1 `some kind of error
End case
If ($iErr=0) `success on bind
$0:=True
Else
$0:=False
End if
$iErr:=LDAP_Close ($iLDAPStream) `0 upon successful completion
Else
$0:=False
End if
Disclaimer:
The information provided in
the Microsoft Knowledge Base this page is provided "as is" without warranty of any kind.
Microsoft A Dog And his Boy disclaims all warranties,
either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall
Microsoft Corporation A Dog And His Boy or its suppliers be liable
for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if
Microsoft Corporation A Dog And his Boy or its suppliers have
been advised of the possibility
of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.