hat jemand Erfahrungen mit dem Ändern von LDAP-Attributen mittels Synapse LDAPSend gemacht? Ich versuche, die Beschreibung von Benutzern zu ändern. Dies klappt jedoch nicht.
Hier mein Code:
Code: Alles auswählen
unit Main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
ComObj, lDapSend, fpjson, jsonparser;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
ldap: TLDAPsend;
lSearchAttribs: TStringList;
lAttrib: TLDAPAttribute;
begin
ldap := TLDAPsend.Create;
lSearchAttribs := TStringList.Create;
lAttrib := TLDAPAttribute.Create;
try
ldap.TargetHost := '10.1.1.200';
ldap.UserName := 'syndesk-dev\administrator';
ldap.Password := 'secret';
ldap.Login;
if ldap.Bind then
begin
Memo1.Lines.add('Bind OK');
lSearchAttribs.Add('sAMAccountName');
lSearchAttribs.Add('distinguishedName');
lSearchAttribs.Add('title');
lSearchAttribs.Add('member');
lSearchAttribs.Add('description');
lSearchAttribs.Add('lastLogonTimestamp');
ldap.Search('CN=Administrator,CN=Users,DC=syndesk-dev,DC=local', False, '', lSearchAttribs);
Memo1.Lines.add(LDAPResultDump(ldap.searchresult));
lAttrib.Clear;
lAttrib.AddPair('description', 'Admin-Beschreibung');
if(ldap.Modify('CN=Administrator,CN=Users,DC=syndesk-dev,DC=local', TLDAPModifyOp.MO_Replace, lAttrib) = false) then
begin
Memo1.Lines.add('Ergebnis: ' + ldap.ResultString);
end;
end;
ldap.Logout;
finally
ldap.Free;
lSearchAttribs.Free;
end;
end;
end.
Code: Alles auswählen
Memo1
Bind OK
Results: 1
Result: 0
Object: CN=Administrator,CN=Users,DC=syndesk-dev,DC=local
Attribute: description
Vordefiniertes Konto für die Verwaltung des Computers bzw. der Domäne
Attribute: distinguishedName
CN=Administrator,CN=Users,DC=syndesk-dev,DC=local
Attribute: sAMAccountName
Administrator
Attribute: lastLogonTimestamp
133101479466054732
Ergebnis: 00000057: LdapErr: DSID-0C090EBF, comment: Error in attribute conversion operation, data 57, v3839
Dank und Gruß
Martin