Skip to content

Commit d809de0

Browse files
committed
app_verify: Include gateway-via node in verbose messages for Verify().
It is often desirable to be able to easily identify the node from which a call is passing through; the node identifier is now included in such messages to help identify. In res_phreaknet, also include the OUTVERIFYSTATUS in log messages.
1 parent fc1ff02 commit d809de0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

apps/app_verify.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@ static int verify_exec(struct ast_channel *chan, const char *data)
11921192
int curl, method, extendtrust, allowtoken, sanitychecks, threshold, blacklist_failopen;
11931193
char name[AST_MAX_CONTEXT], verifyrequest[PATH_MAX], verifycontext[AST_MAX_CONTEXT], local_var[AST_MAX_CONTEXT], stirshaken_var[AST_MAX_CONTEXT], remote_stirshaken_var[AST_MAX_CONTEXT], remote_var[AST_MAX_CONTEXT], via_remote_var[AST_MAX_CONTEXT], token_remote_var[AST_MAX_CONTEXT], validatetokenrequest[PATH_MAX], code_good[PATH_MAX], code_fail[PATH_MAX], code_spoof[PATH_MAX], exceptioncontext[PATH_MAX], setinvars[PATH_MAX], failgroup[PATH_MAX], failureaction[PATH_MAX], failurefile[PATH_MAX], failurelocation[PATH_MAX], successregex[PATH_MAX], blacklist_endpoint[PATH_MAX], loglevel[AST_MAX_CONTEXT], logmsg[PATH_MAX];
11941194
float blacklist_threshold;
1195+
char via[64] = { 0 };
11951196

11961197
AST_DECLARE_APP_ARGS(args,
11971198
AST_APP_ARG(profile);
@@ -1397,7 +1398,6 @@ static int verify_exec(struct ast_channel *chan, const char *data)
13971398
}
13981399
} else { /* reverse */
13991400
char remote_result[64] = { 0 };
1400-
char via[64] = { 0 };
14011401
char peerip[50]; /* more than the max IP address size */
14021402
char *dialstring, *peer;
14031403
char ip[50];
@@ -1559,11 +1559,19 @@ static int verify_exec(struct ast_channel *chan, const char *data)
15591559
}
15601560
success: /* only as a branch, if we fall through to here, that doesn't necessarily mean success */
15611561
verify_set_var(chan, local_var, vresult);
1562-
ast_verb(3, "Verification result for %s (%s) is '%s' (SUCCESS)\n", callerid, name, vresult ? vresult : "(null)");
1562+
if (viaverify) {
1563+
ast_verb(3, "Verification result for %s (%s, via %s) is '%s' (SUCCESS)\n", callerid, name, via, vresult ? vresult : "(null)");
1564+
} else {
1565+
ast_verb(3, "Verification result for %s (%s) is '%s' (SUCCESS)\n", callerid, name, vresult ? vresult : "(null)");
1566+
}
15631567
goto done;
15641568
fail:
15651569
verify_set_var(chan, local_var, viaverify ? code_spoof : code_fail);
1566-
ast_verb(3, "Verification result for %s (%s) is '%s' (FAILURE)\n", callerid, name, viaverify ? (*code_spoof ? code_spoof : "(null)") : (*code_fail ? code_fail : "(null)"));
1570+
if (viaverify) {
1571+
ast_verb(3, "Verification result for %s (%s, via %s) is '%s' (FAILURE)\n", callerid, name, via, viaverify ? (*code_spoof ? code_spoof : "(null)") : (*code_fail ? code_fail : "(null)"));
1572+
} else {
1573+
ast_verb(3, "Verification result for %s (%s) is '%s' (FAILURE)\n", callerid, name, viaverify ? (*code_spoof ? code_spoof : "(null)") : (*code_fail ? code_fail : "(null)"));
1574+
}
15671575
}
15681576

15691577
done:

res/res_phreaknet.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,11 +2002,10 @@ static int outverify(struct ast_channel *chan, const char *lookup)
20022002
varval = pbx_builtin_getvar_helper(chan, "OUTVERIFYSTATUS");
20032003
/* Protect against channel attacks, bad lookups, local IP attacks, etc. Bail on bad lookup. */
20042004
proceed = !strcmp(varval, "PROCEED");
2005-
ast_channel_unlock(chan);
2006-
20072005
if (!proceed) {
2008-
ast_log(LOG_WARNING, "Lookup failed validation: %s\n", lookup);
2006+
ast_log(LOG_WARNING, "Lookup failed validation: %s (OUTVERIFYSTATUS = %s)\n", lookup, S_OR(varval, ""));
20092007
}
2008+
ast_channel_unlock(chan);
20102009

20112010
return proceed ? 0 : 1;
20122011
}

0 commit comments

Comments
 (0)