*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* This file contains Kerberos support code, copyright 2006 by
* send_ipp_status() - Send a status back to the IPP client.
* set_default() - Set the default destination...
* set_job_attrs() - Set job attributes.
+ * set_printer_attrs() - Set printer attributes.
* set_printer_defaults() - Set printer default options from a request.
* start_printer() - Start a printer.
* stop_printer() - Stop a printer.
static void get_ppds(cupsd_client_t *con);
static void get_printers(cupsd_client_t *con, int type);
static void get_printer_attrs(cupsd_client_t *con, ipp_attribute_t *uri);
+static void get_printer_supported(cupsd_client_t *con, ipp_attribute_t *uri);
static void get_subscription_attrs(cupsd_client_t *con, int sub_id);
static void get_subscriptions(cupsd_client_t *con, ipp_attribute_t *uri);
static const char *get_username(cupsd_client_t *con);
;
static void set_default(cupsd_client_t *con, ipp_attribute_t *uri);
static void set_job_attrs(cupsd_client_t *con, ipp_attribute_t *uri);
+static void set_printer_attrs(cupsd_client_t *con, ipp_attribute_t *uri);
static void set_printer_defaults(cupsd_client_t *con,
cupsd_printer_t *printer);
static void start_printer(cupsd_client_t *con, ipp_attribute_t *uri);
* Then validate the request header and required attributes...
*/
- if (con->request->request.any.version[0] != 1)
+ if (con->request->request.any.version[0] != 1 &&
+ con->request->request.any.version[0] != 2)
{
/*
- * Return an error, since we only support IPP 1.x.
+ * Return an error, since we only support IPP 1.x and 2.x.
*/
cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
con->request->request.any.version[0],
con->request->request.any.version[1]);
}
+ else if (con->request->request.any.request_id < 1)
+ {
+ /*
+ * Return an error, since request IDs must be between 1 and 2^31-1
+ */
+
+ cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
+ "%04X %s Bad request ID %d",
+ IPP_BAD_REQUEST, con->http.hostname,
+ con->request->request.any.request_id);
+
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad request ID %d!"),
+ con->request->request.any.request_id);
+ }
else if (!con->request->attrs)
{
cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
*/
attr = con->request->attrs;
- if (attr && !strcmp(attr->name, "attributes-charset") &&
+ if (attr && attr->name &&
+ !strcmp(attr->name, "attributes-charset") &&
(attr->value_tag & IPP_TAG_MASK) == IPP_TAG_CHARSET)
charset = attr;
else
if (attr)
attr = attr->next;
- if (attr && !strcmp(attr->name, "attributes-natural-language") &&
+ if (attr && attr->name &&
+ !strcmp(attr->name, "attributes-natural-language") &&
(attr->value_tag & IPP_TAG_MASK) == IPP_TAG_LANGUAGE)
language = attr;
else
get_printer_attrs(con, uri);
break;
+ case IPP_GET_PRINTER_SUPPORTED_VALUES :
+ get_printer_supported(con, uri);
+ break;
+
case IPP_HOLD_JOB :
hold_job(con, uri);
break;
set_job_attrs(con, uri);
break;
+ case IPP_SET_PRINTER_ATTRIBUTES :
+ set_printer_attrs(con, uri);
+ break;
+
case IPP_HOLD_NEW_JOBS :
hold_new_jobs(con, uri);
break;
uri ? uri->values[0].string.text : "no URI",
con->http.hostname);
+ if (LogLevel == CUPSD_LOG_DEBUG2)
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdProcessIPPRequest: ippLength(response)=%ld",
+ (long)ippLength(con->response));
+
if (cupsdSendHeader(con, HTTP_OK, "application/ipp", CUPSD_AUTH_NONE))
{
#ifdef CUPSD_USE_CHUNKING
if (need_restart_job && pclass->job)
{
- cupsd_job_t *job;
-
/*
- * Stop the current job and then restart it below...
+ * Reset the current job to a "pending" status...
*/
- job = (cupsd_job_t *)pclass->job;
-
- cupsdStopJob(job, 1);
-
- job->state->values[0].integer = IPP_JOB_PENDING;
- job->state_value = IPP_JOB_PENDING;
+ cupsdSetJobState(pclass->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
+ "Job restarted because the class was modified.");
}
- if (need_restart_job)
- cupsdCheckJobs();
-
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
if (modify)
if (!compressions || !filetypes)
{
- cupsdCancelJob(job, 1, IPP_JOB_ABORTED);
+ cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_PURGE,
+ "Job aborted because the scheduler ran out of memory.");
if (con)
send_ipp_status(con, IPP_INTERNAL_ERROR,
* Hold job until specified time...
*/
- cupsdSetJobHoldUntil(job, attr->values[0].string.text);
+ cupsdSetJobHoldUntil(job, attr->values[0].string.text, 0);
job->state->values[0].integer = IPP_JOB_HELD;
job->state_value = IPP_JOB_HELD;
}
else if (job->attrs->request.op.operation_id == IPP_CREATE_JOB)
{
- job->hold_until = time(NULL) + 60;
+ job->hold_until = time(NULL) + MultipleOperationTimeout;
job->state->values[0].integer = IPP_JOB_HELD;
job->state_value = IPP_JOB_HELD;
}
attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
2, NULL, NULL);
- attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
- attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
+ attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
+ attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
}
job->job_sheets = attr;
if ((kbytes = copy_banner(con, job, attr->values[0].string.text)) < 0)
{
- cupsdDeleteJob(job);
+ cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_PURGE,
+ "Aborting job because the start banner could not be "
+ "copied.");
return (NULL);
}
cupsdSetPrinterState(printer, (ipp_pstate_t)(attr->values[0].integer), 0);
}
}
+
if ((attr = ippFindAttribute(con->request, "printer-state-message",
IPP_TAG_TEXT)) != NULL)
{
continue;
printer->reasons[printer->num_reasons] =
- _cupsStrAlloc(attr->values[i].string.text);
+ _cupsStrRetain(attr->values[i].string.text);
+ printer->num_reasons ++;
- if (!strcmp(printer->reasons[printer->num_reasons], "paused") &&
+ if (!strcmp(attr->values[i].string.text, "paused") &&
printer->state != IPP_PRINTER_STOPPED)
{
cupsdLogMessage(CUPSD_LOG_INFO,
printer->name, IPP_PRINTER_STOPPED, printer->state);
cupsdStopPrinter(printer, 0);
}
-
- printer->num_reasons ++;
}
if (PrintcapFormat == PRINTCAP_PLIST)
if (need_restart_job && printer->job)
{
- cupsd_job_t *job;
-
/*
- * Stop the current job and then restart it below...
+ * Restart the current job...
*/
- job = (cupsd_job_t *)printer->job;
-
- cupsdStopJob(job, 1);
-
- job->state->values[0].integer = IPP_JOB_PENDING;
- job->state_value = IPP_JOB_PENDING;
+ cupsdSetJobState(printer->job, IPP_JOB_PENDING, CUPSD_JOB_FORCE,
+ "Job restarted because the printer was modified.");
}
- if (need_restart_job)
- cupsdCheckJobs();
-
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
if (modify)
if (p->num_reasons == 0)
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
- "printer-state-reasons", NULL,
- p->state == IPP_PRINTER_STOPPED ? "paused" : "none");
+ "printer-state-reasons", NULL, "none");
else
ippAddStrings(con->response, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"printer-state-reasons", p->num_reasons, NULL,
* Use the default colorspace...
*/
- num_profiles = 1 + ppd->colorspace != PPD_CS_GRAY;
-
+ attr = ppdFindAttr(ppd, "DefaultColorSpace", NULL);
+
+ num_profiles = (attr && ppd->colorspace == PPD_CS_GRAY) ? 1 : 2;
+
if ((profiles = calloc(num_profiles, sizeof(CMDeviceProfileArray))) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR,
_ppdHashName("CMYK.."), "CMYK", "CMYK", NULL);
break;
+ case PPD_CS_GRAY :
+ if (attr)
+ break;
+
case PPD_CS_N :
apple_init_profile(ppd, NULL, profiles->profiles + 1,
_ppdHashName("DeviceN.."), "DeviceN", "DeviceN",
NULL);
break;
-
- default :
- break;
}
}
}
/*
- * See if the printer is currently printing a job...
+ * See if there are any pending jobs...
*/
- if (printer->job)
- jobid = ((cupsd_job_t *)printer->job)->id;
+ for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
+ job;
+ job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
+ if (job->state_value <= IPP_JOB_PROCESSING &&
+ !strcasecmp(job->dest, printer->name))
+ break;
+
+ if (job)
+ jobid = job->id;
else
{
/*
- * No, see if there are any pending jobs...
+ * No, try stopped jobs...
*/
- for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
+ for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
job;
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
- if (job->state_value <= IPP_JOB_PROCESSING &&
+ if (job->state_value == IPP_JOB_STOPPED &&
!strcasecmp(job->dest, printer->name))
break;
jobid = job->id;
else
{
- for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
- job;
- job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
- if (job->state_value == IPP_JOB_STOPPED &&
- !strcasecmp(job->dest, printer->name))
- break;
-
- if (job)
- jobid = job->id;
- else
- {
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("No active jobs on %s!"),
- printer->name);
- return;
- }
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("No active jobs on %s!"),
+ printer->name);
+ return;
}
}
}
* Cancel the job and return...
*/
- cupsdCancelJob(job, purge, IPP_JOB_CANCELED);
+ cupsdSetJobState(job, IPP_JOB_CANCELED, purge,
+ purge ? "Job purged by \"%s\"" : "Job canceled by \"%s\"",
+ username);
cupsdCheckJobs();
if (purge)
"entry ignored", p->users[i]);
}
- if ((mbr_err = mbr_check_membership(usr_uuid, usr2_uuid,
- &is_member)) != 0)
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG,
- "check_quotas: User \"%s\" identity check failed "
- "(err=%d)", p->users[i], mbr_err);
- is_member = 0;
- }
-
- if (is_member)
+ if (!uuid_compare(usr_uuid, usr2_uuid))
break;
}
#else
for (i = 0; i < attr->num_values; i ++)
toattr->values[i].string.text = attr->values[i].string.text;
}
- else
+ else if (attr->value_tag & IPP_TAG_COPY)
{
for (i = 0; i < attr->num_values; i ++)
toattr->values[i].string.text =
_cupsStrAlloc(attr->values[i].string.text);
}
+ else
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ toattr->values[i].string.text =
+ _cupsStrRetain(attr->values[i].string.text);
+ }
break;
case IPP_TAG_DATE :
toattr->values[i].string.text = attr->values[i].string.text;
}
}
- else
+ else if (attr->value_tag & IPP_TAG_COPY)
{
for (i = 0; i < attr->num_values; i ++)
{
_cupsStrAlloc(attr->values[i].string.text);
}
}
+ else
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ {
+ if (!i)
+ toattr->values[i].string.charset =
+ _cupsStrRetain(attr->values[i].string.charset);
+ else
+ toattr->values[i].string.charset =
+ toattr->values[0].string.charset;
+
+ toattr->values[i].string.text =
+ _cupsStrRetain(attr->values[i].string.text);
+ }
+ }
break;
case IPP_TAG_BEGIN_COLLECTION :
continue;
if (!ra || cupsArrayFind(ra, fromattr->name))
+ {
+ /*
+ * Don't send collection attributes by default to IPP/1.x clients
+ * since many do not support collections...
+ */
+
+ if (fromattr->value_tag == IPP_TAG_BEGIN_COLLECTION &&
+ !ra && to->request.status.version[0] == 1)
+ continue;
+
copy_attribute(to, fromattr, quickcopy);
+ }
}
}
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
if (!strncmp(s, "time-at-", 8))
- cupsFilePuts(out, cupsdGetDateTime(attr->values[i].integer));
+ {
+ struct timeval tv = { attr->values[i].integer, 0 };
+ cupsFilePuts(out, cupsdGetDateTime(&tv, CUPSD_TIME_STANDARD));
+ }
else
cupsFilePrintf(out, "%d", attr->values[i].integer);
break;
"copy_model: Running \"cups-driverd cat %s\"...", from);
if (!cupsdStartProcess(buffer, argv, envp, -1, temppipe[1], CGIPipes[1],
- -1, -1, 0, DefaultProfile, &temppid))
+ -1, -1, 0, DefaultProfile, 0, &temppid))
{
close(tempfd);
unlink(tempfile);
if ((p2_uri = ippFindAttribute(p2->attrs, "printer-uri-supported",
IPP_TAG_URI)) != NULL)
member_uris->values[i].string.text =
- _cupsStrAlloc(p2_uri->values[0].string.text);
+ _cupsStrRetain(p2_uri->values[0].string.text);
else
{
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri,
sizeof(scheme), username, sizeof(username), host,
sizeof(host), &port, resource, sizeof(resource));
- if (!strcmp(resource, "/"))
+ if (!strcmp(resource, "/") || !strcmp(resource, "/jobs"))
{
dest = NULL;
dtype = (cups_ptype_t)0;
completed = 0;
list = Jobs;
}
- else if (attr && !strcmp(attr->values[0].string.text, "printing"))
+ else if (attr && !strcmp(attr->values[0].string.text, "processing"))
{
completed = 0;
list = PrintingJobs;
* Filter out jobs that don't match...
*/
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: job->id = %d", job->id);
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "get_jobs: job->id=%d, dest=\"%s\", username=\"%s\", "
+ "state_value=%d, attrs=%p", job->id, job->dest,
+ job->username, job->state_value, job->attrs);
if (!job->dest || !job->username)
cupsdLoadJob(job);
cupsdLoadJob(job);
if (!job->attrs)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: No attributes for job %d!",
+ job->id);
continue;
+ }
if (username[0] && strcasecmp(username, job->username))
continue;
count ++;
- cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count = %d", count);
-
copy_job_attrs(con, job, ra);
}
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count=%d", count);
+
cupsArrayDelete(ra);
con->response->request.status.status_code = IPP_OK;
}
+/*
+ * 'get_printer_supported()' - Get printer supported values.
+ */
+
+static void
+get_printer_supported(
+ cupsd_client_t *con, /* I - Client connection */
+ ipp_attribute_t *uri) /* I - Printer URI */
+{
+ http_status_t status; /* Policy status */
+ cups_ptype_t dtype; /* Destination type (printer/class) */
+ cupsd_printer_t *printer; /* Printer/class */
+
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_printer_supported(%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.
+ */
+
+ ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ADMINDEFINE,
+ "printer-info", 0);
+ ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ADMINDEFINE,
+ "printer-location", 0);
+
+ con->response->request.status.status_code = IPP_OK;
+}
+
+
/*
* 'get_printers()' - Get a list of printers or classes.
*/
hold_job(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - Job or Printer URI */
{
- ipp_attribute_t *attr, /* Current job-hold-until */
- *newattr; /* New job-hold-until */
+ ipp_attribute_t *attr; /* Current job-hold-until */
+ const char *when; /* New value */
int jobid; /* Job ID */
char scheme[HTTP_MAX_URI], /* Method portion of URI */
username[HTTP_MAX_URI], /* Username portion of URI */
* Hold the job and return...
*/
- cupsdHoldJob(job);
-
- cupsdAddEvent(CUPSD_EVENT_JOB_STATE, cupsdFindDest(job->dest), job,
- "Job held by user.");
-
- if ((newattr = ippFindAttribute(con->request, "job-hold-until",
- IPP_TAG_KEYWORD)) == NULL)
- newattr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
-
- if ((attr = ippFindAttribute(job->attrs, "job-hold-until",
- IPP_TAG_KEYWORD)) == NULL)
- attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME);
+ if ((attr = ippFindAttribute(con->request, "job-hold-until",
+ IPP_TAG_KEYWORD)) == NULL)
+ attr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
if (attr)
{
- /*
- * Free the old hold value and copy the new one over...
- */
-
- _cupsStrFree(attr->values[0].string.text);
-
- if (newattr)
- {
- attr->value_tag = newattr->value_tag;
- attr->values[0].string.text =
- _cupsStrAlloc(newattr->values[0].string.text);
- }
- else
- {
- attr->value_tag = IPP_TAG_KEYWORD;
- attr->values[0].string.text = _cupsStrAlloc("indefinite");
- }
-
- /*
- * Hold job until specified time...
- */
-
- cupsdSetJobHoldUntil(job, attr->values[0].string.text);
+ when = attr->values[0].string.text;
cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, cupsdFindDest(job->dest), job,
- "Job job-hold-until value changed by user.");
+ "Job job-hold-until value changed by user.");
}
+ else
+ when = "indefinite";
- cupsdLogJob(job, CUPSD_LOG_INFO, "Held by \"%s\".", username);
+ cupsdSetJobHoldUntil(job, when, 1);
+ cupsdSetJobState(job, IPP_JOB_HELD, CUPSD_JOB_DEFAULT, "Job held by \"%s\".",
+ username);
con->response->request.status.status_code = IPP_OK;
}
{
job->state->values[0].integer = IPP_JOB_HELD;
job->state_value = IPP_JOB_HELD;
- job->hold_until = time(NULL) + 60;
+ job->hold_until = time(NULL) + MultipleOperationTimeout;
job->dirty = 1;
cupsdMarkDirty(CUPSD_DIRTY_JOBS);
{
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Setting job-state to %d",
attr->values[0].integer);
-
- job->state->values[0].integer = attr->values[0].integer;
- job->state_value = (ipp_jstate_t)attr->values[0].integer;
-
- event |= CUPSD_EVENT_JOB_STATE;
+ cupsdSetJobState(job, attr->values[0].integer,
+ CUPSD_JOB_DEFAULT,
+ "Job state changed by \"%s\"", username);
check_jobs = 1;
}
break;
{
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Setting job-state to %d",
attr->values[0].integer);
- cupsdCancelJob(job, 0, (ipp_jstate_t)attr->values[0].integer);
-
+ cupsdSetJobState(job, (ipp_jstate_t)attr->values[0].integer,
+ CUPSD_JOB_DEFAULT,
+ "Job state changed by \"%s\"", username);
check_jobs = 1;
}
break;
{
cupsdLogJob(job, CUPSD_LOG_DEBUG, "Setting job-hold-until to %s",
attr->values[0].string.text);
- cupsdSetJobHoldUntil(job, attr->values[0].string.text);
+ cupsdSetJobHoldUntil(job, attr->values[0].string.text, 0);
if (!strcmp(attr->values[0].string.text, "no-hold"))
+ {
cupsdReleaseJob(job);
+ check_jobs = 1;
+ }
else
- cupsdHoldJob(job);
+ cupsdSetJobState(job, IPP_JOB_HELD, CUPSD_JOB_DEFAULT,
+ "Job held by \"%s\".", username);
- check_jobs = 1;
- event |= CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE;
+ event |= CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE;
}
}
else if (attr->value_tag == IPP_TAG_DELETEATTR)
}
+/*
+ * '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;
+}
+
+
/*
* 'set_printer_defaults()' - Set printer default options from a request.
*/