From 7f74f7fbc834f6153cf9edb983317a38a8137187 Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 20 Aug 2012 10:23:54 -0700 Subject: [PATCH] On accounting start and end properly error checking on new handle creation. --- .../xml_int/mod_xml_radius/mod_xml_radius.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c index 27219e0ea9..6dcfdbf197 100644 --- a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c +++ b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c @@ -573,7 +573,7 @@ switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) { } if ( mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs) != SWITCH_STATUS_SUCCESS ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle for digest invite authentication\n"); goto err; } @@ -681,7 +681,7 @@ switch_xml_t mod_xml_radius_auth_reg(switch_event_t *params) { } if ( mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs) != SWITCH_STATUS_SUCCESS ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle for registration authentication\n"); goto err; } @@ -849,6 +849,7 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc } switch_status_t mod_xml_radius_accounting_start(switch_core_session_t *session){ + switch_channel_t *channel = switch_core_session_get_channel(session); VALUE_PAIR *send = NULL; uint32_t service = PW_STATUS_START; rc_handle *new_handle = NULL; @@ -866,8 +867,9 @@ switch_status_t mod_xml_radius_accounting_start(switch_core_session_t *session){ goto end; } - if ( mod_xml_radius_new_handle(&new_handle, globals.acct_start_configs) != SWITCH_STATUS_SUCCESS ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle\n"); + if ( mod_xml_radius_new_handle(&new_handle, globals.acct_start_configs) != SWITCH_STATUS_SUCCESS || new_handle == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new accounting_start handle for call: %s\n", + swich_channel_get_variable(channel, "uuid")); goto end; } @@ -923,8 +925,9 @@ switch_status_t mod_xml_radius_accounting_end(switch_core_session_t *session){ goto end; } - if ( mod_xml_radius_new_handle(&new_handle, globals.acct_end_configs) != SWITCH_STATUS_SUCCESS ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle\n"); + if ( mod_xml_radius_new_handle(&new_handle, globals.acct_end_configs) != SWITCH_STATUS_SUCCESS || new_handle == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new accounting_end handle for call: %s\n", + swich_channel_get_variable(channel, "uuid")); goto end; } @@ -976,10 +979,10 @@ SWITCH_STANDARD_APP(radius_auth_handle) if (GLOBAL_DEBUG ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting app authentication\n"); } - - mod_xml_radius_new_handle(&new_handle, globals.auth_app_configs); - if ( new_handle == NULL ) { + if ( mod_xml_radius_new_handle(&new_handle, globals.auth_app_configs) != SWITCH_STATUS_SUCCESS || new_handle == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new authentication handle for call: %s\n", + swich_channel_get_variable(channel, "uuid")); goto err; }