Hello,
I have the following code.
var
pld: PLDAP;
MyMod : LDAPMod;
Value : pchar;
begin
// open connection
pld := ldap_open(pchar(CLDAPServer), CLDAPPort);
if Assigned(pld) then begin
try
// authenticate anonymously
if ldap_simple_bind_s(pld, nil, nil) <> 0 then
Exit;
MyMod.mod_op := LDAP_MOD_REPLACE;
Mymod.mod_type := 'HDID';
StrPCopy(value,'244');
MyMod.modvals.modv_strvals := @Value;
ldap_modify_s(pld, //ldap structure
'l=office,' + Cldaplocationsearchbase, //DN
Mymod);
showmessage('ok');
finally
// close connection
ldap_unbind_s(pld);
end;
End;
The code ldap_modify_s crashes the application.
It is defined in winldap as
function
ldap_modify_s(ld: PLDAP; dn: PCHAR; mods: LDAPModA): ULONG; cdecl;
the Pldap part is fine because I use it elsewhere but I think I may have
filled out the mobs structure wrong. It is defined in winldap as
LDAPModA = record
mod_op: ULONG;
mod_type: PCHAR;
modvals: record
case integer of
0:(modv_strvals: ^PCHAR);
1:(modv_bvals: ^PLDAP_BERVAL);
end;
end;
Any ideas why this is crashing?
You can download my example code that fails with the winldap libary from
here http://www.e-caf.com/~james/Ldap.zip.
Thank you
James
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz