]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix crash in ippserver and hang in ipptool.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 11 Sep 2011 06:15:53 +0000 (06:15 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 11 Sep 2011 06:15:53 +0000 (06:15 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@9995 7a7537e8-13f0-0310-91df-b6672ffda945

test/ippserver.c
test/ipptool.c

index fc1e582b9d21a6d45970dd8da16baedf661d295a..4ce9f9824da1562bdaa8699de42451477304a620 100644 (file)
@@ -4966,9 +4966,7 @@ valid_doc_attributes(
 
     if (attr->num_values != 1 || attr->value_tag != IPP_TAG_KEYWORD ||
         strcmp(attr->values[0].string.text, "none"))
-    {
       respond_unsupported(client, attr);
-    }
     else
       fprintf(stderr, "%s %s compression=\"%s\"\n",
               client->http.hostname,
@@ -4984,9 +4982,7 @@ valid_doc_attributes(
                                IPP_TAG_ZERO)) != NULL)
   {
     if (attr->num_values != 1 || attr->value_tag != IPP_TAG_MIMETYPE)
-    {
       respond_unsupported(client, attr);
-    }
     else
     {
       format = attr->values[0].string.text;
@@ -5001,7 +4997,7 @@ valid_doc_attributes(
 
   if (!strcmp(format, "application/octet-stream") &&
       (client->request->request.op.operation_id == IPP_PRINT_JOB ||
-       client->request->request.op.operation_id != IPP_SEND_DOCUMENT))
+       client->request->request.op.operation_id == IPP_SEND_DOCUMENT))
   {
    /*
     * Auto-type the file using the first 4 bytes of the file...
@@ -5028,8 +5024,8 @@ valid_doc_attributes(
              ippOpString(client->request->request.op.operation_id), format);
 
     if (!attr)
-      ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
-                   "document-format", NULL, format);
+      attr = ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
+                          "document-format", NULL, format);
     else
     {
       _cupsStrFree(attr->values[0].string.text);
@@ -5037,7 +5033,8 @@ valid_doc_attributes(
     }
   }
 
-  if ((supported = ippFindAttribute(client->printer->attrs,
+  if (client->request->request.op.operation_id != IPP_CREATE_JOB &&
+      (supported = ippFindAttribute(client->printer->attrs,
                                     "document-format-supported",
                                    IPP_TAG_MIMETYPE)) != NULL)
   {
@@ -5045,10 +5042,8 @@ valid_doc_attributes(
       if (!_cups_strcasecmp(format, supported->values[i].string.text))
        break;
 
-    if (i >= supported->num_values)
-    {
+    if (i >= supported->num_values && attr)
       respond_unsupported(client, attr);
-    }
   }
 
   return (!client->response->attrs ||
index d908b553adabf65bfddb3f19aed3cf6148cbb0cb..3c7e8675f30f209aa1ef8d0a96a5d8751d7904de 100644 (file)
@@ -2132,7 +2132,15 @@ do_tests(_cups_vars_t *vars,             /* I - Variables */
        }
 
        if (!Cancel && status == HTTP_ERROR)
-         httpReconnect(http);
+       {
+         if (httpReconnect(http))
+         {
+           print_fatal_error("Unable to connect to %s on port %d - %s", vars->hostname,
+                             vars->port, cupsLastErrorString());
+           pass = 0;
+           goto test_exit;
+         }
+       }
       }
     }