Hi,
Using Delphi XE / XE2 and having issues with LDAPSend. It seems like it locks
up when trying to bind. Anyone facing the same?
Basically I have this working C# code:
static bool IsAuthenticated(String FQDN, String domain, String username, String
pwd)
{
String domainAndUsername = (domain + @"\" + username);
String _path = "LDAP://" + FQDN;
bool Success;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername,
pwd, AuthenticationTypes.Secure);
DirectorySearcher Searcher = new DirectorySearcher(entry);
Searcher.SearchScope = SearchScope.OneLevel;
try
{
SearchResult result = Searcher.FindOne();
Success = !(result == null);
}
catch (Exception ex)
{
Success = false;
}
return Success;
}
This should be something like this in Delphi:
Function IsAuthenticated(FQDO: string, domain: string, username: string, pwd:
string): boolean;
var
ldap: TLDAPsend;
l: TStringList;
domainAndUsername: string;
_path: string;
Begin
_path := "LDAP://" + FQDN;
domainAndUsername = domain + '\' + username;
ldap:= TLDAPsend.Create;
ldap.UserName := domainAndUsername;
ldap.Password :=pwd;
ldap.AutoTLS := true; //secure login
try
ldap.TargetHost := _path;
ldap.Login;
Result := ldap.Bind;
//ldap.Search('SAMAccountName='+username, False, '(objectclass=*)', l); -
no need to search or ?!? (eg. FindOne in C#) - if bind pws and
domainandusername combination is ok!
ldap.Logout;
finally
ldap.Free;
end;
end;
This is used to verify the username and password against an AD - I don't need
to get(or set) attributes......
I have tried the "www.openldap.com" example, but it also locks at "bind"-time
;-)
TIA,
Kurt
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public