@@ -285,6 +285,7 @@ static void *process_job(ippeve_job_t *job);
285285static void process_state_message (ippeve_job_t * job , char * message );
286286static bool register_printer (ippeve_printer_t * printer );
287287static bool respond_http (ippeve_client_t * client , http_status_t code , const char * content_coding , const char * type , size_t length );
288+ static void respond_ignored (ippeve_client_t * client , ipp_attribute_t * attr );
288289static void respond_ipp (ippeve_client_t * client , ipp_status_t status , const char * message , ...) _CUPS_FORMAT (3 , 4 );
289290static void respond_unsupported (ippeve_client_t * client , ipp_attribute_t * attr );
290291static void run_printer (ippeve_printer_t * printer );
@@ -6573,6 +6574,26 @@ respond_http(
65736574}
65746575
65756576
6577+ /*
6578+ * 'respond_ignored()' - Respond with an ignored attribute.
6579+ */
6580+
6581+ static void
6582+ respond_ignored (
6583+ ippeve_client_t * client , /* I - Client */
6584+ ipp_attribute_t * attr ) /* I - Attribute */
6585+ {
6586+ ipp_attribute_t * temp ; /* Copy of attribute */
6587+
6588+
6589+ if (!ippGetStatusCode (client -> response ))
6590+ respond_ipp (client , IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED , "Unsupported %s %s%s value." , ippGetName (attr ), ippGetCount (attr ) > 1 ? "1setOf " : "" , ippTagString (ippGetValueTag (attr )));
6591+
6592+ temp = ippCopyAttribute (client -> response , attr , 0 );
6593+ ippSetGroupTag (client -> response , & temp , IPP_TAG_UNSUPPORTED_GROUP );
6594+ }
6595+
6596+
65766597/*
65776598 * 'respond_ipp()' - Send an IPP response.
65786599 */
@@ -6616,7 +6637,7 @@ respond_ipp(ippeve_client_t *client, /* I - Client */
66166637
66176638static void
66186639respond_unsupported (
6619- ippeve_client_t * client , /* I - Client */
6640+ ippeve_client_t * client , /* I - Client */
66206641 ipp_attribute_t * attr ) /* I - Atribute */
66216642{
66226643 ipp_attribute_t * temp ; /* Copy of attribute */
@@ -7578,7 +7599,8 @@ valid_job_attributes(
75787599{
75797600 size_t i , /* Looping var */
75807601 count ; /* Number of values */
7581- bool valid = true; /* Valid attributes? */
7602+ bool fidelity , /* "ipp-attribute-fidelity" value */
7603+ valid = true; /* Valid attributes? */
75827604 ipp_attribute_t * attr , /* Current attribute */
75837605 * supported ; /* xxx-supported attribute */
75847606
@@ -7593,22 +7615,32 @@ valid_job_attributes(
75937615 * Check the various job template attributes...
75947616 */
75957617
7596- if ((attr = ippFindAttribute (client -> request , "copies " , IPP_TAG_ZERO )) != NULL )
7618+ if ((attr = ippFindAttribute (client -> request , "ipp-attribute-fidelity " , IPP_TAG_ZERO )) != NULL )
75977619 {
7598- if (ippGetCount (attr ) != 1 || ippGetValueTag (attr ) != IPP_TAG_INTEGER ||
7599- ippGetInteger (attr , 0 ) < 1 || ippGetInteger (attr , 0 ) > 999 )
7620+ if (ippGetCount (attr ) != 1 || ippGetValueTag (attr ) != IPP_TAG_BOOLEAN )
76007621 {
76017622 respond_unsupported (client , attr );
76027623 valid = false;
76037624 }
76047625 }
76057626
7606- if ((attr = ippFindAttribute (client -> request , "ipp-attribute-fidelity" , IPP_TAG_ZERO )) != NULL )
7627+ fidelity = ippGetBoolean (attr , 0 );
7628+
7629+ if ((attr = ippFindAttribute (client -> request , "copies" , IPP_TAG_ZERO )) != NULL )
76077630 {
7608- if (ippGetCount (attr ) != 1 || ippGetValueTag (attr ) != IPP_TAG_BOOLEAN )
7631+ if (ippGetCount (attr ) != 1 || ippGetValueTag (attr ) != IPP_TAG_INTEGER ||
7632+ ippGetInteger (attr , 0 ) < 1 || ippGetInteger (attr , 0 ) > 999 )
76097633 {
7610- respond_unsupported (client , attr );
7611- valid = false;
7634+ if (fidelity )
7635+ {
7636+ respond_unsupported (client , attr );
7637+ valid = false;
7638+ }
7639+ else
7640+ {
7641+ respond_ignored (client , attr );
7642+ ippDeleteAttribute (client -> request , attr );
7643+ }
76127644 }
76137645 }
76147646
@@ -7647,7 +7679,9 @@ valid_job_attributes(
76477679 ippSetGroupTag (client -> request , & attr , IPP_TAG_JOB );
76487680 }
76497681 else
7682+ {
76507683 ippAddString (client -> request , IPP_TAG_JOB , IPP_TAG_NAME , "job-name" , NULL , "Untitled" );
7684+ }
76517685
76527686 if ((attr = ippFindAttribute (client -> request , "job-priority" , IPP_TAG_ZERO )) != NULL )
76537687 {
@@ -7688,8 +7722,16 @@ valid_job_attributes(
76887722
76897723 if (!ippContainsString (supported , ippGetString (attr , 0 , NULL )))
76907724 {
7691- respond_unsupported (client , attr );
7692- valid = false;
7725+ if (fidelity )
7726+ {
7727+ respond_unsupported (client , attr );
7728+ valid = false;
7729+ }
7730+ else
7731+ {
7732+ respond_ignored (client , attr );
7733+ ippDeleteAttribute (client -> request , attr );
7734+ }
76937735 }
76947736 }
76957737 }
@@ -7729,8 +7771,16 @@ valid_job_attributes(
77297771
77307772 if (!ippContainsString (supported , ippGetString (member , 0 , NULL )))
77317773 {
7732- respond_unsupported (client , attr );
7733- valid = false;
7774+ if (fidelity )
7775+ {
7776+ respond_unsupported (client , attr );
7777+ valid = false;
7778+ }
7779+ else
7780+ {
7781+ respond_ignored (client , attr );
7782+ ippDeleteAttribute (client -> request , attr );
7783+ }
77347784 }
77357785 }
77367786 }
@@ -7793,8 +7843,16 @@ valid_job_attributes(
77937843
77947844 if (i >= count )
77957845 {
7796- respond_unsupported (client , attr );
7797- valid = false;
7846+ if (fidelity )
7847+ {
7848+ respond_unsupported (client , attr );
7849+ valid = false;
7850+ }
7851+ else
7852+ {
7853+ respond_ignored (client , attr );
7854+ ippDeleteAttribute (client -> request , attr );
7855+ }
77987856 }
77997857 }
78007858 }
@@ -7874,8 +7932,16 @@ valid_job_attributes(
78747932
78757933 if (i >= count )
78767934 {
7877- respond_unsupported (client , attr );
7878- valid = false;
7935+ if (fidelity )
7936+ {
7937+ respond_unsupported (client , attr );
7938+ valid = false;
7939+ }
7940+ else
7941+ {
7942+ respond_ignored (client , attr );
7943+ ippDeleteAttribute (client -> request , attr );
7944+ }
78797945 }
78807946 }
78817947 }
@@ -7894,14 +7960,30 @@ valid_job_attributes(
78947960 {
78957961 if (!ippContainsString (supported , sides ))
78967962 {
7897- respond_unsupported (client , attr );
7898- valid = false;
7963+ if (fidelity )
7964+ {
7965+ respond_unsupported (client , attr );
7966+ valid = false;
7967+ }
7968+ else
7969+ {
7970+ respond_ignored (client , attr );
7971+ ippDeleteAttribute (client -> request , attr );
7972+ }
78997973 }
79007974 }
79017975 else if (strcmp (sides , "one-sided" ))
79027976 {
7903- respond_unsupported (client , attr );
7904- valid = false;
7977+ if (fidelity )
7978+ {
7979+ respond_unsupported (client , attr );
7980+ valid = false;
7981+ }
7982+ else
7983+ {
7984+ respond_ignored (client , attr );
7985+ ippDeleteAttribute (client -> request , attr );
7986+ }
79057987 }
79067988 }
79077989
0 commit comments