]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6353 regression from 7ba257ecd6c7ced584acbde9122479e885964795
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Mar 2014 22:33:26 +0000 (18:33 -0400)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Mar 2014 22:34:08 +0000 (18:34 -0400)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_reg.c

index 14446458591b62bc532c309aa5954a329315680c..5f68a5973d5f84aa60a160ba3ec62d62e8b6c31e 100644 (file)
@@ -953,7 +953,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session);
 uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
                                                                  sofia_dispatch_event_t *de,
                                                                  sofia_regtype_t regtype, char *key,
-                                                                 uint32_t keylen, switch_event_t **v_event, const char *is_nat, sofia_private_t **sofia_private_p, switch_xml_t *user_xml, char *sw_acl_token);
+                                                                 uint32_t keylen, switch_event_t **v_event, const char *is_nat, sofia_private_t **sofia_private_p, switch_xml_t *user_xml, const char *sw_acl_token);
 #define sofia_reg_handle_register(_nua_, _profile_, _nh_, _sip_, _de_, _regtype_, _key_, _keylen_, _v_event_, _is_nat_, _sofia_private_p_, _user_xml_) sofia_reg_handle_register_token(_nua_, _profile_, _nh_, _sip_, _de_, _regtype_, _key_, _keylen_, _v_event_, _is_nat_, _sofia_private_p_, _user_xml_, NULL)
 extern switch_endpoint_interface_t *sofia_endpoint_interface;
 void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
index f089e23829a1897f07ae73c5cfc648a32f063ee2..43f6f75313a1a86a3439f050dbffcac667f455ec 100644 (file)
@@ -1128,7 +1128,7 @@ void sofia_reg_close_handles(sofia_profile_t *profile)
 
 uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
                                                                sofia_dispatch_event_t *de, sofia_regtype_t regtype, char *key,
-                                                                 uint32_t keylen, switch_event_t **v_event, const char *is_nat, sofia_private_t **sofia_private_p, switch_xml_t *user_xml, char *sw_acl_token)
+                                                                 uint32_t keylen, switch_event_t **v_event, const char *is_nat, sofia_private_t **sofia_private_p, switch_xml_t *user_xml, const char *sw_acl_token)
 {
        sip_to_t const *to = NULL;
        sip_from_t const *from = NULL;
@@ -1184,6 +1184,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
        sofia_private_t *sofia_private = NULL;
        char *sw_to_user;
        char *sw_reg_host;
+       char *token_val = NULL;
 
        if (sofia_private_p) {
                sofia_private = *sofia_private_p;
@@ -1410,8 +1411,10 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
 
        if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && sofia_test_pflag(profile, PFLAG_BLIND_REG))) {
                regtype = REG_REGISTER;
-               if (sw_acl_token) {
-                       switch_split_user_domain(sw_acl_token, &sw_to_user, &sw_reg_host);
+               if (!zstr(sw_acl_token)) {
+                       token_val = strdup(sw_acl_token);
+
+                       switch_split_user_domain(token_val, &sw_to_user, &sw_reg_host);
                        to_user = sw_to_user;
                        reg_host = sw_reg_host;
                }
@@ -2064,6 +2067,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
        switch_safe_free(dup_mwi_account);
        switch_safe_free(utmp);
        switch_safe_free(path_val);
+       switch_safe_free(token_val);
 
        if (auth_params) {
                switch_event_destroy(&auth_params);
@@ -2084,7 +2088,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
        sofia_regtype_t type = REG_REGISTER;
        int network_port = 0;
        char *is_nat = NULL;
-       char acl_token[512] = "";
+       const char *acl_token = NULL;
 
 
 #if 0 /* This seems to cause undesirable effects so nevermind */
@@ -2173,9 +2177,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
 
                if (ok && !sofia_test_pflag(profile, PFLAG_BLIND_REG)) {
                        type = REG_AUTO_REGISTER;
-                       if (token_sw) {
-                               switch_set_string(acl_token, token_sw);
-                       }
+                       acl_token = token_sw;
                } else if (!ok) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by register acl \"%s\"\n", network_ip, profile->reg_acl[x]);
                        nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());