]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.4svn-r7715.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 15 Jul 2008 01:21:40 +0000 (01:21 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 15 Jul 2008 01:21:40 +0000 (01:21 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@859 a1ca3aef-8c08-0410-bb20-df032aa958be

76 files changed:
CHANGES-1.3.txt
CHANGES.txt
Makefile
backend/ipp.c
backend/lpd.c
backend/mdns.c
backend/pap.c
backend/socket.c
berkeley/lpr.c
cgi-bin/Dependencies
cgi-bin/Makefile
cgi-bin/admin.c
cgi-bin/help-index.c
cgi-bin/search.c
cgi-bin/websearch.c [new file with mode: 0644]
conf/cupsd.conf.in
config-scripts/cups-common.m4
config-scripts/cups-defaults.m4
config.h.in
cups/adminutil.c
cups/auth.c
cups/backend.c
cups/debug.c
cups/dest.c
cups/http-addrlist.c
cups/http-private.h
cups/http-support.c
cups/http.c
cups/ipp.c
cups/langprintf.c
cups/ppd.c
cups/request.c
cups/sidechannel.c
cups/testadmin.c
cups/testcups.c
cups/testfile.c
cups/testhttp.c
desktop/cups.desktop
doc/help/ref-cupsd-conf.html.in
driver/cmyk.c
driver/rastertoescpx.c
filter/image-colorspace.c
filter/image-gif.c
filter/pstops.c
filter/raster.c
filter/rastertolabel.c
filter/testimage.c
filter/texttops.c
locale/strings2po.c
man/cupsd.conf.man.in
man/mantohtml.c
packaging/cups.list.in
packaging/cups.spec.in
scheduler/classes.c
scheduler/client.c
scheduler/conf.c
scheduler/conf.h
scheduler/cups-deviced.c
scheduler/cups-lpd.c
scheduler/dirsvc.c
scheduler/ipp.c
scheduler/job.c
scheduler/log.c
scheduler/main.c
scheduler/printers.c
scheduler/removefile.c
scheduler/select.c
scheduler/testspeed.c
scheduler/type.c
systemv/cancel.c
systemv/cupsctl.c
systemv/cupstestdsc.c
systemv/cupstestppd.c
systemv/lpadmin.c
systemv/lpoptions.c
test/ipptest.c

index ba278571210dc54170d799f62d8723948e6a95b6..7324c268d934fb176fe74768d2d86b55f6454f69 100644 (file)
@@ -4,6 +4,22 @@ CHANGES-1.3.txt
 CHANGES IN CUPS V1.3.8
 
        - Documentation updates (STR #2785, STR #2861, STR #2862)
+       - The IPP backend did not relay marker-* attributes.
+       - The CUPS GNOME/KDE menu item was not localized for
+         Japanese (STR #2876)
+       - The cupstestppd utility reported mixed line endings for
+         Mac OS and Windows PPD files (STR #2874)
+       - The pdftops filter did not print landscape orientation PDF
+         pages correctly on all printers (STR #2850)
+       - The scheduler did not handle expiring of implicit classes
+         or their members properly, leading to a configuration where
+         one of the members would have a short name (STR #2766)
+       - The scheduler and cupstestppd utilities did not support
+         cupsFilter and cupsPreFilter programs with spaces in their
+         names (STR #2866)
+       - Removed unused variables and assignments found by the
+         LLVM "clang" tool.
+       - Added NULL checks recommended by the LLVM "clang" tool.
        - The scheduler would crash if you started a printer that
          pointed to a backend that did not exist (STR #2865)
        - The ppdLocalize functions incorrectly mapped all generic
index 7bc73013223789139c031288bf7dfa2c5b1acebf..e2478d39d481d72d727bb4d32de065aa71269563 100644 (file)
@@ -1,8 +1,12 @@
-CHANGES.txt - 2008-07-02
+CHANGES.txt - 2008-07-14
 ------------------------
 
 CHANGES IN CUPS V1.4b1
 
+       - Added an AccessLogLevel directive to cupsd.conf to control
+         what is logged to the access_log file.
+       - The default LogLevel is now "warn" instead of "info" to reduce
+         the amount of logging that is done to disk by default.
        - The PPD compiler did not include OID query keywords in PPD
          files (STR #2871)
        - The cups-driverd helper program now directly supports driver
index 67fd9d84f31665fb2df668f5af788ac6b54b6322..fefe1336d131f3adccf2789ab3ae73a7bcdd8426 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -103,6 +103,20 @@ depend:
        done
 
 
+#
+# Run the clang.llvm.org static code analysis tool on the C sources.
+#
+
+.PHONY: clang
+clang:
+       if test ! -d clang; then \
+               mkdir clang; \
+       else \
+               rm -rf clang/*; \
+       fi
+       $(MAKE) $(MFLAGS) CC="scan-build -o ../clang $(CC)" clean all
+
+
 #
 # Generate a ctags file...
 #
index 9944220a27279fd5aaebdae7a90cfd26173789b0..5113ac7273eb9b62051e26212380d2d0de7d1eb7 100644 (file)
@@ -22,6 +22,7 @@
  *   compress_files()       - Compress print files...
  *   password_cb()          - Disable the password prompt for
  *                            cupsDoFileRequest().
+ *   report_attr()          - Report an IPP attribute value.
  *   report_printer_state() - Report the printer state.
  *   run_pictwps_filter()   - Convert PICT files to PostScript when printing
  *                            remotely.
@@ -64,6 +65,7 @@ static void   check_printer_state(http_t *http, const char *uri,
 static void    compress_files(int num_files, char **files);
 #endif /* HAVE_LIBZ */
 static const char *password_cb(const char *);
+static void    report_attr(ipp_attribute_t *attr);
 static int     report_printer_state(ipp_t *ipp, int job_id);
 
 #ifdef __APPLE__
@@ -88,6 +90,7 @@ main(int  argc,                               /* I - Number of command-line args */
   int          send_options;           /* Send job options? */
   int          num_options;            /* Number of printer options */
   cups_option_t        *options;               /* Printer options */
+  const char   *device_uri;            /* Device URI */
   char         method[255],            /* Method in URI */
                hostname[1024],         /* Hostname */
                username[255],          /* Username info */
@@ -137,6 +140,11 @@ main(int  argc,                            /* I - Number of command-line args */
                {                       /* Printer attributes we want */
                  "copies-supported",
                  "document-format-supported",
+                 "marker-colors",
+                 "marker-levels",
+                 "marker-message",
+                 "marker-names",
+                 "marker-types",
                  "printer-is-accepting-jobs",
                  "printer-state",
                  "printer-state-message",
@@ -220,7 +228,10 @@ main(int  argc,                            /* I - Number of command-line args */
   * Extract the hostname and printer name from the URI...
   */
 
-  if (httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+  if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
+    return (CUPS_BACKEND_FAILED);
+
+  if (httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
                       method, sizeof(method), username, sizeof(username),
                      hostname, sizeof(hostname), &port,
                      resource, sizeof(resource)) < HTTP_URI_OK)
@@ -398,6 +409,7 @@ main(int  argc,                             /* I - Number of command-line args */
     cups_file_t        *fp;                    /* Temporary file */
     char       buffer[8192];           /* Buffer for copying */
     int                bytes;                  /* Number of bytes read */
+    off_t      tbytes;                 /* Total bytes copied */
 
 
     if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
@@ -414,6 +426,8 @@ main(int  argc,                             /* I - Number of command-line args */
       return (CUPS_BACKEND_FAILED);
     }
 
+    tbytes = 0;
+
     while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
       if (cupsFileWrite(fp, buffer, bytes) < bytes)
       {
@@ -422,9 +436,22 @@ main(int  argc,                            /* I - Number of command-line args */
        unlink(tmpfilename);
        return (CUPS_BACKEND_FAILED);
       }
+      else
+        tbytes += bytes;
 
     cupsFileClose(fp);
 
+   /*
+    * Don't try printing files less than 2 bytes...
+    */
+
+    if (tbytes <= 1)
+    {
+      _cupsLangPuts(stderr, _("ERROR: Empty print file!\n"));
+      unlink(tmpfilename);
+      return (CUPS_BACKEND_FAILED);
+    }
+
    /*
     * Point to the single file from stdin...
     */
@@ -600,6 +627,7 @@ main(int  argc,                             /* I - Number of command-line args */
   */
 
   if ((snmp_fd = _cupsSNMPOpen(http->hostaddr->addr.sa_family)) >= 0)
+  {
     if (backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count, NULL))
     {
      /*
@@ -609,6 +637,9 @@ main(int  argc,                             /* I - Number of command-line args */
       _cupsSNMPClose(snmp_fd);
       snmp_fd = -1;
     }
+  }
+  else
+    start_count = 0;
 
  /*
   * Build a URI for the printer and fill the standard IPP attributes for
@@ -1335,6 +1366,11 @@ check_printer_state(
        *response;                      /* IPP response */
   static const char * const attrs[] =  /* Attributes we want */
   {
+    "marker-colors",
+    "marker-levels",
+    "marker-message",
+    "marker-names",
+    "marker-types",
     "printer-state-message",
     "printer-state-reasons"
   };
@@ -1487,6 +1523,74 @@ password_cb(const char *prompt)          /* I - Prompt (not used) */
 }
 
 
+/*
+ * 'report_attr()' - Report an IPP attribute value.
+ */
+
+static void
+report_attr(ipp_attribute_t *attr)     /* I - Attribute */
+{
+  int  i;                              /* Looping var */
+  char value[1024],                    /* Value string */
+       *valptr,                        /* Pointer into value string */
+       *attrptr;                       /* Pointer into attribute value */
+
+
+ /*
+  * Convert the attribute values into quoted strings...
+  */
+
+  for (i = 0, valptr = value;
+       i < attr->num_values && valptr < (value + sizeof(value) - 10);
+       i ++)
+  {
+    if (i > 0)
+      *valptr++ = ',';
+
+    switch (attr->value_tag)
+    {
+      case IPP_TAG_INTEGER :
+      case IPP_TAG_ENUM :
+          snprintf(valptr, sizeof(value) - (valptr - value), "%d",
+                  attr->values[i].integer);
+         valptr += strlen(valptr);
+         break;
+
+      case IPP_TAG_TEXT :
+      case IPP_TAG_NAME :
+      case IPP_TAG_KEYWORD :
+          *valptr++ = '\"';
+         for (attrptr = attr->values[i].string.text;
+              *attrptr && valptr < (value + sizeof(value) - 10);
+              attrptr ++)
+         {
+           if (*attrptr == '\\' || *attrptr == '\"')
+             *valptr++ = '\\';
+
+           *valptr++ = *attrptr;
+         }
+          *valptr++ = '\"';
+          break;
+
+      default :
+         /*
+         * Unsupported value type...
+         */
+
+          return;
+    }
+  }
+
+  *valptr = '\0';
+
+ /*
+  * Tell the scheduler about the new values...
+  */
+
+  fprintf(stderr, "ATTR: %s=%s\n", attr->name, value);
+}
+
+
 /*
  * 'report_printer_state()' - Report the printer state.
  */
@@ -1497,8 +1601,9 @@ report_printer_state(ipp_t *ipp,  /* I - IPP response */
 {
   int                  i;              /* Looping var */
   int                  count;          /* Count of reasons shown... */
-  ipp_attribute_t      *psm,           /* pritner-state-message */
-                       *reasons;       /* printer-state-reasons */
+  ipp_attribute_t      *psm,           /* printer-state-message */
+                       *reasons,       /* printer-state-reasons */
+                       *marker;        /* marker-* attributes */
   const char           *reason;        /* Current reason */
   const char           *message;       /* Message to show */
   char                 unknown[1024];  /* Unknown message string */
@@ -1605,6 +1710,22 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
 
   fprintf(stderr, "%s\n", state);
 
+ /*
+  * Relay the current marker-* attribute values...
+  */
+
+  if ((marker = ippFindAttribute(ipp, "marker-colors", IPP_TAG_NAME)) != NULL)
+    report_attr(marker);
+  if ((marker = ippFindAttribute(ipp, "marker-levels",
+                                 IPP_TAG_INTEGER)) != NULL)
+    report_attr(marker);
+  if ((marker = ippFindAttribute(ipp, "marker-message", IPP_TAG_TEXT)) != NULL)
+    report_attr(marker);
+  if ((marker = ippFindAttribute(ipp, "marker-names", IPP_TAG_NAME)) != NULL)
+    report_attr(marker);
+  if ((marker = ippFindAttribute(ipp, "marker-types", IPP_TAG_KEYWORD)) != NULL)
+    report_attr(marker);
+
   return (count);
 }
 
index 76123b32ddbea52a9a4f1f126f4ddaec9a1a97f7..5bd0083483d09d49799c49fd95b59f115f0f6410 100644 (file)
@@ -112,6 +112,7 @@ int                                 /* O - Exit status */
 main(int  argc,                                /* I - Number of command-line arguments (6 or 7) */
      char *argv[])                     /* I - Command-line arguments */
 {
+  const char   *device_uri;            /* Device URI */
   char         method[255],            /* Method in URI */
                hostname[1024],         /* Hostname */
                username[255],          /* Username info */
@@ -188,7 +189,10 @@ main(int  argc,                            /* I - Number of command-line arguments (6 or 7) */
   * Extract the hostname and printer name from the URI...
   */
 
-  httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+  if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
+    return (CUPS_BACKEND_FAILED);
+
+  httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
                   method, sizeof(method), username, sizeof(username),
                  hostname, sizeof(hostname), &port,
                  resource, sizeof(resource));
@@ -437,8 +441,6 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
        unlink(tmpfilename);
        return (CUPS_BACKEND_FAILED);
       }
-
-    filename = tmpfilename;
   }
   else if (argc == 6)
   {
@@ -883,6 +885,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
     */
 
     if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
+    {
       if (backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count, NULL))
       {
        /*
@@ -892,6 +895,9 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
        _cupsSNMPClose(snmp_fd);
        snmp_fd = -1;
       }
+    }
+    else
+      start_count = 0;
 
    /*
     * Check for side-channel requests...
index dba97231ca90771bd4e07ed0acb334b37646d8cc..4ae2c8121d6cf6e1c5fb21b23f8577a0f2bc5f16 100644 (file)
@@ -55,7 +55,8 @@ typedef struct
                *fullName,              /* Full name */
                *make_and_model;        /* Make and model from TXT record */
   cups_devtype_t type;                 /* Device registration type */
-  int          cups_shared,            /* CUPS shared printer? */
+  int          priority,               /* Priority associated with type */
+               cups_shared,            /* CUPS shared printer? */
                sent;                   /* Did we list the device? */
 } cups_device_t;
 
@@ -227,6 +228,7 @@ main(int  argc,                             /* I - Number of command-line args */
       * Announce any devices we've found...
       */
 
+      cups_device_t *best;             /* Best matching device */
       char     device_uri[1024];       /* Device URI */
       int      count;                  /* Number of queries */
       static const char * const schemes[] =
@@ -234,7 +236,8 @@ main(int  argc,                             /* I - Number of command-line args */
                                        /* URI schemes for devices */
 
 
-      for (device = (cups_device_t *)cupsArrayFirst(devices), count = 0;
+      for (device = (cups_device_t *)cupsArrayFirst(devices),
+               best = NULL, count = 0;
            device;
           device = (cups_device_t *)cupsArrayNext(devices))
         if (!device->ref && !device->sent)
@@ -268,17 +271,47 @@ main(int  argc,                           /* I - Number of command-line args */
          DNSServiceRefDeallocate(device->ref);
          device->ref = 0;
 
-          httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
-                         schemes[device->type], NULL, device->fullName, 0,
-                         device->cups_shared ? "/cups" : "/");
+          if (!best)
+           best = device;
+         else if (strcasecmp(best->name, device->name) ||
+                  strcasecmp(best->domain, device->domain))
+          {
+           httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
+                           schemes[best->type], NULL, best->fullName, 0,
+                           best->cups_shared ? "/cups" : "/");
+
+           printf("network %s \"%s\" \"%s\"\n", device_uri,
+                  best->make_and_model ? best->make_and_model : "Unknown",
+                  best->name);
+           fflush(stdout);
+
+           best->sent = 1;
+           best       = device;
+         }
+         else if (best->priority > device->priority ||
+                  (best->priority == device->priority &&
+                   best->type < device->type))
+          {
+           best->sent = 1;
+           best       = device;
+         }
+         else
+           device->sent = 1;
+        }
 
-          printf("network %s \"%s\" \"%s\"\n", device_uri,
-                device->make_and_model ? device->make_and_model : "Unknown",
-                device->name);
-          fflush(stdout);
+      if (best)
+      {
+       httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
+                       schemes[best->type], NULL, best->fullName, 0,
+                       best->cups_shared ? "/cups" : "/");
 
-         device->sent = 1;
-        }
+       printf("network %s \"%s\" \"%s\"\n", device_uri,
+              best->make_and_model ? best->make_and_model : "Unknown",
+              best->name);
+       fflush(stdout);
+
+       best->sent = 1;
+      }
     }
   }
 }
@@ -410,7 +443,8 @@ exec_backend(char **argv)           /* I - Command-line arguments */
   * Resolve the device URI...
   */
 
-  resolved_uri = cupsBackendDeviceURI(argv);
+  if ((resolved_uri = cupsBackendDeviceURI(argv)) == NULL)
+    exit(CUPS_BACKEND_FAILED);
 
  /*
   * Extract the scheme from the URI...
@@ -481,47 +515,36 @@ get_device(cups_array_t *devices, /* I - Device array */
   else
     key.type = CUPS_DEVICE_RIOUSBPRINT;
 
-  if ((device = cupsArrayFind(devices, &key)) != NULL)
-  {
-   /*
-    * No, see if this registration is a higher priority protocol...
-    */
+  for (device = cupsArrayFind(devices, &key);
+       device;
+       device = cupsArrayNext(devices))
+    if (strcasecmp(device->name, key.name) ||
+        strcasecmp(device->domain, key.domain))
+      break;
+    else if (device->type == key.type)
+      return (device);
 
-    if (key.type > device->type)
-    {
-      fprintf(stderr, "DEBUG: Updating \"%s\" to \"%s.%s%s\"...\n",
-              device->fullName, serviceName, regtype, replyDomain);
-
-      device->type = key.type;
-    }
-  }
-  else
-  {
-   /*
-    * Yes, add the device...
-    */
+ /*
+  * Yes, add the device...
+  */
 
-    fprintf(stderr, "DEBUG: Found \"%s.%s%s\"...\n", serviceName, regtype,
-            replyDomain);
+  fprintf(stderr, "DEBUG: Found \"%s.%s%s\"...\n", serviceName, regtype,
+         replyDomain);
 
-    device         = calloc(sizeof(cups_device_t), 1);
-    device->name   = strdup(serviceName);
-    device->domain = strdup(replyDomain);
-    device->type   = key.type;
+  device           = calloc(sizeof(cups_device_t), 1);
+  device->name     = strdup(serviceName);
+  device->domain   = strdup(replyDomain);
+  device->type     = key.type;
+  device->priority = 50;
 
-    cupsArrayAdd(devices, device);
-  }
+  cupsArrayAdd(devices, device);
 
  /*
-  * Update the "full name" of this service, which is used for queries...
+  * Set the "full name" of this service, which is used for queries...
   */
 
   snprintf(fullName, sizeof(fullName), "%s.%s%s", serviceName, regtype,
            replyDomain);
-
-  if (device->fullName)
-    free(device->fullName);
-
   device->fullName = strdup(fullName);
 
   return (device);
@@ -585,105 +608,142 @@ query_callback(
   if ((ptr = strstr(name, "._")) != NULL)
     *ptr = '\0';
 
-  if ((device = cupsArrayFind(devices, &key)) != NULL)
+  if (strstr(fullName, "_ipp._tcp.") ||
+      strstr(fullName, "_ipp-tls._tcp."))
+    key.type = CUPS_DEVICE_IPP;
+  else if (strstr(fullName, "_fax-ipp._tcp."))
+    key.type = CUPS_DEVICE_FAX_IPP;
+  else if (strstr(fullName, "_printer._tcp."))
+    key.type = CUPS_DEVICE_PRINTER;
+  else if (strstr(fullName, "_pdl-datastream._tcp."))
+    key.type = CUPS_DEVICE_PDL_DATASTREAM;
+  else
+    key.type = CUPS_DEVICE_RIOUSBPRINT;
+
+  for (device = cupsArrayFind(devices, &key);
+       device;
+       device = cupsArrayNext(devices))
   {
-   /*
-    * Found it, pull out the make and model from the TXT record and save it...
-    */
+    if (strcasecmp(device->name, key.name) ||
+        strcasecmp(device->domain, key.domain))
+    {
+      device = NULL;
+      break;
+    }
+    else if (device->type == key.type)
+    {
+     /*
+      * Found it, pull out the priority and make and model from the TXT
+      * record and save it...
+      */
 
-    const void *value;                 /* Pointer to value */
-    uint8_t    valueLen;               /* Length of value (max 255) */
-    char       make_and_model[512],    /* Manufacturer and model */
-               model[256];             /* Model */
+      const void *value;               /* Pointer to value */
+      uint8_t  valueLen;               /* Length of value (max 255) */
+      char     make_and_model[512],    /* Manufacturer and model */
+               model[256],             /* Model */
+               priority[256];          /* Priority */
 
 
-    if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MFG",
-                                      &valueLen)) == NULL)
-      value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MANUFACTURER", &valueLen);
+      value = TXTRecordGetValuePtr(rdlen, rdata, "priority", &valueLen);
 
-    if (value && valueLen)
-    {
-      memcpy(make_and_model, value, valueLen);
-      make_and_model[valueLen] = '\0';
-    }
-    else
-      make_and_model[0] = '\0';
+      if (value && valueLen)
+      {
+       memcpy(priority, value, valueLen);
+       priority[valueLen] = '\0';
+       device->priority = atoi(priority);
+      }
 
-    if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MDL",
-                                      &valueLen)) == NULL)
-      value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MODEL", &valueLen);
+      if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MFG",
+                                       &valueLen)) == NULL)
+       value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MANUFACTURER",
+                                    &valueLen);
 
-    if (value && valueLen)
-    {
-      memcpy(model, value, valueLen);
-      model[valueLen] = '\0';
-    }
-    else if ((value = TXTRecordGetValuePtr(rdlen, rdata, "product",
-                                           &valueLen)) != NULL && valueLen > 2)
-    {
-      if (((char *)value)[0] == '(')
+      if (value && valueLen)
       {
-       /*
-        * Strip parenthesis...
-       */
-
-       memcpy(model, value + 1, valueLen - 2);
-       model[valueLen - 2] = '\0';
+       memcpy(make_and_model, value, valueLen);
+       make_and_model[valueLen] = '\0';
       }
       else
+       make_and_model[0] = '\0';
+
+      if ((value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MDL",
+                                       &valueLen)) == NULL)
+       value = TXTRecordGetValuePtr(rdlen, rdata, "usb_MODEL", &valueLen);
+
+      if (value && valueLen)
       {
        memcpy(model, value, valueLen);
        model[valueLen] = '\0';
       }
-
-      if (!strcasecmp(model, "GPL Ghostscript") ||
-          !strcasecmp(model, "GNU Ghostscript") ||
-          !strcasecmp(model, "ESP Ghostscript"))
+      else if ((value = TXTRecordGetValuePtr(rdlen, rdata, "product",
+                                            &valueLen)) != NULL && valueLen > 2)
       {
-        if ((value = TXTRecordGetValuePtr(rdlen, rdata, "ty",
-                                          &valueLen)) != NULL)
-        {
+       if (((char *)value)[0] == '(')
+       {
+        /*
+         * Strip parenthesis...
+         */
+
+         memcpy(model, value + 1, valueLen - 2);
+         model[valueLen - 2] = '\0';
+       }
+       else
+       {
          memcpy(model, value, valueLen);
          model[valueLen] = '\0';
+       }
 
-         if ((ptr = strchr(model, ',')) != NULL)
-           *ptr = '\0';
+       if (!strcasecmp(model, "GPL Ghostscript") ||
+           !strcasecmp(model, "GNU Ghostscript") ||
+           !strcasecmp(model, "ESP Ghostscript"))
+       {
+         if ((value = TXTRecordGetValuePtr(rdlen, rdata, "ty",
+                                           &valueLen)) != NULL)
+         {
+           memcpy(model, value, valueLen);
+           model[valueLen] = '\0';
+
+           if ((ptr = strchr(model, ',')) != NULL)
+             *ptr = '\0';
+         }
+         else
+           strcpy(model, "Unknown");
        }
-       else
-         strcpy(model, "Unknown");
       }
-    }
-    else
-      strcpy(model, "Unknown");
+      else
+       strcpy(model, "Unknown");
 
-    if (device->make_and_model)
-      free(device->make_and_model);
+      if (device->make_and_model)
+       free(device->make_and_model);
 
-    if (make_and_model[0])
-    {
-      strlcat(make_and_model, " ", sizeof(make_and_model));
-      strlcat(make_and_model, model, sizeof(make_and_model));
-      device->make_and_model = strdup(make_and_model);
-    }
-    else
-      device->make_and_model = strdup(model);
+      if (make_and_model[0])
+      {
+       strlcat(make_and_model, " ", sizeof(make_and_model));
+       strlcat(make_and_model, model, sizeof(make_and_model));
+       device->make_and_model = strdup(make_and_model);
+      }
+      else
+       device->make_and_model = strdup(model);
 
-    if ((device->type == CUPS_DEVICE_IPP ||
-         device->type == CUPS_DEVICE_PRINTER) &&
-        (value = TXTRecordGetValuePtr(rdlen, rdata, "printer-type",
-                                      &valueLen)) != NULL)
-    {
-     /*
-      * This is a CUPS printer!
-      */
+      if ((device->type == CUPS_DEVICE_IPP ||
+          device->type == CUPS_DEVICE_PRINTER) &&
+         TXTRecordGetValuePtr(rdlen, rdata, "printer-type", &valueLen))
+      {
+       /*
+       * This is a CUPS printer!
+       */
 
-      device->cups_shared = 1;
+       device->cups_shared = 1;
 
-      if (device->type == CUPS_DEVICE_PRINTER)
-        device->sent = 1;
+       if (device->type == CUPS_DEVICE_PRINTER)
+         device->sent = 1;
+      }
+
+      break;
     }
   }
-  else
+
+  if (!device)
     fprintf(stderr, "DEBUG: Ignoring TXT record for \"%s\"...\n", fullName);
 }
 
index f0f194e730a40614c23d95d8794d28e471d38f7b..03c82525923bae48fd1d55a5a3fea42e5b484da5 100644 (file)
@@ -278,7 +278,6 @@ int main (int argc, const char * argv[])
  */
 static int listDevices(void)
 {
-  int  err = noErr;
   int  i;
   int  numberFound;
 
@@ -298,7 +297,7 @@ static int listDevices(void)
     return -1;  /* Network is down */
   }
 
-  if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
+  if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
   {
     _cupsLangPrintError(_("ERROR: Unable to get default AppleTalk zone"));
     return -2;
@@ -410,14 +409,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
   at_inet_t    sendDataAddr;
   at_inet_t    src;
   at_resp_t    resp;
-  int          userdata, xo, reqlen;
+  int          userdata, xo = 0, reqlen;
   u_short      tid;
   u_char       bitmap;
   int          maxfdp1,
                nbp_failures = 0;
   struct timeval timeout, *timeoutPtr;
   u_char       flowQuantum = 1;
-  u_short      recvSequence = 0;
   time_t       now,
                start_time,
                elasped_time, 
@@ -731,7 +729,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
       case AT_PAP_TYPE_SEND_DATA:            /* Send-Data packet */
         sendDataAddr.socket  = src.socket;
         gSendDataID     = tid;
-        recvSequence    = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
+        OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
 
         if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
         {
@@ -913,8 +911,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
 {
   int          result,
                open_result,
-               userdata,
-               atp_err;
+               userdata;
   time_t       tm,
                waitTime;
   char         data[10], 
@@ -963,8 +960,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
 
     fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
 
-    if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 
-                              0, &resp, &retry, 0)) < 0)
+    if (atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 
+                   0, &resp, &retry, 0) < 0)
     {
       statusUpdate("Destination unreachable", 23);
       result = EHOSTUNREACH;
@@ -1031,7 +1028,6 @@ static int papClose()
 {
   int          fd;
   u_short      tmpID;
-  int          result;
   unsigned char        rdata[ATP_DATA_SIZE];
   int          userdata;
   u_char       *puserdata = (u_char *)&userdata;
@@ -1084,9 +1080,9 @@ static int papClose()
     resp.resp[0].iov_base = rdata;
     resp.resp[0].iov_len = sizeof(rdata);
   
-    result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
+    atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
   
-    result = close(fd);
+    close(fd);
   }
   return noErr;
 }
index 5992fc5f737ee8373a04bd175edb8174a30571d4..4e2dac1463304a7d039aaff72d595e2714ec721e 100644 (file)
@@ -61,6 +61,7 @@ int                                   /* O - Exit status */
 main(int  argc,                                /* I - Number of command-line arguments (6 or 7) */
      char *argv[])                     /* I - Command-line arguments */
 {
+  const char   *device_uri;            /* Device URI */
   char         method[255],            /* Method in URI */
                hostname[1024],         /* Hostname */
                username[255],          /* Username info (not used) */
@@ -160,7 +161,10 @@ main(int  argc,                            /* I - Number of command-line arguments (6 or 7) */
   * Extract the hostname and port number from the URI...
   */
 
-  httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+  if ((device_uri = cupsBackendDeviceURI(argv)) == NULL)
+    return (CUPS_BACKEND_FAILED);
+
+  httpSeparateURI(HTTP_URI_CODING_ALL, device_uri,
                   method, sizeof(method), username, sizeof(username),
                  hostname, sizeof(hostname), &port,
                  resource, sizeof(resource));
@@ -364,6 +368,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   */
 
   if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
+  {
     if (backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count, NULL))
     {
      /*
@@ -373,6 +378,9 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
       _cupsSNMPClose(snmp_fd);
       snmp_fd = -1;
     }
+  }
+  else
+    start_count = 0;
 
  /*
   * Print everything...
index a1388be7e1c34b8f65d828ef08510fd2e5ac725b..b529365d7c745fbe81c2791a98909d7e7d8f197d 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpr" command for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
index 1d4cb97914d4527ccf637d2793d308149c8add70..3c913998bc51f466e59ffafc75b94b97fd187f30 100644 (file)
@@ -56,6 +56,9 @@ testtemplate.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
 testtemplate.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
 testtemplate.o: ../cups/file.h ../cups/language.h ../cups/array.h
 testtemplate.o: help-index.h
+websearch.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+websearch.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h
+websearch.o: ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
 # DO NOT DELETE
 
 help-index.32.o: help-index.c  cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
@@ -114,6 +117,9 @@ testtemplate.32.o: testtemplate.c  cgi.h ../cups/cups.h ../cups/ipp.h ../cups/ht
 testtemplate.32.o: testtemplate.c  ../cups/versioning.h ../cups/ppd.h ../cups/array.h
 testtemplate.32.o: testtemplate.c  ../cups/file.h ../cups/language.h ../cups/array.h
 testtemplate.32.o: testtemplate.c  help-index.h
+websearch.32.o: websearch.c  cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+websearch.32.o: websearch.c  ../cups/versioning.h ../cups/ppd.h ../cups/array.h
+websearch.32.o: websearch.c  ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
 # DO NOT DELETE
 
 help-index.64.o: help-index.c  cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
@@ -172,3 +178,6 @@ testtemplate.64.o: testtemplate.c  cgi.h ../cups/cups.h ../cups/ipp.h ../cups/ht
 testtemplate.64.o: testtemplate.c  ../cups/versioning.h ../cups/ppd.h ../cups/array.h
 testtemplate.64.o: testtemplate.c  ../cups/file.h ../cups/language.h ../cups/array.h
 testtemplate.64.o: testtemplate.c  help-index.h
+websearch.64.o: websearch.c  cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+websearch.64.o: websearch.c  ../cups/versioning.h ../cups/ppd.h ../cups/array.h
+websearch.64.o: websearch.c  ../cups/file.h ../cups/language.h ../cups/array.h help-index.h
index 53911d8450822ff7f45dfced7ecf706d701cbf34..3ddc6cd650cdf68831a84e7a816e848d94bafaa1 100644 (file)
@@ -35,7 +35,8 @@ OBJS  =       \
                printers.o \
                testcgi.o \
                testhi.o \
-               testtemplate.o
+               testtemplate.o \
+               websearch.o
 CGIS   =       \
                admin.cgi \
                classes.cgi \
@@ -48,7 +49,8 @@ LIBTARGETS =  \
                $(LIB32CUPSCGI) \
                $(LIB32CUPSCGI) \
                testcgi \
-               testhi
+               testhi \
+               websearch
 
 TARGETS        =       \
                $(LIBTARGETS) \
@@ -390,6 +392,16 @@ testtemplate:      testtemplate.o ../Makedefs libcupscgi.a ../cups/libcups.a
                $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
 
 
+#
+# websearch
+#
+
+websearch:     websearch.o ../Makedefs libcupscgi.a ../cups/libcups.a
+       echo Linking $@...
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ websearch.o libcupscgi.a \
+               ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
+
+
 #
 # Dependencies...
 #
index 3f94b8826973231aa86ba2a0718d18f7f7529ce3..e67582d0202435d81fe437a75376d5a81696dd27 100644 (file)
@@ -969,7 +969,7 @@ do_am_printer(http_t *http,         /* I - HTTP connection */
 
     return;
   }
-  else if (!file && (var = cgiGetVariable("PPD_NAME")) == NULL)
+  else if (!file && !cgiGetVariable("PPD_NAME"))
   {
     if (modify)
     {
@@ -3016,15 +3016,15 @@ do_set_options(http_t *http,            /* I - HTTP connection */
 
         cgiSetVariable("KEYWORD", "job_sheets_start");
        cgiSetVariable("KEYTEXT", cgiText(_("Starting Banner")));
-        cgiSetVariable("DEFCHOICE", attr == NULL ?
-                                   "" : attr->values[0].string.text);
+        cgiSetVariable("DEFCHOICE", attr != NULL ?
+                                   attr->values[0].string.text : "");
 
        cgiCopyTemplateLang("option-pickone.tmpl");
 
         cgiSetVariable("KEYWORD", "job_sheets_end");
        cgiSetVariable("KEYTEXT", cgiText(_("Ending Banner")));
-        cgiSetVariable("DEFCHOICE", attr == NULL && attr->num_values > 1 ?
-                                   "" : attr->values[1].string.text);
+        cgiSetVariable("DEFCHOICE", attr != NULL && attr->num_values > 1 ?
+                                   attr->values[1].string.text : "");
 
        cgiCopyTemplateLang("option-pickone.tmpl");
 
@@ -3211,7 +3211,7 @@ do_set_options(http_t *http,              /* I - HTTP connection */
       }
 
       if ((var = cgiGetVariable("protocol")) != NULL)
-       cupsFilePrintf(out, "*cupsProtocol: %s\n", cgiGetVariable("protocol"));
+       cupsFilePrintf(out, "*cupsProtocol: %s\n", var);
 
       cupsFileClose(in);
       cupsFileClose(out);
@@ -3250,12 +3250,12 @@ do_set_options(http_t *http,            /* I - HTTP connection */
     attr->values[1].string.text = _cupsStrAlloc(cgiGetVariable("job_sheets_end"));
 
     if ((var = cgiGetVariable("printer_error_policy")) != NULL)
-      attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
-                          "printer-error-policy", NULL, var);
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
+                  "printer-error-policy", NULL, var);
 
     if ((var = cgiGetVariable("printer_op_policy")) != NULL)
-      attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
-                          "printer-op-policy", NULL, var);
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME,
+                  "printer-op-policy", NULL, var);
 
    /*
     * Do the request and get back a response...
index cb88aee173440ced395919282eec0e0dc5857b34..9b40252bfab14978b087458916409243e8262319 100644 (file)
@@ -1297,7 +1297,7 @@ help_sort_by_score(help_node_t *n1,       /* I - First node */
                 n2, n2->score, n2->section ? n2->section : "", n2->text));
 
   if (n1->score != n2->score)
-    return (n1->score - n2->score);
+    return (n2->score - n1->score);
 
   if (n1->section && !n2->section)
     return (1);
index d8f023c28361823e2f5e5583f20a535d2b547fd1..7d15d639d3fa7c53b326b2919e7e2d2432dd0f9b 100644 (file)
@@ -47,7 +47,14 @@ cgiCompileSearch(const char *query)  /* I - Query string */
   char         *lword;                 /* Last word in query */
 
 
-  DEBUG_printf(("help_compile_search(query=\"%s\")\n", query ? query : "(nil)"));
+  DEBUG_printf(("cgiCompileSearch(query=\"%s\")\n", query));
+
+ /*
+  * Range check input...
+  */
+
+  if (!query)
+    return (NULL);
 
  /*
   * Allocate a regular expression storage structure...
diff --git a/cgi-bin/websearch.c b/cgi-bin/websearch.c
new file mode 100644 (file)
index 0000000..742c323
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * "$Id$"
+ *
+ *   Web search program for www.cups.org.
+ *
+ *   Copyright 2007-2008 by Apple Inc.
+ *   Copyright 1997-2007 by Easy Software Products.
+ *
+ *   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/".
+ *
+ * Usage:
+ *
+ *   websearch directory "search string"
+ *
+ * Contents:
+ *
+ *   main()       - Search a directory of help files.
+ *   list_nodes() - List matching nodes.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "cgi.h"
+
+
+/*
+ * Local functions...
+ */
+
+static void    list_nodes(const char *title, cups_array_t *nodes);
+
+
+/*
+ * 'main()' - Test the help index code.
+ */
+
+int                                    /* O - Exit status */
+main(int  argc,                                /* I - Number of command-line args */
+     char *argv[])                     /* I - Command-line arguments */
+{
+  help_index_t *hi,                    /* Help index */
+               *search;                /* Search index */
+  char         indexname[1024];        /* Name of index file */
+
+
+  if (argc != 3)
+  {
+    puts("Usage: websearch directory \"search terms\"");
+    return (1);
+  }
+
+ /*
+  * Load the help index...
+  */
+
+  snprintf(indexname, sizeof(indexname), "%s/.index", argv[1]);
+  hi = helpLoadIndex(indexname, argv[1]);
+
+ /*
+  * Do any searches...
+  */
+
+  search = helpSearchIndex(hi, argv[2], NULL, NULL);
+
+  if (search)
+    list_nodes(argv[1], search->sorted);
+
+ /*
+  * Return with no errors...
+  */
+
+  return (0);
+}
+
+
+/*
+ * 'list_nodes()' - List nodes in an array...
+ */
+
+static void
+list_nodes(const char   *title,                /* I - Title string */
+          cups_array_t *nodes)         /* I - Nodes */
+{
+  help_node_t  *node;                  /* Current node */
+
+
+  printf("%d\n", cupsArrayCount(nodes));
+  for (node = (help_node_t *)cupsArrayFirst(nodes);
+       node;
+       node = (help_node_t *)cupsArrayNext(nodes))
+  {
+    if (node->anchor)
+      printf("%d|%s#%s|%s\n", node->score, node->filename, node->anchor,
+             node->text);
+    else
+      printf("%d|%s|%s\n", node->score, node->filename, node->text);
+  }
+}
+
+
+/*
+ * End of "$Id$".
+ */
index c48b70626afd0219ddcb3e5f02bf0dd848fa738f..649b552ee83b648bae33bfda6657ef77b2044f47 100644 (file)
@@ -6,9 +6,9 @@
 #   file.
 #
 
-# Log general information in error_log - change "info" to "debug" for
-# troubleshooting...
-LogLevel info
+# Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
+# for troubleshooting...
+LogLevel @CUPS_LOG_LEVEL@
 
 # Administrator user group...
 SystemGroup @CUPS_SYSTEM_GROUPS@
index a88692f35ddcd4756c694271f91938c3cb116af1..e48fc0fe4f21514bb2ef80d7fcc52d6c30ac4720 100644 (file)
@@ -277,14 +277,30 @@ case $uname in
                AC_CHECK_FUNCS(notify_post)
 
                dnl Check for Authorization Services support
+               AC_ARG_WITH(adminkey, [  --with-adminkey         set the default SystemAuthKey value],
+                       default_adminkey="$withval",
+                       default_adminkey="default")
+               AC_ARG_WITH(operkey, [  --with-operkey          set the default operator @AUTHKEY value],
+                       default_operkey="$withval",
+                       default_operkey="default")
                AC_CHECK_HEADER(Security/Authorization.h, [
                        AC_DEFINE(HAVE_AUTHORIZATION_H)
-                       if grep -q system.print.operator /etc/authorization; then
-                               CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
-                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
+
+                       if test "x$default_adminkey" != xdefault; then
+                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
+                       elif grep -q system.print.operator /etc/authorization; then
+                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
                        else
+                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
+                       fi
+
+                       if test "x$default_operkey" != xdefault; then
+                               CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
+                       elif grep -q system.print.operator /etc/authorization; then
                                CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
-                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
+                       else
+                               CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
                        fi])
                AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
 
index 80287e8069ff4c4f865fc3b2c840a1bbc93b88e6..624b3d6f2558b9c676b5e24c4139c3473a864384 100644 (file)
@@ -43,6 +43,20 @@ AC_ARG_WITH(log_file_perm, [  --with-log-file-perm    set default LogFilePerm va
 AC_SUBST(CUPS_LOG_FILE_PERM)
 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_FILE_PERM, 0$CUPS_LOG_FILE_PERM)
 
+dnl Default LogLevel
+AC_ARG_WITH(log_level, [  --with-log-level        set default LogLevel value, default=warn],
+       CUPS_LOG_LEVEL="$withval",
+       CUPS_LOG_LEVEL="warn")
+AC_SUBST(CUPS_LOG_LEVEL)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_LEVEL, "$CUPS_LOG_LEVEL")
+
+dnl Default AccessLogLevel
+AC_ARG_WITH(log_level, [  --with-access-log-level set default AccessLogLevel value, default=actions],
+       CUPS_LOG_LEVEL="$withval",
+       CUPS_LOG_LEVEL="actions")
+AC_SUBST(CUPS_ACCESS_LOG_LEVEL)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_ACCESS_LOG_LEVEL, "$CUPS_ACCESS_LOG_LEVEL")
+
 dnl Default Browsing
 AC_ARG_ENABLE(browsing, [  --enable-browsing       enable Browsing by default, default=yes])
 if test "x$enable_browsing" = xno; then
index 7c54621fcd1bed3e2f08b4440859f0be0cdbc013..cd801f72e1bd5ee76c6d3bc6365b3e8bc83afd0d 100644 (file)
 #define CUPS_DEFAULT_LOG_FILE_PERM     0644
 
 
+/*
+ * Default logging settings...
+ */
+
+#define CUPS_DEFAULT_LOG_LEVEL "warn"
+#define CUPS_DEFAULT_ACCESS_LOG_LEVEL "actions"
+
+
 /*
  * Default browsing settings...
  */
index 95393afd060b98a1682c962ba4e4cb14b6f7c42d..87ff36fd791745302a6764a812dee17f67950bd3 100644 (file)
@@ -389,7 +389,7 @@ cupsAdminCreateWindowsPPD(
   {
     write_option(dstfp, jclorder ++, "cupsJobSheetsStart", "Start Banner",
                  "job-sheets", suppattr, defattr, 0, 2);
-    write_option(dstfp, jclorder ++, "cupsJobSheetsEnd", "End Banner",
+    write_option(dstfp, jclorder, "cupsJobSheetsEnd", "End Banner",
                  "job-sheets", suppattr, defattr, 1, 2);
   }
 
@@ -967,7 +967,7 @@ _cupsAdminGetServerSettings(
       if (!value && strncmp(line, "</", 2))
         value = line + strlen(line);
 
-      if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
+      if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && value)
       {
        char    *port;                  /* Pointer to port number, if any */
 
@@ -1023,7 +1023,7 @@ _cupsAdminGetServerSettings(
       {
        in_policy = 0;
       }
-      else if (!strcasecmp(line, "<Limit") && in_policy)
+      else if (!strcasecmp(line, "<Limit") && in_policy && value)
       {
        /*
        * See if the policy limit is for the Cancel-Job operation...
@@ -1056,7 +1056,7 @@ _cupsAdminGetServerSettings(
       {
        cancel_policy = 0;
       }
-      else if (!strcasecmp(line, "<Location"))
+      else if (!strcasecmp(line, "<Location") && value)
       {
         in_admin_location = !strcasecmp(value, "/admin");
        in_location       = 1;
@@ -1066,7 +1066,7 @@ _cupsAdminGetServerSettings(
        in_admin_location = 0;
        in_location       = 0;
       }
-      else if (!strcasecmp(line, "Allow") &&
+      else if (!strcasecmp(line, "Allow") && value &&
                strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
 #ifdef AF_LOCAL
               && *value != '/'
@@ -1233,8 +1233,8 @@ _cupsAdminSetServerSettings(
   * Get the cupsd.conf file...
   */
 
-  if ((status = get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
-                               &remote)) == HTTP_OK)
+  if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
+                     &remote) == HTTP_OK)
   {
     if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
     {
@@ -1561,7 +1561,7 @@ _cupsAdminSetServerSettings(
       else
       {
         cupsFilePuts(temp, "# Show general information in error_log.\n");
-       cupsFilePuts(temp, "LogLevel info\n");
+       cupsFilePuts(temp, "LogLevel " CUPS_DEFAULT_LOG_LEVEL "\n");
       }
     }
     else if (!strcasecmp(line, "<Policy"))
@@ -1841,7 +1841,7 @@ _cupsAdminSetServerSettings(
     else
     {
       cupsFilePuts(temp, "# Show general information in error_log.\n");
-      cupsFilePuts(temp, "LogLevel info\n");
+      cupsFilePuts(temp, "LogLevel " CUPS_DEFAULT_LOG_LEVEL "\n");
     }
   }
 
index 561756215ed765907d0f1dcd78ea05fdba732888..06f32d216dba430e0b07547cbb11e78ea78978d7 100644 (file)
@@ -270,8 +270,7 @@ cupsDoAuthentication(http_t     *http,      /* I - Connection to server or @code CUPS
 
     if (http->gssctx != GSS_C_NO_CONTEXT)
     {
-      major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
-                                           GSS_C_NO_BUFFER);
+      gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
       http->gssctx = GSS_C_NO_CONTEXT;
     }
 
@@ -323,14 +322,14 @@ cupsDoAuthentication(http_t     *http,    /* I - Connection to server or @code CUPS
       httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
                     output_token.length);
  
-      major_status = gss_release_buffer(&minor_status, &output_token);
+      gss_release_buffer(&minor_status, &output_token);
     }
     else
     {
       DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
                     "%d bytes!\n", (int)output_token.length));
 
-      major_status = gss_release_buffer(&minor_status, &output_token);
+      gss_release_buffer(&minor_status, &output_token);
 
       return (-1);
     }
@@ -405,12 +404,8 @@ DEBUG_gss_printf(OM_uint32 major_status,/* I - Major status code */
                                        &major_status_string);
 
   if (!GSS_ERROR(err_major_status))
-    err_major_status = gss_display_status(&err_minor_status,
-                                         minor_status,
-                                         GSS_C_MECH_CODE,
-                                         GSS_C_NULL_OID,
-                                         &msg_ctx,
-                                         &minor_status_string);
+    gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
+                      GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
 
   printf("%s: %s, %s\n", message, (char *)major_status_string.value,
         (char *)minor_status_string.value);
index 477d38ecd54c76b109e69958f660b5d3bcd495c4..021dad2e21ce3adfb72f7c2f85516ee76592a1da 100644 (file)
@@ -53,7 +53,7 @@ cupsBackendDeviceURI(char **argv)     /* I - Command-line arguments */
   }
 
   return (_httpResolveURI(device_uri, cg->resolved_uri,
-                          sizeof(cg->resolved_uri)));
+                          sizeof(cg->resolved_uri), 1));
 }
 
 
index cfb8bd6aa0d44d4efbe2f4bd6a3d25c48d60ab6d..76dec26ee51bb1dc4b015ad65e802d796424bf95 100644 (file)
@@ -62,7 +62,6 @@ debug_vsnprintf(char       *buffer,   /* O - Output buffer */
 {
   char         *bufptr,                /* Pointer to position in buffer */
                *bufend,                /* Pointer to end of buffer */
-               sign,                   /* Sign of format width */
                size,                   /* Size character (h, l, L) */
                type;                   /* Format type character */
   int          width,                  /* Width of field */
@@ -74,6 +73,9 @@ debug_vsnprintf(char       *buffer,   /* O - Output buffer */
   int          bytes;                  /* Total number of bytes needed */
 
 
+  if (!buffer || bufsize < 2 || !format)
+    return (-1);
+
  /*
   * Loop through the format string, formatting as needed...
   */
@@ -91,18 +93,14 @@ debug_vsnprintf(char       *buffer, /* O - Output buffer */
 
       if (*format == '%')
       {
-        if (bufptr && bufptr < bufend) *bufptr++ = *format;
+        if (bufptr < bufend)
+         *bufptr++ = *format;
         bytes ++;
         format ++;
        continue;
       }
       else if (strchr(" -+#\'", *format))
-      {
-        *tptr++ = *format;
-        sign = *format++;
-      }
-      else
-        sign = 0;
+        *tptr++ = *format++;
 
       if (*format == '*')
       {
@@ -161,8 +159,6 @@ debug_vsnprintf(char       *buffer, /* O - Output buffer */
          }
        }
       }
-      else
-        prec = -1;
 
       if (*format == 'l' && format[1] == 'l')
       {
@@ -183,6 +179,8 @@ debug_vsnprintf(char       *buffer, /* O - Output buffer */
 
         size = *format++;
       }
+      else
+        size = 0;
 
       if (!*format)
         break;
@@ -365,7 +363,7 @@ debug_vsnprintf(char       *buffer, /* O - Output buffer */
     {
       bytes ++;
 
-      if (bufptr && bufptr < bufend)
+      if (bufptr < bufend)
         *bufptr++ = *format;
 
       format ++;
index 185bd1a50857f7bdadffc5b1ec57d7c7a89c5d81..66289b2c7c687773922bd2ee1e261e2b74b1e0fe 100644 (file)
@@ -120,7 +120,7 @@ cupsAddDest(const char  *name,              /* I  - Destination name */
   if (!name || !dests)
     return (0);
 
-  if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
+  if (cupsGetDest(name, instance, num_dests, *dests))
     return (num_dests);
 
  /*
@@ -980,7 +980,6 @@ appleGetDefault(char *name,         /* I - Name buffer */
 
     DEBUG_puts("appleGetDefault: Missing or bad location history array...");
 
-    CFRelease(network);
     return (NULL);
   }
   
@@ -992,9 +991,6 @@ appleGetDefault(char *name,         /* I - Name buffer */
   else
     name[0] = '\0';
 
-  CFRelease(locations);
-  CFRelease(network);
-
   DEBUG_printf(("appleGetDefault: Returning \"%s\"...\n", name));
 
   return (*name ? name : NULL);
@@ -1206,9 +1202,6 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
       CFRelease(newlocation);
   }
 
-  if (locations)
-    CFRelease(locations);
-  CFRelease(network);
   CFRelease(newprinter);
 }
 
index effe2e6a80ea11e54546f6a4e98a605d34de84e1..265107af04a6383e4f1a6977cca7814e239e675c 100644 (file)
@@ -529,8 +529,6 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
 
         if (addr)
          addr->next = temp;
-       else
-          addr = temp;
       }
     }
     else if (!hostname)
@@ -584,8 +582,6 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
 
         if (addr)
          addr->next = temp;
-       else
-          addr = temp;
       }
     }
   }
index 415f25a9eb6a7ac9819303514a24c669656416e6..f44266ccef25ae12a78be9734a8c0820185aa41d 100644 (file)
@@ -264,7 +264,7 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
 extern char            *_httpEncodeURI(char *dst, const char *src,
                                        size_t dstsize);
 extern const char      *_httpResolveURI(const char *uri, char *resolved_uri,
-                                        size_t resolved_size);
+                                        size_t resolved_size, int log);
 #endif /* !_CUPS_HTTP_PRIVATE_H_ */
 
 /*
index 419383899d00427c09d474960ab6874955e90d23..56e27515cbc2e46a51a246e3dd91980b6eed545c 100644 (file)
@@ -1255,23 +1255,37 @@ const char *                            /* O - Resolved URI */
 _httpResolveURI(
     const char *uri,                   /* I - DNS-SD URI */
     char       *resolved_uri,          /* I - Buffer for resolved URI */
-    size_t     resolved_size)          /* I - Size of URI buffer */
+    size_t     resolved_size,          /* I - Size of URI buffer */
+    int        log)                    /* I - Log progress to stderr? */
 {
   char                 scheme[32],     /* URI components... */
                        userpass[256],
                        hostname[1024],
                        resource[1024];
   int                  port;
+  http_uri_status_t    status;         /* URI decode status */
 
 
+  DEBUG_printf(("_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
+                "resolved_size=" CUPS_LLFMT ")\n", uri, resolved_uri,
+               CUPS_LLCAST resolved_size));
+
  /*
   * Get the device URI...
   */
 
-  if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme),
-                      userpass, sizeof(userpass), hostname, sizeof(hostname),
-                     &port, resource, sizeof(resource)) < HTTP_URI_OK)
+  if ((status = httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme,
+                                sizeof(scheme), userpass, sizeof(userpass),
+                               hostname, sizeof(hostname), &port, resource,
+                               sizeof(resource))) < HTTP_URI_OK)
+  {
+    if (log)
+      _cupsLangPrintf(stderr, _("Bad device URI \"%s\"!\n"), uri);
+
+    DEBUG_printf(("_httpResolveURI: httpSeparateURI returned %d!\n", status));
+    DEBUG_puts("_httpResolveURI: Returning NULL");
     return (NULL);
+  }
 
  /*
   * Resolve it as needed...
@@ -1289,8 +1303,24 @@ _httpResolveURI(
     * Separate the hostname into service name, registration type, and domain...
     */
 
-    regtype = strchr(hostname, '.');
-    *regtype++ = '\0';
+    for (regtype = strstr(hostname, "._tcp") - 2;
+         regtype > hostname;
+        regtype --)
+      if (regtype[0] == '.' && regtype[1] == '_')
+      {
+       /*
+        * Found ._servicetype in front of ._tcp...
+       */
+
+        *regtype++ = '\0';
+       break;
+      }
+
+    if (regtype <= hostname)
+    {
+      DEBUG_puts("_httpResolveURI: Bad hostname, returning NULL");
+      return (NULL);
+    }
 
     domain = regtype + strlen(regtype) - 1;
     if (domain > regtype && *domain == '.')
@@ -1310,6 +1340,14 @@ _httpResolveURI(
 
     resolved_uri[0] = '\0';
 
+    DEBUG_printf(("_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
+                  "domain=\"%s\"\n", hostname, regtype, domain));
+    if (log)
+    {
+      fputs("STATE: +connecting-to-device\n", stderr);
+      _cupsLangPrintf(stderr, _("INFO: Looking for \"%s\"...\n"), hostname);
+    }
+
     if (DNSServiceResolve(&ref, 0, 0, hostname, regtype, domain,
                          resolve_callback,
                          &uribuf) == kDNSServiceErr_NoError)
@@ -1323,11 +1361,25 @@ _httpResolveURI(
       DNSServiceRefDeallocate(ref);
     }
     else
-#endif /* HAVE_DNSSD */
+      uri = NULL;
+
+    if (log)
+      fputs("STATE: -connecting-to-device\n", stderr);
+
+#else
+   /*
+    * No DNS-SD support...
+    */
 
     uri = NULL;
+#endif /* HAVE_DNSSD */
+
+    if (log && !uri)
+      _cupsLangPuts(stderr, _("Unable to find printer!\n"));
   }
 
+  DEBUG_printf(("_httpResolveURI: Returning \"%s\"\n", uri));
+
   return (uri);
 }
 
index 7a150a0b184bc0c1db783851751b7febc0b812aa..894f7641af854c026f983a0f6f0121c5e3efa093 100644 (file)
@@ -298,8 +298,7 @@ void
 httpClose(http_t *http)                        /* I - Connection to server */
 {
 #ifdef HAVE_GSSAPI
-  OM_uint32    minor_status,           /* Minor status code */
-               major_status;           /* Major status code */
+  OM_uint32    minor_status;           /* Minor status code */
 #endif /* HAVE_GSSAPI */
 
 
@@ -326,11 +325,10 @@ httpClose(http_t *http)                   /* I - Connection to server */
 
 #ifdef HAVE_GSSAPI
   if (http->gssctx != GSS_C_NO_CONTEXT)
-    major_status = gss_delete_sec_context(&minor_status, &http->gssctx,
-                                          GSS_C_NO_BUFFER);
+    gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER);
 
   if (http->gssname != GSS_C_NO_NAME)
-    major_status = gss_release_name(&minor_status, &http->gssname);
+    gss_release_name(&minor_status, &http->gssname);
 #endif /* HAVE_GSSAPI */
 
 #ifdef HAVE_AUTHORIZATION_H
index d528b6a540e79cadf87c7399d9706b2c14d926f2..88a42f01c9621e05d94f1f0fb8dab4d41e14e7fb 100644 (file)
@@ -1050,9 +1050,9 @@ ippReadIO(void       *src,                /* I - Data source */
           * Get the request header...
          */
 
-          if ((n = (*cb)(src, buffer, 8)) < 8)
+          if ((*cb)(src, buffer, 8) < 8)
          {
-           DEBUG_printf(("ippReadIO: Unable to read header (%d bytes read)!\n", n));
+           DEBUG_puts("ippReadIO: Unable to read header!");
            return (IPP_ERROR);
          }
 
@@ -1557,6 +1557,12 @@ ippReadIO(void       *src,               /* I - Data source */
                  return (IPP_ERROR);
                }
 
+               if (!value)
+               {
+                 DEBUG_puts("ippReadIO: NULL value!");
+                 return (IPP_ERROR);
+               }
+
                 value->unknown.length = n;
                if (n > 0)
                {
index 089eb4859e99fc931462ccacc7033bdecffd8c1d..84956888c2283db51809ad9effdf727aede0c0cb 100644 (file)
@@ -71,9 +71,8 @@ _cupsLangPrintError(const char *message)/* I - Message */
   * Format the message...
   */
 
-  bytes = snprintf(buffer, sizeof(buffer), "%s: %s",
-                  _cupsLangString(cg->lang_default, message),
-                  strerror(last_errno));
+  snprintf(buffer, sizeof(buffer), "%s: %s",
+          _cupsLangString(cg->lang_default, message), strerror(last_errno));
 
  /*
   * Convert and write to stderr...
@@ -120,8 +119,8 @@ _cupsLangPrintf(FILE        *fp,    /* I - File to write to */
   */
 
   va_start(ap, message);
-  bytes = vsnprintf(buffer, sizeof(buffer),
-                    _cupsLangString(cg->lang_default, message), ap);
+  vsnprintf(buffer, sizeof(buffer),
+            _cupsLangString(cg->lang_default, message), ap);
   va_end(ap);
 
  /*
index cbe20558fe2f98cccdc7aeb3e8bf5c8691da4db1..c10cbc491c385d85630715e71aead54e1cc4819f 100644 (file)
@@ -1088,7 +1088,7 @@ ppdOpen2(cups_file_t *fp)         /* I - File to read from */
       else if (!strcmp(string, "Plus90"))
         ppd->landscape = 90;
     }
-    else if (!strcmp(keyword, "Emulators"))
+    else if (!strcmp(keyword, "Emulators") && string)
     {
       for (count = 1, sptr = string; sptr != NULL;)
         if ((sptr = strchr(sptr, ' ')) != NULL)
@@ -2850,8 +2850,6 @@ ppd_read(cups_file_t    *fp,              /* I - File to read from */
            if (ch == 0x0a)
              cupsFileGetChar(fp);
          }
-
-         ch = '\n';
        }
        else if (ch < ' ' && ch != '\t' && cg->ppd_conform == PPD_CONFORM_STRICT)
        {
index 36b02b912380abcee500ec36da174fba5c3d7c9a..f8978a6278a6490c0a434c9a0f047912f510f54f 100644 (file)
@@ -572,7 +572,6 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
   * Loop until we can send the request without authorization problems.
   */
 
-  status = HTTP_ERROR;
   expect = HTTP_CONTINUE;
 
   for (;;)
index bbb8dab028deb59146566ae52d50119547e7301d..acf9743e8641ce67fc0792c0ee70e09fef163c3c 100644 (file)
@@ -218,7 +218,7 @@ cupsSideChannelRead(
 
     *status = CUPS_SC_STATUS_TOO_BIG;
   }
-  else if (templen > *datalen || templen > (bytes - 4))
+  else if (!datalen || templen > *datalen || templen > (bytes - 4))
   {
    /*
     * Either the response is bigger than the provided buffer or the
index 5091f11b8e00b6e0ec2e8b65a170662e0549f900..f6afd21b946c4ed9cda1f0c762d734a291663997 100644 (file)
@@ -61,7 +61,7 @@ main(int  argc,                               /* I - Number of command-line args */
 
   if (argc > 1)
   {
-    for (i = 1, num_settings = 0; i < argc; i ++)
+    for (i = 1, num_settings = 0, settings = NULL; i < argc; i ++)
       num_settings = cupsParseOptions(argv[i], num_settings, &settings);
 
     if (cupsAdminSetServerSettings(http, num_settings, settings))
index 1ac4456bd555581fcd9334de84e0234b0e8428e8..087ed4310fda51c33728db211c076f5a2d1fb7ef 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   CUPS API test program for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -155,7 +155,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
   if ((dest = cupsGetDest(dests[num_dests / 2].name, NULL, num_dests,
                           dests)) == NULL)
   {
-    status = 1;
     puts("FAIL");
     return (1);
   }
@@ -201,8 +200,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
   if (cupsPrintFile(dest->name, "../data/testprint.ps", "Test Page",
                     dest->num_options, dest->options) <= 0)
   {
-    status = 1;
     puts("FAIL");
+    return (1);
   }
   else
     puts("PASS");
@@ -216,7 +215,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if ((ppdfile = cupsGetPPD(dest->name)) == NULL)
   {
-    status = 1;
     puts("FAIL");
   }
   else
@@ -282,7 +280,7 @@ dests_equal(cups_dest_t *a,         /* I - First destination */
   if (a == b)
     return (1);
 
-  if ((!a && b) || (a && !b))
+  if (!a || !b)
     return (0);
 
   if (strcasecmp(a->name, b->name) ||
@@ -345,5 +343,5 @@ show_diffs(cups_dest_t *a,          /* I - First destination */
 
 
 /*
- * End of "$Id: testfile.c 6192 2007-01-10 19:26:48Z mike $".
+ * End of "$Id$".
  */
index 117b3c9e5dadb9474dcd10eeb25c7b170c2b7764..52bfeedb46aeb8776095a160971b54e7cd3abf83 100644 (file)
@@ -87,7 +87,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
     * Do uncompressed random I/O tests...
     */
 
-    status = random_tests();
+    status += random_tests();
 
    /*
     * Test fdopen and close without reading...
index b445bf9d6d5d0d30e86ad67757de90f3014d09ea..302d4fde5da6daa541c6ab8f02a70f05ec322d61 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   HTTP test program for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -25,7 +25,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "http.h"
+#include "http-private.h"
 #include "string.h"
 
 
@@ -452,6 +452,29 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
     return (failures);
   }
+  else if (strstr(argv[1], "._tcp"))
+  {
+   /*
+    * Test resolving an mDNS name.
+    */
+
+    char       resolved[1024];         /* Resolved URI */
+
+
+    printf("_httpResolveURI(%s): ", argv[1]);
+    fflush(stdout);
+
+    if (!_httpResolveURI(argv[1], resolved, sizeof(resolved)))
+    {
+      puts("FAIL");
+      return (1);
+    }
+    else
+    {
+      printf("PASS (%s)\n", resolved);
+      return (0);
+    }
+  }
 
  /*
   * Test HTTP GET requests...
index 1a9b33a7625470108146f4c5af296588b25ff069..1f264ad0a872a138127e71a204777e39265638aa 100644 (file)
@@ -27,6 +27,8 @@ Name[pl]=Zarządzanie drukowaniem
 Comment[pl]=Interfejs WWW CUPS
 Name[it]=Gestione stampa
 Comment[it]=Interfaccia web di CUPS
+Name[ja]=印刷の管理
+Comment[ja]=CUPS Web インタフェース
 Name[he]=נהל הדפסות
 Comment[he]=ממשק דפדפן של CUPS
 Name[zh_TW]=印表管理
index b61ef0b66fc264298ed1f912ac3eda461b146652..37ddc448a1dd9c36f768fbcd5a3095be5f6476af 100644 (file)
@@ -71,6 +71,38 @@ information to the system log instead of a plain file.</P>
 <VAR>@CUPS_LOGDIR@/access_log</VAR>.</P>
 
 
+<H2 CLASS="title"><A NAME="AccessLogLevel">AccessLogLevel</A></H2>
+
+<H3>Examples</H3>
+
+<PRE CLASS="command">
+AccessLogLevel config
+AccessLogLevel actions
+AccessLogLevel all
+</PRE>
+
+<H3>Description</H3>
+
+<P>The <CODE>AccessLogLevel</CODE> directive controls which requests are logged
+to the access log file. The following levels are defined:</P>
+
+<UL>
+
+       <LI><CODE>config</CODE>; Log when printers and classes are added,
+       deleted, or modified and when configuration files are accessed or
+       updated.</LI>
+
+       <LI><CODE>actions</CODE>; Log when print jobs are submitted,
+       held, released, modified, or canceled, and any of the conditions
+       for <CODE>config</CODE>.</LI>
+
+       <LI><CODE>all</CODE>; Log all requests.</LI>
+
+</UL>
+
+<P>The default access log level is <CODE>@CUPS_ACCESS_LOG_LEVEL@</CODE>.</P>
+
+
 <H2 CLASS="title"><A NAME="Allow">Allow</A></H2>
 
 <H3>Examples</H3>
@@ -1884,7 +1916,7 @@ everything under the preceding levels):</P>
        <LI><CODE>notice</CODE> - Log temporary error conditions</LI>
 
        <LI><CODE>info</CODE> - Log all requests and state
-       changes (default)</LI>
+       changes</LI>
 
        <LI><CODE>debug</CODE> - Log basic debugging
        information</LI>
@@ -1894,6 +1926,8 @@ everything under the preceding levels):</P>
 
 </UL>
 
+<p>The default <code>LogLevel</code> is <code>@CUPS_LOG_LEVEL@</code>.</p>
+
 
 <H2 CLASS="title"><A NAME="MaxClients">MaxClients</A></H2>
 
index 01b87714d8bcf676fc2c38c199a9e4bda01ef7ae..b5ab4ede4ba677e4e18cd064b56e0c22ff8a8207 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   CMYK color separation code for CUPS.
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1993-2005 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -76,8 +76,6 @@ cupsCMYKDoBlack(const cups_cmyk_t   *cmyk,
 {
   int                  k;              /* Current black value */
   const short          **channels;     /* Copy of channel LUTs */
-  const unsigned char  *black_lut,     /* Black LUT */
-                       *color_lut;     /* Color LUT */
   int                  ink,            /* Amount of ink */
                        ink_limit;      /* Ink limit from separation */
 
@@ -94,8 +92,6 @@ cupsCMYKDoBlack(const cups_cmyk_t   *cmyk,
   */
 
   channels  = (const short **)cmyk->channels;
-  black_lut = cmyk->black_lut;
-  color_lut = cmyk->color_lut;
   ink_limit = cmyk->ink_limit;
 
   switch (cmyk->num_channels)
@@ -266,8 +262,6 @@ cupsCMYKDoCMYK(const cups_cmyk_t   *cmyk,
                        y,              /* Current yellow value */
                        k;              /* Current black value */
   const short          **channels;     /* Copy of channel LUTs */
-  const unsigned char  *black_lut,     /* Black LUT */
-                       *color_lut;     /* Color LUT */
   int                  ink,            /* Amount of ink */
                        ink_limit;      /* Ink limit from separation */
 
@@ -284,8 +278,6 @@ cupsCMYKDoCMYK(const cups_cmyk_t   *cmyk,
   */
 
   channels  = (const short **)cmyk->channels;
-  black_lut = cmyk->black_lut;
-  color_lut = cmyk->color_lut;
   ink_limit = cmyk->ink_limit;
 
   switch (cmyk->num_channels)
@@ -540,8 +532,6 @@ cupsCMYKDoGray(const cups_cmyk_t   *cmyk,
   int                  k,              /* Current black value */
                        kc;             /* Current black color value */
   const short          **channels;     /* Copy of channel LUTs */
-  const unsigned char  *black_lut,     /* Black LUT */
-                       *color_lut;     /* Color LUT */
   int                  ink,            /* Amount of ink */
                        ink_limit;      /* Ink limit from separation */
 
@@ -558,8 +548,6 @@ cupsCMYKDoGray(const cups_cmyk_t   *cmyk,
   */
 
   channels  = (const short **)cmyk->channels;
-  black_lut = cmyk->black_lut;
-  color_lut = cmyk->color_lut;
   ink_limit = cmyk->ink_limit;
 
   switch (cmyk->num_channels)
@@ -775,8 +763,6 @@ cupsCMYKDoRGB(const cups_cmyk_t   *cmyk,
                        kc,             /* Current black color value */
                        km;             /* Maximum black value */
   const short          **channels;     /* Copy of channel LUTs */
-  const unsigned char  *black_lut,     /* Black LUT */
-                       *color_lut;     /* Color LUT */
   int                  ink,            /* Amount of ink */
                        ink_limit;      /* Ink limit from separation */
 
@@ -793,8 +779,6 @@ cupsCMYKDoRGB(const cups_cmyk_t   *cmyk,
   */
 
   channels  = (const short **)cmyk->channels;
-  black_lut = cmyk->black_lut;
-  color_lut = cmyk->color_lut;
   ink_limit = cmyk->ink_limit;
 
   switch (cmyk->num_channels)
index 362086e455182dc1c63c39cfa0c3edebb0988ad2..a609011900bf0d36bb36723e3f0fe0d2e9738d69 100644 (file)
@@ -913,6 +913,12 @@ StartPage(ppd_file_t         *ppd, /* I - PPD file */
       band->buffer = calloc(DotRowCount, DotBufferSize);
     }
 
+    if (!DotAvailList)
+    {
+      fputs("ERROR: Unable to allocate band list!\n", stderr);
+      exit(1);
+    }
+
     fputs("DEBUG: Pointer list at start of page...\n", stderr);
 
     for (band = DotAvailList; band != NULL; band = band->next)
@@ -1571,7 +1577,6 @@ ProcessLine(ppd_file_t         *ppd,      /* I - PPD file */
   * Perform the color separation...
   */
 
-  offset   = 0;
   width    = header->cupsWidth;
   subwidth = header->cupsWidth / DotColStep;
   xstep    = 3600 / header->HWResolution[0];
index 01bed936c1cdec83c4f2aab140858ad562177946..8854a90bd8851401ddc0d165e65fa8b82f1060d7 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Colorspace conversions for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1993-2006 by Easy Software Products.
  *
  *   The color saturation/hue matrix stuff is provided thanks to Mr. Paul
@@ -507,8 +507,7 @@ cupsImageRGBAdjust(cups_ib_t *pixels,       /* IO - Input/output pixels */
   static cups_clut_t   *lut = NULL;    /* Lookup table for matrix */
 
 
-  if (saturation != last_sat ||
-      hue != last_hue)
+  if (saturation != last_sat || hue != last_hue || !lut)
   {
    /*
     * Build the color adjustment matrix...
index caa39439e99c0a9a7f9f343bc14105a286ef6bc4..d7023023022618ca8dccefa7ffc3a9fc5e9593eb 100644 (file)
@@ -372,7 +372,6 @@ gif_get_code(FILE *fp,                      /* I - File to read from */
     lastbit   = last_byte * 8;
   }
 
-  ret = 0;
   for (ret = 0, i = curbit + code_size - 1, j = code_size;
        j > 0;
        i --, j --)
@@ -611,6 +610,8 @@ gif_read_lzw(FILE *fp,                      /* I - File to read from */
 
     return (firstcode);
   }
+  else if (!table)
+    return (0);
 
   if (sp > stack)
     return (*--sp);
index 7517a4978ae1df69206189db27b5a676d40cf991..c6c1129a41e70e2c1bf8c3696e4f514a510b164e 100644 (file)
@@ -1054,7 +1054,7 @@ copy_dsc(cups_file_t  *fp,                /* I - File to read from */
   */
 
   if (!JobCanceled)
-    linelen = copy_trailer(fp, doc, ppd, number, line, linelen, linesize);
+    copy_trailer(fp, doc, ppd, number, line, linelen, linesize);
 }
 
 
@@ -2227,7 +2227,6 @@ include_feature(
   char         name[255],              /* Option name */
                value[255];             /* Option value */
   ppd_option_t *option;                /* Option in file */
-  ppd_choice_t *choice;                /* Choice */
 
 
  /*
@@ -2258,7 +2257,7 @@ include_feature(
     return (num_options);
   }
 
-  if ((choice = ppdFindChoice(option, value)) == NULL)
+  if (!ppdFindChoice(option, value))
   {
     fprintf(stderr, _("WARNING: Unknown choice \"%s\" for option \"%s\"!\n"),
             value, name + 1);
@@ -2917,10 +2916,7 @@ start_nup(pstops_doc_t *doc,             /* I - Document information */
                     w / bboxw, l / bboxl);
        }
        else
-       {
           w = PageWidth;
-         l = PageLength;
-       }
        break;
 
     case 2 :
index 015c5a8c4a0e343d1e6dece9609948afff2e93f1..bcfcd97b55eaa53533bae93ca19ec68207bf27a5 100644 (file)
@@ -1015,8 +1015,7 @@ cups_raster_write(
                        *plast;         /* Pointer to last pixel */
   unsigned char                *wptr;          /* Pointer into write buffer */
   int                  bpp,            /* Bytes per pixel */
-                       count,          /* Count */
-                       maxrun;         /* Maximum run of 128 * bpp */
+                       count;          /* Count */
 
 
   DEBUG_printf(("cups_raster_write(r=%p, pixels=%p)\n", r, pixels));
@@ -1049,7 +1048,6 @@ cups_raster_write(
   plast   = pend - bpp;
   wptr    = r->buffer;
   *wptr++ = r->count - 1;
-  maxrun  = 128 * bpp;
 
  /*
   * Write using a modified TIFF "packbits" compression...
index a529e281a029d4270a524f82b21d3f45bf81ef71..20cb77a44d989fe7976fe1d2724f177e336de910 100644 (file)
@@ -1030,9 +1030,6 @@ PCLCompress(unsigned char *line,  /* I - Line to compress */
     comp_ptr += count;
   }
 
-  line_ptr = CompBuffer;
-  line_end = comp_ptr;
-
  /*
   * Set the length of the data and write it...
   */
index 3a538830e3e9dd27e11e180d3b405ab59593326b..0c57279712969ba44f83c24eaa3e4d7582a81c5d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: testimage.c 4485 2005-01-03 19:30:00Z mike $"
+ * "$Id$"
  *
  *   Image library test program for the Common UNIX Printing System (CUPS).
  *
@@ -95,5 +95,5 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: testimage.c 4485 2005-01-03 19:30:00Z mike $".
+ * End of "$Id$".
  */
index e3391ad88c95003cdd99e5b1bf9700edaa7e0c48..c84a447bcfe5db6d145330311ddd43072584d460 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Text to PostScript filter for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1993-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -1005,7 +1005,7 @@ write_line(int     row,           /* I - Row number (0 to N) */
   lchar_t      *start;         /* First character in sequence */
 
 
-  for (col = 0, start = line; col < SizeColumns;)
+  for (col = 0; col < SizeColumns;)
   {
     while (col < SizeColumns && (line->ch == ' ' || line->ch == 0))
     {
index ab9b09108c4962a2a98a3347222ac643f950df18..4eeb6a2e47f0097f4fcb207e83f87452aa5f0a41 100644 (file)
@@ -148,7 +148,7 @@ read_strings(FILE   *strings,               /* I - .strings file */
     if (*bufptr != '\"')
       continue;
 
-    *bufptr++ = '\0';
+    *bufptr = '\0';
 
     return (1);
   }
index 5423988e9c2660aa1676121ca18c342f14a30da8..6fbdd31bb377ec5634ee579f1c33de788c44a73d 100644 (file)
@@ -33,6 +33,14 @@ AccessLog syslog
 .br
 Defines the access log filename.
 .TP 5
+AccessLogLevel config
+.TP 5
+AccessLogLevel actions
+.TP 5
+AccessLogLevel all
+.br
+Specifies the logging level for the AccessLog file.
+.TP 5
 Allow all
 .TP 5
 Allow none
index 12059ac45cc3696b5fcf32cd07066a6720a7c5eb..01a4751967a4d6ac26679e5c81fc32e50133f09e 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Man page to HTML conversion program.
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 2004-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -648,7 +648,6 @@ process_text:
   if (blist)
   {
     fputs("</li>\n</ul>\n", outfile);
-    blist = 0;
   }
 
   if (list)
@@ -659,7 +658,6 @@ process_text:
       fputs("</dd>\n", outfile);
 
     fputs("</dl>\n", outfile);
-    list = 0;
   }
 
   fputs("</body>\n"
index c0ffc9b524b6ac68f83cda491954813e6ed74720..648dcf6ca7a511dd22626e4fc90b2ba61586b476 100644 (file)
@@ -293,7 +293,6 @@ f 0755 root sys $SERVERBIN/daemon/cups-deviced scheduler/cups-deviced
 f 0755 root sys $SERVERBIN/daemon/cups-driverd scheduler/cups-driverd
 f 0755 root sys $SERVERBIN/daemon/cups-polld scheduler/cups-polld
 d 0755 root sys $SERVERBIN/driver -
-f 0755 root sys $SERVERBIN/driver/drv ppdc/drv
 d 0755 root sys $SERVERBIN/filter -
 f 0755 root sys $SERVERBIN/filter/commandtoespcx driver/commandtoescpx
 f 0755 root sys $SERVERBIN/filter/commandtopclx driver/commandtopclx
index 3246b0b00823dabc8af2c87359711a58b790bc66..7b6e55b52fefb73cc951097200bc6094e8cac2b3 100644 (file)
@@ -216,7 +216,6 @@ rm -rf $RPM_BUILD_ROOT
 /usr/lib/cups/daemon/cups-driverd
 /usr/lib/cups/daemon/cups-polld
 %dir /usr/lib/cups/driver
-/usr/lib/cups/driver/drv
 %dir /usr/lib/cups/filter
 /usr/lib/cups/filter/*
 %dir /usr/lib/cups/monitor
index 7fa3c4c5e407d85eb11720cf6d38dc426aa0587d..da828ce7497638f8d632ee247f855d54f2648beb 100644 (file)
@@ -210,7 +210,8 @@ cupsdDeletePrinterFromClasses(
        c = (cupsd_printer_t *)cupsArrayNext(ImplicitPrinters))
     if (c->num_printers == 0)
     {
-      cupsArrayRemove(ImplicitPrinters, c);
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "Deleting implicit class \"%s\"...",
+                      c->name);
       cupsdDeletePrinter(c, 0);
     }
 }
@@ -600,7 +601,7 @@ cupsdLoadAllClasses(void)
               valueptr ++);
 
          if (*valueptr)
-            *valueptr++ = '\0';
+            *valueptr = '\0';
 
          cupsdSetString(&p->job_sheets[1], value);
        }
index cf83656736c87914047dd63a2df0018b48966566..25be7a491b0ff4f52f6b1871b9d83b145c01872b 100644 (file)
@@ -240,7 +240,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
       cupsdLogMessage(CUPSD_LOG_WARN,
                       "Possible DoS attack - more than %d clients connecting "
                      "from %s!",
-                     MaxClientsPerHost, tempcon->http.hostname);
+                     MaxClientsPerHost, con->http.hostname);
     }
 
 #ifdef WIN32
@@ -3246,15 +3246,15 @@ get_cdsa_certificate(cupsd_client_t *con)       /* I - Client connection */
                        ssl_options;    /* SSL Option for hostname */
 
 
-  if ((err = SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL, 
-                             NULL, &policy_search)))
+  if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL, 
+                           NULL, &policy_search))
   {
     cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create a policy search reference");
     CFRelease(keychain);
     return (NULL);
   }
 
-  if ((err = SecPolicySearchCopyNext(policy_search, &policy)))
+  if (SecPolicySearchCopyNext(policy_search, &policy))
   {
     cupsdLogMessage(CUPSD_LOG_ERROR, 
                    "Cannot find a policy to use for searching");
@@ -3271,7 +3271,7 @@ get_cdsa_certificate(cupsd_client_t *con) /* I - Client connection */
   options.Data = (uint8 *)&ssl_options;
   options.Length = sizeof(ssl_options);
 
-  if ((err = SecPolicySetValue(policy, &options)))
+  if (SecPolicySetValue(policy, &options))
   {
     cupsdLogMessage(CUPSD_LOG_ERROR, 
                    "Cannot set policy value to use for searching");
@@ -3728,8 +3728,6 @@ is_cgi(cupsd_client_t *con,               /* I - Client connection */
 
     cupsdSetString(&con->command, filename);
 
-    filename = strrchr(filename, '/') + 1; /* Filename always absolute */
-
     if (options)
       cupsdSetStringf(&con->options, " %s", options);
 
index 955dc2df1eb4aba02e12d4f7c60cc5532861e1fd..78d5a413c03cc55ab7275b801724119a748ad375 100644 (file)
@@ -517,6 +517,7 @@ cupsdReadConfiguration(void)
   * Numeric options...
   */
 
+  AccessLogLevel        = CUPSD_ACCESSLOG_ACTIONS;
   ConfigFilePerm        = CUPS_DEFAULT_CONFIG_FILE_PERM;
   DefaultAuthType       = CUPSD_AUTH_BASIC;
 #ifdef HAVE_SSL
@@ -537,7 +538,7 @@ cupsdReadConfiguration(void)
   KeepAliveTimeout      = DEFAULT_KEEPALIVE;
   ListenBackLog         = SOMAXCONN;
   LogFilePerm           = CUPS_DEFAULT_LOG_FILE_PERM;
-  LogLevel              = CUPSD_LOG_ERROR;
+  LogLevel              = CUPSD_LOG_WARN;
   MaxClients            = 100;
   MaxClientsPerHost     = 0;
   MaxLogSize            = 1024 * 1024;
@@ -2886,10 +2887,26 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown HostNameLookups %s on line %d.",
                        value, linenum);
     }
+    else if (!strcasecmp(line, "AccessLogLevel") && value)
+    {
+     /*
+      * Amount of logging to do to access log...
+      */
+
+      if (!strcasecmp(value, "all"))
+        AccessLogLevel = CUPSD_ACCESSLOG_ALL;
+      else if (!strcasecmp(value, "actions"))
+        AccessLogLevel = CUPSD_ACCESSLOG_ACTIONS;
+      else if (!strcasecmp(value, "config"))
+        AccessLogLevel = CUPSD_ACCESSLOG_CONFIG;
+      else
+        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown AccessLogLevel %s on line %d.",
+                       value, linenum);
+    }
     else if (!strcasecmp(line, "LogLevel") && value)
     {
      /*
-      * Amount of logging to do...
+      * Amount of logging to do to error log...
       */
 
       if (!strcasecmp(value, "debug2"))
index d5c483cc44120f11385b7030255b00e9048ab7b9..e3040d43800d7a9827afee2248cd8d3ad48dfdd9 100644 (file)
@@ -4,7 +4,7 @@
  *   Configuration file definitions for the Common UNIX Printing System (CUPS)
  *   scheduler.
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -37,6 +37,13 @@ typedef enum
   CUPSD_LOG_DEBUG2                     /* Detailed debugging */
 } cupsd_loglevel_t;
 
+typedef enum
+{
+  CUPSD_ACCESSLOG_CONFIG,              /* Log config requests */
+  CUPSD_ACCESSLOG_ACTIONS,             /* Log config, print, and job management requests */
+  CUPSD_ACCESSLOG_ALL                  /* Log everything */
+} cupsd_accesslog_t;
+
 
 /*
  * Printcap formats...
@@ -117,14 +124,16 @@ VAR uid_t         User                    VALUE(1);
                                        /* User ID for server */
 VAR gid_t              Group                   VALUE(0);
                                        /* Group ID for server */
-VAR int                        ClassifyOverride        VALUE(0),
+VAR int                        AccessLogLevel          VALUE(CUPSD_ACCESSLOG_ACTIONS),
+                                       /* Access log level */
+                       ClassifyOverride        VALUE(0),
                                        /* Allow overrides? */
                        ConfigFilePerm          VALUE(0640),
                                        /* Permissions for config files */
                        LogFilePerm             VALUE(0644),
                                        /* Permissions for log files */
-                       LogLevel                VALUE(CUPSD_LOG_ERROR),
-                                       /* Log level */
+                       LogLevel                VALUE(CUPSD_LOG_WARN),
+                                       /* Error log level */
                        MaxClients              VALUE(0),
                                        /* Maximum number of clients */
                        MaxClientsPerHost       VALUE(0),
index 4d05b53c06e94fa19be21fbe0d435dd0d1067be4..3fb619e1eb2b469502ba502c01047c4a4993af30 100644 (file)
@@ -347,8 +347,7 @@ add_device(
     const char *device_uri,            /* I - Device URI */
     const char *device_id)             /* I - 1284 device ID */
 {
-  cupsd_device_t       *device,        /* New device */
-                       *temp;          /* Found device */
+  cupsd_device_t       *device;        /* New device */
 
 
  /*
@@ -377,7 +376,7 @@ add_device(
   * Add the device to the array and return...
   */
 
-  if ((temp = cupsArrayFind(devices, device)) != NULL)
+  if (cupsArrayFind(devices, device))
   {
    /*
     * Avoid duplicates!
index ca918c462d86b85765fdbf0d4f95cf4da6aa08df..55ac71b68eb0b3af4eb63c33cb11395837352280 100644 (file)
@@ -287,19 +287,24 @@ main(int  argc,                           /* I - Number of command-line arguments */
        break;
 
     case 0x05 : /* Remove jobs */
-       /*
-        * Grab the agent and skip to the list of users and/or jobs.
-       */
+        if (list)
+       {
+        /*
+         * Grab the agent and skip to the list of users and/or jobs.
+         */
 
-        agent = list;
+         agent = list;
 
-       for (; *list && !isspace(*list & 255); list ++);
-       while (isspace(*list & 255))
-         *list++ = '\0';
+         for (; *list && !isspace(*list & 255); list ++);
+         while (isspace(*list & 255))
+           *list++ = '\0';
 
-        syslog(LOG_INFO, "Remove jobs %s on %s by %s", list, dest, agent);
+         syslog(LOG_INFO, "Remove jobs %s on %s by %s", list, dest, agent);
 
-        status = remove_jobs(dest, agent, list);
+         status = remove_jobs(dest, agent, list);
+        }
+       else
+         status = 1;
 
        putchar(status);
        break;
index 51509b850f7e42096b4d10250260341bb1c6b401..f9c82f076ebb7666ffa0d48df60e73f5b7de8822 100644 (file)
@@ -557,7 +557,7 @@ cupsdLoadRemoteCache(void)
           for (value = valueptr; *valueptr && !isspace(*valueptr & 255); valueptr ++);
 
          if (*valueptr)
-            *valueptr++ = '\0';
+            *valueptr = '\0';
 
          cupsdSetString(&p->job_sheets[1], value);
        }
@@ -802,7 +802,7 @@ cupsdSendBrowseList(void)
                        to;             /* Timeout time */
 
 
-  if (!Browsing || !BrowseLocalProtocols || !Printers)
+  if (!Browsing || !Printers)
     return;
 
  /*
@@ -816,7 +816,7 @@ cupsdSendBrowseList(void)
   * Figure out how many printers need an update...
   */
 
-  if (BrowseInterval > 0)
+  if (BrowseInterval > 0 && BrowseLocalProtocols)
   {
     int        max_count;                      /* Maximum number to update */
 
@@ -894,7 +894,7 @@ cupsdSendBrowseList(void)
   }
 
  /*
-  * Loop through all of the printers and send local updates as needed...
+  * Loop through all of the printers and timeout old printers as needed...
   */
 
   for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
@@ -905,25 +905,24 @@ cupsdSendBrowseList(void)
     * If this is a remote queue, see if it needs to be timed out...
     */
 
-    if (p->type & CUPS_PRINTER_DISCOVERED)
+    if ((p->type & CUPS_PRINTER_DISCOVERED) &&
+        !(p->type & CUPS_PRINTER_IMPLICIT) &&
+       p->browse_expire < to)
     {
-      if (p->browse_expire < to)
-      {
-       cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
-                      "%s \'%s\' deleted by directory services (timeout).",
-                     (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
-                     p->name);
+      cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
+                   "%s \'%s\' deleted by directory services (timeout).",
+                   (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
+                   p->name);
 
-        cupsdLogMessage(CUPSD_LOG_DEBUG,
-                       "Remote destination \"%s\" has timed out; "
-                       "deleting it...",
-                       p->name);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                     "Remote destination \"%s\" has timed out; "
+                     "deleting it...",
+                     p->name);
 
-        cupsArraySave(Printers);
-        cupsdDeletePrinter(p, 1);
-        cupsArrayRestore(Printers);
-        cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE);
-      }
+      cupsArraySave(Printers);
+      cupsdDeletePrinter(p, 1);
+      cupsArrayRestore(Printers);
+      cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE);
     }
   }
 }
@@ -2439,13 +2438,23 @@ process_browse_data(
                newname[IPP_MAX_NAME],  /* New name of printer */
                *hptr,                  /* Pointer into hostname */
                *sptr;                  /* Pointer into ServerName */
+  const char   *shortname;             /* Short queue name (queue) */
   char         local_make_model[IPP_MAX_NAME];
                                        /* Local make and model */
   cupsd_printer_t *p;                  /* Printer information */
   const char   *ipp_options,           /* ipp-options value */
                *lease_duration;        /* lease-duration value */
+  int          is_class;               /* Is this queue a class? */
 
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "process_browse_data(uri=\"%s\", host=\"%s\", "
+                 "resource=\"%s\", type=%x, state=%d, location=\"%s\", "
+                 "info=\"%s\", make_model=\"%s\", num_attrs=%d, attrs=%p)",
+                 uri, host, resource, type, state,
+                 location ? location : "(nil)", info ? info : "(nil)",
+                 make_model ? make_model : "(nil)", num_attrs, attrs);
+
  /*
   * Determine if the URI contains any illegal characters in it...
   */
@@ -2454,9 +2463,7 @@ process_browse_data(
       (strncmp(resource, "/printers/", 10) &&
        strncmp(resource, "/classes/", 9)))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "process_browse_data: Bad printer URI in browse data: %s",
-                    uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Bad printer URI in browse data: %s", uri);
     return;
   }
 
@@ -2464,8 +2471,7 @@ process_browse_data(
       (!strncmp(resource, "/printers/", 10) && strchr(resource + 10, '/')) ||
       (!strncmp(resource, "/classes/", 9) && strchr(resource + 9, '/')))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "process_browse_data: Bad resource in browse data: %s",
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Bad resource in browse data: %s",
                     resource);
     return;
   }
@@ -2520,11 +2526,12 @@ process_browse_data(
   * See if we already have it listed in the Printers list, and add it if not...
   */
 
-  type   |= CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED;
-  type   &= ~CUPS_PRINTER_IMPLICIT;
-  update = 0;
-  hptr   = strchr(host, '.');
-  sptr   = strchr(ServerName, '.');
+  type     |= CUPS_PRINTER_REMOTE | CUPS_PRINTER_DISCOVERED;
+  type     &= ~CUPS_PRINTER_IMPLICIT;
+  update   = 0;
+  hptr     = strchr(host, '.');
+  sptr     = strchr(ServerName, '.');
+  is_class = type & CUPS_PRINTER_CLASS;
 
   if (!ServerNameIsIP && sptr != NULL && hptr != NULL)
   {
@@ -2544,7 +2551,7 @@ process_browse_data(
     }
   }
 
-  if (type & CUPS_PRINTER_CLASS)
+  if (is_class)
   {
    /*
     * Remote destination is a class...
@@ -2555,210 +2562,140 @@ process_browse_data(
     else
       return;
 
-    if (hptr && !*hptr)
-      *hptr = '.';                     /* Resource FQDN */
+    shortname = resource + 9;
+  }
+  else
+  {
+   /*
+    * Remote destination is a printer...
+    */
 
-    if ((p = cupsdFindDest(name)) == NULL && BrowseShortNames)
-    {
-      if ((p = cupsdFindDest(resource + 9)) != NULL)
-      {
-        if (p->hostname && strcasecmp(p->hostname, host))
-       {
-        /*
-         * Nope, this isn't the same host; if the hostname isn't the local host,
-         * add it to the other class and then find a class using the full host
-         * name...
-         */
+    if (!strncmp(resource, "/printers/", 10))
+      snprintf(name, sizeof(name), "%s@%s", resource + 10, host);
+    else
+      return;
 
-         if (p->type & CUPS_PRINTER_REMOTE)
-         {
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "Renamed remote class \"%s\" to \"%s@%s\"...",
-                           p->name, p->name, p->hostname);
-           cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
-                         "Class \'%s\' deleted by directory services.",
-                         p->name);
-
-            snprintf(newname, sizeof(newname), "%s@%s", p->name, p->hostname);
-            cupsdRenamePrinter(p, newname);
-
-           cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
-                         "Class \'%s\' added by directory services.",
-                         p->name);
-         }
+    shortname = resource + 10;
+  }
 
-          p = NULL;
-       }
-       else if (!p->hostname)
-       {
-        /*
-         * Hostname not set, so this must be a cached remote printer
-         * that was created for a pending print job...
-         */
+  if (hptr && !*hptr)
+    *hptr = '.';                       /* Resource FQDN */
 
-          cupsdSetString(&p->hostname, host);
-         cupsdSetString(&p->uri, uri);
-         cupsdSetString(&p->device_uri, uri);
-          update = 1;
-        }
-      }
-      else
-      {
-       /*
-        * Use the short name for this shared class.
-       */
+  if ((p = cupsdFindDest(name)) == NULL && BrowseShortNames)
+  {
+   /*
+    * Long name doesn't exist, try short name...
+    */
 
-        strlcpy(name, resource + 9, sizeof(name));
-      }
-    }
-    else if (p && !p->hostname)
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "process_browse_data: %s not found...",
+                    name);
+
+    if ((p = cupsdFindDest(shortname)) == NULL)
     {
      /*
-      * Hostname not set, so this must be a cached remote printer
-      * that was created for a pending print job...
+      * Short name doesn't exist, use it for this shared queue.
       */
 
-      cupsdSetString(&p->hostname, host);
-      cupsdSetString(&p->uri, uri);
-      cupsdSetString(&p->device_uri, uri);
-      update = 1;
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "process_browse_data: %s not found...",
+                     shortname);
+      strlcpy(name, shortname, sizeof(name));
     }
-
-    if (!p)
+    else
     {
      /*
-      * Class doesn't exist; add it...
+      * Short name exists...
       */
 
-      p = cupsdAddClass(name);
-
-      cupsdLogMessage(CUPSD_LOG_DEBUG, "Added remote class \"%s\"...", name);
-
-      cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
-                    "Class \'%s\' added by directory services.", name);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "process_browse_data: %s found, type=%x, hostname=%s...",
+                     shortname, p->type, p->hostname ? p->hostname : "(nil)");
 
-     /*
-      * Force the URI to point to the real server...
-      */
+      if (p->type & CUPS_PRINTER_IMPLICIT)
+        p = NULL;                      /* Don't replace implicit classes */
+      else if (p->hostname && strcasecmp(p->hostname, host))
+      {
+       /*
+       * Short name exists but is for a different host.  If this is a remote
+       * queue, rename it and use the long name...
+       */
 
-      p->type      = type & ~CUPS_PRINTER_REJECTING;
-      p->accepting = 1;
-      cupsdSetString(&p->uri, uri);
-      cupsdSetString(&p->device_uri, uri);
-      cupsdSetString(&p->hostname, host);
+       if (p->type & CUPS_PRINTER_REMOTE)
+       {
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "Renamed remote %s \"%s\" to \"%s@%s\"...",
+                         is_class ? "class" : "printer", p->name, p->name,
+                         p->hostname);
+         cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
+                       "%s \'%s\' deleted by directory services.",
+                       is_class ? "Class" : "Printer", p->name);
+
+         snprintf(newname, sizeof(newname), "%s@%s", p->name, p->hostname);
+         cupsdRenamePrinter(p, newname);
+
+         cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
+                       "%s \'%s\' added by directory services.",
+                       is_class ? "Class" : "Printer", p->name);
+       }
 
-      update = 1;
+       /*
+        * Force creation with long name...
+       */
 
-      cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE);
+       p = NULL;
+      }
     }
   }
   else
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "process_browse_data: %s found, type=%x, hostname=%s...",
+                   name, p->type, p->hostname ? p->hostname : "(nil)");
+
+  if (!p)
   {
    /*
-    * Remote destination is a printer...
+    * Queue doesn't exist; add it...
     */
 
-    if (!strncmp(resource, "/printers/", 10))
-      snprintf(name, sizeof(name), "%s@%s", resource + 10, host);
+    if (is_class)
+      p = cupsdAddClass(name);
     else
-      return;
-
-    if (hptr && !*hptr)
-      *hptr = '.';                     /* Resource FQDN */
-
-    if ((p = cupsdFindDest(name)) == NULL && BrowseShortNames)
-    {
-      if ((p = cupsdFindDest(resource + 10)) != NULL)
-      {
-        if (p->hostname && strcasecmp(p->hostname, host))
-       {
-        /*
-         * Nope, this isn't the same host; if the hostname isn't the local host,
-         * add it to the other printer and then find a printer using the full host
-         * name...
-         */
-
-         if (p->type & CUPS_PRINTER_REMOTE)
-         {
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "Renamed remote printer \"%s\" to \"%s@%s\"...",
-                           p->name, p->name, p->hostname);
-           cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
-                         "Printer \'%s\' deleted by directory services.",
-                         p->name);
-
-            snprintf(newname, sizeof(newname), "%s@%s", p->name, p->hostname);
-            cupsdRenamePrinter(p, newname);
-
-           cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
-                         "Printer \'%s\' added by directory services.",
-                         p->name);
-         }
-
-          p = NULL;
-       }
-       else if (!p->hostname)
-       {
-        /*
-         * Hostname not set, so this must be a cached remote printer
-         * that was created for a pending print job...
-         */
-
-          cupsdSetString(&p->hostname, host);
-         cupsdSetString(&p->uri, uri);
-         cupsdSetString(&p->device_uri, uri);
-          update = 1;
-        }
-      }
-      else
-      {
-       /*
-        * Use the short name for this shared printer.
-       */
+      p = cupsdAddPrinter(name);
 
-        strlcpy(name, resource + 10, sizeof(name));
-      }
-    }
-    else if (p && !p->hostname)
-    {
-     /*
-      * Hostname not set, so this must be a cached remote printer
-      * that was created for a pending print job...
-      */
+    cupsdClearString(&(p->hostname));
 
-      cupsdSetString(&p->hostname, host);
-      cupsdSetString(&p->uri, uri);
-      cupsdSetString(&p->device_uri, uri);
-      update = 1;
-    }
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "Added remote %s \"%s\"...",
+                    is_class ? "class" : "printer", name);
 
-    if (!p)
-    {
-     /*
-      * Printer doesn't exist; add it...
-      */
+    cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
+                 "%s \'%s\' added by directory services.",
+                 is_class ? "Class" : "Printer", name);
 
-      p = cupsdAddPrinter(name);
+   /*
+    * Force the URI to point to the real server...
+    */
 
-      cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
-                    "Printer \'%s\' added by directory services.", name);
+    p->type      = type & ~CUPS_PRINTER_REJECTING;
+    p->accepting = 1;
 
-      cupsdLogMessage(CUPSD_LOG_DEBUG, "Added remote printer \"%s\"...", name);
+    cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP);
+  }
 
-     /*
-      * Force the URI to point to the real server...
-      */
+  if (!p)
+    return;
 
-      p->type      = type & ~CUPS_PRINTER_REJECTING;
-      p->accepting = 1;
-      cupsdSetString(&p->hostname, host);
-      cupsdSetString(&p->uri, uri);
-      cupsdSetString(&p->device_uri, uri);
+  if (!p->hostname)
+  {
+   /*
+    * Hostname not set, so this must be a cached remote printer
+    * that was created for a pending print job...
+    */
 
-      update = 1;
+    cupsdSetString(&p->hostname, host);
+    cupsdSetString(&p->uri, uri);
+    cupsdSetString(&p->device_uri, uri);
+    update = 1;
 
-      cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE);
-    }
+    cupsdMarkDirty(CUPSD_DIRTY_REMOTE);
   }
 
  /*
@@ -2823,7 +2760,7 @@ process_browse_data(
 
   if (!make_model || !make_model[0])
   {
-    if (type & CUPS_PRINTER_CLASS)
+    if (is_class)
       snprintf(local_make_model, sizeof(local_make_model),
                "Remote Class on %s", host);
     else
@@ -2877,7 +2814,7 @@ process_browse_data(
   {
     cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
                   "%s \'%s\' deleted by directory services.",
-                 (type & CUPS_PRINTER_CLASS) ? "Class" : "Printer", p->name);
+                 is_class ? "Class" : "Printer", p->name);
 
     cupsdExpireSubscriptions(p, NULL);
  
index 7562cd9e2888739b85d93328f60ac73fceaf697a..621663e3a59ff279665c36923bc453809ccfb26a 100644 (file)
@@ -1670,8 +1670,7 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
                                IPP_TAG_INTEGER)) != NULL)
     attr->values[0].integer = 0;
   else
-    attr = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER,
-                         "job-k-octets", 0);
+    ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-k-octets", 0);
 
   if ((attr = ippFindAttribute(job->attrs, "job-hold-until",
                                IPP_TAG_KEYWORD)) == NULL)
@@ -2001,9 +2000,7 @@ add_job_subscriptions(
   * none...
   */
 
-  for (attr = job->attrs->attrs, prev = NULL;
-       attr;
-       prev = attr, attr = attr->next)
+  for (attr = job->attrs->attrs; attr; attr = attr->next)
     if (attr->group_tag == IPP_TAG_SUBSCRIPTION)
       break;
 
@@ -2175,6 +2172,9 @@ add_job_subscriptions(
 
  /*
   * Remove all of the subscription attributes from the job request...
+  *
+  * TODO: Optimize this since subscription groups have to come at the
+  * end of the request...
   */
 
   for (attr = job->attrs->attrs, prev = NULL; attr; attr = next)
@@ -3480,7 +3480,8 @@ apply_printer_defaults(
   * job object...
   */
 
-  for (i = printer->num_options, num_options = 0, option = printer->options;
+  for (i = printer->num_options, num_options = 0, options = NULL,
+           option = printer->options;
        i > 0;
        i --, option ++)
     if (!ippFindAttribute(job->attrs, option->name, IPP_TAG_ZERO))
@@ -5033,8 +5034,6 @@ copy_model(cupsd_client_t *con,           /* I - Client connection */
     * See if we have data ready...
     */
 
-    bytes = 0;
-
     FD_ZERO(&input);
     FD_SET(temppipe[0], &input);
     FD_SET(CGIPipes[0], &input);
@@ -9845,9 +9844,9 @@ send_http_error(
 
 static void
 send_ipp_status(cupsd_client_t *con,   /* I - Client connection */
-               ipp_status_t   status,  /* I - IPP status code */
-              const char     *message, /* I - Status message */
-              ...)                     /* I - Additional args as needed */
+                ipp_status_t   status, /* I - IPP status code */
+               const char     *message,/* I - Status message */
+               ...)                    /* I - Additional args as needed */
 {
   va_list      ap;                     /* Pointer to additional args */
   char         formatted[1024];        /* Formatted errror message */
index 8dbee2b59380c6657ff0ffe17606cde53a138cfa..9b025a387abe4ba1fcbab028fa3b89beb1e72029 100644 (file)
@@ -2436,8 +2436,8 @@ set_hold_until(cupsd_job_t *job,  /* I - Job to update */
   */
 
   if (attr == NULL)
-    attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
-                        "job-hold-until", NULL, holdstr);
+    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-hold-until",
+                 NULL, holdstr);
   else
     cupsdSetString(&attr->values[0].string.text, holdstr);
 
@@ -2821,7 +2821,7 @@ start_job(cupsd_job_t     *job,           /* I - Job ID */
 
   i = ipp_length(job->attrs);
 
-  if (i > optlength)
+  if (i > optlength || !options)
   {
     if (optlength == 0)
       optptr = malloc(i);
@@ -3807,23 +3807,25 @@ update_job(cupsd_job_t *job)            /* I - Job to check */
     {
       cupsdLogJob(job, loglevel, "%s", message);
 
-      strlcpy(job->printer->state_message, message,
-             sizeof(job->printer->state_message));
-      cupsdAddPrinterHistory(job->printer);
+      if (loglevel < CUPSD_LOG_DEBUG)
+      {
+       strlcpy(job->printer->state_message, message,
+               sizeof(job->printer->state_message));
+       cupsdAddPrinterHistory(job->printer);
 
-      if (loglevel <= CUPSD_LOG_INFO)
        event |= CUPSD_EVENT_PRINTER_STATE;
 
-      if (loglevel <= job->status_level)
-      {
-       /*
-       * Some messages show in the printer-state-message attribute...
-       */
+       if (loglevel <= job->status_level)
+       {
+        /*
+         * Some messages show in the printer-state-message attribute...
+         */
 
-       if (loglevel != CUPSD_LOG_NOTICE)
-         job->status_level = loglevel;
+         if (loglevel != CUPSD_LOG_NOTICE)
+           job->status_level = loglevel;
 
-       update_job_attrs(job, 1);
+         update_job_attrs(job, 1);
+       }
       }
     }
 
index ea6d7755db552e9ca3d457731ba788edb18909ba..1eb10c2d05a8df72484735a4a04fddad9a8d68d1 100644 (file)
@@ -150,12 +150,8 @@ cupsdLogGSSMessage(
                                           &major_status_string);
 
   if (!GSS_ERROR(err_major_status))
-    err_major_status = gss_display_status(&err_minor_status,
-                                         minor_status,
-                                         GSS_C_MECH_CODE,
-                                         GSS_C_NULL_OID,
-                                         &msg_ctx,
-                                         &minor_status_string);
+    gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
+                       GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
 
   ret = cupsdLogMessage(level, "%s: %s, %s", message,
                        (char *)major_status_string.value,
@@ -481,6 +477,112 @@ cupsdLogRequest(cupsd_client_t *con,      /* I - Request to log */
                };
 
 
+ /*
+  * Filter requests as needed...
+  */
+
+  if (AccessLogLevel < CUPSD_ACCESSLOG_ALL)
+  {
+   /*
+    * Eliminate simple GET requests...
+    */
+
+    if ((con->operation == HTTP_GET &&
+         strncmp(con->uri, "/admin/conf", 11) &&
+        strncmp(con->uri, "/admin/log", 10)) ||
+       (con->operation == HTTP_POST && !con->request &&
+        strncmp(con->uri, "/admin", 6)) ||
+       (con->operation != HTTP_POST && con->operation != HTTP_PUT))
+      return (1);
+
+    if (con->request && con->response &&
+        con->response->request.status.status_code < IPP_REDIRECTION_OTHER_SITE)
+    {
+     /*
+      * Check successful requests...
+      */
+
+      ipp_op_t op = con->request->request.op.operation_id;
+      static cupsd_accesslog_t standard_ops[] =
+      {
+        CUPSD_ACCESSLOG_ALL,   /* reserved */
+        CUPSD_ACCESSLOG_ALL,   /* reserved */
+        CUPSD_ACCESSLOG_ACTIONS,/* Print-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Print-URI */
+        CUPSD_ACCESSLOG_ACTIONS,/* Validate-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Create-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Send-Document */
+        CUPSD_ACCESSLOG_ACTIONS,/* Send-URI */
+        CUPSD_ACCESSLOG_ACTIONS,/* Cancel-Job */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Job-Attributes */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Jobs */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Printer-Attributes */
+        CUPSD_ACCESSLOG_ACTIONS,/* Hold-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Release-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Restart-Job */
+       CUPSD_ACCESSLOG_ALL,    /* reserved */
+        CUPSD_ACCESSLOG_CONFIG,        /* Pause-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Resume-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Purge-Jobs */
+        CUPSD_ACCESSLOG_CONFIG,        /* Set-Printer-Attributes */
+        CUPSD_ACCESSLOG_ACTIONS,/* Set-Job-Attributes */
+        CUPSD_ACCESSLOG_CONFIG,        /* Get-Printer-Supported-Values */
+        CUPSD_ACCESSLOG_ACTIONS,/* Create-Printer-Subscription */
+        CUPSD_ACCESSLOG_ACTIONS,/* Create-Job-Subscription */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Subscription-Attributes */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Subscriptions */
+        CUPSD_ACCESSLOG_ACTIONS,/* Renew-Subscription */
+        CUPSD_ACCESSLOG_ACTIONS,/* Cancel-Subscription */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Notifications */
+        CUPSD_ACCESSLOG_ACTIONS,/* Send-Notifications */
+        CUPSD_ACCESSLOG_ALL,   /* reserved */
+        CUPSD_ACCESSLOG_ALL,   /* reserved */
+        CUPSD_ACCESSLOG_ALL,   /* reserved */
+        CUPSD_ACCESSLOG_ALL,   /* Get-Print-Support-Files */
+        CUPSD_ACCESSLOG_CONFIG,        /* Enable-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Disable-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Pause-Printer-After-Current-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Hold-New-Jobs */
+        CUPSD_ACCESSLOG_ACTIONS,/* Release-Held-New-Jobs */
+        CUPSD_ACCESSLOG_CONFIG,        /* Deactivate-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Activate-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Restart-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Shutdown-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* Startup-Printer */
+        CUPSD_ACCESSLOG_ACTIONS,/* Reprocess-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Cancel-Current-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Suspend-Current-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Resume-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* Promote-Job */
+        CUPSD_ACCESSLOG_ACTIONS        /* Schedule-Job-After */
+      };
+      static cupsd_accesslog_t cups_ops[] =
+      {
+        CUPSD_ACCESSLOG_ALL,   /* CUPS-Get-Default */
+        CUPSD_ACCESSLOG_ALL,   /* CUPS-Get-Printers */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Add-Modify-Printer */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Delete-Printer */
+        CUPSD_ACCESSLOG_ALL,   /* CUPS-Get-Classes */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Add-Modify-Class */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Delete-Class */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Accept-Jobs */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Reject-Jobs */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Set-Default */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Get-Devices */
+        CUPSD_ACCESSLOG_CONFIG,        /* CUPS-Get-PPDs */
+        CUPSD_ACCESSLOG_ACTIONS,/* CUPS-Move-Job */
+        CUPSD_ACCESSLOG_ACTIONS,/* CUPS-Authenticate-Job */
+        CUPSD_ACCESSLOG_ALL    /* CUPS-Get-PPD */
+      };
+      
+
+      if ((op <= IPP_SCHEDULE_JOB_AFTER && standard_ops[op] > AccessLogLevel) ||
+          (op >= CUPS_GET_DEFAULT && op <= CUPS_GET_PPD &&
+          cups_ops[op - CUPS_GET_DEFAULT] > AccessLogLevel))
+        return (1);
+    }
+  }
+
 #ifdef HAVE_VSYSLOG
  /*
   * See if we are logging accesses via syslog...
@@ -818,7 +920,7 @@ format_log_line(const char *message,        /* I - Printf-style format string */
       log_linesize = len;
     }
 
-    len = vsnprintf(log_line, log_linesize, message, ap);
+    vsnprintf(log_line, log_linesize, message, ap);
   }
 
   return (log_line);
index e3319467aa8e9f6fcecde4eaf9880958b3bce427..b6beb3ee0424122c156d7e35ffafb94d53e1bb67 100644 (file)
@@ -941,7 +941,7 @@ main(int  argc,                             /* I - Number of command-line args */
 #endif /* HAVE_LDAP */
     }
 
-    if (Browsing && BrowseLocalProtocols && current_time > browse_time)
+    if (Browsing && current_time > browse_time)
     {
       cupsdSendBrowseList();
       browse_time = current_time;
index c5f4a91a93beab466c5dfc93811606f3d893a1fd..c675e090d01bbeb3992d0bbe726f58826d14306c 100644 (file)
@@ -133,6 +133,8 @@ cupsdAddPrinter(const char *name)   /* I - Name of printer */
   if (!Printers)
     Printers = cupsArrayNew(compare_printers, NULL);
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAddPrinter: Adding %s to Printers", p->name);
   cupsArrayAdd(Printers, p);
 
   if (!ImplicitPrinters)
@@ -640,10 +642,17 @@ cupsdDeletePrinter(
   * Remove the printer from the list...
   */
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdDeletePrinter: Removing %s from Printers", p->name);
   cupsArrayRemove(Printers, p);
 
   if (p->type & CUPS_PRINTER_IMPLICIT)
+  {
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "cupsdDeletePrinter: Removing %s from ImplicitPrinters",
+                   p->name);
     cupsArrayRemove(ImplicitPrinters, p);
+  }
 
  /*
   * Remove the dummy interface/icon/option files under IRIX...
@@ -1128,7 +1137,7 @@ cupsdLoadAllPrinters(void)
           for (value = valueptr; *valueptr && !isspace(*valueptr & 255); valueptr ++);
 
          if (*valueptr)
-            *valueptr++ = '\0';
+            *valueptr = '\0';
 
          cupsdSetString(&p->job_sheets[1], value);
        }
@@ -1285,10 +1294,17 @@ cupsdRenamePrinter(
   * Remove the printer from the array(s) first...
   */
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdRenamePrinter: Removing %s from Printers", p->name);
   cupsArrayRemove(Printers, p);
 
   if (p->type & CUPS_PRINTER_IMPLICIT)
+  {
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "cupsdRenamePrinter: Removing %s from ImplicitPrinters",
+                   p->name);
     cupsArrayRemove(ImplicitPrinters, p);
+  }
 
  /*
   * Rename the printer type...
@@ -1316,10 +1332,17 @@ cupsdRenamePrinter(
   * Add the printer back to the printer array(s)...
   */
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdRenamePrinter: Adding %s to Printers", p->name);
   cupsArrayAdd(Printers, p);
 
   if (p->type & CUPS_PRINTER_IMPLICIT)
+  {
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "cupsdRenamePrinter: Adding %s to ImplicitPrinters",
+                   p->name);
     cupsArrayAdd(ImplicitPrinters, p);
+  }
 }
 
 
@@ -1574,7 +1597,7 @@ cupsdSaveAllPrinters(void)
     {
       cupsFilePrintf(fp, "Attribute %s ", marker->name);
 
-      if (!ptr && (ptr = strchr(marker->values[0].string.text, '#')) != NULL)
+      if ((ptr = strchr(marker->values[0].string.text, '#')) != NULL)
       {
        cupsFileWrite(fp, marker->values[0].string.text,
                      ptr - marker->values[0].string.text);
@@ -3740,7 +3763,7 @@ add_printer_defaults(cupsd_printer_t *p)/* I - Printer */
   * Add all of the default options from the .conf files...
   */
 
-  for (num_options = 0, i = p->num_options, option = p->options;
+  for (num_options = 0, options = NULL, i = p->num_options, option = p->options;
        i > 0;
        i --, option ++)
   {
@@ -3825,7 +3848,8 @@ add_printer_filter(
   *     super/type cost program
   */
 
-  if (sscanf(filter, "%15[^/]/%31s%d%1023s", super, type, &cost, program) != 4)
+  if (sscanf(filter, "%15[^/]/%31s%d%*[ \t]%1023[^\n]", super, type, &cost,
+             program) != 4)
   {
     cupsdLogMessage(CUPSD_LOG_ERROR, "%s: invalid filter string \"%s\"!",
                     p->name, filter);
index 10de4ea74907bc852b1ad05276d9e5cd4855c319..5cf16bfda08368747c09467c61cffcefb549ac42 100644 (file)
@@ -196,8 +196,9 @@ overwrite_data(int        fd,               /* I - File descriptor */
 
 
 #ifdef TEST
+#  define testmain main
 int
-main(void)
+testmain(void)
 {
   FILE *fp;
 
index 6f68436856ee725a9c047876d93b3e01a01488a4..20c9547fd60c1d05a0c4f9c30d1a069b29953ffe 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Select abstraction functions for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 2006-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -259,7 +259,9 @@ cupsdAddSelect(int             fd,  /* I - File descriptor */
               void            *data)   /* I - Data to pass to callback */
 {
   _cupsd_fd_t  *fdptr;                 /* File descriptor record */
+#ifdef HAVE_EPOLL
   int          added;                  /* 1 if added, 0 if modified */
+#endif /* HAVE_EPOLL */
 
 
  /*
@@ -296,10 +298,14 @@ cupsdAddSelect(int             fd,        /* I - File descriptor */
       return (0);
     }
 
+#ifdef HAVE_EPOLL
     added = 1;
   }
   else
     added = 0;
+#else
+  }
+#endif /* HAVE_EPOLL */
 
 #ifdef HAVE_KQUEUE
   {
index 11cdfcae676fee0526acf35b1a9884fdb3906e3f..c9fe4ed68d193ee39bd7121aaaad49844b62f9a9 100644 (file)
@@ -305,8 +305,6 @@ do_test(const char        *server,  /* I - Server to use */
       case IPP_PRINT_JOB :
          ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                        NULL, "ipp://localhost/printers/test");
-          ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-hold-until",
-                      NULL, "indefinite");
          ippDelete(cupsDoFileRequest(http, request, "/printers/test",
                                      "../data/testprint.ps"));
           break;
index 6532b9c08b79a39b9ca23b9a8f02dd597d089232..e93720d07c718cea3314f3ef0474e279882d1bf9 100644 (file)
@@ -284,8 +284,7 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
       while (isalnum(*rule & 255) && (ptr - name) < (sizeof(name) - 1))
         *ptr++ = *rule++;
 
-      *ptr       = '\0';
-      num_values = 0;
+      *ptr = '\0';
 
       if (*rule == '(')
       {
@@ -415,7 +414,6 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
 
        snprintf(value[0], sizeof(value[0]), "*.%s", name);
        length[0]  = strlen(value[0]);
-       num_values = 1;
        op         = MIME_MAGIC_MATCH;
       }
 
index 8d057bbdd497b29ad0a5f906821317ff2ae8ebb4..7b4d0db4d5476aa933cc427819ca621bbfc26a22 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "cancel" command for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -59,7 +59,6 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
   op        = IPP_CANCEL_JOB;
   purge     = 0;
-  job_id    = 0;
   dest      = NULL;
   user      = NULL;
   http      = NULL;
index 1cd6fc8326ebdd8ae6a2f0b284a349eeee29d08b..9c8e4f8c1f5aaa305f9552c1305abbaee51decab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cupsctl.c 6379 2007-03-21 14:57:22Z mike $"
+ * "$Id$"
  *
  *   CUPS control program for the Common UNIX Printing System (CUPS).
  *
@@ -222,5 +222,5 @@ usage(const char *opt)                      /* I - Option character/string */
 
 
 /*
- * End of "$Id: cupsctl.c 6379 2007-03-21 14:57:22Z mike $".
+ * End of "$Id$".
  */
index ce4a8a7077e7dbe98a2238c87ceef9209c123338..e2267c2ade0df6306abda3c3c3026bdf09330f3c 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   DSC test program for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -192,7 +192,6 @@ check_file(const char *filename)    /* I - File to read from */
        if (!status)
           _cupsLangPuts(stdout, _("FAIL\n"));
 
-       status ++;
        _cupsLangPuts(stdout,
                      _("    Missing %!PS-Adobe-3.0 on first line!\n"
                        "        REF: Page 17, 3.1 Conforming Documents\n"));
index b3b3ff0cea48f16a6ce16db01bcd34758983ad54..b2317564956ccae7c3a377628b322152731fd6d1 100644 (file)
@@ -1628,12 +1628,12 @@ check_basics(const char *filename)      /* I - PPD file to check */
 
           if (eol == EOL_NONE)
            eol = EOL_CRLF;
-         else
+         else if (eol != EOL_CRLF)
            mixed = 1;
        }
        else if (eol == EOL_NONE)
          eol = EOL_CR;
-        else
+        else if (eol != EOL_CR)
          mixed = 1;
       }
       
@@ -1831,11 +1831,12 @@ check_filters(ppd_file_t *ppd,          /* I - PPD file */
              int        verbose,       /* I - Verbosity level */
              int        warn)          /* I - Warnings only? */
 {
+  int          i;                      /* Looping var */
   ppd_attr_t   *attr;                  /* PPD attribute */
   const char   *ptr;                   /* Pointer into string */
   char         super[16],              /* Super-type for filter */
                type[256],              /* Type for filter */
-               program[256],           /* Program/filter name */
+               program[1024],          /* Program/filter name */
                pathprog[1024];         /* Complete path to program/filter */
   int          cost;                   /* Cost of filter */
   const char   *prefix;                /* WARN/FAIL prefix */
@@ -1843,13 +1844,10 @@ check_filters(ppd_file_t *ppd,          /* I - PPD file */
 
   prefix = warn ? "  WARN  " : "**FAIL**";
 
-  for (attr = ppdFindAttr(ppd, "cupsFilter", NULL);
-       attr;
-       attr = ppdFindNextAttr(ppd, "cupsFilter", NULL))
+  for (i = 0; i < ppd->num_filters; i ++)
   {
-    if (!attr->value ||
-       sscanf(attr->value, "%15[^/]/%255s%d%255s", super, type, &cost,
-              program) != 4)
+    if (sscanf(ppd->filters[i], "%15[^/]/%255s%d%*[ \t]%1023[^\n]", super, type,
+               &cost, program) != 4)
     {
       if (!warn && !errors && !verbose)
        _cupsLangPuts(stdout, _(" FAIL\n"));
@@ -1857,7 +1855,7 @@ check_filters(ppd_file_t *ppd,            /* I - PPD file */
       if (verbose >= 0)
        _cupsLangPrintf(stdout,
                        _("      %s  Bad cupsFilter value \"%s\"!\n"),
-                       prefix, attr->value ? attr->value : "");
+                       prefix, ppd->filters[i]);
 
       if (!warn)
         errors ++;
@@ -1899,8 +1897,8 @@ check_filters(ppd_file_t *ppd,            /* I - PPD file */
        attr = ppdFindNextAttr(ppd, "cupsPreFilter", NULL))
   {
     if (!attr->value ||
-       sscanf(attr->value, "%15[^/]/%255s%d%255s", super, type, &cost,
-              program) != 4)
+       sscanf(attr->value, "%15[^/]/%255s%d%*[ \t]%1023[^\n]", super, type,
+              &cost, program) != 4)
     {
       if (!warn && !errors && !verbose)
        _cupsLangPuts(stdout, _(" FAIL\n"));
index 4448ecf62cc73b2bb0eb3f5d69092194aa283188..5ee882342bdfc7e53795534b211602f79095f9d8 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpadmin" command for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -914,12 +914,13 @@ add_printer_to_class(http_t *http,        /* I - Server connection */
     attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_URI,
                          "member-uris", members->num_values + 1, NULL, NULL);
     for (i = 0; i < members->num_values; i ++)
-      attr->values[i].string.text = strdup(members->values[i].string.text);
+      attr->values[i].string.text = _cupsStrAlloc(members->values[i].string.text);
 
-    attr->values[i].string.text = strdup(uri);
+    attr->values[i].string.text = _cupsStrAlloc(uri);
   }
   else
-    attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris", NULL, uri);
+    ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris", NULL,
+                 uri);
 
  /*
   * Then send the request...
@@ -1189,7 +1190,8 @@ delete_printer_from_class(
 
     for (j = 0, k = 0; j < members->num_values; j ++)
       if (j != i)
-        attr->values[k ++].string.text = strdup(members->values[j].string.text);
+        attr->values[k ++].string.text =
+           _cupsStrAlloc(members->values[j].string.text);
   }
 
  /*
index 0dc5d0b56772f8961d48df257d754dd31a89280f..d2d42ce9c078b561da37d943c3595a62e45c32f5 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Printer option program for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -96,7 +96,9 @@ main(int  argc,                               /* I - Number of command-line arguments */
            if (num_dests == 0)
              num_dests = cupsGetDests(&dests);
 
-            if ((dest = cupsGetDest(printer, instance, num_dests, dests)) == NULL)
+            if (num_dests == 0 || !dests ||
+               (dest = cupsGetDest(printer, instance, num_dests,
+                                   dests)) == NULL)
            {
              _cupsLangPuts(stderr,
                            _("lpoptions: Unknown printer or class!\n"));
@@ -463,8 +465,8 @@ list_group(ppd_file_t  *ppd,                /* I - PPD file */
 
            while (cparam)
            {
-             _cupsLangPrintf(stdout, "%s%s=%s", choice->marked ? "*" : "",
-                             cparam->name, types[cparam->type]);
+             _cupsLangPrintf(stdout, "%s%s=%s", prefix, cparam->name,
+                             types[cparam->type]);
              cparam = (ppd_cparam_t *)cupsArrayNext(coption->params);
              prefix = " ";
            }
index 5b22888edde73a914a83a00b8db854818ca0a24f..f2bc6f714a1c4d3f0c83b03008ca464eccba7e3e 100644 (file)
@@ -308,7 +308,6 @@ do_tests(const char *uri,           /* I - URI to connect on */
     request       = ippNew();
     op            = (ipp_op_t)0;
     group         = IPP_TAG_ZERO;
-    value         = IPP_TAG_ZERO;
     num_statuses  = 0;
     num_expects   = 0;
     num_displayed = 0;