Cancelling Jobs (Patch proposal)
Dimitri Goldin
goldin at ipcon.de
Fri Jan 6 02:41:00 PST 2006
Hello CUPSers,
The company I work at has a lot of customers of which quite a couple
have problems with Job of other users taking up the whole printer for
hours because some print before they look. In earlier version everyone
was able to cancel others jobs. Now you decided to disable this.
But it seems quite a problem to teach the users how to log in.
So, why not making this a configuration option?
I tried and it seems to work properly:
__________________
diff -Naur cups-1.1.23_old/scheduler/conf.c cups-1.1.23/scheduler/conf.c
--- cups-1.1.23_old/scheduler/conf.c 2006-01-03 18:02:31.000000000 +0100
+++ cups-1.1.23/scheduler/conf.c 2006-01-03 19:37:54.000000000 +0100
@@ -142,7 +142,8 @@
{ "ServerName", &ServerName, VAR_STRING },
{ "ServerRoot", &ServerRoot, VAR_STRING },
{ "TempDir", &TempDir, VAR_STRING },
- { "Timeout", &Timeout, VAR_INTEGER }
+ { "Timeout", &Timeout, VAR_INTEGER },
+ { "AnonCancel", &AnonCancel, VAR_BOOLEAN }
};
#define NUM_VARS (sizeof(variables) / sizeof(variables[0]))
@@ -1555,6 +1556,15 @@
else
LogMessage(L_WARN, "Unknown ServerTokens %s on line %d.", value, linenum);
}
+ else if(strcasecmp(name, "AnonCancel")==0) {
+
+ if(strcasecmp(value, "enable")==0) {
+ AnonCancel = TRUE;
+ }
+ if(strcasecmp(value, "disable")==0) {
+ AnonCancel = FALSE;
+ }
+ }
else
{
/*
diff -Naur cups-1.1.23_old/scheduler/conf.h cups-1.1.23/scheduler/conf.h
--- cups-1.1.23_old/scheduler/conf.h 2006-01-03 18:02:31.000000000 +0100
+++ cups-1.1.23/scheduler/conf.h 2006-01-03 19:32:36.000000000 +0100
@@ -153,8 +153,10 @@
RunAsUser VALUE(FALSE),
/* Run as unpriviledged user? */
RunUser, /* User to run as, used for files */
- PrintcapFormat VALUE(PRINTCAP_BSD);
+ PrintcapFormat VALUE(PRINTCAP_BSD),
/* Format of printcap file? */
+ AnonCancel VALUE(FALSE);
+ /* Whether auth is needed to cancel jobs */
VAR cups_file_t *AccessFile VALUE(NULL),
/* Access log file */
*ErrorFile VALUE(NULL),
diff -Naur cups-1.1.23_old/scheduler/ipp.c cups-1.1.23/scheduler/ipp.c
--- cups-1.1.23_old/scheduler/ipp.c 2006-01-03 18:02:31.000000000 +0100
+++ cups-1.1.23/scheduler/ipp.c 2006-01-03 19:38:09.000000000 +0100
@@ -1830,7 +1830,7 @@
* See if the job is owned by the requesting user...
*/
- if (!validate_user(con, job->username, username, sizeof(username)))
+ if (AnonCancel == FALSE && validate_user(con, job->username, username, sizeof(username)) == 0)
{
LogMessage(L_ERROR, "cancel_job: \"%s\" not authorized to delete job id %d owned by \"%s\"!",
username, jobid, job->username);
__________________
Cheers
More information about the cups
mailing list