summaryrefslogtreecommitdiff
path: root/notifier
diff options
context:
space:
mode:
authorMichael Hanselmann <public@hansmi.ch>2018-05-09 01:22:56 +0200
committerMichael Hanselmann <public@hansmi.ch>2018-05-09 01:26:21 +0200
commit077bd665bdd881c33b3086541365e36b4c733d57 (patch)
treed08592cf815c20094aab07a963f4627303de387f /notifier
parentdfe5f3b95cfde0a59fdebf03e789f7cdc680c380 (diff)
downloadcups-077bd665bdd881c33b3086541365e36b4c733d57.tar.gz
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.
Diffstat (limited to 'notifier')
-rw-r--r--notifier/mailto.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/notifier/mailto.c b/notifier/mailto.c
index a05addf62..9b3aeccab 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);