Hi,
See previous messages in the RPG400-l archives
Example:
http://archive.midrange.com/rpg400-l/200511/msg00173.html
In our case:
Although ldap_search_st always gives an "Operations Error",
Everything can be read without a problem...
Hth
Luc
Luc Pittoors
Dienst Informatica | Service Informatique
ABVV-FGTB | Hoogstraat 42 | 1000 Brussel
Tel +32 2 506 82 37 | Fax +32 2 550 14 11
luc.pittoors@xxxxxxx | www.abvv.be
Save Energy... please don't reply on this e-mail unless you really need
to or want to
message: 1
date: Sat, 24 Jan 2009 18:38:04 -0500
from: <dblucas@xxxxxxxxxxx>
subject: Active Directory RPG Code fails on ISeries Box
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.