]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Destroy variables on a sip_pvt before copying vars from the sip_peer.
authorDavid Vossel <dvossel@digium.com>
Fri, 20 May 2011 16:38:28 +0000 (16:38 +0000)
committerDavid Vossel <dvossel@digium.com>
Fri, 20 May 2011 16:38:28 +0000 (16:38 +0000)
(closes issue #19202)
Reported by: wdoekes
Patches:
      issue19202_destroy_challenged_invite_chanvars.patch uploaded by wdoekes (license 717)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@320055 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index e38f8c31322c60625e95f36f98f2f8287439d690..5837e0e67370b7b5f16d941350459fbf76c88dc5 100644 (file)
@@ -10749,7 +10749,9 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
                ast_copy_flags(&p->flags[0], &user->flags[0], SIP_FLAGS_TO_COPY);
                ast_copy_flags(&p->flags[1], &user->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
                if (sipmethod == SIP_INVITE) {
-                       /* copy channel vars */
+                       /* destroy old channel vars and copy new channel vars */
+                       ast_variables_destroy(p->chanvars);
+                       p->chanvars = NULL;
                        for (v = user->chanvars ; v ; v = v->next) {
                                if ((tmpvar = ast_variable_new(v->name, v->value))) {
                                        tmpvar->next = p->chanvars; 
@@ -10909,7 +10911,9 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ
                                ast_string_field_set(p, authname, peer->name);
 
                                if (sipmethod == SIP_INVITE) {
-                                       /* copy channel vars */
+                                       /* destroy old channel vars and copy new channel vars */
+                                       ast_variables_destroy(p->chanvars);
+                                       p->chanvars = NULL;
                                        for (v = peer->chanvars ; v ; v = v->next) {
                                                if ((tmpvar = ast_variable_new(v->name, v->value))) {
                                                        tmpvar->next = p->chanvars;