Index: man/cancel.man =================================================================== --- man/cancel.man (revision 10826) +++ man/cancel.man (working copy) @@ -12,7 +12,7 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH cancel 1 "CUPS" "20 March 2006" "Apple Inc." +.TH cancel 1 "CUPS" "21 January 2013" "Apple Inc." .SH NAME cancel - cancel jobs .SH SYNOPSIS @@ -23,7 +23,7 @@ .I hostname[:port] ] [ -u .I username -] [ +] [ -x ] [ .I id ] [ .I destination @@ -56,6 +56,10 @@ -u username .br Cancels jobs owned by \fIusername\fR. +.TP 5 +-x +.br +Deletes job data files in addition to canceling. .SH COMPATIBILITY Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#". Index: scheduler/ipp.c =================================================================== --- scheduler/ipp.c (revision 10826) +++ scheduler/ipp.c (working copy) @@ -3,7 +3,7 @@ * * IPP routines for the CUPS scheduler. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * This file contains Kerberos support code, copyright 2006 by @@ -3286,8 +3286,12 @@ { for (i = 0; i < job_ids->num_values; i ++) { - if (!cupsdFindJob(job_ids->values[i].integer)) + if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL) break; + + if (con->request->request.op.operation_id == IPP_CANCEL_MY_JOBS && + _cups_strcasecmp(job->username, username)) + break; } if (i < job_ids->num_values) @@ -3343,6 +3347,10 @@ if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL || _cups_strcasecmp(job->dest, printer->name)) break; + + if (con->request->request.op.operation_id == IPP_CANCEL_MY_JOBS && + _cups_strcasecmp(job->username, username)) + break; } if (i < job_ids->num_values) Index: systemv/cancel.c =================================================================== --- systemv/cancel.c (revision 10826) +++ systemv/cancel.c (working copy) @@ -3,7 +3,7 @@ * * "cancel" command for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -101,8 +101,7 @@ break; case 'a' : /* Cancel all jobs */ - purge = 1; - op = IPP_PURGE_JOBS; + op = IPP_CANCEL_JOBS; break; case 'h' : /* Connect to host */ @@ -151,6 +150,10 @@ } break; + case 'x' : /* Purge job(s) */ + purge = 1; + break; + default : _cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."), @@ -271,19 +274,22 @@ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, user); ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1); + + if (op == IPP_CANCEL_JOBS) + op = IPP_CANCEL_MY_JOBS; } else ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser()); - if (op == IPP_PURGE_JOBS) + if (purge) ippAddBoolean(request, IPP_TAG_OPERATION, "purge-jobs", purge); /* * Do the request and get back a response... */ - if (op == IPP_PURGE_JOBS && (!user || _cups_strcasecmp(user, cupsUser()))) + if (op == IPP_CANCEL_JOBS && (!user || _cups_strcasecmp(user, cupsUser()))) response = cupsDoRequest(http, request, "/admin/"); else response = cupsDoRequest(http, request, "/jobs/");