]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/ipp.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / scheduler / ipp.c
index 8c266c7c9db13a34db2b2a8617ca5dc6da6d9b7f..caa1cc49ee259749d794bf53a2c99c17d92e7992 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * "$Id$"
- *
  * IPP routines for the CUPS scheduler.
  *
  * Copyright 2007-2016 by Apple Inc.
@@ -9,11 +7,7 @@
  * This file contains Kerberos support code, copyright 2006 by
  * Jelmer Vernooij.
  *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file.  If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -126,8 +120,7 @@ static void send_ipp_status(cupsd_client_t *con, ipp_status_t status,
 static void    set_default(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    set_job_attrs(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    set_printer_attrs(cupsd_client_t *con, ipp_attribute_t *uri);
-static void    set_printer_defaults(cupsd_client_t *con,
-                                    cupsd_printer_t *printer);
+static int     set_printer_defaults(cupsd_client_t *con, cupsd_printer_t *printer);
 static void    start_printer(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    stop_printer(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    url_encode_attr(ipp_attribute_t *attr, char *buffer, size_t bufsize);
@@ -155,9 +148,30 @@ cupsdProcessIPPRequest(
   int                  sub_id;         /* Subscription ID */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                  "cupsdProcessIPPRequest(%p[%d]): operation_id = %04x",
-                  con, con->number, con->request->request.op.operation_id);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdProcessIPPRequest(%p[%d]): operation_id=%04x(%s)", con, con->number, con->request->request.op.operation_id, ippOpString(con->request->request.op.operation_id));
+
+  if (LogLevel >= CUPSD_LOG_DEBUG2)
+  {
+    for (group = IPP_TAG_ZERO, attr = ippFirstAttribute(con->request); attr; attr = ippNextAttribute(con->request))
+    {
+      const char  *name;                /* Attribute name */
+      char        value[1024];          /* Attribute value */
+
+      if (group != ippGetGroupTag(attr))
+      {
+        group = ippGetGroupTag(attr);
+        if (group != IPP_TAG_ZERO)
+          cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdProcessIPPRequest: %s", ippTagString(group));
+      }
+
+      if ((name = ippGetName(attr)) == NULL)
+        continue;
+
+      ippAttributeString(attr, value, sizeof(value));
+
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdProcessIPPRequest: %s %s%s '%s'", name, ippGetCount(attr) > 1 ? "1setOf " : "", ippTagString(ippGetValueTag(attr)), value);
+    }
+  }
 
  /*
   * First build an empty response message for this request...
@@ -934,6 +948,8 @@ add_class(cupsd_client_t  *con,             /* I - Client connection */
 
     pclass = cupsdAddClass(resource + 9);
     modify = 0;
+
+    pclass->printer_id = NextPrinterId ++;
   }
   else if ((status = cupsdCheckPolicy(pclass->op_policy_ptr, con,
                                       NULL)) != HTTP_OK)
@@ -989,6 +1005,9 @@ add_class(cupsd_client_t  *con,            /* I - Client connection */
       */
 
       send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
+      if (!modify)
+       cupsdDeletePrinter(pclass, 0);
+
       return;
     }
 
@@ -1011,6 +1030,9 @@ add_class(cupsd_client_t  *con,           /* I - Client connection */
       send_ipp_status(con, IPP_BAD_REQUEST,
                       _("Attempt to set %s printer-state to bad value %d."),
                       pclass->name, attr->values[0].integer);
+      if (!modify)
+       cupsdDeletePrinter(pclass, 0);
+
       return;
     }
 
@@ -1067,12 +1089,18 @@ add_class(cupsd_client_t  *con,         /* I - Client connection */
 
        send_ipp_status(con, IPP_NOT_FOUND,
                        _("The printer or class does not exist."));
+       if (!modify)
+         cupsdDeletePrinter(pclass, 0);
+
        return;
       }
       else if (dtype & CUPS_PRINTER_CLASS)
       {
         send_ipp_status(con, IPP_BAD_REQUEST,
                        _("Nested classes are not allowed."));
+       if (!modify)
+         cupsdDeletePrinter(pclass, 0);
+
         return;
       }
 
@@ -1084,7 +1112,13 @@ add_class(cupsd_client_t  *con,          /* I - Client connection */
     }
   }
 
-  set_printer_defaults(con, pclass);
+  if (!set_printer_defaults(con, pclass))
+  {
+    if (!modify)
+      cupsdDeletePrinter(pclass, 0);
+
+    return;
+  }
 
   if ((attr = ippFindAttribute(con->request, "auth-info-required",
                                IPP_TAG_KEYWORD)) != NULL)
@@ -1561,6 +1595,16 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
     return (NULL);
   }
 
+  attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
+
+  if (attr && !ippValidateAttribute(attr))
+  {
+    send_ipp_status(con, IPP_ATTRIBUTES, _("Bad requesting-user-name value: %s"), cupsLastErrorString());
+    if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL)
+      attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
+    return (NULL);
+  }
+
   if ((job = cupsdAddJob(priority, printer->name)) == NULL)
   {
     send_ipp_status(con, IPP_INTERNAL_ERROR,
@@ -1579,8 +1623,6 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
   add_job_uuid(job);
   apply_printer_defaults(printer, job);
 
-  attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME);
-
   if (con->username[0])
   {
     cupsdSetString(&job->username, con->username);
@@ -1696,7 +1738,24 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
     attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
                         "job-hold-until", NULL, val);
   }
-  if (attr && strcmp(attr->values[0].string.text, "no-hold"))
+
+  if (printer->holding_new_jobs)
+  {
+   /*
+    * Hold all new jobs on this printer...
+    */
+
+    if (attr && strcmp(attr->values[0].string.text, "no-hold"))
+      cupsdSetJobHoldUntil(job, ippGetString(attr, 0, NULL), 0);
+    else
+      cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+    job->state->values[0].integer = IPP_JOB_HELD;
+    job->state_value              = IPP_JOB_HELD;
+
+    ippSetString(job->attrs, &job->reasons, 0, "job-held-on-create");
+  }
+  else if (attr && strcmp(attr->values[0].string.text, "no-hold"))
   {
    /*
     * Hold job until specified time...
@@ -2280,6 +2339,8 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
 
     printer = cupsdAddPrinter(resource + 10);
     modify  = 0;
+
+    printer->printer_id = NextPrinterId ++;
   }
   else if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con,
                                       NULL)) != HTTP_OK)
@@ -2329,22 +2390,6 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
     http_uri_status_t  uri_status;     /* URI separation status */
     char               old_device_uri[1024];
                                        /* Old device URI */
-    static const char * const uri_status_strings[] =
-    {
-      "URI too large.",
-      "Bad arguments to function.",
-      "Bad resource path.",
-      "Bad port number.",
-      "Bad hostname/address.",
-      "Bad username/password.",
-      "Bad URI scheme.",
-      "Bad URI.",
-      "OK",
-      "Missing URI scheme.",
-      "Unknown URI scheme",
-      "Missing resource path."
-    };
-
 
     need_restart_job = 1;
 
@@ -2355,14 +2400,15 @@ add_printer(cupsd_client_t  *con,       /* I - Client connection */
                                 host, sizeof(host), &port,
                                 resource, sizeof(resource));
 
-    cupsdLogMessage(CUPSD_LOG_DEBUG,
-                   "%s device-uri: %s", printer->name,
-                   uri_status_strings[uri_status - HTTP_URI_STATUS_OVERFLOW]);
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "%s device-uri: %s", printer->name, httpURIStatusString(uri_status));
 
     if (uri_status < HTTP_URI_OK)
     {
       send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
                      attr->values[0].string.text);
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2383,6 +2429,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
                          "To enable, see the FileDevice directive in "
                          "\"%s/cups-files.conf\"."),
                        ServerRoot);
+       if (!modify)
+         cupsdDeletePrinter(printer, 0);
+
        return;
       }
     }
@@ -2401,6 +2450,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
 
        send_ipp_status(con, IPP_NOT_POSSIBLE,
                         _("Bad device-uri scheme \"%s\"."), scheme);
+       if (!modify)
+         cupsdDeletePrinter(printer, 0);
+
        return;
       }
     }
@@ -2445,6 +2497,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     {
       send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad port-monitor \"%s\"."),
                      attr->values[0].string.text);
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2484,6 +2539,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     {
       send_ipp_status(con, IPP_BAD_REQUEST,
                       _("Cannot share a remote Kerberized printer."));
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2494,6 +2552,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
       */
 
       send_ipp_status(con, IPP_BAD_REQUEST, _("Cannot change printer-is-shared for remote queues."));
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2517,6 +2578,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     {
       send_ipp_status(con, IPP_BAD_REQUEST, _("Bad printer-state value %d."),
                       attr->values[0].integer);
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2553,6 +2617,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
                      attr->num_values,
                      (int)(sizeof(printer->reasons) /
                            sizeof(printer->reasons[0])));
+      if (!modify)
+        cupsdDeletePrinter(printer, 0);
+
       return;
     }
 
@@ -2586,7 +2653,13 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
                   "Printer \"%s\" state changed.", printer->name);
   }
 
-  set_printer_defaults(con, printer);
+  if (!set_printer_defaults(con, printer))
+  {
+    if (!modify)
+      cupsdDeletePrinter(printer, 0);
+
+    return;
+  }
 
   if ((attr = ippFindAttribute(con->request, "auth-info-required",
                                IPP_TAG_KEYWORD)) != NULL)
@@ -2627,6 +2700,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
       if (strncmp(line, "*PPD-Adobe", 10))
       {
        send_ipp_status(con, IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED, _("Bad PPD file."));
+       if (!modify)
+         cupsdDeletePrinter(printer, 0);
+
        return;
       }
 
@@ -2641,6 +2717,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
       if (copy_file(srcfile, dstfile, ConfigFilePerm))
       {
        send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file - %s"), strerror(errno));
+       if (!modify)
+         cupsdDeletePrinter(printer, 0);
+
        return;
       }
 
@@ -2667,6 +2746,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     else if (strstr(ppd_name, "../"))
     {
       send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Invalid ppd-name value."));
+      if (!modify)
+       cupsdDeletePrinter(printer, 0);
+
       return;
     }
     else
@@ -2680,6 +2762,9 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
       if (copy_model(con, ppd_name, dstfile))
       {
         send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to copy PPD file."));
+       if (!modify)
+         cupsdDeletePrinter(printer, 0);
+
        return;
       }
 
@@ -2696,8 +2781,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
 
     char cache_name[1024];             /* Cache filename for printer attrs */
 
-    snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir,
-             printer->name);
+    snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, printer->name);
     unlink(cache_name);
 
     cupsdSetPrinterReasons(printer, "none");
@@ -2757,9 +2841,15 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
   * Update the printer attributes and return...
   */
 
-  cupsdSetPrinterAttrs(printer);
   if (!printer->temporary)
+  {
+    if (!printer->printer_id)
+      printer->printer_id = NextPrinterId ++;
+
     cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
+  }
+
+  cupsdSetPrinterAttrs(printer);
 
   if (need_restart_job && printer->job)
   {
@@ -2858,6 +2948,8 @@ apply_printer_defaults(
                *option;                /* Current option */
 
 
+  cupsdLogJob(job, CUPSD_LOG_DEBUG, "Applying default options...");
+
  /*
   * Collect all of the default options and add the missing ones to the
   * job object...
@@ -2869,8 +2961,12 @@ apply_printer_defaults(
        i --, option ++)
     if (!ippFindAttribute(job->attrs, option->name, IPP_TAG_ZERO))
     {
-      num_options = cupsAddOption(option->name, option->value, num_options,
-                                  &options);
+      if (!strcmp(option->name, "print-quality") && ippFindAttribute(job->attrs, "cupsPrintQuality", IPP_TAG_NAME))
+        continue;                     /* Don't override cupsPrintQuality */
+
+      cupsdLogJob(job, CUPSD_LOG_DEBUG, "Adding default %s=%s", option->name, option->value);
+
+      num_options = cupsAddOption(option->name, option->value, num_options, &options);
     }
 
  /*
@@ -5229,8 +5325,13 @@ create_local_bg_thread(
   * Try connecting to the printer...
   */
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Generating PPD file from \"%s\"...", printer->name, printer->device_uri);
+
   if (httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme, sizeof(scheme), userpass, sizeof(userpass), host, sizeof(host), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Bad device URI \"%s\".", printer->name, printer->device_uri);
     return (NULL);
+  }
 
   if (!strcmp(scheme, "ipps") || port == 443)
     encryption = HTTP_ENCRYPTION_ALWAYS;
@@ -5238,18 +5339,25 @@ create_local_bg_thread(
     encryption = HTTP_ENCRYPTION_IF_REQUESTED;
 
   if ((http = httpConnect2(host, port, NULL, AF_UNSPEC, encryption, 1, 30000, NULL)) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to connect to %s:%d: %s", printer->name, host, port, cupsLastErrorString());
     return (NULL);
+  }
 
  /*
   * Query the printer for its capabilities...
   */
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Connected to %s:%d, sending Get-Printer-Attributes request...", printer->name, host, port);
+
   request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer->device_uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "all");
 
   response = cupsDoRequest(http, request, resource);
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Get-Printer-Attributes returned %s", printer->name, ippErrorString(cupsLastError()));
+
   // TODO: Grab printer icon file...
   httpClose(http);
 
@@ -5269,11 +5377,15 @@ create_local_bg_thread(
       cupsdSetString(&printer->geo_location, ippGetString(attr, 0, NULL));
 
     if ((from = cupsFileOpen(fromppd, "r")) == NULL)
+    {
+      cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to read generated PPD: %s", printer->name, strerror(errno));
       return (NULL);
+    }
 
     snprintf(toppd, sizeof(toppd), "%s/ppd/%s.ppd", ServerRoot, printer->name);
     if ((to = cupsdCreateConfFile(toppd, ConfigFilePerm)) == NULL)
     {
+      cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to create PPD for printer: %s", printer->name, strerror(errno));
       cupsFileClose(from);
       return (NULL);
     }
@@ -5284,12 +5396,18 @@ create_local_bg_thread(
     cupsFileClose(from);
     if (!cupsdCloseCreatedConfFile(to, toppd))
     {
-      printer->state     = IPP_PSTATE_IDLE;
-      printer->accepting = 1;
+      printer->config_time = time(NULL);
+      printer->state       = IPP_PSTATE_IDLE;
+      printer->accepting   = 1;
 
       cupsdSetPrinterAttrs(printer);
+
+      cupsdAddEvent(CUPSD_EVENT_PRINTER_CONFIG, printer, NULL, "Printer \"%s\" is now available.", printer->name);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" is now available.", printer->name);
     }
   }
+  else
+    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: PPD creation failed: %s", printer->name, cupsLastErrorString());
 
   return (NULL);
 }
@@ -5402,6 +5520,9 @@ create_local_printer(
     return;
   }
 
+  printer->shared    = 0;
+  printer->temporary = 1;
+
   cupsdSetDeviceURI(printer, ippGetString(device_uri, 0, NULL));
 
   if (printer_geo_location)
@@ -6379,10 +6500,9 @@ get_jobs(cupsd_client_t  *con,           /* I - Client connection */
   ipp_jstate_t job_state;              /* job-state value */
   int          first_job_id = 1,       /* First job ID */
                first_index = 1,        /* First index */
-               current_index = 0;      /* Current index */
-  int          limit = 0;              /* Maximum number of jobs to return */
-  int          count;                  /* Number of jobs that match */
-  int          need_load_job = 0;      /* Do we need to load the job? */
+               limit = 0,              /* Maximum number of jobs to return */
+               count,                  /* Number of jobs that match */
+               need_load_job = 0;      /* Do we need to load the job? */
   const char   *job_attr;              /* Job attribute requested */
   ipp_attribute_t *job_ids;            /* job-ids attribute */
   cupsd_job_t  *job;                   /* Current job pointer */
@@ -6690,9 +6810,12 @@ get_jobs(cupsd_client_t  *con,           /* I - Client connection */
   }
   else
   {
-    for (count = 0, job = (cupsd_job_t *)cupsArrayFirst(list);
-        (limit <= 0 || count < limit) && job;
-        job = (cupsd_job_t *)cupsArrayNext(list))
+    if (first_index > 1)
+      job = (cupsd_job_t *)cupsArrayIndex(list, first_index - 1);
+    else
+      job = (cupsd_job_t *)cupsArrayFirst(list);
+
+    for (count = 0; (limit <= 0 || count < limit) && job; job = (cupsd_job_t *)cupsArrayNext(list))
     {
      /*
       * Filter out jobs that don't match...
@@ -6724,10 +6847,6 @@ get_jobs(cupsd_client_t  *con,           /* I - Client connection */
       if (job->id < first_job_id)
        continue;
 
-      current_index ++;
-      if (current_index < first_index)
-        continue;
-
       if (need_load_job && !job->attrs)
       {
         cupsdLoadJob(job);
@@ -7349,6 +7468,7 @@ get_printers(cupsd_client_t *con, /* I - Client connection */
   ipp_attribute_t *attr;               /* Current attribute */
   int          limit;                  /* Max number of printers to return */
   int          count;                  /* Number of printers that match */
+  int          printer_id;             /* Printer we are interested in */
   cupsd_printer_t *printer;            /* Current printer pointer */
   cups_ptype_t printer_type,           /* printer-type attribute */
                printer_mask;           /* printer-type-mask attribute */
@@ -7402,6 +7522,17 @@ get_printers(cupsd_client_t *con,        /* I - Client connection */
   * Support filtering...
   */
 
+  if ((attr = ippFindAttribute(con->request, "printer-id", IPP_TAG_INTEGER)) != NULL)
+  {
+    if ((printer_id = ippGetInteger(attr, 0)) <= 0)
+    {
+      send_ipp_status(con, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, _("Bad \"printer-id\" value %d."), printer_id);
+      return;
+    }
+  }
+  else
+    printer_id = 0;
+
   if ((attr = ippFindAttribute(con->request, "printer-type",
                                IPP_TAG_ENUM)) != NULL)
     printer_type = (cups_ptype_t)attr->values[0].integer;
@@ -7451,6 +7582,9 @@ get_printers(cupsd_client_t *con, /* I - Client connection */
     if (!local && !printer->shared)
       continue;
 
+    if (printer_id && printer->printer_id != printer_id)
+      continue;
+
     if ((!type || (printer->type & CUPS_PRINTER_CLASS) == type) &&
         (printer->type & printer_mask) == printer_type &&
        (!location ||
@@ -8868,6 +9002,8 @@ release_held_new_jobs(
                     "Printer \"%s\" now printing pending/new jobs (\"%s\").",
                     printer->name, get_username(con));
 
+  cupsdCheckJobs();
+
  /*
   * Everything was ok, so return OK status...
   */
@@ -10539,7 +10675,7 @@ set_printer_attrs(cupsd_client_t  *con, /* I - Client connection */
  * 'set_printer_defaults()' - Set printer default options from a request.
  */
 
-static void
+static int                             /* O - 1 on success, 0 on failure */
 set_printer_defaults(
     cupsd_client_t  *con,              /* I - Client connection */
     cupsd_printer_t *printer)          /* I - Printer */
@@ -10668,7 +10804,7 @@ set_printer_defaults(
        send_ipp_status(con, IPP_NOT_POSSIBLE,
                        _("Unknown printer-op-policy \"%s\"."),
                        attr->values[0].string.text);
-       return;
+       return (0);
       }
     }
     else if (!strcmp(attr->name, "printer-error-policy"))
@@ -10685,7 +10821,7 @@ set_printer_defaults(
        send_ipp_status(con, IPP_NOT_POSSIBLE,
                        _("Unknown printer-error-policy \"%s\"."),
                        attr->values[0].string.text);
-       return;
+       return (0);
       }
 
       cupsdLogMessage(CUPSD_LOG_DEBUG,
@@ -10781,6 +10917,8 @@ set_printer_defaults(
          break;
     }
   }
+
+  return (1);
 }
 
 
@@ -11378,8 +11516,3 @@ validate_user(cupsd_job_t    *job,      /* I - Job */
   return (cupsdCheckPolicy(printer ? printer->op_policy_ptr : DefaultPolicyPtr,
                            con, owner) == HTTP_OK);
 }
-
-
-/*
- * End of "$Id$".
- */