From 5947e9d5ad8747f367d81111fc09750f82e9bcf9 Mon Sep 17 00:00:00 2001 From: msweet Date: Wed, 28 Oct 2015 15:20:59 +0000 Subject: [PATCH] Fix IPP conformance issues and a bug in the printer-state-reasons reporting from ippserver. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12946 a1ca3aef-8c08-0410-bb20-df032aa958be --- test/ippserver.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/ippserver.c b/test/ippserver.c index ef1e5e379..69e29cd38 100644 --- a/test/ippserver.c +++ b/test/ippserver.c @@ -1086,7 +1086,10 @@ create_job(_ipp_client_t *client) /* I - Client */ ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id); ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, uri); ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uuid", NULL, uuid); - ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, client->printer->uri); + if ((attr = ippFindAttribute(client->request, "printer-uri", IPP_TAG_URI)) != NULL) + ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, ippGetString(attr, 0, NULL)); + else + ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, client->printer->uri); ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "time-at-creation", (int)(job->created - client->printer->start_time)); cupsArrayAdd(client->printer->jobs, job); @@ -1770,9 +1773,6 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default) if (!ippFindAttribute(printer->attrs, "job-password-supported", IPP_TAG_ZERO)) ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "job-password-supported", 4); - /* job-preferred-attributes-supported */ - ippAddBoolean(printer->attrs, IPP_TAG_PRINTER, "job-preferred-attributes-supported", 0); - /* job-priority-default */ if (!ippFindAttribute(printer->attrs, "job-priority-default", IPP_TAG_ZERO)) ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "job-priority-default", 50); @@ -1980,6 +1980,9 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default) if (!ippFindAttribute(printer->attrs, "pdl-override-supported", IPP_TAG_ZERO)) ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "pdl-override-supported", NULL, "attempted"); + /* preferred-attributes-supported */ + ippAddBoolean(printer->attrs, IPP_TAG_PRINTER, "preferred-attributes-supported", 0); + /* print-color-mode-default */ if (!ippFindAttribute(printer->attrs, "print-color-mode-default", IPP_TAG_ZERO)) ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "print-color-mode-default", NULL, "auto"); @@ -3681,7 +3684,7 @@ ipp_get_printer_attributes( { if (printer->state_reasons & bit) { - snprintf(reason, sizeof(reason), "%s-%s", _ipp_preason_strings[0], printer->state == IPP_PSTATE_IDLE ? "report" : printer->state == IPP_PSTATE_PROCESSING ? "warning" : "error"); + snprintf(reason, sizeof(reason), "%s-%s", _ipp_preason_strings[i], printer->state == IPP_PSTATE_IDLE ? "report" : printer->state == IPP_PSTATE_PROCESSING ? "warning" : "error"); if (attr) ippSetString(client->response, &attr, ippGetCount(attr), reason); else -- 2.39.2