dovecot-2.0-sslstream: lmtp client: More fixes to handling RCPT ...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:12 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/353a30947b91
changeset: 10287:353a30947b91
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 09 20:03:42 2009 -0500
description:
lmtp client: More fixes to handling RCPT TO failures.

diffstat:

1 file changed, 15 insertions(+), 25 deletions(-)
src/lib-lda/lmtp-client.c |   40 +++++++++++++++-------------------------

diffs (50 lines):

diff -r aa8729e340ba -r 353a30947b91 src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Mon Nov 09 19:27:27 2009 -0500
+++ b/src/lib-lda/lmtp-client.c	Mon Nov 09 20:03:42 2009 -0500
@@ -183,31 +183,21 @@ lmtp_client_data_next(struct lmtp_client
 {
 	struct lmtp_rcpt *rcpt;
 	unsigned int i, count;
-	bool last = TRUE;
-
-	switch (client->protocol) {
-	case LMTP_CLIENT_PROTOCOL_SMTP:
-		i_assert(client->rcpt_next_data_idx == 0);
-
-		rcpt = array_get_modifiable(&client->recipients, &count);
-		for (i = 0; i < count; i++) {
-			rcpt[i].failed = line[0] != '2';
-			rcpt[i].data_callback(!rcpt[i].failed, line,
-					      rcpt[i].context);
-		}
-		client->rcpt_next_data_idx = count;
-		break;
-	case LMTP_CLIENT_PROTOCOL_LMTP:
-		rcpt = array_idx_modifiable(&client->recipients,
-					    client->rcpt_next_data_idx);
-		rcpt->failed = line[0] != '2';
-		last = ++client->rcpt_next_data_idx ==
-			array_count(&client->recipients);
-
-		rcpt->data_callback(!rcpt->failed, line, rcpt->context);
-		break;
-	}
-	return !last;
+
+	rcpt = array_get_modifiable(&client->recipients, &count);
+	for (i = client->rcpt_next_data_idx; i < count; i++) {
+		if (rcpt[i].failed) {
+			/* already called rcpt_to_callback with failure */
+			continue;
+		}
+
+		rcpt[i].failed = line[0] != '2';
+		rcpt[i].data_callback(!rcpt[i].failed, line,
+				      rcpt[i].context);
+		if (client->protocol == LMTP_CLIENT_PROTOCOL_LMTP)
+			break;
+	}
+	return i < count;
 }
 
 static void lmtp_client_send_data(struct lmtp_client *client)


More information about the dovecot-cvs mailing list