These are chat archives for IndySockets/Indy

8th
May 2017
Jos de Bruijn
@josdebr_twitter
May 08 2017 10:33
@josdebr_twitter what is the EXACT error message? What does the call stack look like when the error occurs?
Hi Remy,
the exact error message is: "ERangeError raised: Range check error". I get the error after I call "IMAPClient.Retrieve(i, Msg)"
I've managed to generate a callstack, I can even get you a Eureka log file if you can read it. But here is the callstack extracted from my log:
IdGlobalProtocols.pas| |GetUniqueFileName |1644[45] |
IdGlobalProtocols.pas| |GetUniqueFileName |1599[0] |
IdGlobalProtocols.pas| |MakeTempFilename |1584[35] |
IdGlobalProtocols.pas| |MakeTempFilename |1549[0] |
IdAttachmentFile.pas |TIdAttachmentFile |PrepareTempStream |144[3] |
IdMessageClient.pas | |ProcessAttachment |840[7] |
IdMessageClient.pas | |ProcessAttachment |833[0] |
IdMessageClient.pas |TIdMessageClient |ReceiveBody |1024[115]|
IdMessageClient.pas |TIdMessageClient |ProcessMessage |1535[8] |
IdMessageClient.pas |TIdMessageClient |ProcessMessage |1527[0] |
IdMessageHelper.pas | |Internal_TIdMessageClientHelper_ProcessMessage|60[12] |
IdMessageHelper.pas | |Internal_TIdMessageClientHelper_ProcessMessage|48[0] |
IdMessageHelper.pas | |Internal_TIdMessageHelper_LoadFromStream |85[9] |
IdMessageHelper.pas | |Internal_TIdMessageHelper_LoadFromStream |76[0] |
IdMessageHelper.pas | |TIdMessageHelper_LoadFromStream |97[1] |
IdMessageHelper.pas | |TIdMessageHelper_LoadFromStream |96[0] |
IdIMAP4.pas |TIdIMAP4 |InternalRetrieve |4951[59] |
IdIMAP4.pas |TIdIMAP4 |InternalRetrieve |4892[0] |
IdIMAP4.pas |TIdIMAP4 |Retrieve |4601[2] |
IdIMAP4.pas |TIdIMAP4 |Retrieve |4599[0] |
Ryan Truran
@RyanTruran
May 08 2017 15:35
@rlebeau I'm running into your name everywhere looking for a solution to my smtp not relaying to an address outside of my domain.
Ryan Truran
@RyanTruran
May 08 2017 15:46
http://stackoverflow.com/questions/43742574/send-email-outside-of-domain-in-cbuilder
I have posted a question on stackoverflow with the link provided above. to summarize my issue I am trying to send an email outside of my domain. I am using TIdSMTP to connect to my smtp server. Everything works fine when I am only trying to send within my domain, but if I have to relay to another domain the email will not send. I receive a "Unable to relay" error when providing the correct username and password with an AuthType of satDefault. If I change the AuthType to satSASL and add an SASL mechanism I get an error that reads "Doesn't support AUTH or the specified SASL handlers!!"
Remy Lebeau
@rlebeau
May 08 2017 16:21
@josdebr_twitter it is odd to see a range error in GetUniqueFileName(), the only thing I can see it doing that might cause that is it calls Ticks64() in a loop until FileExists() returns false. But I don't see Ticks64() in your call stack. And your line numbers do not coorespond to the latest version of IdGlobalProtocols.pas. What exactly is on line 1644 of your copy?
@RyanTruran Your server is refusing to relay, which could happen if you are not logging in correctly. The SASL error means there is no TIdSASL component in the TIdSMTP.SASLMechanisms property that matches what the server is expecting (see the AUTH entries in the TIdSMTP.Capabilities property after connecting and before logging in). If you use satDefault instead, try setting the TIdSMTP.ValidateAuthLoginCapability property to False, otherwise login might be skipped if TIdSMTP.Capabilities does not include an entry for the AUTH LOGIN command even if the server actually supports it (it is not a secure command, unless used over SSL/TLS, so it is not always advertised as supported)
Remy Lebeau
@rlebeau
May 08 2017 16:36
@RyanTruran I updated my answer on SO.
Ryan Truran
@RyanTruran
May 08 2017 16:51
@rlebeau where is the AUTH entry in the capabilities property? all I see is Fdelimiter, FLineBreak, FQuoteChar , etc. no AUTH or Fauth
Remy Lebeau
@rlebeau
May 08 2017 16:53
@RyanTruran you need to look at the content of the list. Capabilities is a plain TStringList. It contains the strings that the SMTP server returns in reply to the EHLO command. Amongst other things, it will contain "AUTH=..." and/or "AUTH ..." strings for the supported authentication schemes
Ryan Truran
@RyanTruran
May 08 2017 16:56
that's what I assumed. the list is empty
it should be under FDefined right?
Remy Lebeau
@rlebeau
May 08 2017 17:01
@RyanTruran no, FDefined is only used for keeping track of which delimiter properties have been assigned values (Delimiter, StrictDelimiter, QuoteChar, NameValueSeparator, and LineBreak). The AUTH strings are in the Strings[] subproperty instead. Have you ever worked with TStringList before?
Ryan Truran
@RyanTruran
May 08 2017 17:04
AUTH NTLM?
Remy Lebeau
@rlebeau
May 08 2017 17:04
@RyanTruran Yes, those strings. Which means you need to add TIdSASLNTLM in the TIdSMTP.SASLMechanisms property, at least.
Ryan Truran
@RyanTruran
May 08 2017 17:05
So will I need to create that or is there a mechanism already built that I can use.
I'm not seeing one with my version of c++ builder
I guess I need to add the source file
Remy Lebeau
@rlebeau
May 08 2017 17:07
@RyanTruran Indy has many TIdSASL components. They should be on your IDE's Component Palette on the "Indy SASL" page. Or instantiate them in code at runtime instead. But either way, you need to built up the contents of the TIdSASLMechanisms property to point at those components, before you login to the server.
Ryan Truran
@RyanTruran
May 08 2017 17:08
gotcha that's what I was doing before just not with NTLM as that does not show up in my Indy SASL tool pallete
Remy Lebeau
@rlebeau
May 08 2017 17:09
@RyanTruran doesn't look like TIdSASLNTLM is registered by default. Not sure if it was ever finalized or not.
Ryan Truran
@RyanTruran
May 08 2017 17:10
so what would I need to do to add it.
Remy Lebeau
@rlebeau
May 08 2017 17:12
@RyanTruran unless you recompile Indy to register it, you should just add IdSASL_NTLM.pas to your project directly, then #include the resulting IdSASL_NTLM.hpp file in your code and instantiate a TIdSASLNTLM object at runtime and Add() it to the SASLMechanisms property.
Ryan Truran
@RyanTruran
May 08 2017 17:13
so I should grab the .pas off of github right?
Remy Lebeau
@rlebeau
May 08 2017 17:13
@RyanTruran I have no idea if TIdSASLNTLM works or not, which is probably why it is still not registered by default. Is that the only AUTH the server is reporting?
@RyanTruran Indy's code is not on GitHub. It is on AToZed's own SVN server (link is on Indy's website). GitHub is only used for chat and issue tracking
Ryan Truran
@RyanTruran
May 08 2017 17:15
so are you with indy?
Remy Lebeau
@rlebeau
May 08 2017 17:19
@RyanTruran yes, I am the primary developer of Indy, and one of its admins. But I'm not with AToZed. And I didn't write TIdSASLNTLM, and have no way of testing it myself (no access to any servers that use NTLM authentication).
Ryan Truran
@RyanTruran
May 08 2017 17:20
gotcha
so when I add the .pas to the project does it generate a .hpp? that I can include?
Remy Lebeau
@rlebeau
May 08 2017 17:23
@RyanTruran It will, when the project compiles the .pas file. C++Builder projects can include Pascal source files, and it will always compile Pascal files before C/C++ files, for exactly the reason of generating any necessary .hpp files that may be used by the C/C++ code.
Ryan Truran
@RyanTruran
May 08 2017 17:24
which will occur when I compile the project right?
Remy Lebeau
@rlebeau
May 08 2017 17:26
@RyanTruran yes
Jos de Bruijn
@josdebr_twitter
May 08 2017 19:33
@rlebeau I am using 10.6.2.0.
On line 1644 i've got the following code: Result := LFName + IntToHex(LNamePart, 8) + LFQE;
Remy Lebeau
@rlebeau
May 08 2017 22:19
@josdebr_twitter What version of Delphi are you using? What is the actual value of LNamePart when the error occurs? LNamePart is a TIdTicks, which is a UInt64. Is the value of LNamePart > High(Int64) (9223372036854775807) when the error occurs? IntToHex() has had an overload for UInt64 since XE2. Do you get the same error if you preceed that line of code with {$R-} or {$RANGECHECKS OFF}?