Skip to content

Commit 00bd189

Browse files
committed
Update the default policy for the Set-Printer-Attributes operation as admin.
1 parent 7484e48 commit 00bd189

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ v2.5b1 - YYYY-MM-DD
9494
returns "localhost" for a non-loopback address.
9595
- Updated the IPP Everywhere PPD generator to support "job-presets-supported"
9696
pairs for custom boolean, integer, and keyword attributes.
97+
- Updated the default "cups.conf" policies to specify the Set-Printer-Attributes
98+
operation as an administrative operation.
9799
- Deprecated the "page-border" Job Template attribute (Issue #1020)
98100
- Removed the `cups-config` utility (use `pkg-config` instead)
99101
- Fixed use-after-free in `cupsdAcceptClient()` when we log warning during error

conf/cupsd.conf.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ WebInterface @CUPS_WEBIF@
8080
</Limit>
8181

8282
# All administration operations require an administrator to authenticate...
83-
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
83+
<Limit Set-Printer-Attributes CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
8484
AuthType Default
8585
Require user @SYSTEM
8686
Order deny,allow
@@ -131,7 +131,7 @@ WebInterface @CUPS_WEBIF@
131131
</Limit>
132132

133133
# All administration operations require an administrator to authenticate...
134-
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
134+
<Limit Set-Printer-Attributes CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
135135
AuthType Default
136136
Require user @SYSTEM
137137
Order deny,allow
@@ -177,7 +177,7 @@ WebInterface @CUPS_WEBIF@
177177
</Limit>
178178

179179
# All administration operations require an administrator to authenticate...
180-
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
180+
<Limit Set-Printer-Attributes CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
181181
AuthType Default
182182
Require user @SYSTEM
183183
Order deny,allow

scheduler/conf.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,9 +4472,9 @@ set_policy_defaults(cupsd_policy_t *pol)/* I - Policy */
44724472

44734473

44744474
/*
4475-
* Verify that we have an explicit policy for Validate-Job, Cancel-Jobs,
4476-
* Cancel-My-Jobs, Close-Job, and CUPS-Get-Document, which ensures that
4477-
* upgrades do not introduce new security issues...
4475+
* Verify that we have an explicit policy for Cancel-Jobs, Cancel-My-Jobs,
4476+
* Close-Job, CUPS-Get-Document, Set-Printer-Attributes, and Validate-Job,
4477+
* which ensures that upgrades do not introduce new security issues...
44784478
*
44794479
* CUPS STR #4659: Allow a lone <Limit All> policy.
44804480
*/
@@ -4575,6 +4575,25 @@ set_policy_defaults(cupsd_policy_t *pol)/* I - Policy */
45754575
else
45764576
cupsdLogMessage(CUPSD_LOG_WARN, "No limit for CUPS-Get-Document defined in policy %s and no suitable template found.", pol->name);
45774577
}
4578+
4579+
if ((op = cupsdFindPolicyOp(pol, IPP_OP_SET_PRINTER_ATTRIBUTES)) == NULL ||
4580+
op->op == IPP_ANY_OPERATION)
4581+
{
4582+
if ((op = cupsdFindPolicyOp(pol, IPP_OP_CUPS_ADD_MODIFY_PRINTER)) != NULL &&
4583+
op->op != IPP_ANY_OPERATION)
4584+
{
4585+
/*
4586+
* Add a new limit for Set-Printer-Attributes using the
4587+
* CUPS-Add-Modify-Printer limit as a template...
4588+
*/
4589+
4590+
cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Set-Printer-Attributes defined in policy %s - using CUPS-Add-Modify-Printer's policy.", pol->name);
4591+
4592+
cupsdAddPolicyOp(pol, op, IPP_OP_SET_PRINTER_ATTRIBUTES);
4593+
}
4594+
else
4595+
cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Set-Printer-Attributes defined in policy %s and no suitable template found.", pol->name);
4596+
}
45784597
}
45794598

45804599
/*

0 commit comments

Comments
 (0)