]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 79904 via svnmerge from
authorJason Parker <jparker@digium.com>
Fri, 17 Aug 2007 19:13:25 +0000 (19:13 +0000)
committerJason Parker <jparker@digium.com>
Fri, 17 Aug 2007 19:13:25 +0000 (19:13 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue #10430)
........
r79904 | qwell | 2007-08-17 14:12:19 -0500 (Fri, 17 Aug 2007) | 11 lines

Don't send a semicolon over the wire in sip notify messages.
Caused by fix for issue 9938.

I basically took the code that existed before 9938 was fixed, and
 copied it into a new function - ast_unescape_semicolon

There should be very few places this will be needed (pbx_config
 does NOT need this (see issue 9938 for details))

Issue 10430, patch by me, with help/ideas from murf (thanks murf).

........

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

channels/chan_sip.c
include/asterisk/strings.h
main/utils.c

index f8b0470670ab85e0c056061d5ba27f4893f8079d..7a95c1d76579ab108b4e207b613268007dd86386 100644 (file)
@@ -12310,7 +12310,7 @@ static int sip_notify(int fd, int argc, char *argv[])
                initreqprep(&req, p, SIP_NOTIFY);
 
                for (var = varlist; var; var = var->next)
-                       add_header(&req, var->name, var->value);
+                       add_header(&req, var->name, ast_unescape_semicolon(var->value));
 
                /* Recalculate our side, and recalculate Call ID */
                ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip);
index 8b0daab87bddf4a004f5d10e857c578372e709f2..76b58d7150192ad03e862bcd5c18e9c40b60a51b 100644 (file)
@@ -146,6 +146,13 @@ char *ast_strip(char *s),
  */
 char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes);
 
+/*!
+  \brief Strip backslash for "escaped" semicolons.
+  \brief s The string to be stripped (will be modified).
+  \return The stripped string.
+ */
+char *ast_unescape_semicolon(char *s);
+
 /*!
   \brief Size-limited null-terminating string copy.
   \arg dst The destination buffer.
index a73927e5ac704fcab9d1c3cdae541e630c7297b5..2b87e2b4a4105167edd2e5e8adebee49e101fe6a 100644 (file)
@@ -935,6 +935,21 @@ char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
        return s;
 }
 
+char *ast_unescape_semicolon(char *s)
+{
+       char *e;
+       char *work = s;
+
+       while ((e = strchr(work, ';'))) {
+               if ((e > work) && (*(e-1) == '\\')) {
+                       memmove(e - 1, e, strlen(e) + 1);
+                       work = e;
+               }
+       }
+
+       return s;
+}
+
 int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap)
 {
        int result;