From 3ff1d34c97abe4dc7d2ed74a0877f76eff2ffb7d Mon Sep 17 00:00:00 2001 From: Eric Menezes Noronha Date: Fri, 4 Apr 2014 17:30:41 -0300 Subject: [PATCH] -Adicionado condição de continuar a pesquisa apenas se for efetuado o login. -Build alterada para 2.8.1.6. --- MapaTesteProj/MapaCACIC.dproj | 2 +- MapaTesteProj/MapaCACIC.identcache | Bin 1327 -> 0 bytes MapaTesteProj/MapaCACIC.res | Bin 4188 -> 0 bytes MapaTesteProj/MapaTeste.dcu | Bin 29790 -> 0 bytes MapaTesteProj/MapaTeste.pas | 38 +++++++++----------------------------- 5 files changed, 10 insertions(+), 30 deletions(-) diff --git a/MapaTesteProj/MapaCACIC.dproj b/MapaTesteProj/MapaCACIC.dproj index 874805c..eb5ee1d 100644 --- a/MapaTesteProj/MapaCACIC.dproj +++ b/MapaTesteProj/MapaCACIC.dproj @@ -24,7 +24,7 @@ Delphi.Personality -FalseTrueFalseTrueFalse2815TrueFalseFalseFalseFalse10461252Dataprev - Emp. de TI da Prev Social - URES/SESSSistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC2.8.1.53.0Licença: GNU/LGPLmapacacic.dpr +FalseTrueFalseTrueFalse2816TrueFalseFalseFalseFalse10461252Dataprev - Emp. de TI da Prev Social - URES/SESSSistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC2.8.1.63.0Licença: GNU/LGPLmapacacic.dpr diff --git a/MapaTesteProj/MapaCACIC.identcache b/MapaTesteProj/MapaCACIC.identcache index 7c0e401..9131734 100644 Binary files a/MapaTesteProj/MapaCACIC.identcache and b/MapaTesteProj/MapaCACIC.identcache differ diff --git a/MapaTesteProj/MapaCACIC.res b/MapaTesteProj/MapaCACIC.res index 0b9149e..3953fcf 100644 Binary files a/MapaTesteProj/MapaCACIC.res and b/MapaTesteProj/MapaCACIC.res differ diff --git a/MapaTesteProj/MapaTeste.dcu b/MapaTesteProj/MapaTeste.dcu index 747fa58..f75b631 100644 Binary files a/MapaTesteProj/MapaTeste.dcu and b/MapaTesteProj/MapaTeste.dcu differ diff --git a/MapaTesteProj/MapaTeste.pas b/MapaTesteProj/MapaTeste.pas index eb47af0..f086f08 100644 --- a/MapaTesteProj/MapaTeste.pas +++ b/MapaTesteProj/MapaTeste.pas @@ -123,12 +123,7 @@ type strTeInfoPatrimonio6, strTeInfoPatrimonio7 : String; formMonitor: TForm; - ldap: TLDAPsend; - getTimer: TTimer; - procedure WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64); - procedure WorkEnd(ASender: TObject; AWorkMode: TWorkMode); - procedure GetTimerTimer(Sender: TObject); procedure FormSetFocus(VerificaFoco: Boolean); procedure MontaInterface; procedure RecuperaValoresAnteriores; @@ -809,33 +804,18 @@ begin end; end; -procedure TfrmMapaCacic.WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64); -begin - getTimer.Enabled := True; -end; -procedure TfrmMapaCacic.WorkEnd(ASender: TObject; AWorkMode: TWorkMode); -begin - getTimer.Enabled := False; -end; - -procedure TfrmMapaCacic.GetTimerTimer(Sender: TObject); -begin - ldap.Logout; -end; - function TfrmMapaCacic.LDAPName: string; var retorno: TStringList; i: integer; host, username, psswd, base, strDadosLDAP, aux, identificador : string; + ldap: TLDAPsend; begin result := ''; ldap := TLDAPsend.Create; retorno := TStringList.Create; - getTimer := TTimer.create(nil); - getTimer.OnTimer := GetTimerTimer; - getTimer.Interval := 5000; + // PEGANDO OS DADOS DO POR MEIO DO GET/CONFIGS, ONDE SERÁ GRAVADO NO GERCOLS.INF strDadosLDAP := objCacic.deCrypt(objCacic.getValueFromFile('Configs','servidor_autenticacao',strGerColsInfFileName)); host := objCacic.getValueFromTags('ip', strDadosLDAP); @@ -852,20 +832,20 @@ begin if (host<>'') or (base<>'') or (retorno.count=0) then begin try - getTimer.Enabled := true; try ldap.TargetHost := host; ldap.UserName := username; ldap.Password := psswd; - ldap.Login; //Loga no LDAP. - ldap.BindSasl; //Autentica no LDAP com Usuário e senha repassado. (BindSasl é mais seguro que Bind) - ldap.Search(base, False, identificador+ '=' + getUserLogon, retorno); //Faz a pesquisa, com o CPF repassado. - result := LDAPResultdump(ldap.SearchResult); - ldap.Logout; + if ldap.Login then //Loga no LDAP. + begin + ldap.BindSasl; //Autentica no LDAP com Usuário e senha repassado. (BindSasl é mais seguro que Bind) + ldap.Search(base, False, identificador+ '=' + getUserLogon, retorno); //Faz a pesquisa, com o CPF repassado. + result := LDAPResultdump(ldap.SearchResult); + ldap.Logout; + end; finally ldap.Free; retorno.Free; - getTimer.Free; end; Except on E:Exception do -- libgit2 0.21.2