summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-06-03 22:27:58 -0700
committerJohn Denker <jsd@av8n.com>2012-07-13 18:39:07 -0700
commit425d3db4e3ad58b7ea5d185accfd16e8079613f1 (patch)
treea8bd2a4f7d78e9971665bdd20cfee3bcb2e8d560
parent8ebb34bd4f4328f7828735be480d77f884f9359a (diff)
Increase qmail-remote's compliance with RFC2821.
Some smtp servers are now emitting 5xx responses from the get-go, and mere RFC821 behavior doesn't deal well with them. Credit: Adrian Ho.
-rw-r--r--qmail-remote.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/qmail-remote.c b/qmail-remote.c
index 7d65473..6941ba4 100644
--- a/qmail-remote.c
+++ b/qmail-remote.c
@@ -222,13 +222,17 @@ void smtp()
int flagbother;
int i;
- if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
+ code = smtpcode();
+ if (code >= 500) quit("DConnected to "," but greeting failed");
+ if (code != 220) quit("ZConnected to "," but greeting failed");
substdio_puts(&smtpto,"HELO ");
substdio_put(&smtpto,helohost.s,helohost.len);
substdio_puts(&smtpto,"\r\n");
substdio_flush(&smtpto);
- if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
+ code = smtpcode();
+ if (code >= 500) quit("DConnected to "," but my name was rejected");
+ if (code != 250) quit("ZConnected to "," but my name was rejected");
substdio_puts(&smtpto,"MAIL FROM:<");
substdio_put(&smtpto,sender.s,sender.len);