apps/app_verify.c
static void profile_set_param(struct call_verify *v, const char *param, const char *val, int linenum, int failunknown)
{
	VERIFY_LOAD_STR_PARAM(verifymethod, !strcasecmp(val, "direct") || !strcasecmp(val, "reverse") || !strcasecmp(val, "regex") || !strcasecmp(val, "pattern"));
	VERIFY_LOAD_STR_PARAM(requestmethod, !strcasecmp(val, "curl") || !strcasecmp(val, "enum"));
	VERIFY_LOAD_STR_PARAM(verifyrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(verifycontext, val[0]);
	VERIFY_LOAD_STR_PARAM(validatetokenrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(obtaintokenrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(local_var, val[0] && !contains_whitespace(val)); /* could cause bad things to happen if we try setting a var name with spaces */
	VERIFY_LOAD_STR_PARAM(via_number, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(via_remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(token_remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(setinvars, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(setoutvars, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_INT_PARAM(sanitychecks, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(extendtrust, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(allowtoken, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(flagprivateip, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_STR_PARAM(successregex, val[0]);
	VERIFY_LOAD_STR_PARAM(blacklist_endpoint, val[0]);
	VERIFY_LOAD_FLOAT_PARAM(blacklist_threshold, val[0]);
	VERIFY_LOAD_INT_PARAM(blacklist_failopen, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_STR_PARAM(outregex, val[0]);
	VERIFY_LOAD_STR_PARAM(exceptioncontext, val[0]);
	VERIFY_LOAD_STR_PARAM(failureaction, !strcasecmp(val, "nothing") || !strcasecmp(val, "hangup") || !strcasecmp(val, "playback") || !strcasecmp(val, "redirect"));
	VERIFY_LOAD_STR_PARAM(failurefile, val[0]);
	VERIFY_LOAD_STR_PARAM(failurelocation, val[0]);
	VERIFY_LOAD_STR_PARAM(region, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(clli, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(failgroup, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(code_good, val[0]);
	VERIFY_LOAD_STR_PARAM(code_fail, val[0]);
	VERIFY_LOAD_STR_PARAM(code_requestfail, val[0]);
	VERIFY_LOAD_STR_PARAM(code_spoof, val[0]);
	VERIFY_LOAD_STR_PARAM(loglevel, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(logmsg, val[0]);

	if (!strcasecmp(param, "threshold")) { /* this is parsing an actual number, not turning yes or no into a 1 or 0 */
		if (ast_str_to_int(val, &v->threshold) || v->threshold < 0) {
			ast_log(LOG_WARNING, "Invalid %s: '%s'\n", param, val);
			v->threshold = 0;
		}
		return;
	}
	if (failunknown) {
		if (linenum >= 0) {
			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s at line %d of verify.conf\n", v->name, param, linenum);
		} else {
			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s\n", v->name, param);
		}
	}
}
/*! \brief Set parameter in profile from configuration file */
\brief Set parameter in profile from configuration file
\ brief Set parameter in profile from configuration file
static void profile_set_param(struct call_verify *v, const char *param, const char *val, int linenum, int failunknown)
{
	VERIFY_LOAD_STR_PARAM(verifymethod, !strcasecmp(val, "direct") || !strcasecmp(val, "reverse") || !strcasecmp(val, "regex") || !strcasecmp(val, "pattern"));
	VERIFY_LOAD_STR_PARAM(requestmethod, !strcasecmp(val, "curl") || !strcasecmp(val, "enum"));
	VERIFY_LOAD_STR_PARAM(verifyrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(verifycontext, val[0]);
	VERIFY_LOAD_STR_PARAM(validatetokenrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(obtaintokenrequest, val[0]);
	VERIFY_LOAD_STR_PARAM(local_var, val[0] && !contains_whitespace(val)); 
	VERIFY_LOAD_STR_PARAM(via_number, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(via_remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(token_remote_var, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(setinvars, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(setoutvars, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_INT_PARAM(sanitychecks, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(extendtrust, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(allowtoken, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_INT_PARAM(flagprivateip, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_STR_PARAM(successregex, val[0]);
	VERIFY_LOAD_STR_PARAM(blacklist_endpoint, val[0]);
	VERIFY_LOAD_FLOAT_PARAM(blacklist_threshold, val[0]);
	VERIFY_LOAD_INT_PARAM(blacklist_failopen, !strcasecmp(val, "yes") || !strcasecmp(val, "no"));
	VERIFY_LOAD_STR_PARAM(outregex, val[0]);
	VERIFY_LOAD_STR_PARAM(exceptioncontext, val[0]);
	VERIFY_LOAD_STR_PARAM(failureaction, !strcasecmp(val, "nothing") || !strcasecmp(val, "hangup") || !strcasecmp(val, "playback") || !strcasecmp(val, "redirect"));
	VERIFY_LOAD_STR_PARAM(failurefile, val[0]);
	VERIFY_LOAD_STR_PARAM(failurelocation, val[0]);
	VERIFY_LOAD_STR_PARAM(region, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(clli, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(failgroup, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(code_good, val[0]);
	VERIFY_LOAD_STR_PARAM(code_fail, val[0]);
	VERIFY_LOAD_STR_PARAM(code_requestfail, val[0]);
	VERIFY_LOAD_STR_PARAM(code_spoof, val[0]);
	VERIFY_LOAD_STR_PARAM(loglevel, val[0] && !contains_whitespace(val));
	VERIFY_LOAD_STR_PARAM(logmsg, val[0]);
	if (!strcasecmp(param, "threshold")) { 
		if (ast_str_to_int(val, &v->threshold) || v->threshold < 0) {
			ast_log(LOG_WARNING, "Invalid %s: '%s'\n", param, val);
			v->threshold = 0;
		}
		return;
	}
	if (failunknown) {
		if (linenum >= 0) {
			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s at line %d of verify.conf\n", v->name, param, linenum);
		} else {
			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s\n", v->name, param);
		}
	}
}
static void profile_set_param ( struct call_verify * v , const char * param , const char * val , int linenum , int failunknown ) { VERIFY_LOAD_STR_PARAM ( verifymethod , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_STR_PARAM ( requestmethod , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_STR_PARAM ( verifyrequest , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( verifycontext , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( validatetokenrequest , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( obtaintokenrequest , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( local_var , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( via_number , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( remote_var , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( via_remote_var , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( token_remote_var , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( setinvars , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( setoutvars , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_INT_PARAM ( sanitychecks , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_INT_PARAM ( extendtrust , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_INT_PARAM ( allowtoken , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_INT_PARAM ( flagprivateip , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_STR_PARAM ( successregex , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( blacklist_endpoint , val [ 0 ] ) ; VERIFY_LOAD_FLOAT_PARAM ( blacklist_threshold , val [ 0 ] ) ; VERIFY_LOAD_INT_PARAM ( blacklist_failopen , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_STR_PARAM ( outregex , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( exceptioncontext , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( failureaction , ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) || ! strcasecmp ( val , " " ) ) ; VERIFY_LOAD_STR_PARAM ( failurefile , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( failurelocation , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( region , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( clli , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( failgroup , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( code_good , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( code_fail , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( code_requestfail , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( code_spoof , val [ 0 ] ) ; VERIFY_LOAD_STR_PARAM ( loglevel , val [ 0 ] && ! contains_whitespace ( val ) ) ; VERIFY_LOAD_STR_PARAM ( logmsg , val [ 0 ] ) ; if ( ! strcasecmp ( param , " " ) ) { if ( ast_str_to_int ( val , & v -> threshold ) || v -> threshold < 0 ) { ast_log ( LOG_WARNING , " \n " , param , val ) ; v -> threshold = 0 ; } return ; } if ( failunknown ) { if ( linenum >= 0 ) { ast_log ( LOG_WARNING , " \n " , v -> name , param , linenum ) ; } else { ast_log ( LOG_WARNING , " \n " , v -> name , param ) ; } } }
\brief Set parameter in profile from configuration file
\ brief Set parameter in profile from configuration file
/* could cause bad things to happen if we try setting a var name with spaces */ /* this is parsing an actual number, not turning yes or no into a 1 or 0 */