Skip to content

Commit dce85e1

Browse files
committed
Report an error if you use lpadmin to set defaults for a temporary queue (Issue #237)
1 parent 939368f commit dce85e1

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Changes in CUPS v2.4.8 (TBA)
1212
- Updated IPP Everywhere printer creation error reporting (Issue #347)
1313
- Raised `cups_enum_dests()` timeout for listing available IPP printers
1414
(Issue #751)
15+
- Now report an error for temporary printer defaults with lpadmin (Issue #237)
1516
- Fixed mapping of PPD InputSlot, MediaType, and OutputBin values (Issue #238)
1617
- Fixed "document-unprintable-error" handling (Issue #391)
1718
- Fixed the web interface not showing an error for a non-existent printer

scheduler/ipp.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11015,6 +11015,9 @@ set_printer_defaults(
1101511015
* Only allow keywords and names...
1101611016
*/
1101711017

11018+
if (printer->temporary)
11019+
goto temporary_printer;
11020+
1101811021
if (attr->value_tag != IPP_TAG_NAME && attr->value_tag != IPP_TAG_KEYWORD)
1101911022
continue;
1102011023

@@ -11035,6 +11038,9 @@ set_printer_defaults(
1103511038
}
1103611039
else if (!strcmp(attr->name, "requesting-user-name-allowed"))
1103711040
{
11041+
if (printer->temporary)
11042+
goto temporary_printer;
11043+
1103811044
cupsdFreeStrings(&(printer->users));
1103911045

1104011046
printer->deny_users = 0;
@@ -11049,6 +11055,9 @@ set_printer_defaults(
1104911055
}
1105011056
else if (!strcmp(attr->name, "requesting-user-name-denied"))
1105111057
{
11058+
if (printer->temporary)
11059+
goto temporary_printer;
11060+
1105211061
cupsdFreeStrings(&(printer->users));
1105311062

1105411063
printer->deny_users = 1;
@@ -11063,6 +11072,9 @@ set_printer_defaults(
1106311072
}
1106411073
else if (!strcmp(attr->name, "job-quota-period"))
1106511074
{
11075+
if (printer->temporary)
11076+
goto temporary_printer;
11077+
1106611078
if (attr->value_tag != IPP_TAG_INTEGER)
1106711079
continue;
1106811080

@@ -11074,6 +11086,9 @@ set_printer_defaults(
1107411086
}
1107511087
else if (!strcmp(attr->name, "job-k-limit"))
1107611088
{
11089+
if (printer->temporary)
11090+
goto temporary_printer;
11091+
1107711092
if (attr->value_tag != IPP_TAG_INTEGER)
1107811093
continue;
1107911094

@@ -11085,6 +11100,9 @@ set_printer_defaults(
1108511100
}
1108611101
else if (!strcmp(attr->name, "job-page-limit"))
1108711102
{
11103+
if (printer->temporary)
11104+
goto temporary_printer;
11105+
1108811106
if (attr->value_tag != IPP_TAG_INTEGER)
1108911107
continue;
1109011108

@@ -11099,6 +11117,9 @@ set_printer_defaults(
1109911117
cupsd_policy_t *p; /* Policy */
1110011118

1110111119

11120+
if (printer->temporary)
11121+
goto temporary_printer;
11122+
1110211123
if (attr->value_tag != IPP_TAG_NAME)
1110311124
continue;
1110411125

@@ -11120,6 +11141,9 @@ set_printer_defaults(
1112011141
}
1112111142
else if (!strcmp(attr->name, "printer-error-policy"))
1112211143
{
11144+
if (printer->temporary)
11145+
goto temporary_printer;
11146+
1112311147
if (attr->value_tag != IPP_TAG_NAME && attr->value_tag != IPP_TAG_KEYWORD)
1112411148
continue;
1112511149

@@ -11150,6 +11174,9 @@ set_printer_defaults(
1115011174
namelen > (sizeof(name) - 1) || attr->num_values != 1)
1115111175
continue;
1115211176

11177+
if (printer->temporary)
11178+
goto temporary_printer;
11179+
1115311180
/*
1115411181
* OK, anything else must be a user-defined default...
1115511182
*/
@@ -11223,6 +11250,17 @@ set_printer_defaults(
1122311250
}
1122411251

1122511252
return (1);
11253+
11254+
/*
11255+
* If we get here this is a temporary printer and you can't set defaults for
11256+
* this kind of queue...
11257+
*/
11258+
11259+
temporary_printer:
11260+
11261+
send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Unable to save value for \"%s\" with a temporary printer."), attr->name);
11262+
11263+
return (0);
1122611264
}
1122711265

1122811266

0 commit comments

Comments
 (0)