Skip to content

Commit

Permalink
submission: relay backend: Use smtp_reply_is_success() to evaluate re…
Browse files Browse the repository at this point in the history
…ply form relay.

Before, it evaluated the reply status directly.
  • Loading branch information
stephanbosch committed Oct 15, 2018
1 parent cb3e468 commit 3cda72f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/submission/submission-backend-relay.c
Expand Up @@ -205,7 +205,7 @@ relay_cmd_helo_callback(const struct smtp_reply *relay_reply,
if (!backend_relay_handle_relay_reply(backend, relay_reply, &reply))
return;

if ((relay_reply->status / 100) == 2) {
if (smtp_reply_is_success(relay_reply)) {
relay_cmd_helo_reply(cmd, helo);
} else {
/* RFC 2034, Section 4:
Expand Down Expand Up @@ -313,7 +313,7 @@ relay_cmd_mail_callback(const struct smtp_reply *relay_reply,
if (!backend_relay_handle_relay_reply(backend, relay_reply, &reply))
return;

if ((relay_reply->status / 100) == 2) {
if (smtp_reply_is_success(relay_reply)) {
/* if relay accepts it, we accept it too */

/* the default 2.0.0 code won't do */
Expand Down Expand Up @@ -460,7 +460,7 @@ relay_cmd_rcpt_callback(const struct smtp_reply *relay_reply,
if (!backend_relay_handle_relay_reply(backend, relay_reply, &reply))
return;

if ((relay_reply->status / 100) == 2) {
if (smtp_reply_is_success(relay_reply)) {
/* the default 2.0.0 code won't do */
if (!smtp_reply_has_enhanced_code(relay_reply))
reply.enhanced_code = SMTP_REPLY_ENH_CODE(2, 1, 5);
Expand Down Expand Up @@ -583,7 +583,7 @@ relay_cmd_data_callback(const struct smtp_reply *relay_reply,
if (!backend_relay_handle_relay_reply(backend, relay_reply, &reply))
return;

if (relay_reply->status / 100 == 2) {
if (smtp_reply_is_success(relay_reply)) {
i_info("Successfully relayed message: "
"from=<%s>, size=%"PRIuUOFF_T", "
"id=%s, nrcpt=%u, reply=`%s'",
Expand Down Expand Up @@ -704,7 +704,7 @@ relay_cmd_noop_callback(const struct smtp_reply *relay_reply,
if (!backend_relay_handle_relay_reply(backend, relay_reply, &reply))
return;

if ((relay_reply->status / 100) == 2) {
if (smtp_reply_is_success(relay_reply)) {
smtp_server_reply(cmd, 250, "2.0.0", "OK");
} else {
smtp_server_reply_forward(cmd, &reply);
Expand Down Expand Up @@ -921,7 +921,7 @@ static void backend_relay_ready_cb(const struct smtp_reply *reply,
struct client *client = backend->backend.client;

/* check relay status */
if ((reply->status / 100) != 2) {
if (!smtp_reply_is_success(reply)) {
i_error("Failed to establish relay connection: %s",
smtp_reply_log(reply));
client_destroy(client,
Expand Down

0 comments on commit 3cda72f

Please sign in to comment.