]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge easysw-1.4svn-r7834
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 4 Aug 2008 21:07:04 +0000 (21:07 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 4 Aug 2008 21:07:04 +0000 (21:07 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@905 a1ca3aef-8c08-0410-bb20-df032aa958be

27 files changed:
CHANGES-1.3.txt
CHANGES.txt
config-scripts/cups-common.m4
config-scripts/cups-pam.m4
config.h.in
configure.in
cups/emit.c
cups/http.c
cups/mark.c
cups/options.c
cups/request.c
cups/test.ppd
cups/testppd.c
desktop/cups.desktop.in [moved from desktop/cups.desktop with 96% similarity]
doc/help/ref-printers-conf.html
filter/rastertohp.c
init/cups.xml.in
man/cups-lpd.man.in
notifier/rss.c
scheduler/auth.c
scheduler/client.c
scheduler/cups-lpd.c
scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
scheduler/subscriptions.c
scheduler/subscriptions.h

index ea573a92464260d0073221fc3dc02592abe61245..c12c81ba0705d7f1e407f8f749ef3be96f3e12ea 100644 (file)
@@ -3,6 +3,10 @@ CHANGES-1.3.txt
 
 CHANGES IN CUPS V1.3.9
 
+       - Firefox 3 did not work with the CUPS web interface in SSL
+         mode (STR #2892)
+       - Custom options with multiple parameters were not emitted
+         correctly.
        - Refined the cupstestppd utility.
        - ppdEmit*() did not support custom JCL options (STR #2889)
        - The cupstestppd utility incorrectly reported missing
index 8a1984e9a28571d72650560f999f08b7ff7155e0..8c672abeb83ad712ef4a2d65a28afa1d7fafe1b4 100644 (file)
@@ -1,8 +1,26 @@
-CHANGES.txt - 2008-07-28
+CHANGES.txt - 2008-08-04
 ------------------------
 
 CHANGES IN CUPS V1.4b1
 
+       - The sample HP driver now supports A5 (STR #2798)
+       - The CUPS web interface menu item now uses the xdg-open
+         command, when available (STR #2724)
+       - The cups-lpd program now supports the -h option (STR #2794)
+       - The scheduler now sets the PAM_TTY parameter and the
+         PAM_ESTABLISH_CRED credential flag (STR #2745)
+       - The scheduler now logs unsuccessful requests to the error_log
+         file as errors (STR #2616)
+       - Added support for a "retry-current-job" error policy that
+         retries the current job immediately when the backend encounters
+         an error (STR #2555)
+       - The scheduler now returns a "forbidden" error when a user
+         correctly authenticates but does not have permission to
+         continue further (STR #2101)
+       - The scheduler now loads both the server and CA certificates
+         (if present) from the ServerCertificate file (STR #2146)
+       - New RSS subscriptions now create their feed files immediately
+         (STR #2853)
        - Added support for a device-location attribute which provides
          the physical location of a printer device.
        - Added a cupsBackendReport() API which handles quoting of the
index 16e6b2b0e6732d563021012da580afab239b29bf..a9eae2709073303c87a61af7b9ca30b3520086f8 100644 (file)
@@ -51,6 +51,13 @@ AC_PATH_PROG(MV,mv)
 AC_PATH_PROG(RM,rm)
 AC_PATH_PROG(RMDIR,rmdir)
 AC_PATH_PROG(SED,sed)
+AC_PATH_PROG(XDGOPEN,xdg-open)
+if test "x$XDGOPEN" = x; then
+       CUPS_HTMLVIEW="htmlview"
+else
+       CUPS_HTMLVIEW="$XDGOPEN"
+fi
+AC_SUBST(CUPS_HTMLVIEW)
 
 AC_MSG_CHECKING(for install-sh script)
 INSTALL="`pwd`/install-sh -c"
@@ -222,8 +229,11 @@ AC_SUBST(CUPSDLIBS)
 dnl See if we have POSIX ACL support...
 SAVELIBS="$LIBS"
 LIBS=""
-AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
-CUPSDLIBS="$CUPSDLIBS $LIBS"
+AC_ARG_ENABLE(acl, [  --enable-acl            enable POSIX ACL support, default=auto])
+if test "x$enable_acl" != xno; then
+       AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
+       CUPSDLIBS="$CUPSDLIBS $LIBS"
+fi
 LIBS="$SAVELIBS"
 
 dnl Check for DBUS support
index 9b49e7ad6e53da676d8a2920d45c22c148bd0b28..fec896533f0f794ba0bc2c045362ebfc5420e5b0 100644 (file)
@@ -31,6 +31,7 @@ if test x$enable_pam != xno; then
        AC_CHECK_LIB(dl,dlopen)
        AC_CHECK_LIB(pam,pam_start)
        AC_CHECK_LIB(pam,pam_set_item,AC_DEFINE(HAVE_PAM_SET_ITEM))
+       AC_CHECK_LIB(pam,pam_setcred,AC_DEFINE(HAVE_PAM_SETCRED))
        AC_CHECK_HEADER(security/pam_appl.h)
        if test x$ac_cv_header_security_pam_appl_h != xyes; then
                AC_CHECK_HEADER(pam/pam_appl.h,
index 9a95a084fa11279cf7285f3d3547c1940a14df20..39a8d63f3f33cb4a5598bc928be2a74c74d31218 100644 (file)
 
 #undef HAVE_PAM_PAM_APPL_H
 #undef HAVE_PAM_SET_ITEM
+#undef HAVE_PAM_SETCRED
 
 
 /*
index 8ff9a0e0caafbee7b3baf7eaf96d88da7fd44817..f50c7afbb5f93171596147b85b5be4acdc02972d 100644 (file)
@@ -64,6 +64,7 @@ AC_SUBST(UNINSTALL_LANGUAGES)
 
 AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
          conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
+         desktop/cups.desktop
          doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html
          init/org.cups.cups-lpd.plist init/cups.xml
          man/client.conf.man man/cups-deviced.man man/cups-driverd.man
index fed81fc48ae09c5e947b33fadd1268fc294d2969..f36a48d983d4810d089a95f7b8090912747fbee5 100644 (file)
  *
  * Contents:
  *
- *   ppdCollect()        - Collect all marked options that reside in the
- *                         specified section.
- *   ppdCollect2()       - Collect all marked options that reside in the
- *                         specified section and minimum order.
- *   ppdEmit()           - Emit code for marked options to a file.
- *   ppdEmitAfterOrder() - Emit a subset of the code for marked options to a
- *                         file.
- *   ppdEmitFd()         - Emit code for marked options to a file.
- *   ppdEmitJCL()        - Emit code for JCL options to a file.
- *   ppdEmitJCLEnd()     - Emit JCLEnd code to a file.
- *   ppdEmitString()     - Get a string containing the code for marked options.
- *   ppd_handle_media()  - Handle media selection...
+ *   ppdCollect()          - Collect all marked options that reside in the
+ *                           specified section.
+ *   ppdCollect2()         - Collect all marked options that reside in the
+ *                           specified section and minimum order.
+ *   ppdEmit()             - Emit code for marked options to a file.
+ *   ppdEmitAfterOrder()   - Emit a subset of the code for marked options to a
+ *                           file.
+ *   ppdEmitFd()           - Emit code for marked options to a file.
+ *   ppdEmitJCL()          - Emit code for JCL options to a file.
+ *   ppdEmitJCLEnd()       - Emit JCLEnd code to a file.
+ *   ppdEmitString()       - Get a string containing the code for marked
+ *                           options.
+ *   ppd_compare_cparams() - Compare the order of two custom parameters.
+ *   ppd_handle_media()    - Handle media selection...
  */
 
 /*
@@ -53,6 +55,7 @@
  * Local functions...
  */
 
+static int     ppd_compare_cparams(ppd_cparam_t *a, ppd_cparam_t *b);
 static void    ppd_handle_media(ppd_file_t *ppd);
 
 
@@ -954,15 +957,23 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
        */
 
         const char     *s;             /* Pointer into string value */
+        cups_array_t   *params;        /* Parameters in the correct output order */
 
 
+        params = cupsArrayNew((cups_array_func_t)ppd_compare_cparams, NULL);
+
+        for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+            cparam;
+            cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
+          cupsArrayAdd(params, cparam);
+
         snprintf(bufptr, bufend - bufptr + 1,
                 "%%%%BeginFeature: *Custom%s True\n", coption->keyword);
         bufptr += strlen(bufptr);
 
-        for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+        for (cparam = (ppd_cparam_t *)cupsArrayFirst(params);
             cparam;
-            cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
+            cparam = (ppd_cparam_t *)cupsArrayNext(params))
        {
           switch (cparam->type)
          {
@@ -1000,6 +1011,8 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
                break;
           }
        }
+
+       cupsArrayDelete(params);
       }
       else
       {
@@ -1043,12 +1056,24 @@ ppdEmitString(ppd_file_t    *ppd,       /* I - PPD file record */
 }
 
 
+/*
+ * 'ppd_compare_cparams()' - Compare the order of two custom parameters.
+ */
+
+static int                             /* O - Result of comparison */
+ppd_compare_cparams(ppd_cparam_t *a,   /* I - First parameter */
+                    ppd_cparam_t *b)   /* I - Second parameter */
+{
+  return (a->order - b->order);
+}
+
+
 /*
  * 'ppd_handle_media()' - Handle media selection...
  */
 
 static void
-ppd_handle_media(ppd_file_t *ppd)
+ppd_handle_media(ppd_file_t *ppd)      /* I - PPD file */
 {
   ppd_choice_t *manual_feed,           /* ManualFeed choice, if any */
                *input_slot,            /* InputSlot choice, if any */
index 894f7641af854c026f983a0f6f0121c5e3efa093..26f2107891ed99e2d501165f79d2cd5db6f1efb6 100644 (file)
@@ -3032,7 +3032,8 @@ http_wait(http_t *http,                   /* I - Connection to server */
 #  elif defined(HAVE_CDSASSL)
     size_t bytes;                      /* Bytes that are available */
 
-    if (!SSLGetBufferedReadSize(((http_tls_t *)http->tls)->session, &bytes) && bytes > 0)
+    if (!SSLGetBufferedReadSize(((http_tls_t *)(http->tls))->session, &bytes) &&
+        bytes > 0)
       return (1);
 #  endif /* HAVE_LIBSSL */
   }
index bad9303aa39c814d3378501a1c0ea4a5a66415d6..c60517f06727538b0cd5fea1ab1a36180e5ff913 100644 (file)
@@ -885,7 +885,7 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
 
     if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
     {
-      num_vals = cupsParseOptions(choice + 1, 0, &vals);
+      num_vals = cupsParseOptions(choice, 0, &vals);
 
       for (i = 0, val = vals; i < num_vals; i ++, val ++)
       {
index f1f36df269d5085c5648a2602b185f5cd5f9dbff..d7be9fe2fdfbb7968eaedd3fa4af96076c774d1e 100644 (file)
@@ -225,7 +225,22 @@ cupsParseOptions(
     return (num_options);
   }
 
-  ptr = copyarg;
+  if (*copyarg == '{')
+  {
+   /*
+    * Remove surrounding {} so we can parse "{name=value ... name=value}"...
+    */
+
+    if ((ptr = copyarg + strlen(copyarg) - 1) > copyarg && *ptr == '}')
+    {
+      *ptr = '\0';
+      ptr  = copyarg + 1;
+    }
+    else
+      ptr = copyarg;
+  }
+  else
+    ptr = copyarg;
 
  /*
   * Skip leading spaces...
index fc6a7fa1822849addd0e3e8f51c3e20ffa1d7580..02098b4143a513703b4ef76d6614507a12803258 100644 (file)
@@ -255,8 +255,12 @@ cupsDoIORequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
       status   = http->status;
     }
 
-    if (status == HTTP_FORBIDDEN)
+    if (status == HTTP_FORBIDDEN || status == HTTP_ERROR ||
+        status == HTTP_SERVICE_UNAVAILABLE)
+    {
+      _cupsSetHTTPError(status);
       break;
+    }
 
     if (response)
     {
@@ -565,7 +569,7 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
   if (ippFindAttribute(request, "auth-info", IPP_TAG_TEXT) &&
       !httpAddrLocalhost(http->hostaddr) && !http->tls &&
       httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
-    return (HTTP_ERROR);
+    return (HTTP_SERVICE_UNAVAILABLE);
 #endif /* HAVE_SSL */
 
  /*
@@ -599,7 +603,7 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
     if (httpPost(http, resource))
     {
       if (httpReconnect(http))
-        return (HTTP_ERROR);
+        return (HTTP_SERVICE_UNAVAILABLE);
       else
         continue;
     }
index 80927065a81c38d15c624a34d75400542f7827cc..6074d13503f357ec0f805936492ca9aebfeb776b 100644 (file)
 *CloseUI: *StringOption
 
 *CustomStringOption True/Custom String: "StringOption=Custom"
-*ParamCustomStringOption String: 1 string 1 10
+*ParamCustomStringOption String1: 2 string 1 10
+*ParamCustomStringOption String2: 1 string 1 10
 
 *CloseGroup: Extended
 
index cfd872d2910074e9d2fe8a57735644b8963c40e3..c52309e3927558cf2793798cdaa5aae7bb85c79f 100644 (file)
@@ -80,7 +80,10 @@ static const char    *custom_code =
                        "%%EndFeature\n"
                        "} stopped cleartomark\n"
                        "[{\n"
-                       "%%BeginFeature: *StringOption None\n"
+                       "%%BeginFeature: *CustomStringOption True\n"
+                       "(value\\0502\\051)\n"
+                       "(value 1)\n"
+                       "StringOption=Custom\n"
                        "%%EndFeature\n"
                        "} stopped cleartomark\n"
                        "[{\n"
@@ -183,8 +186,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
     if (s)
       free(s);
 
-    fputs("ppdEmitString (custom size): ", stdout);
+    fputs("ppdEmitString (custom size and string): ", stdout);
     ppdMarkOption(ppd, "PageSize", "Custom.400x500");
+    ppdMarkOption(ppd, "StringOption", "{String1=\"value 1\" String2=value(2)}");
 
     if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
        !strcmp(s, custom_code))
similarity index 96%
rename from desktop/cups.desktop
rename to desktop/cups.desktop.in
index 78cf19cfae77e40789b38c7b0de45b814039866d..d5e2612f7969541f141b576dfc99d01578139ee6 100644 (file)
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Categories=Application;System;X-Red-Hat-Base;
 Encoding=UTF-8
-Exec=htmlview http://localhost:631/
+Exec=@CUPS_HTMLVIEW@ http://localhost:631/
 GenericName=
 Icon=cups
 MimeType=
index c8a459f8b4ae8ed171030ce0b9df98f8f9b8f77b..33397e8b0717ffa5c34e4c6be6db1680f3955e10 100644 (file)
@@ -191,6 +191,9 @@ error policy:</P>
        <LI><CODE>abort-job</CODE> - Abort the job and proceed
        with the next job in the queue</LI>
 
+       <LI><CODE>retry-current-job</CODE> - Retry the current job
+       immediately</LI>
+
        <LI><CODE>retry-job</CODE> - Retry the job after waiting
        for N seconds; the <VAR>cupsd.conf</VAR> <A
        HREF="ref-cupsd-conf.html#JobRetryInterval"><CODE>JobRetryInterval</CODE></A>
index 48b0cfcb1dd022bfe717b24502de9124648c8f3b..0f8fd74fb99652a6ab4e1cfe99eb29f981d25d5f 100644 (file)
@@ -183,6 +183,10 @@ StartPage(ppd_file_t         *ppd, /* I - PPD file */
           printf("\033&l80A");                 /* Set page size */
          break;
 
+      case 595 : /* A5 */
+          printf("\033&l25A");                 /* Set page size */
+         break;
+
       case 624 : /* DL Envelope */
           printf("\033&l90A");                 /* Set page size */
          break;
index e47398ae471b112b6f7e07007970825fa5a32ec8..81aa0b3ba0477d4eb74a38c404fe382eff70f664 100644 (file)
@@ -1,6 +1,8 @@
 <?xml version="1.0"?>
 <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
 <!--
+    $Id$
+
     Service manifest for CUPS.
 
     This service manifest introduces smf(5) services for CUPS.  The services
@@ -15,7 +17,7 @@
 
     Norm.Jacobs@Sun.COM
 
-    $Id$
+    CUPS data files in @datarootdir@...
 -->
 
 <service_bundle type='manifest' name='SUNWcups:services'>
index 6c06e75aed2834ce36588f9a872643e83bae914e..3c5dcb059b55b5d383cc349b35817b47afc717fa 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\"   cups-lpd man page 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
 .\"   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/".
 .\"
-.TH cups-lpd 8 "Common UNIX Printing System" "24 April 2006" "Apple Inc."
+.TH cups-lpd 8 "Common UNIX Printing System" "4 August 2008" "Apple Inc."
 .SH NAME
 cups-lpd \- receive print jobs and report printer status to lpd clients
 .SH SYNOPSIS
 .B cups-lpd
-[ -n ] [ -o
+[ -h
+.I hostname[:port]
+] [ -n ] [ -o
 .I option=value
 ]
 .SH DESCRIPTION
@@ -59,6 +61,10 @@ named \fI/etc/xinetd.d/cups\fR containing the following lines:
 .fi
 .SH OPTIONS
 .TP 5
+.h hostname[:port]
+.br
+Sets the CUPS server (and port) to use.
+.TP 5
 -n
 .br
 Disables reverse address lookups; normally \fIcups-lpd\fR will
index aac3abf3944405148e0dd34c0b810dfe7e3f7df2..4e2d14faf5271e96d69207dcd01c09b264644bd1 100644 (file)
@@ -33,6 +33,7 @@
 #include <cups/string.h>
 #include <cups/array.h>
 #include <errno.h>
+#include <sys/select.h>
 
 
 /*
@@ -109,6 +110,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
   cups_array_t *rss;                   /* RSS message array */
   _cups_rss_t  *msg;                   /* RSS message */
   char         baseurl[1024];          /* Base URL */
+  fd_set       input;                  /* Input set for select() */
+  struct timeval timeout;              /* Timeout for select() */
+  int          changed;                /* Has the RSS data changed? */
+  int          exit_status;            /* Exit status */
 
 
   fprintf(stderr, "DEBUG: argc=%d\n", argc);
@@ -229,6 +234,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   load_rss(rss, filename);
 
+  changed = cupsArrayCount(rss) == 0;
+
  /*
   * Localize for the user's chosen language...
   */
@@ -239,8 +246,59 @@ main(int  argc,                            /* I - Number of command-line arguments */
   * Read events and update the RSS file until we are out of events.
   */
 
-  for (;;)
+  for (exit_status = 0, event = NULL;;)
   {
+    if (changed)
+    {
+     /*
+      * Save the messages to the file again, uploading as needed...
+      */ 
+
+      if (save_rss(rss, newname, baseurl))
+      {
+       if (http)
+       {
+        /*
+          * Upload the RSS file...
+         */
+
+          if ((status = cupsPutFile(http, resource, filename)) != HTTP_CREATED)
+            fprintf(stderr, "ERROR: Unable to PUT %s from %s on port %d: %d %s\n",
+                   resource, host, port, status, httpStatus(status));
+       }
+       else
+       {
+        /*
+          * Move the new RSS file over top the old one...
+         */
+
+          if (rename(newname, filename))
+            fprintf(stderr, "ERROR: Unable to rename %s to %s: %s\n",
+                   newname, filename, strerror(errno));
+       }
+
+       changed = 0;
+      }
+    }
+
+   /*
+    * Wait up to 30 seconds for an event...
+    */
+
+    timeout.tv_sec  = 30;
+    timeout.tv_usec = 0;
+
+    FD_ZERO(&input);
+    FD_SET(0, &input);
+
+    if (select(1, &input, NULL, NULL, &timeout) < 0)
+      continue;
+    else if (!FD_ISSET(0, &input))
+    {
+      fprintf(stderr, "DEBUG: %s is bored, exiting...\n", argv[1]);
+      break;
+    }
+
    /*
     * Read the next event...
     */
@@ -256,16 +314,7 @@ main(int  argc,                            /* I - Number of command-line arguments */
       fputs("DEBUG: ippReadFile() returned IPP_ERROR!\n", stderr);
 
     if (state <= IPP_IDLE)
-    {
-      ippDelete(event);
-
-      if (http)
-        unlink(filename);
-
-      httpClose(http);
-
-      return (0);
-    }
+      break;
 
    /*
     * Collect the info from the event...
@@ -308,15 +357,8 @@ main(int  argc,                            /* I - Number of command-line arguments */
       {
         fprintf(stderr, "ERROR: Unable to create message: %s\n",
                strerror(errno));
-
-        ippDelete(event);
-
-       if (http)
-          unlink(filename);
-
-        httpClose(http);
-
-       return (1);
+        exit_status = 1;
+       break;
       }
 
      /*
@@ -325,6 +367,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
       cupsArrayAdd(rss, msg);
 
+      changed = 1;
+
      /*
       * Trim the array as needed...
       */
@@ -337,34 +381,6 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
        delete_message(msg);
       }
-
-     /*
-      * Save the messages to the file again, uploading as needed...
-      */ 
-
-      if (save_rss(rss, newname, baseurl))
-      {
-       if (http)
-       {
-        /*
-          * Upload the RSS file...
-         */
-
-          if ((status = cupsPutFile(http, resource, filename)) != HTTP_CREATED)
-            fprintf(stderr, "ERROR: Unable to PUT %s from %s on port %d: %d %s\n",
-                   resource, host, port, status, httpStatus(status));
-       }
-       else
-       {
-        /*
-          * Move the new RSS file over top the old one...
-         */
-
-          if (rename(newname, filename))
-            fprintf(stderr, "ERROR: Unable to rename %s to %s: %s\n",
-                   newname, filename, strerror(errno));
-       }
-      }
     }
 
     if (subject)
@@ -374,7 +390,22 @@ main(int  argc,                            /* I - Number of command-line arguments */
       free(text);
 
     ippDelete(event);
+    event = NULL;
   }
+
+ /*
+  * We only get here when idle or error...
+  */
+
+  ippDelete(event);
+
+  if (http)
+  {
+    unlink(filename);
+    httpClose(http);
+  }
+
+  return (exit_status);
 }
 
 
index d0d5641bceea53ad59028c40702ed31aa6d5f908..2391b78ee112572e64ab4103556c89d8ac9fff35 100644 (file)
@@ -671,13 +671,34 @@ cupsdAuthorize(cupsd_client_t *con)       /* I - Client connection */
              return;
            }
 
-#  if defined(HAVE_PAM_SET_ITEM) && defined(PAM_RHOST)
+#  ifdef HAVE_PAM_SET_ITEM
+#    ifdef PAM_RHOST
            pamerr = pam_set_item(pamh, PAM_RHOST, con->http.hostname);
            if (pamerr != PAM_SUCCESS)
              cupsdLogMessage(CUPSD_LOG_WARN,
-                             "cupsdAuthorize: pam_set_item() returned %d "
-                             "(%s)!", pamerr, pam_strerror(pamh, pamerr));
-#  endif /* HAVE_PAM_SET_ITEM && PAM_RHOST */
+                             "cupsdAuthorize: pam_set_item(PAM_RHOST) "
+                             "returned %d (%s)!", pamerr,
+                             pam_strerror(pamh, pamerr));
+#    endif /* PAM_RHOST */
+
+#    ifdef PAM_TTY
+           pamerr = pam_set_item(pamh, PAM_TTY, "cups");
+           if (pamerr != PAM_SUCCESS)
+             cupsdLogMessage(CUPSD_LOG_WARN,
+                             "cupsdAuthorize: pam_set_item(PAM_TTY) "
+                             "returned %d (%s)!", pamerr,
+                             pam_strerror(pamh, pamerr));
+#    endif /* PAM_TTY */
+#  endif /* HAVE_PAM_SET_ITEM */
+
+#  ifdef HAVE_PAM_SETCRED
+            pamerr = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
+           if (pamerr != PAM_SUCCESS)
+             cupsdLogMessage(CUPSD_LOG_WARN,
+                             "cupsdAuthorize: pam_setcred() "
+                             "returned %d (%s)!", pamerr,
+                             pam_strerror(pamh, pamerr));
+#  endif /* HAVE_PAM_SETCRED */
 
            pamerr = pam_authenticate(pamh, PAM_SILENT);
            if (pamerr != PAM_SUCCESS)
@@ -2154,7 +2175,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
          return (HTTP_OK);
       }
 
-      return (HTTP_UNAUTHORIZED);
+      return (HTTP_FORBIDDEN);
     }
 #endif /* HAVE_AUTHORIZATION_H */
 
@@ -2178,7 +2199,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
         return (HTTP_OK);
     }
 
-    return (HTTP_UNAUTHORIZED);
+    return (HTTP_FORBIDDEN);
   }
 
  /*
@@ -2215,7 +2236,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
   cupsdLogMessage(CUPSD_LOG_DEBUG,
                   "cupsdIsAuthorized: User not in group(s)!");
 
-  return (HTTP_UNAUTHORIZED);
+  return (HTTP_FORBIDDEN);
 }
 
 
index ac52bd99efa2ecca5dad5a2182e0e9bf9cb684c8..b9e525c9f87fdb29b3b26cab264ccb0a74623a4f 100644 (file)
@@ -29,6 +29,7 @@
  *   cupsdWriteClient()      - Write data to a client as needed.
  *   check_if_modified()     - Decode an "If-Modified-Since" line.
  *   compare_clients()       - Compare two client connections.
+ *   data_ready()            - Check whether data is available from a client.
  *   encrypt_client()        - Enable encryption for the client...
  *   get_cdsa_certificate()  - Convert a keychain name into the CFArrayRef
  *                            required by SSLSetCertificate.
@@ -89,6 +90,7 @@ static int            check_if_modified(cupsd_client_t *con,
                                          struct stat *filestats);
 static int             compare_clients(cupsd_client_t *a, cupsd_client_t *b,
                                        void *data);
+static int             data_ready(cupsd_client_t *con);
 #ifdef HAVE_SSL
 static int             encrypt_client(cupsd_client_t *con);
 #endif /* HAVE_SSL */
@@ -1046,8 +1048,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
        */
 
         while ((status = httpUpdate(HTTP(con))) == HTTP_CONTINUE)
-         if (con->http.used == 0 ||
-             !memchr(con->http.buffer, '\n', con->http.used))
+         if (!data_ready(con))
            break;
 
        if (status != HTTP_OK && status != HTTP_CONTINUE)
@@ -1946,7 +1947,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            }
          }
         }
-       while (con->http.state == HTTP_PUT_RECV && con->http.used > 0);
+       while (con->http.state == HTTP_PUT_RECV && data_ready(con));
 
         if (con->http.state == HTTP_WAITING)
        {
@@ -2121,7 +2122,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            }
          }
         }
-       while (con->http.state == HTTP_POST_RECV && con->http.used > 0);
+       while (con->http.state == HTTP_POST_RECV && data_ready(con));
 
        if (con->http.state == HTTP_POST_SEND)
        {
@@ -3006,6 +3007,38 @@ compare_clients(cupsd_client_t *a,       /* I - First client */
 }
 
 
+/*
+ * 'data_ready()' - Check whether data is available from a client.
+ */
+
+static int                             /* O - 1 if data is ready, 0 otherwise */
+data_ready(cupsd_client_t *con)                /* I - Client */
+{
+  if (con->http.used > 0)
+    return (1);
+#ifdef HAVE_SSL
+  else if (con->http.tls)
+  {
+#  ifdef HAVE_LIBSSL
+    if (SSL_pending((SSL *)(con->http.tls)))
+      return (1);
+#  elif defined(HAVE_GNUTLS)
+    if (gnutls_record_check_pending(((http_tls_t *)(con->http.tls))->session))
+      return (1);
+#  elif defined(HAVE_CDSASSL)
+    size_t bytes;                      /* Bytes that are available */
+
+    if (!SSLGetBufferedReadSize(((http_tls_t *)(con->http.tls))->session,
+                                &bytes) && bytes > 0)
+      return (1);
+#  endif /* HAVE_LIBSSL */
+  }
+#endif /* HAVE_SSL */
+
+  return (0);
+}
+
+
 #ifdef HAVE_SSL
 /*
  * 'encrypt_client()' - Enable encryption for the client...
@@ -3043,7 +3076,8 @@ encrypt_client(cupsd_client_t *con)       /* I - Client to encrypt */
 
   SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
   SSL_CTX_use_PrivateKey_file(context, ServerKey, SSL_FILETYPE_PEM);
-  SSL_CTX_use_certificate_file(context, ServerCertificate, SSL_FILETYPE_PEM);
+  SSL_CTX_use_certificate_chain_file(context, ServerCertificate,
+                                     SSL_FILETYPE_PEM);
 
   bio = BIO_new(_httpBIOMethods());
   BIO_ctrl(bio, BIO_C_SET_FILE_PTR, 0, (char *)HTTP(con));
index 55ac71b68eb0b3af4eb63c33cb11395837352280..450c93f02a5207aba53499e1ff8ac5a9c4215edd 100644 (file)
@@ -148,6 +148,19 @@ main(int  argc,                            /* I - Number of command-line arguments */
     {
       switch (argv[i][1])
       {
+        case 'h' : /* -h hostname[:port] */
+            if (argv[i][2])
+             cupsSetServer(argv[i] + 2);
+           else
+           {
+             i ++;
+             if (i < argc)
+               cupsSetServer(argv[i]);
+             else
+               syslog(LOG_WARNING, "Expected hostname string after -h option!");
+           }
+           break;
+
        case 'o' : /* Option */
            if (argv[i][2])
              num_defaults = cupsParseOptions(argv[i] + 2, num_defaults,
index b8fbeaa5c8086d1ad01cd8c651de5c3f7da498ec..23d15ad8b81abb5283e4f5ab859345bedb14059f 100644 (file)
@@ -678,10 +678,12 @@ cupsdProcessIPPRequest(
     * Sending data from the scheduler...
     */
 
-    cupsdLogMessage(CUPSD_LOG_DEBUG,
-                    "cupsdProcessIPPRequest: %d status_code=%x (%s)",
-                    con->http.fd, con->response->request.status.status_code,
-                   ippErrorString(con->response->request.status.status_code));
+    cupsdLogMessage(con->response->request.status.status_code
+                        >= IPP_BAD_REQUEST ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
+                    "Returning %s for %s from %s",
+                   ippErrorString(con->response->request.status.status_code),
+                   ippOpString(con->request->request.op.operation_id),
+                   con->http.hostname);
 
     if (cupsdSendHeader(con, HTTP_OK, "application/ipp", CUPSD_AUTH_NONE))
     {
@@ -10474,6 +10476,7 @@ set_printer_defaults(
         continue;
 
       if (strcmp(attr->values[0].string.text, "abort-job") &&
+          strcmp(attr->values[0].string.text, "retry-current-job") &&
           strcmp(attr->values[0].string.text, "retry-job") &&
           strcmp(attr->values[0].string.text, "stop-printer"))
       {
index e0bd77534006150ce34de4385fe410eacb1e7bd3..e2d74c6329e22191daceb31b0327e65b19996248 100644 (file)
@@ -659,11 +659,13 @@ cupsdFinishJob(cupsd_job_t *job)  /* I - Job */
          cupsdMarkDirty(CUPSD_DIRTY_JOBS);
 
         /*
-         * If the job was queued to a class, try requeuing it...  For
-         * faxes and retry-job queues, hold the current job for 5 minutes.
+         * If the job was queued to a class or the error policy is
+         * "retry-current-job", try requeuing it...  For faxes and retry-job
+         * queues, hold the current job for 5 minutes.
          */
 
-         if (job->dtype & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
+         if ((job->dtype & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT)) ||
+             !strcmp(printer->error_policy, "retry-current-job"))
            cupsdCheckJobs();
          else if ((printer->type & CUPS_PRINTER_FAX) ||
                   !strcmp(printer->error_policy, "retry-job"))
index df8f7f24cc02fb730c313cc2872d9d7d8ac1cae1..eeed48f6603244fdfa59edac1dc0b4d4f8e72a6f 100644 (file)
@@ -349,6 +349,7 @@ cupsdCreateCommonData(void)
   static const char * const errors[] = /* printer-error-policy-supported values */
                {
                  "abort-job",
+                 "retry-current-job",
                  "retry-job",
                  "stop-printer"
                };
index 4f92f873b74662e955bc3418ab41ed8418145215..a0e2dc60212d719c32f26ff81a84716e7080b6b8 100644 (file)
@@ -389,6 +389,13 @@ cupsdAddSubscription(
 
   cupsArrayAdd(Subscriptions, temp);
 
+ /*
+  * For RSS subscriptions, run the notifier immediately...
+  */
+
+  if (uri && !strncmp(uri, "rss:", 4))
+    cupsd_start_notifier(temp);
+
   return (temp);
 }
 
index ab0154b7138a5de9f6457b2ae37b5f5c0fa8becf..15e11a445f7fb527a8f62a53bbb3c3d638677682 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Subscription 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