Question

In my code, before my TIdIMAP4 connection is created, I set up a whole bunch of SASL mechanisms, in what is hopefully the prescribed "best to worst" order like this:

IMAP.SASLMechanisms.Add.SASL := mIdSASLCRAMSHA1;
IMAP.SASLMechanisms.Add.SASL := mIdSASLCRAMMD5;
IMAP.SASLMechanisms.Add.SASL := mIdSASLSKey;
IMAP.SASLMechanisms.Add.SASL := mIdSASLOTP;
IMAP.SASLMechanisms.Add.SASL := mIdSASLAnonymous;
IMAP.SASLMechanisms.Add.SASL := mIdSASLExternal;
IMAP.SASLMechanisms.Add.SASL := mIdSASLLogin;
IMAP.SASLMechanisms.Add.SASL := mIdSASLPlain;

and I'm setting IMAP.AuthType := iatSASL; so I think it should be connecting with SASL. But is there any way (say, after the connection is established) to find out which SASL mechanism it actually used in creating the connection?

Was it helpful?

Solution

Sorry, but there is nothing in Indy to find out which SASL(s) are attempted and/or successful. Indy compares the contents of the SASLMechanisms against the server's reported SASLs, builds up a list of matches, and then loops through that list trying each SASL one at a time until one of them succeeds, then the list is discarded. The only way to know which SASL(s) are being attempted is to monitor the raw socket traffic, such as with one of Indy's Intercept components, and manually parse the IMAP commands that are being sent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top