![]() |
Indy HTTPServer + SSL in SVN Version kaputt
r4177, Delphi 2007
Beim starten des HTTPServers wirft dieser eine Exception:
Code:
Das liegt an folgender Funktion:
Exception class EIdOSSLLoadingRootCertError with message 'Could not load root certificate.
error:0B064071:x509 certificate routines:ADD_CERT_DIR:invalid directory'.
Delphi-Quellcode:
Woraround:
function IndySSL_CTX_load_verify_locations(ctx: PSSL_CTX;
const ACAFile, ACAPath: String): TIdC_INT; begin Result := SSL_CTX_load_verify_locations(ctx, PAnsiChar(ACAFile), PAnsiChar(ACAPath)); end;
Delphi-Quellcode:
Wenn der ACAPath leer ist (was er immer ist), dann wird durch die PAnsiChar Konvertierung ein #0 zurückgegeben, was nicht NULL ist und dadurch überprüft OpenSSL den Pfad, der dann ungültig ist und in der o.g. Exception resultiert. Ein hardcoded NIL hilft. Ist aber nicht wirklich schön ;). Besser wäre eine Erkennung von Indy ob der User eine Datei oder einen Pfad angegeben hat und dann den jeweils richtigen Parameter ausfüllt und den anderen per NIL deaktiviert.
function IndySSL_CTX_load_verify_locations(ctx: PSSL_CTX;
const ACAFile, ACAPath: String): TIdC_INT; begin Result := SSL_CTX_load_verify_locations(ctx, PAnsiChar(ACAFile), nil); end; Doku: ![]() paresy |
Re: Indy HTTPServer + SSL in SVN Version kaputt
Hallo paresy,
Zitat:
Allgemeine Lösung ist ein Casten auf Pointer und dann auf PAnsiChar, wie z.B. jetzt hier:
Delphi-Quellcode:
Gruß,
function IndyX509_STORE_load_locations(ctx: PX509_STORE;
const AFileName, APathName: String): TIdC_INT; {$IFDEF USE_INLINE} inline; {$ENDIF} begin // RLebeau 4/18/2010: X509_STORE_load_locations() expects nil pointers // for unused values, but casting a string directly to a PAnsiChar // always produces a non-nil pointer, which causes X509_STORE_load_locations() // to fail. Need to cast the string to an intermediate Pointer so the // PAnsiChar cast is applied to the raw data and thus can be nil... // Result := X509_STORE_load_locations(ctx, PAnsiChar(Pointer(UTF8String(AFileName))), PAnsiChar(Pointer(UTF8String(APathName)))); end; Assertor |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:52 Uhr. |
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