Index: scheduler/ipp.c =================================================================== --- scheduler/ipp.c (revision 6992) +++ scheduler/ipp.c (working copy) @@ -908,16 +908,6 @@ } /* - * Check policy... - */ - - if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) - { - send_http_error(con, status, NULL); - return; - } - - /* * See if the class already exists; if not, create a new class... */ @@ -941,18 +931,31 @@ } /* - * No, add the pclass... + * No, check the default policy and then add the class... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + pclass = cupsdAddClass(resource + 9); modify = 0; } else if (pclass->type & CUPS_PRINTER_IMPLICIT) { /* - * Rename the implicit class to "AnyClass" or remove it... + * Check the default policy, then tename the implicit class to "AnyClass" + * or remove it... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + if (ImplicitAnyClasses) { snprintf(newname, sizeof(newname), "Any%s", resource + 9); @@ -971,9 +974,15 @@ else if (pclass->type & CUPS_PRINTER_DISCOVERED) { /* - * Rename the remote class to "Class"... + * Check the default policy, then rename the remote class to "Class"... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + snprintf(newname, sizeof(newname), "%s@%s", resource + 9, pclass->hostname); cupsdRenamePrinter(pclass, newname); @@ -984,6 +993,12 @@ pclass = cupsdAddClass(resource + 9); modify = 0; } + else if ((status = cupsdCheckPolicy(pclass->op_policy_ptr, con, + NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } else modify = 1; @@ -2180,16 +2195,6 @@ } /* - * Check policy... - */ - - if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) - { - send_http_error(con, status, NULL); - return; - } - - /* * See if the printer already exists; if not, create a new printer... */ @@ -2213,18 +2218,31 @@ } /* - * No, add the printer... + * No, check the default policy then add the printer... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + printer = cupsdAddPrinter(resource + 10); modify = 0; } else if (printer->type & CUPS_PRINTER_IMPLICIT) { /* - * Rename the implicit printer to "AnyPrinter" or delete it... + * Check the default policy, then rename the implicit printer to + * "AnyPrinter" or delete it... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + if (ImplicitAnyClasses) { snprintf(newname, sizeof(newname), "Any%s", resource + 10); @@ -2243,9 +2261,16 @@ else if (printer->type & CUPS_PRINTER_DISCOVERED) { /* - * Rename the remote printer to "Printer@server"... + * Check the default policy, then rename the remote printer to + * "Printer@server"... */ + if ((status = cupsdCheckPolicy(DefaultPolicyPtr, con, NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } + snprintf(newname, sizeof(newname), "%s@%s", resource + 10, printer->hostname); cupsdRenamePrinter(printer, newname); @@ -2257,6 +2282,12 @@ printer = cupsdAddPrinter(resource + 10); modify = 0; } + else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, + NULL)) != HTTP_OK) + { + send_http_error(con, status, NULL); + return; + } else modify = 1;