[fpc-pascal] Dependency of OpenSSL 1.0.2 still in FPC 3.2.0 on some platforms?

Bo Berglund bo.berglund at gmail.com
Mon May 17 22:06:10 CEST 2021


On Sat, 15 May 2021 09:00:08 +0200 (CEST), Michael Van Canneyt via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>
>Glad you got it working.
>
>I worked for some time for a mass mailing company. 
>From that experience I assure you that delivering mail is NOT easy.
>
>Meanwhile, there are a lot of safety mechanisms installed on all "big" mail
>platforms, and getting a mail delivered becomes more and more difficult.
>
>Michael.

Well, now I got stuck again...
I did all of my code testing on Windows because that is my normal environment.

When all was done I had created a mailsupport unit encapsulating the stuff I
need for my emailings and I used that in a command line mailer to verify that
everything worked OK.
Which it did on Windows except for some fussy mailservers who would not receive
the emails (my GMail account), but the email was in any case sent.

But then when I moved to Linux (on Raspberry Pi3) I always got errors on mail
send. So no outgoing email.

So I have now finally traced the execution using the Lazarus debugger and it
seems like Synapse does not connect using SSL after all.. :(

I have set it up as well as I have understood the documentation with the smtp
switches for SSL and TLS active (set to true) and the port and user is set as on
Windows (after all I copied the source files over to the Linux box and opened
the project in Lazarus over there). The test emailer has all of the logon etc
info built into the executable (just for testing of course) but failed.

So when I single-step in the code I reach the following location after starting
on SMTP.Connect:

function TSMTPSend.Connect: Boolean;
begin
  FSock.CloseSocket;
  FSock.Bind(FIPInterface, cAnyPort);
  if FSock.LastError = 0 then
    FSock.Connect(FTargetHost, FTargetPort);
  if FSock.LastError = 0 then
    if FFullSSL then
      FSock.SSLDoConnect;  //<= I get to here
  Result := FSock.LastError = 0;
end;

procedure TTCPBlockSocket.SSLDoConnect;
begin
  ResetLastError;
  if not FSSL.Connect then  //<=This goes to no action....
    FLastError := WSASYSNOTREADY;
  ExceptCheck;
end;

function TCustomSSL.Connect: boolean; //<= To here!
begin
  ReturnError;
  Result := False;
end;


Then I traced over into the ExceptCheck function:

procedure TBlockSocket.ExceptCheck;
var
  e: ESynapseError;
begin
  FLastErrorDesc := GetErrorDescEx;  // <== HERE
  if (LastError <> 0) and (LastError <> WSAEINPROGRESS)
    and (LastError <> WSAEWOULDBLOCK) then
  begin
    DoStatus(HR_Error, IntToStr(FLastError) + ',' + FLastErrorDesc);
    if FRaiseExcept then
    begin
      e := ESynapseError.Create(Format('Synapse TCP/IP Socket error %d: %s',
        [FLastError, FLastErrorDesc]));
      e.ErrorCode := FLastError;
      e.ErrorMessage := FLastErrorDesc;
      raise e;
    end;
  end;
end;

FLastErrorDesc gets set to "SSL/TLS support is not compiled"

So now I do not know what to do, is this indicating that I need to change some
Synapse config to get it working or is it a platform problem (Linux)???

What could I do in order to make SSL/TLS support "compiled"
In the documentation
 http://www.ararat.cz/synapse/doku.php/public:howto:sslplugin

they write:
First you must explicitly select what plugin you wish to use. You can do it
simply by adding unit with SSL plugin to your project sources. You can add only
one from SSL plugins in one project! When you wish to use OpenSSL, then add
/ssl_openssl/ to your project uses, for example.

And that is what I have done, it is listed in uses of my mailsupport source file
as:
uses
  Classes,
  SysUtils,
  smtpsend,
  ssl_openssl, //<= Here
  synautil,
  mimemess,
  mimepart;

Yet it is "not compiled"...

Very confusing.

-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list