+/*
+ * 'set_printer_attrs()' - Set printer attributes.
+ */
+
+static void
+set_printer_attrs(cupsd_client_t *con, /* I - Client connection */
+ ipp_attribute_t *uri) /* I - Printer */
+{
+ http_status_t status; /* Policy status */
+ cups_ptype_t dtype; /* Destination type (printer/class) */
+ cupsd_printer_t *printer; /* Printer/class */
+ ipp_attribute_t *attr; /* Printer attribute */
+ int changed = 0; /* Was anything changed? */
+
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "set_printer_attrs(%p[%d], %s)", con,
+ con->http.fd, uri->values[0].string.text);
+
+ /*
+ * Is the destination valid?
+ */
+
+ if (!cupsdValidateDest(uri->values[0].string.text, &dtype, &printer))
+ {
+ /*
+ * Bad URI...
+ */
+
+ send_ipp_status(con, IPP_NOT_FOUND,
+ _("The printer or class was not found."));
+ return;
+ }
+
+ /*
+ * Check policy...
+ */
+
+ if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, NULL)) != HTTP_OK)
+ {
+ send_http_error(con, status, printer);
+ return;
+ }
+
+ /*
+ * Return a list of attributes that can be set via Set-Printer-Attributes.
+ */
+
+ if ((attr = ippFindAttribute(con->request, "printer-location",
+ IPP_TAG_TEXT)) != NULL)
+ {
+ cupsdSetString(&printer->location, attr->values[0].string.text);
+ changed = 1;
+ }
+
+ if ((attr = ippFindAttribute(con->request, "printer-info",
+ IPP_TAG_TEXT)) != NULL)
+ {
+ cupsdSetString(&printer->info, attr->values[0].string.text);
+ changed = 1;
+ }
+
+ /*
+ * Update the printer attributes and return...
+ */
+
+ if (changed)
+ {
+ cupsdSetPrinterAttrs(printer);
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
+
+ cupsdAddEvent(CUPSD_EVENT_PRINTER_CONFIG, printer, NULL,
+ "Printer \"%s\" description or location changed by \"%s\".",
+ printer->name, get_username(con));
+
+ cupsdLogMessage(CUPSD_LOG_INFO,
+ "Printer \"%s\" description or location changed by \"%s\".",
+ printer->name, get_username(con));
+ }
+
+ con->response->request.status.status_code = IPP_OK;
+}
+
+