Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Umstellung LDAP auf SSL/TLS (https://www.delphipraxis.net/215148-umstellung-ldap-auf-ssl-tls.html)

rabatscher 21. Mai 2024 13:45

AW: Umstellung LDAP auf SSL/TLS
 
Zitat:

Zitat von Blup (Beitrag 1536900)
Die Abfrage von LDAP_OPT_SSL liefert LDAP_LOCAL_ERROR.
Ob die Variable als NativeUInt, CARDINAL oder Pointer deklariert ist, spielt keine Rolle, die sind bei mir alle 32Bit.

Ich vermute, TLS is bereits aktiviert und deshalb steht die Option SSL nicht zur Verfügung.
Das bedeutet für mich, die Anleitung von MS ist nicht mehr aktuell oder unvollständig.

Im Quelltext "LDAPAdmin" wird die Option LDAP_OPT_SSL nicht benutzt und LDAP_LOCAL_ERROR an einer Stelle ignoriert:
Delphi-Quellcode:
  if ldapSSL then
    ldappld := ldap_sslinit(PChar(ldapServer), ldapPort,1)
  else
    ldappld := ldap_init(PChar(ldapServer), ldapPort);
  if Assigned(pld) then
  try
    LdapCheck(ldap_set_option(pld,LDAP_OPT_PROTOCOL_VERSION,@ldapVersion));
    if ldapSSL or ldapTLS then
    begin
      res := ldap_set_option(pld, LDAP_OPT_SERVER_CERTIFICATE, @VerifyCert);
      if (res <> LDAP_SUCCESS) and (res <> LDAP_LOCAL_ERROR) then
        LdapCheck(res);
      CertServerName := PChar(ldapServer);
    end;
    CertUserAbort := false;
    if ldapTLS then
    begin
      res := ldap_start_tls_s(ldappld, nil, nil, nil, nil);
      if CertUserAbort then
        Abort;
      LdapCheck(res);
    end;
    case ldapAuthMethod of
Ich versuch diese Variante...


Der Handler SetTLS der LDAPAdmin TLDAPSession Klasse setzt den Wert:

Code:
procedure TLDAPSession.SetTLS(Value: Boolean);
begin
  if Connected and (Value <> ldapTLS) then
  begin
    if Value then
      LdapCheck(ldap_start_tls_s(ldappld, nil, nil, nil, nil))
    else
    if not ldap_stop_tls_s(ldappld) then
    begin
      //MessageDlg(stStopTLSError, mtError, [mbOk], 0);
      Disconnect;
    end;
  end;
  ldapTLS := Value;
end;
So.. bevor das Werkl startet wird die TLS session gestartet. Dann wird natürlich kein ssl init aufgerufen...


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:39 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz