Authentication error
Brought to you by:
sheda0
When a server request an authentication SMTP class
throws an exception.
I found the bug is in AuthImplemented(string s) method.
It happens when the server response is not fast enough
and AuthImplemented doesn't get the proper response
from the server so it thinks Auth is not implemented. It
returns false instead of true, which leads the client into
sending MAIL FROM instead of sending the Username &
Password.
I currently work on solving this bug.
Logged In: YES
user_id=1035831
A temporary solution for the problem is as follows. I know my
change is still not the best solution. For such a solution there
should be some major code rewrite done.
My changes are:
/// Check to see if AUTH command returns valid challenge.
/// A valid AUTH string must be passed
into this method.
private bool AuthImplemented(ref
NetworkStream nw)
{
int i = 0;
string s;
while(i < 30)
{
s = ReadFromStream
(ref nw);
if (s.IndexOf
(ReplyConstants.SERVER_CHALLENGE) != -1)
return true;
else
{
if (s.IndexOf
(ReplyConstants.NOT_IMPLEMENTED) != -1)
return false;
else
{
Thread.Sleep(500);
i++;
}
}
}
return false;
}
The upper method (private bool AuthLogin(ref NetworkStream
nwstream)) which calls this methot should be changed
according to parameter type change.
Logged In: NO
I met with the same problem.
The inelegant solution is: just add a Thread.Sleep(1000)
before Function AuthImplemented
Logged In: NO
It is just the same bug I was troubled.Thank you for your
help.