Hi again,

Everything seemed all right until I choosed another (and wrongfully) 
password... I was still able to both login and to bind...

{code}
uses ldapsend

var
    fldap:tldapsend;
    fad_domain,ausername,apassword:string;
begin
    ausername:='your AD username';
    apassword:='your AD password';
    fldap := TLDAPSend.Create;
    fad_domain:= 'your.ad.domain';
    fldap.TargetHost:=fad_domain;
    //next line is the key to getting AD authentication working
    fldap.UserName := ausername+'@'+fad_domain;
    fldap.Password := apassword;
    Result := fldap.Login;
    If result then
    begin
      Result := fldap.Bind;
    end;
    If result then 
application.messagebox('Welcome','Information',mb_iconInformation+mb_ok)
    else application.messagebox('Sorry!!! You are not 
welcome','Information',mb_iconInformation+mb_ok);
    fldap.logout;
    freeandnil(fldap);
end;

In VS I use:
        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;
        }

Where FQDN is the ip of the domainserver the username is just the username 
(doesn't include the domain) - and I do also use secure...

Anybody have an idea how to solve this?

All the best!
Kurt

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to