[Mono-list] [PATCH] System.Web.Mail.SmtpStream

Tobias DiPasquale toby@cbcg.net
28 Apr 2003 20:11:36 -0400


--=-CUE5TukVp24jIgcDMXGf
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hello all,

It came to my attention recently that the SmtpStream class as
implemented in Mono is not RFC-compliant. All addresses in MAIL and RCPT
commands must be wrapped in "<>". I have created a patch against the
latest CVS to fix this particular problem, inlined below. Thanks!

P.S. I wasn't sure how this project liked its patch files, so I created
this one in the same manner that the Linux kernel creates theirs. The
fix is so small that it should not be hard to apply if the patch format
is wrong. Thanks again!

P.P.S. I noticed that SmtpMail is listed as having 3 methods missing.
Which are those? The ToString(), GetHashCode(), GetType() and Equals()
methods were inaccessible to me, as I could not instantiate an instance
of the SmtpMail class (this was with MS.NET SDK 1.1 on Windows). Anybody
have a clue for me on this one? I'd love to finish this class up...

<patch>

diff -Naur mcs/class/System.Web/System.Web.Mail/SmtpStream.cs
mcs_NEW/class/System.Web/System.Web.Mail/SmtpStream.cs
--- mcs/class/System.Web/System.Web.Mail/SmtpStream.cs	2003-03-12
23:20:03.000000000 +0000
+++ mcs_NEW/class/System.Web/System.Web.Mail/SmtpStream.cs	2003-04-28
23:11:30.000000000 +0000
@@ -50,7 +50,7 @@
 	}
 =09
 	public void WriteMailFrom( string from ) {
-	    command =3D "MAIL FROM: " + from;
+	    command =3D "MAIL FROM: <" + from + ">";
 	    WriteLine( command );
 	    ReadResponse();
 	    CheckForStatusCode( 250 );
@@ -58,7 +58,7 @@
 	}
 =09
 	public void WriteRcptTo( string to ) {
-	    command =3D "RCPT TO: " + to; =20
+	    command =3D "RCPT TO: <" + to + ">"; =20
 	    WriteLine( command );
 	    ReadResponse();
 	    CheckForStatusCode( 250 );

</patch>

--=20
Tobias DiPasquale
88FA 30C9 1E63 CFE2 CBD8  37C4 DA1C E2BF 1D26 F036
http://cbcg.net/

--=-CUE5TukVp24jIgcDMXGf
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iQEXAwUAPq3DONoc4r8dJvA2FALJ6QP+LpRUhmWPARiv0WF3QIk++tiqXoWklE4f
d3GJVZF4l7/J7bBK0pANpNW+trhKc4EKOgLUIr7GAdWMeM8DovcYTexUJmXWcK0d
6mW2POPxRNja1nSrf6tG5Mxi1fvYoU7+3OISAR/VN/5B5TFhjpt2eRXnyWr9aK49
c6Hjsk8VPoYD/RQScZm7ODHrNXW+xPY1WFjoIPWkc0BiTxDh1P/iBteBDdA62hCN
GNu6Q/pOJpLsQyNi/z1VcM3mg5mWd9q/NxOURaXZXx8ILqoJZNduMEYurU6QqPC6
Al3IjfBvdhl+Am0Dyp+P8zlI/QEghvdFtsZPSOH9P4imt96wykA5NidT
=8MBV
-----END PGP SIGNATURE-----

--=-CUE5TukVp24jIgcDMXGf--