× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



THIS CODE WORKS against LDAP
THIS CODE FAILS against Active Directory (windows box)


*======================================================================
* Procedure: DSRV_Connect
*
* Description: DSRV Connect Procedure - The purpose of this procedure * is to establish a connection to the DirectoryServices server.
*
*====================================================================== P DSRV_Connect B Export
D DSRV_Connect PI LikeDS(DSRV_Parms)
D InpDSRV_Parms LikeDS(DSRV_Parms)

D DSRV_PTR S *
D rtnVal S LIKE(RtnSuccess)

D Wrk_Connector DS LikeDS(DSRV_Connector)

/Free

// Attempt the call to DSRV Open aka: ldap_init
DSRV_PTR = ldap_init(InpDSRV_Parms.Server:InpDSRV_Parms.PortNumber);

rtnVal = ldap_simple_bind_s(DSRV_PTR:
InpDSRV_Parms.UserID:InpDSRV_Parms.Password);

Wrk_Connector.ConnectPtr = DSRV_PTR;

If rtnVal = LDAP_SUCCESS;
Wrk_Connector.Success = TRUE;
Else;
Wrk_Connector.Success = FALSE;
rtnVal = ldap_get_errno(DSRV_PTR);
EndIf;

Return Wrk_Connector;

/End-Free

P DSRV_Connect E



// Attempt the call to ldap_search
initialRtnVal =
ldap_search_st(DSRVID:Base:Scope:Filter
:%addr(AttrVal):AttrsOnly:%addr(Timeout):DSRV_Message);

*===================================================================== * Procedure: doActiveDir
*
* Description: doActiveDir Procedure - The purpose of this procedure
* is to provide a method that performs an AD operation
*====================================================================
P doActiveDir B
D PI LIKE(RtnSuccess)

/FREE

WrkDSRV_Parms = DSRV_Init(2);
Wrk_Connector = DSRV_Connect(WrkDSRV_Parms);

base = 'DC=MYDC,DC=EXT';
attrsOnly = 0;
scope = 2;

AttrVal(1) = 'cn' + x'00';
AttrPtr(1) = %addr(AttrVal(1));
AttrPtr(2) = *NULL;

p_timeval = %addr(timeoutVal);
tv_sec = 120;
tv_usec = 0;

filter = '(&(objectclass=*)(uid=MYNAME))';

Wrk_DtStruct = DSRV_Search(Wrk_Connector.ConnectPtr
: base
: scope
: filter
: AttrVal
: attrsOnly
: timeoutVal
: message);

If Wrk_DtStruct.RtnLastError = 0;
rtnString = %Str(message);
Else;
rtnString = GetLastErr(Wrk_DtStruct.RtnLastError);
EndIf;

DSRV_Close(Wrk_Connector.ConnectPtr);

Return Wrk_DtStruct.RtnLastError;

/END-FREE

P doActiveDir E

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.