]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use the printer-op-policy for the printer or class when it is modified, not
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 28 Sep 2007 18:17:23 +0000 (18:17 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 28 Sep 2007 18:17:23 +0000 (18:17 +0000)
the default policy (STR #2525)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@6994 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.3.txt
scheduler/ipp.c

index b381293805093a532d8b1694ee97f2cd4f51d2e0..9c531fa81637011bdedb718c58e09ee308f05125 100644 (file)
@@ -3,6 +3,8 @@ CHANGES-1.3.txt
 
 CHANGES IN CUPS V1.3.3
 
+       - The scheduler did not use the printer-op-policy when
+         modifying classes or printers (STR #2525)
        - The auth-info-required attribute was not always updated
          for remote queues that required authentication.
        - The German web interface localization contained errors
index c9473b9e611a66ab4c48ad76adf24322af908362..679eb710e31b1e21b334a6fb429aa4cd79b18bb8 100644 (file)
@@ -907,16 +907,6 @@ add_class(cupsd_client_t  *con,            /* I - Client connection */
     return;
   }
 
- /*
-  * 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 @@ add_class(cupsd_client_t  *con,           /* I - Client connection */
     }
 
    /*
-    * 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 @@ add_class(cupsd_client_t  *con,            /* I - Client connection */
   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 @@ add_class(cupsd_client_t  *con,            /* I - Client connection */
     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;
 
@@ -2179,16 +2194,6 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
     return;
   }
 
- /*
-  * 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 @@ add_printer(cupsd_client_t  *con,       /* I - Client connection */
     }
 
    /*
-    * 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 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
   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 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
     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;