×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Can you tell me where is it that it starts to fail? When you does the
ldap_simple_bind_s, are you using the full path of the userID as the
user ID value? For
example:'cn=myLdapUserID,ou=resources,ou=corporate,dc=us,dc=usamobility,
dc=com'



<dblucas@xxxxxxxxxxx> wrote in message
news:<mailman.2707.1232840302.21608.rpg400-l@xxxxxxxxxxxx>...
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-2026 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.