Helder,
O Active Directory da Microsoft é um tipo de servidor LDAP, portanto
opera com protocolo LDAP, veja abaixo a resposta que enviei ao David a
alguns dias atrás.
Sds,
Erasmo
/Olá David,
Eu fiz uma DLL em C para realizar as autenticações via LDAP, utilizando
a library WINLDAP.H, que possui todas as rotinas LDAP, e declarei as
funções dentro do Centura como External Functions. Veja abaixo a função
que faz autenticação:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winldap.h>
DLLIMPORT int LDAP_AUTHENTICATE_V3 (char *p_host, char *p_dominio, char
*p_usuario, char *p_senha)
{
LDAP *ld;
// open a connection
ld = ldap_init(p_host, LDAP_PORT);
if (ld == NULL)
{
return (int)LdapGetLastError();
}
// change LDAP Version
ULONG version = LDAP_VERSION3;
ULONG ResTest = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION,
(void*)&version);
if (ResTest !=LDAP_SUCCESS)
{
return (int)ResTest;
}
// authenticate
char v_ud[200];
strcpy( v_ud, "cn=");
strcat( v_ud, p_usuario);
strcat( v_ud, ",");
strcat( v_ud, p_dominio);
ULONG vResult = ldap_simple_bind_s(ld, v_ud, p_senha);
if ( vResult == LDAP_SUCCESS )
{
ldap_unbind(ld);
return 0;
}
else
{
return (int)vResult;
}
}
Para usar a função no Centura basta fazer um if:
IF
LDAP_AUTHENTICATE_V3("192.168.61.5","dc=softway,dc=com,dc=br","erasmo",s_senha)
Espero ter ajudado.
Sds,
Erasmo
--
Erasmo Bispo de Oliveira Junior
Gerente de Pesquisa e Desenvolvimento
Softway - Softcomex Informática Ltda.
Pabx: +55 (19) 3344.9200
Direto: +55 (19) 3344.9361
Fax: +55 (19) 3344.9240
e-mail: [EMAIL PROTECTED]
web: http://www.softcomex.com.br /
Helder Lins wrote:
Pessoal,
Alguém conhece alguma maneira de um programa SqlWindows fazer
autenticação utilizando um serviço de diretório Active Directory da
Microsoft?
Agradeço a atenção.
Helder
--
Erasmo Bispo de Oliveira Junior
Gerente de Pesquisa e Desenvolvimento
Softway - Softcomex Informática Ltda.
Pabx: +55 (19) 3344.9200
Direto: +55 (19) 3344.9361
Fax: +55 (19) 3344.9240
e-mail: [EMAIL PROTECTED]
web: http://www.softcomex.com.br