]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror fix from trunk.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 26 Mar 2014 21:17:02 +0000 (21:17 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 26 Mar 2014 21:17:02 +0000 (21:17 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11745 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
backend/ipp.c

index c03be409e13c3151d2d7d725eb81f889bcbab84a..3f35ada177d62cac2de37fcc116807e6305c8567 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES.txt - 1.7.2 - 2014-03-25
+CHANGES.txt - 1.7.2 - 2014-03-26
 --------------------------------
 
 CHANGES IN CUPS V1.7.2
@@ -10,6 +10,8 @@ CHANGES IN CUPS V1.7.2
        - Added a German localization (STR #4363)
        - Fixed documentation and naming of Create-Job/Printer-Subscriptions
          operations (STR #4389)
+       - Phone numbers in fax jobs were not properly filtered for IPP FaxOut
+         (<rdar://problem/16351701>)
        - Updated Linux "relro" support (STR #4349)
        - cupsEnumDests did not set the "is_default" field (STR #4332)
        - cupsDoIORequest could miss the server status, causing failed lpadmin
index 2f19e3d37dd8db30cb48c5fae37c53d852595807..f1baa93d954899d39d5354c6d65134ac81e29e94 100644 (file)
@@ -2877,14 +2877,51 @@ new_request(
       if ((keyword = cupsGetOption("phone", num_options, options)) != NULL)
       {
        ipp_t   *destination;           /* destination collection */
-       char    tel_uri[1024];          /* tel: URI */
+       char    phone[1024],            /* Phone number string */
+               ch,                     /* Character from phone string */
+               *ptr,                   /* Pointer into string */
+               tel_uri[1024];          /* tel: URI */
+        static const char * const allowed = "0123456789#*-+.()";
+                                       /* Allowed characters */
 
         destination = ippNew();
 
-        httpAssembleURI(HTTP_URI_CODING_ALL, tel_uri, sizeof(tel_uri), "tel",
-                        NULL, NULL, 0, keyword);
-        ippAddString(destination, IPP_TAG_JOB, IPP_TAG_URI, "destination-uri",
-                     NULL, tel_uri);
+       /*
+        * Unescape and filter out spaces and other characters that are not
+        * allowed in a tel: URI.
+        */
+
+        for (ptr = phone; *keyword && ptr < (phone + sizeof(phone) - 1);)
+        {
+          ch = *keyword++;
+          if (ch == '%')
+          {
+            if (*keyword >= '0' && *keyword <= '9')
+              ch = (*keyword++ - '0') << 4;
+            else if (*keyword >= 'a' && *keyword <= 'f')
+              ch = (*keyword++ - 'a' + 10) << 4;
+            else if (*keyword >= 'A' && *keyword <= 'F')
+              ch = (*keyword++ - 'A' + 10) << 4;
+            else
+              continue;
+
+            if (*keyword >= '0' && *keyword <= '9')
+              ch += *keyword++ - '0';
+            else if (*keyword >= 'a' && *keyword <= 'f')
+              ch += *keyword++ - 'a' + 10;
+            else if (*keyword >= 'A' && *keyword <= 'F')
+              ch += *keyword++ - 'A' + 10;
+            else
+              continue;
+          }
+
+          if (strchr(allowed, ch))
+            *ptr++ = ch;
+        }
+
+        *ptr = '\0';
+        httpAssembleURI(HTTP_URI_CODING_ALL, tel_uri, sizeof(tel_uri), "tel", NULL, NULL, 0, phone);
+        ippAddString(destination, IPP_TAG_JOB, IPP_TAG_URI, "destination-uri", NULL, tel_uri);
 
        if ((keyword = cupsGetOption("faxPrefix", num_options,
                                     options)) != NULL && *keyword)