summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2014-11-20 16:13:22 +0000
committerJonathan Rose <jrose@digium.com>2014-11-20 16:13:22 +0000
commitddc3f4846f3b3d509cdb5f49f0d823de059f737a (patch)
treee6550547f6a7cd05ac2bcd11e41f1b2fc28ee2aa
parent19ba0d136348e1325e572dba4dd6c53af21d29b7 (diff)
PJSIP ACLs: Fix ACLs not loading on startup and apply/acl issues on contact
The biggest problem this patch fixes is that ACLs weren't previously being loaded when the res_pjsip_acl module was loaded. Yikes. In addition, the ACL options contact_permit and contact_acl were effectively interpreted as contact_deny and this patch fixes that as well. AST-1418 #close Reported by: Thomas Thompson Review: https://reviewboard.asterisk.org/r/4120/ ASTERISK-24531 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4171/ ........ Merged revisions 428333 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@428343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--res/res_pjsip_acl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/res/res_pjsip_acl.c b/res/res_pjsip_acl.c
index 8155bf880..115d1b860 100644
--- a/res/res_pjsip_acl.c
+++ b/res/res_pjsip_acl.c
@@ -233,8 +233,9 @@ static int acl_handler(const struct aco_option *opt, struct ast_variable *var, v
struct ast_sip_acl *sip_acl = obj;
int error = 0;
int ignore;
- if (!strncmp(var->name, "contact", 7)) {
- ast_append_acl(var->name + 7, var->value, &sip_acl->contact_acl, &error, &ignore);
+
+ if (!strncmp(var->name, "contact_", 8)) {
+ ast_append_acl(var->name + 8, var->value, &sip_acl->contact_acl, &error, &ignore);
} else {
ast_append_acl(var->name, var->value, &sip_acl->acl, &error, &ignore);
}
@@ -287,6 +288,8 @@ static int load_module(void)
ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "contact_deny", "", acl_handler, NULL, NULL, 0, 0);
ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "contact_acl", "", acl_handler, NULL, NULL, 0, 0);
+ ast_sorcery_load_object(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE);
+
ast_sip_register_service(&acl_module);
return AST_MODULE_LOAD_SUCCESS;
}