smtp_appender / smtp_fsm: problems with some smtp servers

12 views
Skip to first unread message

arterlang

unread,
Apr 15, 2010, 12:35:50 PM4/15/10
to Log4erl
the smtp_fsm module seems to have problems with some smtp servers, for
example with smpt.1und1.com.

smtp.1und1.com gives a double response to EHLO: (below wireshark
capture: look at No. 8, 10 and 11 !)

No. Time Source Destination
Protocol Info
4 0.027146 212.227.15.145 192.168.0.211
SMTP S: 220 smtp.1und1.com (mrbap2) Welcome to Nemesis ESMTP
server


No. Time Source Destination
Protocol Info
6 0.030640 192.168.0.211 212.227.15.145
SMTP C: ehlo mac.local


No. Time Source Destination
Protocol Info
8 0.047280 212.227.15.145 192.168.0.211
SMTP S: 250-smtp.1und1.com


No. Time Source Destination
Protocol Info
10 0.047687 192.168.0.211 212.227.15.145
SMTP C: mail from:v...@xyz.org


No. Time Source Destination
Protocol Info
11 0.061382 212.227.15.145 192.168.0.211
SMTP S: 250-STARTTLS | 250-AUTH LOGIN PLAIN | 250-AUTH=LOGIN PLAIN
| 250-PIPELINING | 250-SIZE 120000000 | 250 HELP


No. Time Source Destination
Protocol Info
13 0.079297 212.227.15.145 192.168.0.211
SMTP S: 250 OK


No. Time Source Destination
Protocol Info
14 0.079344 192.168.0.211 212.227.15.145
SMTP C: rcpt to:v...@xyz.org


No. Time Source Destination
Protocol Info
16 0.133750 192.168.0.211 212.227.15.145
SMTP C: Data


No. Time Source Destination
Protocol Info
18 2.091425 212.227.15.145 192.168.0.211
SMTP S: 550 must be authenticated


No. Time Source Destination
Protocol Info
20 2.091877 192.168.0.211 212.227.15.145
SMTP C: DATA fragment, 6 bytes


No. Time Source Destination
Protocol Info
21 2.103540 212.227.15.145 192.168.0.211
SMTP S: 554 No valid recipients


No. Time Source Destination
Protocol Info
24 2.115444 212.227.15.145 192.168.0.211
SMTP S: 250 OK

possible fast fix in the smtp_fsm module:

...

smtp_start({ehlo, Name}, _Pid, Info) ->
Msg = ["ehlo ", Name, "\r\n"],
ok = gen_tcp:send(Info#info.socket, Msg),
case get_response(Info#info.socket) of
{"250", Resp} ->
Tokens = string:tokens(Resp, "\r\n"),
Strs = [string:sub_string(X,5) || X <- Tokens],
NewInfo = Info#info{features = tl(Strs)},
case NewInfo#info.features of
[] -> get_info_reply(Info);
_ -> {reply, {ok, Resp}, smtp_conn, NewInfo}
end;
{_Code, Resp} ->
{reply, {ehlo_error, Resp}, smtp_start, Info};
Error ->
{stop, conn_error, {conn_error, Error}, []}
end.

%% added 15.04.2010 ===========================================
%% because smtp_fsm failed with smtp server smpt.1und1.com
get_info_reply(Info)->
case get_response(Info#info.socket) of
{"250", Resp} ->
Tokens = string:tokens(Resp, "\r\n"),
Strs = [string:sub_string(X,5) || X <- Tokens],
NewInfo = Info#info{features = tl(Strs)},
{reply, {ok, Resp}, smtp_conn, NewInfo};
{_Code, Resp} ->
{reply, {ehlo_error, Resp}, smtp_start, Info};
Error ->
{stop, conn_error, {conn_error, Error}, []}
end.

...

Ahmed Ali

unread,
Apr 16, 2010, 3:31:51 PM4/16/10
to log...@googlegroups.com
Hi arterlang,

This seems to be a problem in the SMTP library I'm using
(smtp_fsm.erl). There is a new version which might resolve this
problem but I'll have to check.

Thanks for sharing the fix.

Best regards,

Ahmed
> --
> You received this message because you are subscribed to the Google Groups "Log4erl" group.
> To post to this group, send email to log...@googlegroups.com.
> To unsubscribe from this group, send email to log4erl+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/log4erl?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Log4erl" group.
To post to this group, send email to log...@googlegroups.com.
To unsubscribe from this group, send email to log4erl+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/log4erl?hl=en.

Reply all
Reply to author
Forward
0 new messages