From: Michael Hanselmann Date: Tue, 8 May 2018 23:22:56 +0000 (+0200) Subject: mailto: Wait for server opening message X-Git-Tag: v2.3b5~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=077bd665bdd881c33b3086541365e36b4c733d57;p=thirdparty%2Fcups.git mailto: Wait for server opening message A subset of all mailserver configurations reject SMTP sessions where the client sends anything before the server sent its opening message. This is the case with Exim on Ubuntu Artful, for example: SMTP protocol synchronization error (input sent without waiting for greeting) Not waiting for the opening message is a violation of the session initiation described in RFC5321 (section 3.1). Update the mailto notifier to wait for a non-error status code from the server before proceeding to start the mail transaction. --- diff --git a/notifier/mailto.c b/notifier/mailto.c index a05addf627..9b3aeccaba 100644 --- a/notifier/mailto.c +++ b/notifier/mailto.c @@ -248,6 +248,10 @@ email_message(const char *to, /* I - Recipient of message */ fprintf(stderr, "DEBUG: Connected to \"%s\"...\n", mailtoSMTPServer); + if (!cupsFileGets(fp, response, sizeof(response)) || atoi(response) >= 500) + goto smtp_error; + fprintf(stderr, "DEBUG: <<< %s\n", response); + cupsFilePrintf(fp, "HELO %s\r\n", httpGetHostname(NULL, hostbuf, sizeof(hostbuf))); fprintf(stderr, "DEBUG: >>> HELO %s\n", hostbuf);