Skip to content

Commit

Permalink
Format code. Safe usage of spfresult
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbf committed Jul 17, 2018
1 parent 8942e67 commit ce2f34e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions smf-spf.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,15 +836,18 @@ static sfsistat smf_envfrom(SMFICTX *ctx, char **args) {
break;
}
if (status == SPF_RESULT_TEMPERROR && !conf.accept_temperror) {
char reject[2 * MAXLINE];

snprintf(reject, sizeof(reject), "Found a problem processing SFP for %s. Error: %s", context->sender, SPF_strreason(spf_response->reason));
if (spf_response) SPF_response_free(spf_response);
if (spf_request) SPF_request_free(spf_request);
if (spf_server) SPF_server_free(spf_server);
smfi_setreply(ctx, "451" , "4.4.3", reject);
return SMFIS_TEMPFAIL;
}
char reject[2 * MAXLINE];
if (spf_response) {
snprintf(reject, sizeof(reject), "Found a problem processing SFP for %s. Error: (no reason)", context->sender);
} else {
snprintf(reject, sizeof(reject), "Found a problem processing SFP for %s. Error: %s", context->sender, SPF_strreason(spf_response->reason));
}
if (spf_response) SPF_response_free(spf_response);
if (spf_request) SPF_request_free(spf_request);
if (spf_server) SPF_server_free(spf_server);
smfi_setreply(ctx, "451" , "4.4.3", reject);
return SMFIS_TEMPFAIL;
}
if (status == SPF_RESULT_FAIL && conf.refuse_fail && !conf.tos) {
char reject[2 * MAXLINE];

Expand Down

0 comments on commit ce2f34e

Please sign in to comment.