Skip to content

Commit

Permalink
auth: Log policy decisions clearly
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse authored and villesavolainen committed Feb 6, 2019
1 parent 1eeb837 commit 54105bd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/auth/auth-request.c
Expand Up @@ -1026,9 +1026,22 @@ static
void auth_request_policy_check_callback(int result, void *context)
{
struct auth_policy_check_ctx *ctx = context;
const char *action;

ctx->request->policy_processed = TRUE;

if (result < 0)
action = "drop connection";
else if (result == 0)
action = "continue";
else
action = t_strdup_printf("tarpit %d second(s)", result);
if (result != 0)
auth_request_log_info(ctx->request, "policy", "Policy check action is %s",
action);
else
auth_request_log_debug(ctx->request, "policy", "Policy check action is %s",
action);
if (result == -1) {
/* fail it right here and now */
auth_request_fail(ctx->request);
Expand Down

0 comments on commit 54105bd

Please sign in to comment.