mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-16 05:07:06 +00:00
use profile flag instead
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15655 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
383541f3d0
commit
c48ccd9e95
@ -201,6 +201,7 @@ typedef enum {
|
|||||||
PFLAG_SIPCOMPACT,
|
PFLAG_SIPCOMPACT,
|
||||||
PFLAG_SQL_IN_TRANS,
|
PFLAG_SQL_IN_TRANS,
|
||||||
PFLAG_PASS_CALLEE_ID,
|
PFLAG_PASS_CALLEE_ID,
|
||||||
|
PFLAG_LOG_AUTH_FAIL,
|
||||||
/* No new flags below this line */
|
/* No new flags below this line */
|
||||||
PFLAG_MAX
|
PFLAG_MAX
|
||||||
} PFLAGS;
|
} PFLAGS;
|
||||||
@ -517,7 +518,6 @@ struct sofia_profile {
|
|||||||
uint32_t timer_t4;
|
uint32_t timer_t4;
|
||||||
char *contact_user;
|
char *contact_user;
|
||||||
char *local_network;
|
char *local_network;
|
||||||
int log_auth_failures;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct private_object {
|
struct private_object {
|
||||||
|
@ -1888,7 +1888,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||||||
} else if (!strcasecmp(var, "auto-restart")) {
|
} else if (!strcasecmp(var, "auto-restart")) {
|
||||||
profile->auto_restart = switch_true(val);
|
profile->auto_restart = switch_true(val);
|
||||||
} else if (!strcasecmp(var, "log-auth-failures")) {
|
} else if (!strcasecmp(var, "log-auth-failures")) {
|
||||||
profile->log_auth_failures = switch_true(val);
|
if (switch_true(val)) {
|
||||||
|
sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||||
|
} else {
|
||||||
|
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||||
|
}
|
||||||
} else if (!strcasecmp(var, "dtmf-type")) {
|
} else if (!strcasecmp(var, "dtmf-type")) {
|
||||||
if (!strcasecmp(val, "rfc2833")) {
|
if (!strcasecmp(val, "rfc2833")) {
|
||||||
profile->dtmf_type = DTMF_2833;
|
profile->dtmf_type = DTMF_2833;
|
||||||
@ -2417,7 +2421,6 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
|
sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
|
||||||
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
|
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
|
||||||
sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
|
sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
|
||||||
profile->log_auth_failures = 0;
|
|
||||||
|
|
||||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
@ -2446,7 +2449,11 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||||||
} else if (!strcasecmp(var, "auto-restart")) {
|
} else if (!strcasecmp(var, "auto-restart")) {
|
||||||
profile->auto_restart = switch_true(val);
|
profile->auto_restart = switch_true(val);
|
||||||
} else if (!strcasecmp(var, "log-auth-failures")) {
|
} else if (!strcasecmp(var, "log-auth-failures")) {
|
||||||
profile->log_auth_failures = switch_true(val);
|
if (switch_true(val)) {
|
||||||
|
sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||||
|
} else {
|
||||||
|
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||||
|
}
|
||||||
} else if (!strcasecmp(var, "dtmf-type")) {
|
} else if (!strcasecmp(var, "dtmf-type")) {
|
||||||
if (!strcasecmp(val, "rfc2833")) {
|
if (!strcasecmp(val, "rfc2833")) {
|
||||||
profile->dtmf_type = DTMF_2833;
|
profile->dtmf_type = DTMF_2833;
|
||||||
|
@ -976,7 +976,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
|||||||
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
|
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
|
||||||
|
|
||||||
/* Log line added to support Fail2Ban */
|
/* Log line added to support Fail2Ban */
|
||||||
if ( profile->log_auth_failures ) {
|
if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
|
||||||
if (regtype == REG_REGISTER) {
|
if (regtype == REG_REGISTER) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (REGISTER) on sofia profile '%s' "
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (REGISTER) on sofia profile '%s' "
|
||||||
"for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
|
"for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user