]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Sides is a keyword value (as is media, normally...)
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 10 Feb 2003 17:58:12 +0000 (17:58 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 10 Feb 2003 17:58:12 +0000 (17:58 +0000)
Check the page-ranges attribute for correct ordering of values.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@3328 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
cups/encode.c
scheduler/ipp.c

index 6b3b35f51f9cdd2e000e87cfc2b090769f94adf3..4215731effda7adce1117158c5e65603242b95d2 100644 (file)
@@ -1,8 +1,12 @@
-CHANGES.txt - 02/05/2003
+CHANGES.txt - 02/10/2003
 ------------------------
 
 CHANGES IN CUPS V1.1.19
 
+       - The scheduler no longer accepts rangeOfInteger values
+         that are out of order (e.g. 5-1)
+       - The sides attribute was incorrectly sent as a name
+         value; it is a keyword value.
        - The IPP backend now detects if the destination queue
          has gone away and reports an error.
        - The scheduler now allocates its select() sets to
index 8ceb9e79f368603e0f8cc85c7783aaa33d957610..15e982b8e2c3450305e37f3934d8b2237920b2f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: encode.c,v 1.12 2003/01/24 20:39:40 mike Exp $"
+ * "$Id: encode.c,v 1.13 2003/02/10 17:58:11 mike Exp $"
  *
  *   Option encoding routines for the Common UNIX Printing System (CUPS).
  *
@@ -64,6 +64,7 @@ static const ipp_option_t ipp_options[] =
                          { "job-priority",             IPP_TAG_INTEGER },
                          { "job-quota-period",         IPP_TAG_INTEGER },
                          { "landscape",                IPP_TAG_BOOLEAN },
+                         { "media",                    IPP_TAG_KEYWORD },
                          { "mirror",                   IPP_TAG_BOOLEAN },
                          { "natural-scaling",          IPP_TAG_INTEGER },
                          { "number-up",                IPP_TAG_INTEGER },
@@ -80,6 +81,7 @@ static const ipp_option_t ipp_options[] =
                          { "print-quality",            IPP_TAG_ENUM },
                          { "saturation",               IPP_TAG_INTEGER },
                          { "scaling",                  IPP_TAG_INTEGER },
+                         { "sides",                    IPP_TAG_KEYWORD },
                          { "wrap",                     IPP_TAG_BOOLEAN }
                        };
 
@@ -380,5 +382,5 @@ cupsEncodeOptions(ipp_t         *ipp,               /* I - Request to add to */
 
 
 /*
- * End of "$Id: encode.c,v 1.12 2003/01/24 20:39:40 mike Exp $".
+ * End of "$Id: encode.c,v 1.13 2003/02/10 17:58:11 mike Exp $".
  */
index 0d1cc9a6ed02d3f38993bb8696878f84bf629690..34d2395309c563b6cfb9aaef6bf49f6b65f89163 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.187 2003/02/05 21:10:16 mike Exp $"
+ * "$Id: ipp.c,v 1.188 2003/02/10 17:58:12 mike Exp $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -2115,6 +2115,8 @@ create_job(client_t        *con,  /* I - Client connection */
   int                  port;           /* Port portion of URI */
   printer_t            *printer;       /* Printer data */
   int                  kbytes;         /* Size of print file */
+  int                  i;              /* Looping var */
+  int                  lowerpagerange; /* Page range bound */
 
 
   LogMessage(L_DEBUG2, "create_job(%p[%d], %s)\n", con, con->http.fd,
@@ -2177,7 +2179,7 @@ create_job(client_t        *con,  /* I - Client connection */
   }
 
  /*
-  * Validate job template attributes; for now just copies...
+  * Validate job template attributes; for now just copies and page-ranges...
   */
 
   if ((attr = ippFindAttribute(con->request, "copies", IPP_TAG_INTEGER)) != NULL)
@@ -2186,11 +2188,28 @@ create_job(client_t        *con,        /* I - Client connection */
     {
       LogMessage(L_INFO, "create_job: bad copies value %d.",
                  attr->values[0].integer);
-      send_ipp_error(con, IPP_ATTRIBUTES);
+      send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
   }
 
+  if ((attr = ippFindAttribute(con->request, "page-ranges", IPP_TAG_RANGE)) != NULL)
+  {
+    for (i = 0, lowerpagerange = 1; i < attr->num_values; i ++)
+    {
+      if (attr->values[i].range.lower < lowerpagerange || 
+         attr->values[i].range.lower > attr->values[i].range.upper)
+      {
+       LogMessage(L_ERROR, "create_job: bad page-ranges values %d-%d.",
+                  attr->values[i].range.lower, attr->values[i].range.upper);
+       send_ipp_error(con, IPP_BAD_REQUEST);
+       return;
+      }
+
+      lowerpagerange = attr->values[i].range.upper + 1;
+    }
+  }
+
  /*
   * Make sure we aren't over our limit...
   */
@@ -3863,6 +3882,8 @@ print_job(client_t        *con,           /* I - Client connection */
   printer_t            *printer;       /* Printer data */
   struct stat          fileinfo;       /* File information */
   int                  kbytes;         /* Size of file */
+  int                  i;              /* Looping var */
+  int                  lowerpagerange; /* Page range bound */
 
 
   LogMessage(L_DEBUG2, "print_job(%p[%d], %s)\n", con, con->http.fd,
@@ -3882,7 +3903,7 @@ print_job(client_t        *con,           /* I - Client connection */
   }
 
  /*
-  * Validate job template attributes; for now just copies...
+  * Validate job template attributes; for now just copies and page-ranges...
   */
 
   if ((attr = ippFindAttribute(con->request, "copies", IPP_TAG_INTEGER)) != NULL)
@@ -3891,11 +3912,28 @@ print_job(client_t        *con,         /* I - Client connection */
     {
       LogMessage(L_INFO, "print_job: bad copies value %d.",
                  attr->values[0].integer);
-      send_ipp_error(con, IPP_ATTRIBUTES);
+      send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
   }
 
+  if ((attr = ippFindAttribute(con->request, "page-ranges", IPP_TAG_RANGE)) != NULL)
+  {
+    for (i = 0, lowerpagerange = 1; i < attr->num_values; i ++)
+    {
+      if (attr->values[i].range.lower < lowerpagerange || 
+         attr->values[i].range.lower > attr->values[i].range.upper)
+      {
+       LogMessage(L_ERROR, "print_job: bad page-ranges values %d-%d.",
+                  attr->values[i].range.lower, attr->values[i].range.upper);
+       send_ipp_error(con, IPP_BAD_REQUEST);
+       return;
+      }
+
+      lowerpagerange = attr->values[i].range.upper + 1;
+    }
+  }
+
  /*
   * OK, see if the client is sending the document compressed - CUPS
   * doesn't support compression yet...
@@ -6031,5 +6069,5 @@ validate_user(client_t   *con,            /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.187 2003/02/05 21:10:16 mike Exp $".
+ * End of "$Id: ipp.c,v 1.188 2003/02/10 17:58:12 mike Exp $".
  */