diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2021-04-05 15:57:50 -0400 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2021-04-05 15:57:50 -0400 |
commit | 064e50fb06e83e6c1756e2a81c2fcbd4d6fca8e6 (patch) | |
tree | 45145c8db9a634af861cb1ed87a7378837e72763 /scheduler/ipp.c | |
parent | 6918883fba4942931dc455b32545d6edf18dec5c (diff) | |
download | cups-064e50fb06e83e6c1756e2a81c2fcbd4d6fca8e6.tar.gz |
Import all of the bug fixes from the OpenPrinting CUPS repository.
Import the improvements to ippeveprinter from OpenPrinting/ippsample.
Import the improvements to ippfind and ipptool from OpenPrinting/ippsample.
Diffstat (limited to 'scheduler/ipp.c')
-rw-r--r-- | scheduler/ipp.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 2fe3bf25c..191844117 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -880,7 +880,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */ * Class doesn't exist; see if we have a printer of the same name... */ - if ((pclass = cupsdFindPrinter(resource + 9)) != NULL) + if (cupsdFindPrinter(resource + 9)) { /* * Yes, return an error... @@ -2273,7 +2273,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */ * Printer doesn't exist; see if we have a class of the same name... */ - if ((printer = cupsdFindClass(resource + 10)) != NULL) + if (cupsdFindClass(resource + 10)) { /* * Yes, return an error... @@ -4891,7 +4891,7 @@ copy_printer_attrs( } if (printer->alert && (!ra || cupsArrayFind(ra, "printer-alert"))) - ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_STRING, "printer-alert", NULL, printer->alert); + ippAddOctetString(con->response, IPP_TAG_PRINTER, "printer-alert", printer->alert, (int)strlen(printer->alert)); if (printer->alert_description && (!ra || cupsArrayFind(ra, "printer-alert-description"))) ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-alert-description", NULL, printer->alert_description); @@ -5016,6 +5016,9 @@ copy_printer_attrs( if (!ra || cupsArrayFind(ra, "queued-job-count")) add_queued_job_count(con, printer); + if (!ra || cupsArrayFind(ra, "uri-security-supported")) + ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "uri-security-supported", NULL, is_encrypted ? "tls" : "none"); + copy_attrs(con->response, printer->attrs, ra, IPP_TAG_ZERO, 0, NULL); if (printer->ppd_attrs) copy_attrs(con->response, printer->ppd_attrs, ra, IPP_TAG_ZERO, 0, NULL); @@ -10866,17 +10869,13 @@ set_printer_defaults( case IPP_TAG_INTEGER : case IPP_TAG_ENUM : - sprintf(value, "%d", attr->values[0].integer); - printer->num_options = cupsAddOption(name, value, - printer->num_options, - &(printer->options)); + printer->num_options = cupsAddIntegerOption(name, attr->values[0].integer, printer->num_options, &(printer->options)); cupsdLogMessage(CUPSD_LOG_DEBUG, "Setting %s to %s...", attr->name, value); break; case IPP_TAG_RANGE : - sprintf(value, "%d-%d", attr->values[0].range.lower, - attr->values[0].range.upper); + snprintf(value, sizeof(value), "%d-%d", attr->values[0].range.lower, attr->values[0].range.upper); printer->num_options = cupsAddOption(name, value, printer->num_options, &(printer->options)); @@ -10885,10 +10884,7 @@ set_printer_defaults( break; case IPP_TAG_RESOLUTION : - sprintf(value, "%dx%d%s", attr->values[0].resolution.xres, - attr->values[0].resolution.yres, - attr->values[0].resolution.units == IPP_RES_PER_INCH ? - "dpi" : "dpcm"); + snprintf(value, sizeof(value), "%dx%d%s", attr->values[0].resolution.xres, attr->values[0].resolution.yres, attr->values[0].resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm"); printer->num_options = cupsAddOption(name, value, printer->num_options, &(printer->options)); |