[Dnsmail-cvs] dnsmail SmtpClient.cs,1.3,1.4
Brought to you by:
ethem
From: Ethem E. <et...@us...> - 2006-08-07 15:10:39
|
Update of /cvsroot/dnsmail/dnsmail In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv20526/dnsmail Modified Files: SmtpClient.cs Log Message: Initailize buffers before receiving data. Index: SmtpClient.cs =================================================================== RCS file: /cvsroot/dnsmail/dnsmail/SmtpClient.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SmtpClient.cs 7 Aug 2006 11:33:39 -0000 1.3 --- SmtpClient.cs 7 Aug 2006 15:10:32 -0000 1.4 *************** *** 55,67 **** LingerState = new LingerOption(true, 5); Connect(remote); ! if (!Client.Poll(21000000, SelectMode.SelectRead) || ! SendAndReceive(null) != Commands.Ok) { throw new MailServerException(LastResponse); } ! ! dataStream = GetStream(); ! recvBuffer = new byte[256]; ! esmtp = (LastAnswer.ToLower().IndexOf("esmtp") != -1); } --- 55,70 ---- LingerState = new LingerOption(true, 5); Connect(remote); ! if (Client.Poll(21000000, SelectMode.SelectRead)) { + dataStream = GetStream(); + recvBuffer = new byte[256]; + if (SendAndReceive(null) == Commands.Ok) + { + esmtp = (LastAnswer.ToLower().IndexOf("esmtp") != -1); + return; + } throw new MailServerException(LastResponse); } ! throw new MailServerException(String.Empty); } *************** *** 89,99 **** disposed = true; - if (disposing) - { - UseLog = false; - x509cert = null; - recvBuffer = null; - } - if (dataStream != null) { --- 92,95 ---- *************** *** 426,430 **** private const int MaxBuffer = 8192; private const string quitcmd = "QUIT\r\n"; ! internal enum Commands : byte { Pending = 0, --- 422,426 ---- private const int MaxBuffer = 8192; private const string quitcmd = "QUIT\r\n"; ! internal enum Commands { Pending = 0, *************** *** 455,459 **** breceived += bytes; tmpResp += Encoding.ASCII.GetString(recvBuffer, 0, bytes); ! } while (tmpResp[tmpResp.Length - 1] != '\n' && Client.Poll(500, SelectMode.SelectRead)); if (tmpResp.Length < 4) --- 451,459 ---- breceived += bytes; tmpResp += Encoding.ASCII.GetString(recvBuffer, 0, bytes); ! if (tmpResp[tmpResp.Length - 1] == '\n') ! { ! break; ! } ! } while (Client.Poll(500, SelectMode.SelectRead)); if (tmpResp.Length < 4) *************** *** 465,474 **** if (!quit) { ! string log = tmpResp.Trim(); ! lastcode = int.Parse(log.Substring(0, 3)); ! lastanswer = log.Substring(4); } ! ! return (Commands)Convert.ToByte(tmpResp[0]); } --- 465,472 ---- if (!quit) { ! lastcode = int.Parse(tmpResp.Substring(0, 3)); ! lastanswer = tmpResp.Substring(4).Trim(); } ! return (Commands)Enum.Parse(typeof(Commands), tmpResp.Substring(0, 1)); } |