🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #470

Re: Indy SMTP and TLS options

#470
From: Remy Lebeau (TeamB)
Date: Mon, 25 Feb 2008 17:57
77 lines
4602 bytes
"BrianV" <bvanmatre_remove_@yahoo.com> wrote in message 
news:47bf8bb4$1@newsgroups.borland.com...

> I'm using indy 10.1.5, the version that ships with C++ Builder 2007.

Then you are using an outdated version of Indy.  What shipped with BCB 2007 
(and 2006, for that matter) was NOT the latest version of Indy.

> First off, the definitions of utUseExplicitTLS, utUseImplicitTLS, 
> utUseRequireTLS, and utNoTLSSupport aren't very clear to me.
> Can someone explain in any detail what these options would be
> used for

utUseExplicitTLS = SSL/TLS is not automatically enabled when the connection 
is initially opened.  The protocol being used must expose an explicit 
command, such as "STARTTLS" or "STLS", that the component can send to the 
server to begin negotiating a new SSL/TLS session when it is ready to do so, 
such as before sending sensitive information (username/password, etc).  If 
the protocol does not expose such a command that Indy recognizes, the 
component triggers its OnTLSNotAvailable event, allowing you to decide 
whether to continue using an unsecure connection or not.  If no event 
handler is assigned, or it returns False, then the connection is closed and 
an exception is raised.

utUseImplicitTLS = SSL/TLS is enabled at the very beginning when connecting 
to a dedicated SSL/TLS-enabled port on the server.  No explicit SSL/TLS 
command is used in the protocol to begin a new secure session, as it must be 
established before the first protocol-level command can be issued.  If the 
port does not support SSL/TLS, the connection fails and an exception is 
raised.

utUseRequireTLS = This is effectively the same as utExplicitTLS, with one 
difference - the component is not allowed to continue with an unsecure 
connection if an SSL/TLS session fails to be established.  The 
OnTLSNotAvailable event is not triggered.  The connection is immediately 
closed and an exception is raised.

utNoTLSSupport = TLS is disabled, and the connection is used normally and 
unsecured.

> Also, the implementation is confusing as well.  In my
> version of Indy, the code that sets these options looks like
> (in IdExplicitTLSClientServerBase.pas, line 399):

You are only looking at a small piece of the puzzle.  The UseTLS property is 
not handled by TIdExplicitTLSClient alone.  Each descendant component uses 
the UseTLS property differently than other components.  They also override 
the SupportsTLS property getter in order to verify protocol-specific 
conditions.

> If you set the value to utUseRequireTLS, then, the code changes
> your Port value to FRegularProtPort (which is defined as 25) at
> point A.

See my explanation above about how utUseRequireTLS and utImplicitTLS differ. 
That will explain why TIdExplicitTLSClient has to swap the ports around.

> Further, the behavior of this method is dependent on the order in
> which you call things. For example if you set your port first, it will
> get changed to 25.  If you set your port after setting TLS option, it
> stays the same.

The Port property is the definitive authority over where the connection 
ultimately connects to.  You can set it after setting the UseTLS property 
and it will override accordingly.  RFCs for standardized protocols dictate 
what the default Port values are.  The UseTLS setter uses those values 
internally (via the FRegularProtPort and FImplicitTLSProtPort members) if 
you have not overriden the Port property value beforehand.

> If anyone has been able to get a TIdSMTP component in indy 10
> to work right with the TLS options, I'd love to hear of any tricks.

See above.


Gambit 
Technical Details
Message-ID: <47c3017b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47bf8bb4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ac02878589379fbf
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <47bf8bb4$1@newsgroups.borland.com>
Subject: Re: Indy SMTP and TLS options
Date: Mon, 25 Feb 2008 09:57:39 -0800
Lines: 79
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47c3017b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1203962235 207.178.157.90 (25 Feb 2008 09:57:15 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail