From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 5 Dec 2003 17:05:26 +0600 From: Alexey Morozov To: community@altlinux.ru Subject: Re: [Comm] =?koi8-r?B?0M/Nz8fJ1MUgzsHMwcTJ?= =?koi8-r?B?1Nggzc/Exc3O1cAg0M/e1NU=?= Message-ID: <20031205110526.GE11434@pyro.hopawar.private.net> References: <3FCB7BCF.6010305@parkheights.dyndns.org> <20031201174215.GA15284@mrkooll.tdr.pibhe.com> <3FCBA597.8090101@parkheights.dyndns.org> <20031202064037.GA22967@localhost.localdomain> <20031203164636.GA8375@ivanov-sz1.gtedc.gte.com> <20031203220945.GB3140@localhost.localdomain> <20031204164812.GA9307@ivanov-sz1.gtedc.gte.com> <20031204190411.GA22392@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tVmo9FyGdCe4F4YN" Content-Disposition: inline In-Reply-To: <20031204190411.GA22392@localhost.localdomain> User-Agent: Mutt/1.4i X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.3 Precedence: list Reply-To: community@altlinux.ru List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2003 11:05:33 -0000 Archived-At: List-Archive: List-Post: --tVmo9FyGdCe4F4YN Content-Type: multipart/mixed; boundary="+KJYzRxRHjYqLGl5" Content-Disposition: inline Content-Transfer-Encoding: 8bit --+KJYzRxRHjYqLGl5 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Dec 05, 2003 at 01:04:11AM +0600, Alexey Morozov wrote: > Поэтому, собственно, я и хочу добиться требуемой мне функциональности от > msmtp + что-нибудь. В msmtp, на самом деле, подправить нужно не так много. > Нужно, собственно, разделять коды ошибок на фатальные и нет. Патч в аттачменте. Проверять еще не проверял, но "должно работать" (TM) :-)) --+KJYzRxRHjYqLGl5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="msmtp-0.6.2-alt-status.patch" diff -urN msmtp-0.6.2.orig/src/esmtp.c msmtp-0.6.2/src/esmtp.c --- msmtp-0.6.2.orig/src/esmtp.c 2003-11-14 00:06:10 +0600 +++ msmtp-0.6.2/src/esmtp.c 2003-12-05 14:26:35 +0600 @@ -862,7 +862,7 @@ if ((fd = open_socket(server, port)) < 0) { add_error_line("cannot connect to SMTP server"); - error_code = EX_UNAVAILABLE; + error_code = EX_TEMPFAIL; goto exit; } /* start TLS encryption for TLS-only servers (no STARTTLS) if wanted */ @@ -879,7 +879,7 @@ if (smtp_get_response(fd, &tls, 220) != 220) { add_error_line("cannot get initial ok message from SMTP server"); - error_code = EX_UNAVAILABLE; + error_code = EX_TEMPFAIL; goto close_exit; } /* start smtp session */ @@ -919,11 +919,29 @@ error_code = EX_IOERR; goto close_exit; } - if (smtp_get_response(fd, &tls, 250) != 250) + if ((error_code = smtp_get_response(fd, &tls, 250)) != 250) { add_error_line("line `MAIL FROM:<%s>' not accepted by SMTP server", from); - error_code = EX_DATAERR; + switch (error_code) { + case 451: + case 452: + error_code = EX_TEMPFAIL; + break; + case 503: + error_code = EX_SOFTWARE; + break; + case 550: + error_code = EX_NOPERM; + break; + case 552: + case 553: + error_code = EX_UNAVAILABLE; + break; + default: + error_code = EX_PROTOCOL; + break; + } goto close_exit; } for (i = 0; i < rcptc; i++) @@ -933,11 +951,35 @@ error_code = EX_IOERR; goto close_exit; } - if (smtp_get_response(fd, &tls, 250) != 250) + if ((error_code = smtp_get_response(fd, &tls, 250)) != 250) { + switch (error_code) { + case 251: // not actually an error + continue; + case 450: + case 451: + case 452: + error_code = EX_TEMPFAIL; + break; + case 503: + error_code = EX_SOFTWARE; + break; + case 550: + error_code = EX_NOPERM; + break; + case 551: + error_code = EX_NOUSER; + break; + case 552: + case 553: + error_code = EX_UNAVAILABLE; + break; + default: + error_code = EX_PROTOCOL; + break; + } add_error_line("line `RCPT TO:<%s>' not accepted by SMTP server", rcptv[i]); - error_code = EX_DATAERR; goto close_exit; } } @@ -947,10 +989,23 @@ error_code = EX_IOERR; goto close_exit; } - if (smtp_get_response(fd, &tls, 354) != 354) + if ((error_code = smtp_get_response(fd, &tls, 354)) != 354) { + switch (error_code) { + case 451: + error_code = EX_TEMPFAIL; + break; + case 503: + error_code = EX_SOFTWARE; + break; + case 554: + error_code = EX_DATAERR; + break; + default: + error_code = EX_PROTOCOL; + break; + } add_error_line("SMTP server does not accept the mail"); - error_code = EX_DATAERR; goto close_exit; } /* Copy the mail from mailf to fd, converting '\n' to '\r\n' and a leading @@ -1029,10 +1084,24 @@ error_code = EX_IOERR; goto close_exit; } - if (smtp_get_response(fd, &tls, 250) != 250) + if ((error_code = smtp_get_response(fd, &tls, 250)) != 250) { + switch (error_code) { + case 451: + case 452: + error_code = EX_TEMPFAIL; + break; + case 552: + error_code = EX_UNAVAILABLE; + break; + case 554: + error_code = EX_DATAERR; + break; + default: + error_code = EX_PROTOCOL; + break; + } add_error_line("SMTP server did not accept the mail"); - error_code = EX_DATAERR; goto close_exit; } --+KJYzRxRHjYqLGl5-- --tVmo9FyGdCe4F4YN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/0GZ2X5DZdJn19V0RAmNcAJ0crFVZsAf5FGO68RHDwOGMhLvWQwCcCMaN Bhy7IAl+9W5soJ6LYwE4TP4= =KNuC -----END PGP SIGNATURE----- --tVmo9FyGdCe4F4YN--