[asterisk-commits] kharwell: branch kharwell/pimp_sip_security r390389 - in /team/kharwell/pimp_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 3 18:07:48 CDT 2013


Author: kharwell
Date: Mon Jun  3 18:07:47 2013
New Revision: 390389

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390389
Log:
addressed review issues

Modified:
    team/kharwell/pimp_sip_security/res/res_sip/config_security.c
    team/kharwell/pimp_sip_security/res/res_sip/sip_distributor.c
    team/kharwell/pimp_sip_security/res/res_sip_acl.c
    team/kharwell/pimp_sip_security/res/res_sip_outbound_authenticator_digest.c

Modified: team/kharwell/pimp_sip_security/res/res_sip/config_security.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_security/res/res_sip/config_security.c?view=diff&rev=390389&r1=390388&r2=390389
==============================================================================
--- team/kharwell/pimp_sip_security/res/res_sip/config_security.c (original)
+++ team/kharwell/pimp_sip_security/res/res_sip/config_security.c Mon Jun  3 18:07:47 2013
@@ -34,13 +34,14 @@
 static int acl_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
 {
 	struct ast_sip_security *security = obj;
-	int error;
+	int error = 0;
 	int ignore;
 	if (!strncmp(var->name, "contact", 7)) {
 		ast_append_acl(var->name + 7, var->value, &security->contact_acl, &error, &ignore);
 	} else {
 		ast_append_acl(var->name, var->value, &security->acl, &error, &ignore);
 	}
+	ast_log(LOG_VERBOSE, "ERROR ERROR = %d\n", error);
 	return error;
 }
 

Modified: team/kharwell/pimp_sip_security/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_security/res/res_sip/sip_distributor.c?view=diff&rev=390389&r1=390388&r2=390389
==============================================================================
--- team/kharwell/pimp_sip_security/res/res_sip/sip_distributor.c (original)
+++ team/kharwell/pimp_sip_security/res/res_sip/sip_distributor.c Mon Jun  3 18:07:47 2013
@@ -135,7 +135,6 @@
 		return;
 	}
 
-	ao2_ref(artificial_auth, +1);
 	ast_string_field_set(artificial_auth, realm, "asterisk");
 	ast_string_field_set(artificial_auth, auth_user, "");
 	ast_string_field_set(artificial_auth, auth_pass, "");
@@ -160,7 +159,6 @@
 		return;
 	}
 
-	ao2_ref(artificial_endpoint, +1);
 	artificial_endpoint->num_inbound_auths = 1;
 }
 

Modified: team/kharwell/pimp_sip_security/res/res_sip_acl.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_security/res/res_sip_acl.c?view=diff&rev=390389&r1=390388&r2=390389
==============================================================================
--- team/kharwell/pimp_sip_security/res/res_sip_acl.c (original)
+++ team/kharwell/pimp_sip_security/res/res_sip_acl.c Mon Jun  3 18:07:47 2013
@@ -166,25 +166,17 @@
 
 static pj_bool_t acl_on_rx_msg(pjsip_rx_data *rdata)
 {
-	int forbidden = 0;
-	struct ao2_container *acls = ast_sorcery_retrieve_by_fields(
+	RAII_VAR(struct ao2_container *, acls, ast_sorcery_retrieve_by_fields(
 		ast_sip_get_sorcery(), SIP_SORCERY_SECURITY_TYPE,
-		AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
-	struct ast_sip_security *matched_acl;
+		AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL), ao2_cleanup);
+	RAII_VAR(struct ast_sip_security *, matched_acl, NULL, ao2_cleanup);
 
 	if (!acls) {
 		ast_log(LOG_ERROR, "Unable to retrieve ACL sorcery data\n");
 		return PJ_FALSE;
 	}
 
-	matched_acl = ao2_callback(acls, 0, check_acls, rdata);
-	if (matched_acl) {
-		forbidden = 1;
-		ao2_ref(matched_acl, -1);
-	}
-	ao2_ref(acls, -1);
-
-	if (forbidden) {
+	if ((matched_acl = ao2_callback(acls, 0, check_acls, rdata))) {
 		if (rdata->msg_info.msg->line.req.method.id != PJSIP_ACK_METHOD) {
 			pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);
 		}

Modified: team/kharwell/pimp_sip_security/res/res_sip_outbound_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_security/res/res_sip_outbound_authenticator_digest.c?view=diff&rev=390389&r1=390388&r2=390389
==============================================================================
--- team/kharwell/pimp_sip_security/res/res_sip_outbound_authenticator_digest.c (original)
+++ team/kharwell/pimp_sip_security/res/res_sip_outbound_authenticator_digest.c Mon Jun  3 18:07:47 2013
@@ -58,6 +58,7 @@
 			break;
 		case AST_SIP_AUTH_TYPE_ARTIFICIAL:
 			ast_log(LOG_ERROR, "Trying to set artificial outbound auth credentials shouldn't happen.\n");
+			break;
 		}
 	}
 




More information about the asterisk-commits mailing list