]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't send a semicolon over the wire in sip notify messages.
authorJason Parker <jparker@digium.com>
Fri, 17 Aug 2007 19:12:19 +0000 (19:12 +0000)
committerJason Parker <jparker@digium.com>
Fri, 17 Aug 2007 19:12:19 +0000 (19:12 +0000)
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/branches/1.4@79904 65c4cc65-6c06-0410-ace0-fbb531ad65f3

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

index 9b41cd6802871ec74f752f48730f7f7385fccbd6..9bdc60e2daf162ac92a52a530dc54bef901fab0f 100644 (file)
@@ -11120,7 +11120,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 */
                if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip))
index fad6f27825b180b1ead83fe03f0412c552b94d0c..68ecb2048915e024964435a6a13522305384ca62 100644 (file)
@@ -141,6 +141,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.
   \param ast_copy_string function being used
index 8b2b86694cf8290309e9757555bb2a611cdf3c9d..56d3ffe85fa2d2f24f03176674da1b2ba6645f9f 100644 (file)
@@ -880,6 +880,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;