Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
346 Beiträge
 
#7

AW: Umstellung LDAP auf SSL/TLS

  Alt 17. Mai 2024, 18:25
Well i hastily tried this
Code:
procedure TForm10.LDAPConnect;
var
  pConn: PLDAP;
  Version: NativeUInt;
  CurrVer: NativeUInt;
begin
  pConn := ldap_sslinit('DESKTOP-HOST1', LDAP_SSL_PORT, 1);
  if not Assigned(pConn) then
    Exit;

  try
    Version := LDAP_VERSION3;
    if ldap_set_option(pConn, LDAP_OPT_PROTOCOL_VERSION, @Version) <> LDAP_SUCCESS then
      Exit;
    if ldap_get_option(pConn, LDAP_OPT_SSL, @CurrVer) <> LDAP_SUCCESS then
      Exit;
    Memo1.Lines.Add('Current SSL status : ' + BoolToStr(CurrVer <> 0, true));

    if CurrVer = NativeUInt(LDAP_OPT_OFF) then
    begin
      CurrVer := NativeUInt(LDAP_OPT_ON);
      if ldap_set_option(pConn, LDAP_OPT_SSL, @CurrVer) <> LDAP_SUCCESS then
        Exit;
    end;

    // check again
    if ldap_get_option(pConn, LDAP_OPT_SSL, @CurrVer) <> LDAP_SUCCESS then
      Exit;
    Memo1.Lines.Add('Current SSL status : ' + BoolToStr(CurrVer <> 0, true));

    Memo1.Lines.Add('Success');
  finally
    ldap_unbind_s(pConn);
  end;
end;
and it did gave me this result in the memo
Zitat:
Current SSL status : False
Current SSL status : False
Success
It did refuse to enable SSL, but this is on my PC and i have no LDAP infrastructure to test deeper, but the point is :
There is no Error at all !
Kas
  Mit Zitat antworten Zitat