<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>/dev/random &#187; Mail</title>
	<atom:link href="http://skolobov.wordpress.com/category/mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://skolobov.wordpress.com</link>
	<description>Generating Randomness Since the Epoch</description>
	<lastBuildDate>Tue, 26 May 2009 07:19:32 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='skolobov.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/94bd7818784d6337cdd47a39770d467c?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>/dev/random &#187; Mail</title>
		<link>http://skolobov.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://skolobov.wordpress.com/osd.xml" title="/dev/random" />
		<item>
		<title>Bug in Nokia E61i SMTP Client Software</title>
		<link>http://skolobov.wordpress.com/2007/08/24/bug-in-nokia-e61i-smtp-client-software/</link>
		<comments>http://skolobov.wordpress.com/2007/08/24/bug-in-nokia-e61i-smtp-client-software/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 17:00:54 +0000</pubDate>
		<dc:creator>skolobov</dc:creator>
				<category><![CDATA[Bug]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://skolobov.wordpress.com/2007/08/24/bug-in-nokia-e61i-smtp-client-software/</guid>
		<description><![CDATA[I was troubleshooting a strange problem recently. A brand new Nokia E61i smartphone could receive but not send any e-mail.  The server configuration has not changed and other mail clients are working fine, so it must be the server.

It is very basic and straightforward configuration &#8211; a FreeBSD server running Qmail with SPAMCONTROL patch [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=skolobov.wordpress.com&blog=1567523&post=17&subd=skolobov&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was troubleshooting a strange problem recently. A brand new Nokia E61i smartphone could receive but not send any e-mail.  The server configuration has not changed and other mail clients are working fine, so it must be the server.
</p>
<p>It is very basic and straightforward configuration &#8211; a <a href="http://www.FreeBSD.org/">FreeBSD</a> server running <a href="http://cr.yp.to/qmail.html">Qmail</a> with <a href="http://www.fehcom.de/qmail/spamcontrol.html">SPAMCONTROL patch</a> as SMTP server and <a href="http://www.bincimap.org/">BincIMAP</a> as IMAP4 server. This configuration worked perfectly until the client asked to add this shiny new Nokia phone to the mix.
</p>
<p>Receiving e-mail via IMAP4 did not pose any problems &#8211; it just worked (sans the self-signed SSL certificate which I figured out later) but sending mail via SMTP protocol just did not work at all.</p>
</p>
<p><span id="more-17"></span></p>
<p>
The server requires SSL-encrypted connection and successful SMTP authentication before allowing relaying mail to non-local recipients. My initial thought was that perhaps it was due some mismatch in supported encryption algorithms (SHA vs DES vs 3DES, that type of thing). After tweaking the settings a lot on the server side, and even completely disabling SSL encryption altogether I realized it is not the culprit here.</p>
<p>
So I have enabled verbose SMTP protocol logging and this is what I saw:
</p>
<pre>
2007-08-16_12:04:16.53449 53365 &gt; 220 server.example.com ESMTP
2007-08-16_12:04:16.55913 53365 &lt; EHLO [xx.xx.xx.198]
2007-08-16_12:04:16.55935 53365 &gt; 250-server.example.com
2007-08-16_12:04:16.55940 53365 &gt; 250-PIPELINING
2007-08-16_12:04:16.55949 53365 &gt; 250-8BITMIME
2007-08-16_12:04:16.55957 53365 &gt; 250-SIZE 0
2007-08-16_12:04:16.55966 53365 &gt; 250 AUTH LOGIN PLAIN
2007-08-16_12:04:16.58764 53365 &lt; AUTH LOGIN
[SMTP authentication details snipped]
2007-08-16_12:04:16.60694 Accept::ORIG::Valid_Auth: P:EMSTPA
     S:xx.xx.xx.198:unknown H:[xx.xx.xx.198] 'login' ?= 'valid_user'
2007-08-16_12:04:16.60707 53365 &gt; 235 ok, go ahead (#2.0.0)
</pre>
</p>
<p>
As you see from this log excerpt, an SMTP session has been successfully established, SMTP client has successfully authenticated to the server and the server now ready start accepting e-mails from this client.
</p>
<p>
Everything looks perfect up to this point &#8211; see what happens next:
</p>
<pre>
2007-08-16_12:04:16.76834 53365 &lt; <strong>RSET</strong>
2007-08-16_12:04:16.76857 53365 &gt; <strong>250 flushed</strong>
</pre>
</p>
<p>
What on Earth the developers have been smoking? Why reset an SMTP connection <span style="font-style:italic;" class="Apple-style-span">right after </span>the authentication? Have they read RFC-822 yet?
</p>
<p>
So, let us continue with our example:
</p>
<pre>
2007-08-16_12:04:16.77749 53365 &lt; MAIL FROM:&lt;valid_user@example.com&gt;
2007-08-16_12:04:16.77787 53365 &gt; 250 ok
2007-08-16_12:04:16.82899 53365 &lt; RCPT TO:&lt;someone@example.org&gt; 
2007-08-16_12:04:16.82908 Reject::ORIG::<strong>Missing_Auth</strong>: P:ESMTPA
     S:xx.xx.xx.198:unknown H:[xx.xx.xx.198]
     F:valid_user@example.com T:someone@example.org
2007-08-16_12:04:16.82922 53365 &gt; 535 <strong>authentication required (#5.7.1)</strong>
</pre>
</p>
<p>
Of course &#8211; authentication is indeed required to send e-mail to external recipients (otherwise it would simply be an open relay).  No wonder the SMTP server (rightfully!) rejects the attempt and closes the connection:
</p>
<pre>
2007-08-16_12:04:16.85379 53365 &lt; QUIT
2007-08-16_12:04:16.85433 53365 &gt; 221 server.example.com
2007-08-16_12:04:16.85445 53365 &gt; [EOF] 
</pre>
</p>
<p>
Luckily, Qmail is an open-source software, so I was able to make a trivial modification in the qmail-smtpd.c sources:</p>
<pre>
--- qmail-smtpd.c.bak   Fri Aug 24 20:32:39 2007
+++ qmail-smtpd.c       Thu Aug 16 16:18:50 2007
@@ -784,7 +784,7 @@
 }
 void smtp_rset()
 {
-  seenmail = 0; rcptcount = 0; seenauth = 0; seenttls = 0;
+  seenmail = 0; rcptcount = 0; /* seenauth = 0; seenttls = 0; */
   mailfrom.len = 0; rcptto.len = 0; tlsinfo.len = 0;
   out("250 flushed\r\n");
 }
</pre>
</p>
<p>
This is essentially makes RSET command a no-op when it comes to SMTP authentication.This solved the problem for me &#8211; my client is now able to send e-mail messages in addition to just receiving them.
</p>
<p>
Still &#8211; <strong>bad developer, no cookie&#8230;  </strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/skolobov.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/skolobov.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/skolobov.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/skolobov.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/skolobov.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/skolobov.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/skolobov.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/skolobov.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/skolobov.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/skolobov.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/skolobov.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/skolobov.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=skolobov.wordpress.com&blog=1567523&post=17&subd=skolobov&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://skolobov.wordpress.com/2007/08/24/bug-in-nokia-e61i-smtp-client-software/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5b166c75ec2bd10d967800066327b078?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">skolobov</media:title>
		</media:content>
	</item>
	</channel>
</rss>