* renew_subscription() - Renew an existing subscription...
* restart_job() - Restart an old print job.
* save_auth_info() - Save authentication information for a job.
- * save_krb5_creds() - Save Kerberos credentials for the job.
* send_document() - Send a file to a printer or class.
* send_http_error() - Send a HTTP error back to the IPP client.
* send_ipp_status() - Send a status back to the IPP client.
mime_type_t *filetype);
static void add_job_state_reasons(cupsd_client_t *con, cupsd_job_t *job);
static void add_job_subscriptions(cupsd_client_t *con, cupsd_job_t *job);
-static void add_job_uuid(cupsd_client_t *con, cupsd_job_t *job);
+static void add_job_uuid(cupsd_job_t *job);
static void add_printer(cupsd_client_t *con, ipp_attribute_t *uri);
static void add_printer_state_reasons(cupsd_client_t *con,
cupsd_printer_t *p);
static void restart_job(cupsd_client_t *con, ipp_attribute_t *uri);
static void save_auth_info(cupsd_client_t *con, cupsd_job_t *job,
ipp_attribute_t *auth_info);
-#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5_H)
-static void save_krb5_creds(cupsd_client_t *con, cupsd_job_t *job);
-#endif /* HAVE_GSSAPI && HAVE_KRB5_H */
static void send_document(cupsd_client_t *con, ipp_attribute_t *uri);
static void send_http_error(cupsd_client_t *con, http_status_t status,
cupsd_printer_t *printer);
static void send_ipp_status(cupsd_client_t *con, ipp_status_t status,
const char *message, ...)
-# ifdef __GNUC__
-__attribute__ ((__format__ (__printf__, 3, 4)))
-# endif /* __GNUC__ */
-;
+ __attribute__((__format__(__printf__, 3, 4)));
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);
con->request->request.any.version[1]);
send_ipp_status(con, IPP_VERSION_NOT_SUPPORTED,
- _("Bad request version number %d.%d"),
+ _("Bad request version number %d.%d."),
con->request->request.any.version[0],
con->request->request.any.version[1]);
}
IPP_BAD_REQUEST, con->http.hostname,
con->request->request.any.request_id);
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad request ID %d"),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad request ID %d."),
con->request->request.any.request_id);
}
else if (!con->request->attrs)
"%04X %s No attributes in request",
IPP_BAD_REQUEST, con->http.hostname);
- send_ipp_status(con, IPP_BAD_REQUEST, _("No attributes in request"));
+ send_ipp_status(con, IPP_BAD_REQUEST, _("No attributes in request."));
}
else
{
IPP_BAD_REQUEST, con->http.hostname);
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Attribute groups are out of order (%x < %x)"),
+ _("Attribute groups are out of order (%x < %x)."),
attr->group_tag, group);
break;
}
"attributes-natural-language", NULL, DefaultLanguage);
if (charset &&
- strcasecmp(charset->values[0].string.text, "us-ascii") &&
- strcasecmp(charset->values[0].string.text, "utf-8"))
+ _cups_strcasecmp(charset->values[0].string.text, "us-ascii") &&
+ _cups_strcasecmp(charset->values[0].string.text, "utf-8"))
{
/*
* Bad character set...
IPP_CHARSET, con->http.hostname,
charset->values[0].string.text);
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Unsupported character set \"%s\""),
+ _("Unsupported character set \"%s\"."),
charset->values[0].string.text);
}
else if (!charset || !language ||
cupsdLogMessage(CUPSD_LOG_DEBUG, "End of attributes...");
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Missing required attributes"));
+ _("Missing required attributes."));
}
else
{
*/
if (!strcmp(username->values[0].string.text, "root") &&
- strcasecmp(con->http.hostname, "localhost") &&
+ _cups_strcasecmp(con->http.hostname, "localhost") &&
strcmp(con->username, "root"))
{
/*
ippOpString(con->request->request.op.operation_id));
send_ipp_status(con, IPP_OPERATION_NOT_SUPPORTED,
- _("%s not supported"),
+ _("%s not supported."),
ippOpString(
con->request->request.op.operation_id));
break;
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
printer->accepting = 1;
printer->state_message[0] = '\0';
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"Now accepting jobs.");
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("A printer named \"%s\" already exists"),
+ _("A printer named \"%s\" already exists."),
resource + 9);
return;
}
pclass->name, attr->values[0].boolean, pclass->accepting);
pclass->accepting = attr->values[0].boolean;
- cupsdAddPrinterHistory(pclass);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, pclass, NULL, "%s accepting jobs.",
pclass->accepting ? "Now" : "No longer");
attr->values[0].integer != IPP_PRINTER_STOPPED)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Attempt to set %s printer-state to bad value %d"),
+ _("Attempt to set %s printer-state to bad value %d."),
pclass->name, attr->values[0].integer);
return;
}
{
strlcpy(pclass->state_message, attr->values[0].string.text,
sizeof(pclass->state_message));
- cupsdAddPrinterHistory(pclass);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, pclass, NULL, "%s",
pclass->state_message);
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
else if (dtype & CUPS_PRINTER_CLASS)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Nested classes are not allowed"));
+ _("Nested classes are not allowed."));
return;
}
}
else
{
- cupsdAddPrinterHistory(pclass);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
pclass, NULL, "New class \"%s\" added by \"%s\".",
pclass->name, get_username(con));
if (con)
send_ipp_status(con, IPP_INTERNAL_ERROR,
- _("Unable to allocate memory for file types"));
+ _("Unable to allocate memory for file types."));
return (-1);
}
*/
if (!printer->shared &&
- strcasecmp(con->http.hostname, "localhost") &&
- strcasecmp(con->http.hostname, ServerName))
+ _cups_strcasecmp(con->http.hostname, "localhost") &&
+ _cups_strcasecmp(con->http.hostname, ServerName))
{
send_ipp_status(con, IPP_NOT_AUTHORIZED,
- _("The printer or class is not shared"));
+ _("The printer or class is not shared."));
return (NULL);
}
filetype->type);
send_ipp_status(con, IPP_DOCUMENT_FORMAT,
- _("Unsupported format \'%s\'"), mimetype);
+ _("Unsupported format \"%s\"."), mimetype);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
"document-format", NULL, mimetype);
if (attr->value_tag != IPP_TAG_KEYWORD &&
attr->value_tag != IPP_TAG_NAME)
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-sheets value type"));
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-sheets value type."));
return (NULL);
}
if (attr->num_values > 2)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Too many job-sheets values (%d > 2)"),
+ _("Too many job-sheets values (%d > 2)."),
attr->num_values);
return (NULL);
}
if (strcmp(attr->values[i].string.text, "none") &&
!cupsdFindBanner(attr->values[i].string.text))
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-sheets value \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-sheets value \"%s\"."),
attr->values[i].string.text);
return (NULL);
}
if (!ippFindAttribute(con->request, "PageRegion", IPP_TAG_ZERO) &&
!ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
- _pwgGetPageSize(printer->pwg, con->request, NULL, &exact))
+ _ppdCacheGetPageSize(printer->pc, con->request, NULL, &exact))
{
if (!exact &&
(media_col = ippFindAttribute(con->request, "media-col",
if (MaxJobs && cupsArrayCount(Jobs) >= MaxJobs)
{
- send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Too many active jobs."));
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Too many active jobs."));
return (NULL);
}
if ((job = cupsdAddJob(priority, printer->name)) == NULL)
{
send_ipp_status(con, IPP_INTERNAL_ERROR,
- _("Unable to add job for destination \"%s\""),
+ _("Unable to add job for destination \"%s\"."),
printer->name);
return (NULL);
}
cupsdMarkDirty(CUPSD_DIRTY_JOBS);
- add_job_uuid(con, job);
+ add_job_uuid(job);
apply_printer_defaults(printer, job);
attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME);
}
else if ((attr = ippFindAttribute(job->attrs, "job-sheets",
IPP_TAG_ZERO)) != NULL)
- job->sheets = attr;
+ job->job_sheets = attr;
/*
* Fill in the response info...
resource, sizeof(resource)) < HTTP_URI_OK)
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Bad notify-recipient-uri URI \"%s\""), recipient);
+ _("Bad notify-recipient-uri \"%s\"."), recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_URI_SCHEME);
return;
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("notify-recipient-uri URI \"%s\" uses unknown "
- "scheme"), recipient);
+ "scheme."), recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_URI_SCHEME);
return;
if (!strcmp(scheme, "rss") && !check_rss_recipient(recipient))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("notify-recipient-uri URI \"%s\" is already used"),
+ _("notify-recipient-uri URI \"%s\" is already used."),
recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_ATTRIBUTES);
if (strcmp(pullmethod, "ippget"))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Bad notify-pull-method \"%s\""), pullmethod);
+ _("Bad notify-pull-method \"%s\"."), pullmethod);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_ATTRIBUTES);
return;
strcmp(attr->values[0].string.text, "utf-8"))
{
send_ipp_status(con, IPP_CHARSET,
- _("Character set \"%s\" not supported"),
+ _("Character set \"%s\" not supported."),
attr->values[0].string.text);
return;
}
strcmp(attr->values[0].string.text, DefaultLanguage)))
{
send_ipp_status(con, IPP_CHARSET,
- _("Language \"%s\" not supported"),
+ _("Language \"%s\" not supported."),
attr->values[0].string.text);
return;
}
{
send_ipp_status(con, IPP_REQUEST_VALUE,
_("The notify-user-data value is too large "
- "(%d > 63 octets)"),
+ "(%d > 63 octets)."),
attr->values[0].unknown.length);
return;
}
*/
static void
-add_job_uuid(cupsd_client_t *con, /* I - Client connection */
- cupsd_job_t *job) /* I - Job */
+add_job_uuid(cupsd_job_t *job) /* I - Job */
{
- char uuid[1024]; /* job-uuid string */
- _cups_md5_state_t md5state; /* MD5 state */
- unsigned char md5sum[16]; /* MD5 digest/sum */
-
-
- /*
- * First see if the job already has a job-uuid attribute; if so, return...
- */
-
- if (ippFindAttribute(job->attrs, "job-uuid", IPP_TAG_URI))
- return;
+ char uuid[64]; /* job-uuid string */
- /*
- * No job-uuid attribute, so build a version 3 UUID with the local job
- * ID at the end; see RFC 4122 for details. Start with the MD5 sum of
- * the ServerName, server name and port that the client connected to,
- * and local job ID...
- */
-
- snprintf(uuid, sizeof(uuid), "%s:%s:%d:%d", ServerName, con->servername,
- con->serverport, job->id);
-
- _cupsMD5Init(&md5state);
- _cupsMD5Append(&md5state, (unsigned char *)uuid, strlen(uuid));
- _cupsMD5Finish(&md5state, md5sum);
/*
- * Format the UUID URI using the MD5 sum and job ID.
+ * Add a job-uuid attribute if none exists...
*/
- snprintf(uuid, sizeof(uuid),
- "urn:uuid:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-"
- "%02x%02x%02x%02x%02x%02x",
- md5sum[0], md5sum[1], md5sum[2], md5sum[3], md5sum[4], md5sum[5],
- (md5sum[6] & 15) | 0x30, md5sum[7], (md5sum[8] & 0x3f) | 0x40,
- md5sum[9], md5sum[10], md5sum[11], md5sum[12], md5sum[13],
- md5sum[14], md5sum[15]);
-
- ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uuid", NULL, uuid);
+ if (!ippFindAttribute(job->attrs, "job-uuid", IPP_TAG_URI))
+ ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-uuid", NULL,
+ _httpAssembleUUID(ServerName, RemotePort, job->dest, job->id,
+ uuid, sizeof(uuid)));
}
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("A class named \"%s\" already exists"),
+ _("A class named \"%s\" already exists."),
resource + 10);
return;
}
if (uri_status < HTTP_URI_OK)
{
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\""),
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
attr->values[0].string.text);
cupsdLogMessage(CUPSD_LOG_DEBUG,
"add_printer: httpSeparateURI returned %d", uri_status);
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("File device URIs have been disabled! "
+ _("File device URIs have been disabled. "
"To enable, see the FileDevice directive in "
"\"%s/cupsd.conf\"."),
ServerRoot);
* Could not find device in list!
*/
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri scheme \"%s\""),
- scheme);
+ send_ipp_status(con, IPP_NOT_POSSIBLE,
+ _("Bad device-uri scheme \"%s\"."), scheme);
return;
}
}
if (!supported || i >= supported->num_values)
{
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\""),
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"."),
attr->values[0].string.text);
return;
}
printer->name, attr->values[0].boolean, printer->accepting);
printer->accepting = attr->values[0].boolean;
- cupsdAddPrinterHistory(printer);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"%s accepting jobs.",
if ((attr = ippFindAttribute(con->request, "printer-is-shared",
IPP_TAG_BOOLEAN)) != NULL)
{
+ if (attr->values[0].boolean &&
+ printer->num_auth_info_required == 1 &&
+ !strcmp(printer->auth_info_required[0], "negotiate"))
+ {
+ send_ipp_status(con, IPP_BAD_REQUEST,
+ _("Cannot share a remote Kerberized printer."));
+ return;
+ }
+
if (printer->shared && !attr->values[0].boolean)
cupsdDeregisterPrinter(printer, 1);
if (attr->values[0].integer != IPP_PRINTER_IDLE &&
attr->values[0].integer != IPP_PRINTER_STOPPED)
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d"),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d."),
attr->values[0].integer);
return;
}
{
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
- cupsdAddPrinterHistory(printer);
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
printer->state_message);
(int)(sizeof(printer->reasons) / sizeof(printer->reasons[0])))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Too many printer-state-reasons values (%d > %d)"),
+ _("Too many printer-state-reasons values (%d > %d)."),
attr->num_values,
(int)(sizeof(printer->reasons) /
sizeof(printer->reasons[0])));
if (copy_model(con, attr->values[0].string.text, dstfile))
{
- send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file"));
+ send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
return;
}
char cache_name[1024]; /* Cache filename for printer attrs */
- snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir,
- printer->name);
- unlink(cache_name);
-
- snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg3", CacheDir,
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir,
printer->name);
unlink(cache_name);
}
else
{
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
cftext; /* Localized text */
+ (void)id;
+
/*
* Build the profile name dictionary...
*/
dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ if (!dict)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to initialize profile \"%s\".",
+ iccfile);
+ return;
+ }
cftext = CFStringCreateWithCString(kCFAllocatorDefault, text,
kCFStringEncodingUTF8);
# ifdef HAVE_COLORSYNCREGISTERDEVICE
if (iccfile)
{
- url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
+ url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
(const UInt8 *)iccfile,
strlen(iccfile), false);
ppd_option_t *cm_option; /* Color model option */
ppd_choice_t *cm_choice; /* Color model choice */
int num_profiles; /* Number of profiles */
- CMError error = 0; /* Last error */
+ OSStatus error = 0; /* Last error */
unsigned device_id, /* Printer device ID */
- profile_id, /* Profile ID */
+ profile_id = 0, /* Profile ID */
default_profile_id = 0;
/* Default profile ID */
CFMutableDictionaryRef device_name; /* Printer device name dictionary */
strlcpy(iccfile, attr->value, sizeof(iccfile));
if (access(iccfile, 0))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "%s: ICC Profile \"%s\" does not exist.", p->name,
+ iccfile);
continue;
+ }
num_profiles ++;
}
else
strlcpy(iccfile, attr->value, sizeof(iccfile));
- if (access(iccfile, 0))
+ if (_cupsFileCheck(iccfile, _CUPS_FILE_CHECK_FILE, !RunUser,
+ cupsdLogFCMessage, p))
continue;
if (profile_key[0] == 'c')
* See if this is the default profile...
*/
- if (!default_profile_id)
+ if (!default_profile_id && q1_choice && q2_choice && q3_choice)
{
- if (q2_choice)
- {
- if (q3_choice)
- {
- snprintf(selector, sizeof(selector), "%s.%s.%s",
- q1_choice, q2_choice, q3_choice);
- if (!strcmp(selector, attr->spec))
- default_profile_id = profile_id;
- }
+ snprintf(selector, sizeof(selector), "%s.%s.%s", q1_choice, q2_choice,
+ q3_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
- if (!default_profile_id)
- {
- snprintf(selector, sizeof(selector), "%s.%s.", q1_choice,
- q2_choice);
- if (!strcmp(selector, attr->spec))
- default_profile_id = profile_id;
- }
- }
+ if (!default_profile_id && q1_choice && q2_choice)
+ {
+ snprintf(selector, sizeof(selector), "%s.%s.", q1_choice, q2_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
- if (!default_profile_id && q3_choice)
- {
- snprintf(selector, sizeof(selector), "%s..%s", q1_choice,
- q3_choice);
- if (!strcmp(selector, attr->spec))
- default_profile_id = profile_id;
- }
+ if (!default_profile_id && q1_choice && q3_choice)
+ {
+ snprintf(selector, sizeof(selector), "%s..%s", q1_choice, q3_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
- if (!default_profile_id)
- {
- snprintf(selector, sizeof(selector), "%s..", q1_choice);
- if (!strcmp(selector, attr->spec))
- default_profile_id = profile_id;
- }
+ if (!default_profile_id && q1_choice)
+ {
+ snprintf(selector, sizeof(selector), "%s..", q1_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
+
+ if (!default_profile_id && q2_choice && q3_choice)
+ {
+ snprintf(selector, sizeof(selector), ".%s.%s", q2_choice, q3_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
+
+ if (!default_profile_id && q2_choice)
+ {
+ snprintf(selector, sizeof(selector), ".%s.", q2_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
+ }
+
+ if (!default_profile_id && q3_choice)
+ {
+ snprintf(selector, sizeof(selector), "..%s", q3_choice);
+ if (!strcmp(selector, attr->spec))
+ default_profile_id = profile_id;
}
}
switch (ppd->colorspace)
{
+ default :
case PPD_CS_RGB :
case PPD_CS_CMY :
profile_id = _ppdHashName("RGB..");
apple_init_profile(ppd, NULL, profile, profile_id, "RGB", "RGB",
NULL);
break;
+
case PPD_CS_RGBK :
case PPD_CS_CMYK :
profile_id = _ppdHashName("CMYK..");
switch (ppd->colorspace)
{
+ default :
case PPD_CS_RGB :
case PPD_CS_CMY :
profile_id = _ppdHashName("RGB..");
kCFPreferencesCurrentHost
};
CFDictionaryRef deviceDict; /* Device dictionary */
- CFUUIDRef deviceUUID; /* Device UUID (TODO: use printer-uuid value) */
+ CFUUIDRef deviceUUID; /* Device UUID */
deviceDict = CFDictionaryCreate(kCFAllocatorDefault,
(const void **)deviceDictKeys,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
deviceUUID = ColorSyncCreateUUIDFromUInt32(device_id);
- if (deviceDict && deviceUUID &&
- !ColorSyncRegisterDevice(kColorSyncPrinterDeviceClass, deviceUUID,
+
+ if (!deviceDict || !deviceUUID ||
+ !ColorSyncRegisterDevice(kColorSyncPrinterDeviceClass, deviceUUID,
deviceDict))
error = 1001;
# ifdef HAVE_COLORSYNCREGISTERDEVICE
if (ColorSyncUnregisterDevice != NULL)
{
- CFUUIDRef deviceUUID; /* Printer UUID */
+ /*
+ * Because we may have registered the printer profiles using a prior device
+ * ID-based UUID, remove both the old style UUID and current UUID for the
+ * printer.
+ */
- deviceUUID = ColorSyncCreateUUIDFromUInt32(_ppdHashName(p->name));
- /* TODO: Use printer-uuid value */
+ CFUUIDRef deviceUUID; /* Device UUID */
+ deviceUUID = ColorSyncCreateUUIDFromUInt32(_ppdHashName(p->name));
if (deviceUUID)
{
ColorSyncUnregisterDevice(kColorSyncPrinterDeviceClass, deviceUUID);
}
#endif /* __APPLE__ */
+
/*
* 'apply_printer_defaults()' - Apply printer default options to a job.
*/
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND,
- _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job #%d is not held for authentication"),
+ _("Job #%d is not held for authentication."),
jobid);
return;
}
send_http_error(con, HTTP_UNAUTHORIZED, printer);
else
send_ipp_status(con, IPP_NOT_AUTHORIZED,
- _("No authentication information provided"));
+ _("No authentication information provided."));
return;
}
cupsdReleaseJob(job);
+ cupsdAddEvent(CUPSD_EVENT_JOB_STATE, NULL, job, "Job authenticated by user");
+
cupsdLogJob(job, CUPSD_LOG_INFO, "Authenticated by \"%s\".", con->username);
+
+ cupsdCheckJobs();
}
else
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Missing requesting-user-name attribute"));
+ _("Missing requesting-user-name attribute."));
return;
}
}
else
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Missing requesting-user-name attribute"));
+ _("Missing requesting-user-name attribute."));
return;
}
if (strcmp(uri->name, "printer-uri"))
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("The printer-uri attribute is required"));
+ _("The printer-uri attribute is required."));
return;
}
(!strncmp(resource, "/classes/", 9) && resource[9]))
{
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
if (i < job_ids->num_values)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("job-id %d not found."),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
job_ids->values[i].integer);
return;
}
for (i = 0; i < job_ids->num_values; i ++)
{
if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL ||
- strcasecmp(job->dest, printer->name))
+ _cups_strcasecmp(job->dest, printer->name))
break;
}
if (i < job_ids->num_values)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("job-id %d not found."),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
job_ids->values[i].integer);
return;
}
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
job;
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
if (job->state_value <= IPP_JOB_PROCESSING &&
- !strcasecmp(job->dest, printer->name))
+ !_cups_strcasecmp(job->dest, printer->name))
break;
if (job)
job;
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
if (job->state_value == IPP_JOB_STOPPED &&
- !strcasecmp(job->dest, printer->name))
+ !_cups_strcasecmp(job->dest, printer->name))
break;
if (job)
jobid = job->id;
else
{
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("No active jobs on %s"),
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("No active jobs on %s."),
printer->name);
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("notify-subscription-id %d no good"), sub_id);
+ _("Subscription #%d does not exist."), sub_id);
return;
}
break;
}
#else
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
break;
#endif /* HAVE_MBR_UID_TO_UUID */
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
attr->values[0].integer);
return;
}
fromattr->group_tag != IPP_TAG_ZERO) || !fromattr->name)
continue;
- if (exclude &&
+ if (!strcmp(fromattr->name, "job-printer-uri"))
+ continue;
+
+ if (exclude &&
(cupsArrayFind(exclude, fromattr->name) ||
cupsArrayFind(exclude, "all")))
{
/*
* We need to exclude this attribute for security reasons; we require the
- * job-id and job-printer-uri attributes regardless of the security
- * settings for IPP conformance.
+ * job-id attribute regardless of the security settings for IPP
+ * conformance.
+ *
+ * The job-printer-uri attribute is handled by copy_job_attrs().
*
* Subscription attribute security is handled by copy_subscription_attrs().
*/
- if (strcmp(fromattr->name, "job-id") &&
- strcmp(fromattr->name, "job-printer-uri"))
+ if (strcmp(fromattr->name, "job-id"))
continue;
}
case IPP_TAG_KEYWORD :
case IPP_TAG_CHARSET :
case IPP_TAG_LANGUAGE :
- if (!strcasecmp(banner->filetype->type, "postscript"))
+ if (!_cups_strcasecmp(banner->filetype->type, "postscript"))
{
/*
* Need to quote strings for PS banners...
snprintf(buffer, sizeof(buffer), "%s/daemon/cups-driverd", ServerBin);
snprintf(tempfile, sizeof(tempfile), "%s/%d.ppd", TempDir, con->http.fd);
tempfd = open(tempfile, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (tempfd < 0)
+ if (tempfd < 0 || cupsdOpenPipe(temppipe))
return (-1);
- cupsdOpenPipe(temppipe);
-
cupsdLogMessage(CUPSD_LOG_DEBUG,
"copy_model: Running \"cups-driverd cat %s\"...", from);
* Send the requested attributes for each job...
*/
- httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL,
- con->servername, con->serverport, "/jobs/%d",
- job->id);
-
if (!cupsArrayFind(exclude, "all"))
{
if ((!exclude || !cupsArrayFind(exclude, "document-count")) &&
if ((!exclude || !cupsArrayFind(exclude, "job-more-info")) &&
(!ra || cupsArrayFind(ra, "job-more-info")))
+ {
+ httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "http",
+ NULL, con->servername, con->serverport, "/jobs/%d",
+ job->id);
ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI,
"job-more-info", NULL, job_uri);
+ }
if (job->state_value > IPP_JOB_PROCESSING &&
(!exclude || !cupsArrayFind(exclude, "job-preserved")) &&
"job-printer-up-time", time(NULL));
}
+ if (!ra || cupsArrayFind(ra, "job-printer-uri"))
+ {
+ httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL,
+ con->servername, con->serverport,
+ job->dtype & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_CLASS) ?
+ "/classes/%s" : "/printers/%s",
+ job->dest);
+ ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI,
+ "job-printer-uri", NULL, job_uri);
+ }
+
if (!ra || cupsArrayFind(ra, "job-state-reasons"))
add_job_state_reasons(con, job);
if (!ra || cupsArrayFind(ra, "job-uri"))
+ {
+ httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL,
+ con->servername, con->serverport, "/jobs/%d",
+ job->id);
ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI,
"job-uri", NULL, job_uri);
+ }
copy_attrs(con->response, job->attrs, ra, IPP_TAG_JOB, 0, exclude);
}
/* Printer icons */
time_t curtime; /* Current time */
int i; /* Looping var */
- ipp_attribute_t *history; /* History collection */
/*
ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"printer-state-change-time", printer->state_time);
- if (MaxPrinterHistory > 0 && printer->num_history > 0 &&
- cupsArrayFind(ra, "printer-state-history"))
- {
- /*
- * Printer history is only sent if specifically requested, so that
- * older CUPS/IPP clients won't barf on the collection attributes.
- */
-
- history = ippAddCollections(con->response, IPP_TAG_PRINTER,
- "printer-state-history",
- printer->num_history, NULL);
-
- for (i = 0; i < printer->num_history; i ++)
- copy_attrs(history->values[i].collection = ippNew(), printer->history[i],
- NULL, IPP_TAG_ZERO, 0, NULL);
- }
-
if (!ra || cupsArrayFind(ra, "printer-state-message"))
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
"printer-state-message", NULL, printer->state_message);
{
int type; /* printer-type value */
-
/*
* Add the CUPS-specific printer-type attribute...
*/
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
if (!attr)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("No subscription attributes in request"));
+ _("No subscription attributes in request."));
return;
}
resource, sizeof(resource)) < HTTP_URI_OK)
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Bad notify-recipient-uri URI \"%s\""), recipient);
+ _("Bad notify-recipient-uri \"%s\"."), recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_URI_SCHEME);
return;
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
_("notify-recipient-uri URI \"%s\" uses unknown "
- "scheme"), recipient);
+ "scheme."), recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_URI_SCHEME);
return;
if (!strcmp(scheme, "rss") && !check_rss_recipient(recipient))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("notify-recipient-uri URI \"%s\" is already used"),
+ _("notify-recipient-uri URI \"%s\" is already used."),
recipient);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_ATTRIBUTES);
if (strcmp(pullmethod, "ippget"))
{
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Bad notify-pull-method \"%s\""), pullmethod);
+ _("Bad notify-pull-method \"%s\"."), pullmethod);
ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
"notify-status-code", IPP_ATTRIBUTES);
return;
strcmp(attr->values[0].string.text, "utf-8"))
{
send_ipp_status(con, IPP_CHARSET,
- _("Character set \"%s\" not supported"),
+ _("Character set \"%s\" not supported."),
attr->values[0].string.text);
return;
}
strcmp(attr->values[0].string.text, DefaultLanguage)))
{
send_ipp_status(con, IPP_CHARSET,
- _("Language \"%s\" not supported"),
+ _("Language \"%s\" not supported."),
attr->values[0].string.text);
return;
}
{
send_ipp_status(con, IPP_REQUEST_VALUE,
_("The notify-user-data value is too large "
- "(%d > 63 octets)"),
+ "(%d > 63 octets)."),
attr->values[0].unknown.length);
return;
}
else
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("notify-events not specified"));
+ _("notify-events not specified."));
return;
}
}
{
if ((job = cupsdFindJob(jobid)) == NULL)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("Job %d not found"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
+ jobid);
return;
}
}
}
if (job)
- cupsdLogMessage(CUPSD_LOG_DEBUG, "Added subscription %d for job %d",
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Added subscription #%d for job %d.",
sub->id, job->id);
else if (printer)
cupsdLogMessage(CUPSD_LOG_DEBUG,
- "Added subscription %d for printer \"%s\"",
+ "Added subscription #%d for printer \"%s\".",
sub->id, printer->name);
else
- cupsdLogMessage(CUPSD_LOG_DEBUG, "Added subscription %d for server",
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Added subscription #%d for server.",
sub->id);
sub->interval = interval;
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
printer->name);
unlink(filename);
- snprintf(filename, sizeof(filename), "%s/%s.ipp4", CacheDir, printer->name);
- unlink(filename);
-
snprintf(filename, sizeof(filename), "%s/%s.png", CacheDir, printer->name);
unlink(filename);
- snprintf(filename, sizeof(filename), "%s/%s.pwg3", CacheDir, printer->name);
+ snprintf(filename, sizeof(filename), "%s/%s.data", CacheDir, printer->name);
unlink(filename);
#ifdef __APPLE__
con->response->request.status.status_code = IPP_OK;
}
else
- send_ipp_status(con, IPP_NOT_FOUND, _("No default printer"));
+ send_ipp_status(con, IPP_NOT_FOUND, _("No default printer."));
}
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
* Check policy...
*/
- if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK)
+ if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con,
+ job->username)) != HTTP_OK)
{
send_http_error(con, status, NULL);
return;
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Missing document-number attribute"));
+ _("Missing document-number attribute."));
return;
}
if ((docnum = attr->values[0].integer) < 1 || docnum > job->num_files ||
attr->num_values > 1)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("Document %d not found in job %d."),
- docnum, jobid);
+ send_ipp_status(con, IPP_NOT_FOUND,
+ _("Document #%d does not exist in job #%d."), docnum,
+ jobid);
return;
}
"Unable to open document %d in job %d - %s", docnum, jobid,
strerror(errno));
send_ipp_status(con, IPP_NOT_FOUND,
- _("Unable to open document %d in job %d"), docnum, jobid);
+ _("Unable to open document #%d in job #%d."), docnum,
+ jobid);
return;
}
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
if (strcmp(uri->name, "printer-uri"))
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("No printer-uri in request"));
+ send_ipp_status(con, IPP_BAD_REQUEST, _("No printer-uri in request."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
else
if (i < job_ids->num_values)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("job-id %d not found."),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
job_ids->values[i].integer);
return;
}
continue;
}
- if (username[0] && strcasecmp(username, job->username))
+ if (username[0] && _cups_strcasecmp(username, job->username))
continue;
if (count > 0)
if (!ids)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Missing notify-subscription-ids attribute"));
+ _("Missing notify-subscription-ids attribute."));
return;
}
* Bad subscription ID...
*/
- send_ipp_status(con, IPP_NOT_FOUND,
- _("notify-subscription-id %d no good"),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Subscription #%d does not exist."),
ids->values[i].integer);
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
if ((!type || (printer->type & CUPS_PRINTER_CLASS) == type) &&
(printer->type & printer_mask) == printer_type &&
(!location ||
- (printer->location && !strcasecmp(printer->location, location))))
+ (printer->location && !_cups_strcasecmp(printer->location, location))))
{
/*
* If HideImplicitMembers is enabled, see if this printer or class
* Bad subscription ID...
*/
- send_ipp_status(con, IPP_NOT_FOUND,
- _("notify-subscription-id %d no good"), sub_id);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Subscription #%d does not exist."),
+ sub_id);
return;
}
if (!job)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%s does not exist"),
- resource + 6);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
+ atoi(resource + 6));
return;
}
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
else if ((attr = ippFindAttribute(con->request, "notify-job-id",
if (!job)
{
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"),
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."),
attr->values[0].integer);
return;
}
sub;
sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
if ((!printer || sub->dest == printer) && (!job || sub->job == job) &&
- (!username[0] || !strcasecmp(username, sub->owner)))
+ (!username[0] || !_cups_strcasecmp(username, sub->owner)))
{
ippAddSeparator(con->response);
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
*/
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
return;
}
+ /*
+ * See if the job is in a state that allows holding...
+ */
+
+ if (job->state_value > IPP_JOB_STOPPED)
+ {
+ /*
+ * Return a "not-possible" error...
+ */
+
+ send_ipp_status(con, IPP_NOT_POSSIBLE,
+ _("Job #%d is finished and cannot be altered."),
+ job->id);
+ return;
+ }
+
/*
* Hold the job and return...
*/
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
printer->holding_new_jobs = 1;
cupsdSetPrinterReasons(printer, "+hold-new-jobs");
- cupsdAddPrinterHistory(printer);
if (dtype & CUPS_PRINTER_CLASS)
cupsdLogMessage(CUPSD_LOG_INFO,
*/
send_ipp_status(con, IPP_BAD_REQUEST,
- _("job-printer-uri attribute missing"));
+ _("job-printer-uri attribute missing."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("Job #%d does not exist"), attr->values[0].integer);
+ _("Job #%d does not exist."), attr->values[0].integer);
return;
}
else
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND,
- _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
else
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job #%d is finished and cannot be altered"),
+ _("Job #%d is finished and cannot be altered."),
job->id);
return;
}
* completed...
*/
- if (strcasecmp(job->dest, src) ||
+ if (_cups_strcasecmp(job->dest, src) ||
job->state_value > IPP_JOB_STOPPED)
continue;
)
{
send_ipp_status(con, IPP_ATTRIBUTES,
- _("Unsupported compression \"%s\""),
+ _("Unsupported compression \"%s\"."),
attr->values[0].string.text);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"compression", NULL, attr->values[0].string.text);
if (!con->filename)
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("No file!?"));
+ send_ipp_status(con, IPP_BAD_REQUEST, _("No file in print request."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
type) != 2)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad document-format \"%s\""),
+ _("Bad document-format \"%s\"."),
format->values[0].string.text);
return;
}
if (sscanf(default_format, "%15[^/]/%31[^;]", super, type) != 2)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad document-format \"%s\""),
+ _("Bad document-format \"%s\"."),
default_format);
return;
}
else if (!filetype)
{
send_ipp_status(con, IPP_DOCUMENT_FORMAT,
- _("Unsupported document-format \"%s\""),
+ _("Unsupported document-format \"%s\"."),
format ? format->values[0].string.text :
"application/octet-stream");
cupsdLogMessage(CUPSD_LOG_INFO,
* Read any embedded job ticket info from PS files...
*/
- if (!strcasecmp(filetype->super, "application") &&
- (!strcasecmp(filetype->type, "postscript") ||
- !strcasecmp(filetype->type, "pdf")))
+ if (!_cups_strcasecmp(filetype->super, "application") &&
+ (!_cups_strcasecmp(filetype->type, "postscript") ||
+ !_cups_strcasecmp(filetype->type, "pdf")))
read_job_ticket(con);
/*
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
strlcpy(printer->state_message, attr->values[0].string.text,
sizeof(printer->state_message));
- cupsdAddPrinterHistory(printer);
-
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
"No longer accepting jobs.");
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
printer->holding_new_jobs = 0;
cupsdSetPrinterReasons(printer, "-hold-new-jobs");
- cupsdAddPrinterHistory(printer);
if (dtype & CUPS_PRINTER_CLASS)
cupsdLogMessage(CUPSD_LOG_INFO,
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
* Nope - return a "not possible" error...
*/
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("Job #%d is not held"), jobid);
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Job #%d is not held."), jobid);
return;
}
* Bad subscription ID...
*/
- send_ipp_status(con, IPP_NOT_FOUND,
- _("notify-subscription-id %d no good"), sub_id);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Subscription #%d does not exist."),
+ sub_id);
return;
}
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job subscriptions cannot be renewed"));
+ _("Job subscriptions cannot be renewed."));
return;
}
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
* Nope - return a "not possible" error...
*/
- send_ipp_status(con, IPP_NOT_POSSIBLE, _("Job #%d is not complete"),
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Job #%d is not complete."),
jobid);
return;
}
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job #%d cannot be restarted - no files"), jobid);
+ _("Job #%d cannot be restarted - no files."), jobid);
return;
}
int i; /* Looping var */
char filename[1024]; /* Job authentication filename */
cups_file_t *fp; /* Job authentication file */
- char line[2048]; /* Line for file */
+ char line[65536]; /* Line for file */
cupsd_printer_t *dest; /* Destination printer/class */
fchown(cupsFileNumber(fp), 0, 0);
fchmod(cupsFileNumber(fp), 0400);
+ for (i = 0;
+ i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0]));
+ i ++)
+ cupsdClearString(job->auth_env + i);
+
if (auth_info && auth_info->num_values == dest->num_auth_info_required)
{
/*
* Write 1 to 3 auth values...
*/
- cupsdClearString(&job->auth_username);
- cupsdClearString(&job->auth_domain);
- cupsdClearString(&job->auth_password);
-
- for (i = 0; i < auth_info->num_values; i ++)
+ for (i = 0;
+ i < auth_info->num_values &&
+ i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0]));
+ i ++)
{
httpEncode64_2(line, sizeof(line), auth_info->values[i].string.text,
strlen(auth_info->values[i].string.text));
cupsFilePrintf(fp, "%s\n", line);
if (!strcmp(dest->auth_info_required[i], "username"))
- cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s",
+ cupsdSetStringf(job->auth_env + i, "AUTH_USERNAME=%s",
auth_info->values[i].string.text);
else if (!strcmp(dest->auth_info_required[i], "domain"))
- cupsdSetStringf(&job->auth_domain, "AUTH_DOMAIN=%s",
+ cupsdSetStringf(job->auth_env + i, "AUTH_DOMAIN=%s",
auth_info->values[i].string.text);
else if (!strcmp(dest->auth_info_required[i], "password"))
- cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s",
+ cupsdSetStringf(job->auth_env + i, "AUTH_PASSWORD=%s",
+ auth_info->values[i].string.text);
+ else if (!strcmp(dest->auth_info_required[i], "negotiate"))
+ cupsdSetStringf(job->auth_env + i, "AUTH_NEGOTIATE=%s",
+ auth_info->values[i].string.text);
+ else
+ cupsdSetStringf(job->auth_env + i, "AUTH_%s=%s",
+ dest->auth_info_required[i],
auth_info->values[i].string.text);
}
}
httpEncode64_2(line, sizeof(line), con->username, strlen(con->username));
cupsFilePrintf(fp, "%s\n", line);
- cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", con->username);
- cupsdClearString(&job->auth_domain);
+ cupsdSetStringf(job->auth_env + 0, "AUTH_USERNAME=%s", con->username);
/*
* Write the authenticated password...
httpEncode64_2(line, sizeof(line), con->password, strlen(con->password));
cupsFilePrintf(fp, "%s\n", line);
- cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", con->password);
+ cupsdSetStringf(job->auth_env + 1, "AUTH_PASSWORD=%s", con->password);
}
+#ifdef HAVE_GSSAPI
+ if (con->gss_uid > 0)
+ {
+ cupsFilePrintf(fp, "%d\n", (int)con->gss_uid);
+ cupsdSetStringf(&job->auth_uid, "AUTH_UID=%d", (int)con->gss_uid);
+ }
+#endif /* HAVE_GSSAPI */
+
/*
* Write a random number of newlines to the end of the file...
*/
*/
cupsFileClose(fp);
-
-#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5_H)
-# ifdef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID
- if (con->have_gss &&
- (con->http.hostaddr->addr.sa_family == AF_LOCAL || con->gss_creds))
-# else
- if (con->have_gss && con->gss_creds)
-# endif /* HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID */
- save_krb5_creds(con, job);
- else if (job->ccname)
- cupsdClearString(&(job->ccname));
-#endif /* HAVE_GSSAPI && HAVE_KRB5_H */
-}
-
-
-#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5_H)
-/*
- * 'save_krb5_creds()' - Save Kerberos credentials for the job.
- */
-
-static void
-save_krb5_creds(cupsd_client_t *con, /* I - Client connection */
- cupsd_job_t *job) /* I - Job */
-{
- /*
- * Get the credentials...
- */
-
- job->ccache = cupsdCopyKrb5Creds(con);
-
- /*
- * Add the KRB5CCNAME environment variable to the job so that the
- * backend can use the credentials when printing.
- */
-
- if (job->ccache)
- {
- cupsdSetStringf(&(job->ccname), "KRB5CCNAME=FILE:%s",
- krb5_cc_get_name(KerberosContext, job->ccache));
-
- cupsdLogJob(job, CUPSD_LOG_DEBUG2, "save_krb5_creds: %s", job->ccname);
- }
- else
- cupsdClearString(&(job->ccname));
}
-#endif /* HAVE_GSSAPI && HAVE_KRB5_H */
/*
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
#endif /* HAVE_LIBZ */
)
{
- send_ipp_status(con, IPP_ATTRIBUTES, _("Unsupported compression \"%s\""),
+ send_ipp_status(con, IPP_ATTRIBUTES, _("Unsupported compression \"%s\"."),
attr->values[0].string.text);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"compression", NULL, attr->values[0].string.text);
attr->values[0].boolean)
goto last_document;
- send_ipp_status(con, IPP_BAD_REQUEST, _("No file!?"));
+ send_ipp_status(con, IPP_BAD_REQUEST, _("No file in print request."));
return;
}
if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]",
super, type) != 2)
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad document-format \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad document-format \"%s\"."),
format->values[0].string.text);
return;
}
if (sscanf(default_format, "%15[^/]/%31[^;]", super, type) != 2)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Could not scan type \"%s\""),
- default_format);
+ _("Bad document-format-default \"%s\"."), default_format);
return;
}
}
else if (!filetype)
{
send_ipp_status(con, IPP_DOCUMENT_FORMAT,
- _("Unsupported format \'%s/%s\'"), super, type);
+ _("Unsupported document-format \"%s/%s\"."), super, type);
cupsdLogMessage(CUPSD_LOG_INFO,
"Hint: Do you have the raw file printing rules enabled?");
filetype->type);
send_ipp_status(con, IPP_DOCUMENT_FORMAT,
- _("Unsupported format \'%s\'"), mimetype);
+ _("Unsupported document-format \"%s\"."), mimetype);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
"document-format", NULL, mimetype);
cupsdLogMessage(status == HTTP_FORBIDDEN ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
"Returning HTTP %s for %s (%s) from %s",
httpStatus(status),
- ippOpString(con->request->request.op.operation_id),
+ con->request ?
+ ippOpString(con->request->request.op.operation_id) :
+ "no operation-id",
uri ? uri->values[0].string.text : "no URI",
con->http.hostname);
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
IPP_TAG_INTEGER)) == NULL)
{
send_ipp_status(con, IPP_BAD_REQUEST,
- _("Got a printer-uri attribute but no job-id"));
+ _("Got a printer-uri attribute but no job-id."));
return;
}
* Not a valid URI!
*/
- send_ipp_status(con, IPP_BAD_REQUEST,
- _("Bad job-uri attribute \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),
uri->values[0].string.text);
return;
}
* Nope - return a "not found" error...
*/
- send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist"), jobid);
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid);
return;
}
*/
send_ipp_status(con, IPP_NOT_POSSIBLE,
- _("Job #%d is finished and cannot be altered"), jobid);
+ _("Job #%d is finished and cannot be altered."), jobid);
return;
}
if (attr->value_tag != IPP_TAG_INTEGER)
{
- send_ipp_status(con, IPP_REQUEST_VALUE, _("Bad job-priority value"));
+ send_ipp_status(con, IPP_REQUEST_VALUE, _("Bad job-priority value."));
if ((attr2 = copy_attribute(con->response, attr, 0)) != NULL)
attr2->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
if (attr->value_tag != IPP_TAG_ENUM)
{
- send_ipp_status(con, IPP_REQUEST_VALUE, _("Bad job-state value"));
+ send_ipp_status(con, IPP_REQUEST_VALUE, _("Bad job-state value."));
if ((attr2 = copy_attribute(con->response, attr, 0)) != NULL)
attr2->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}
if (cupsdCheckGroup(username, pw, name))
break;
}
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
break;
}
)
{
send_ipp_status(con, IPP_ATTRIBUTES,
- _("Unsupported compression \"%s\""),
+ _("Unsupported compression \"%s\"."),
attr->values[0].string.text);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"compression", NULL, attr->values[0].string.text);
if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]",
super, type) != 2)
{
- send_ipp_status(con, IPP_BAD_REQUEST, _("Bad document-format \"%s\""),
+ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad document-format \"%s\"."),
format->values[0].string.text);
return;
}
cupsdLogMessage(CUPSD_LOG_INFO,
"Hint: Do you have the raw file printing rules enabled?");
send_ipp_status(con, IPP_DOCUMENT_FORMAT,
- _("Unsupported document-format \"%s\""),
+ _("Unsupported document-format \"%s\"."),
format->values[0].string.text);
ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
"document-format", NULL, format->values[0].string.text);
*/
send_ipp_status(con, IPP_NOT_FOUND,
- _("The printer or class was not found."));
+ _("The printer or class does not exist."));
return;
}