--- /dev/null
+Index: conf/cupsd.conf.in
+===================================================================
+--- conf/cupsd.conf.in (.../tags/release-1.4.0) (wersja 8809)
++++ conf/cupsd.conf.in (.../branches/branch-1.4) (wersja 8809)
+@@ -1,9 +1,8 @@
+ #
+ # "$Id$"
+ #
+-# Sample configuration file for the Common UNIX Printing System (CUPS)
+-# scheduler. See "man cupsd.conf" for a complete description of this
+-# file.
++# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
++# complete description of this file.
+ #
+
+ # Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"
+Index: conf/mime.types
+===================================================================
+--- conf/mime.types (.../tags/release-1.4.0) (wersja 8809)
++++ conf/mime.types (.../branches/branch-1.4) (wersja 8809)
+@@ -95,7 +95,7 @@
+
+ image/gif gif string(0,GIF87a) string(0,GIF89a)
+ image/png png string(0,<89>PNG)
+-image/jpeg jpeg jpg jpe string(0,<FFD8FF>) &&\
++image/jpeg jpeg jpg jpe string(0,<FFD8FF>) +\
+ (char(3,0xe0) char(3,0xe1) char(3,0xe2) char(3,0xe3)\
+ char(3,0xe4) char(3,0xe5) char(3,0xe6) char(3,0xe7)\
+ char(3,0xe8) char(3,0xe9) char(3,0xea) char(3,0xeb)\
+@@ -114,7 +114,7 @@
+
+ #image/fpx fpx
+ image/x-alias pix short(8,8) short(8,24)
+-image/x-bitmap bmp string(0,BM) && !printable(2,14)
++image/x-bitmap bmp string(0,BM) + !printable(2,14)
+ image/x-icon ico
+
+ ########################################################################
+Index: backend/runloop.c
+===================================================================
+--- backend/runloop.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/runloop.c (.../branches/branch-1.4) (wersja 8809)
+@@ -147,7 +147,7 @@
+ int snmp_fd, /* I - SNMP socket or -1 if none */
+ http_addr_t *addr, /* I - Address of device */
+ int use_bc, /* I - Use back-channel? */
+- void (*side_cb)(int, int, int, http_addr_t *, int))
++ int (*side_cb)(int, int, int, http_addr_t *, int))
+ /* I - Side-channel callback */
+ {
+ int nfds; /* Maximum file descriptor value + 1 */
+@@ -274,7 +274,8 @@
+ * loop since it may have read from print_fd...
+ */
+
+- (*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc);
++ if ((*side_cb)(print_fd, device_fd, snmp_fd, addr, use_bc))
++ side_cb = NULL;
+ continue;
+ }
+
+Index: backend/backend-private.h
+===================================================================
+--- backend/backend-private.h (.../tags/release-1.4.0) (wersja 8809)
++++ backend/backend-private.h (.../branches/branch-1.4) (wersja 8809)
+@@ -276,16 +276,16 @@
+ extern int backendGetMakeModel(const char *device_id,
+ char *make_model,
+ int make_model_size);
+-extern void backendNetworkSideCB(int print_fd, int device_fd,
++extern int backendNetworkSideCB(int print_fd, int device_fd,
+ int snmp_fd, http_addr_t *addr,
+ int use_bc);
+ extern ssize_t backendRunLoop(int print_fd, int device_fd, int snmp_fd,
+ http_addr_t *addr, int use_bc,
+- void (*side_cb)(int print_fd,
+- int device_fd,
+- int snmp_fd,
+- http_addr_t *addr,
+- int use_bc));
++ int (*side_cb)(int print_fd,
++ int device_fd,
++ int snmp_fd,
++ http_addr_t *addr,
++ int use_bc));
+ extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr,
+ int *page_count,
+ int *printer_state);
+Index: backend/usb-libusb.c
+===================================================================
+--- backend/usb-libusb.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/usb-libusb.c (.../branches/branch-1.4) (wersja 8809)
+@@ -179,7 +179,12 @@
+ }
+
+ if (pfds[1].revents & POLLIN)
+- tbytes += side_cb(printer, print_fd);
++ {
++ if ((bytes = side_cb(printer, print_fd)) < 0)
++ pfds[1].events = 0; /* Filter has gone away... */
++ else
++ tbytes += bytes;
++ }
+ }
+ }
+
+@@ -745,10 +750,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
+- return (0);
+- }
++ return (-1);
+
+ switch (command)
+ {
+Index: backend/usb-unix.c
+===================================================================
+--- backend/usb-unix.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/usb-unix.c (.../branches/branch-1.4) (wersja 8809)
+@@ -36,7 +36,7 @@
+ */
+
+ static int open_device(const char *uri, int *use_bc);
+-static void side_cb(int print_fd, int device_fd, int snmp_fd,
++static int side_cb(int print_fd, int device_fd, int snmp_fd,
+ http_addr_t *addr, int use_bc);
+
+
+@@ -579,10 +579,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
+- return;
+- }
++ return (-1);
+
+ switch (command)
+ {
+@@ -625,7 +622,7 @@
+ break;
+ }
+
+- cupsSideChannelWrite(command, status, data, datalen, 1.0);
++ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+ }
+
+
+Index: backend/usb-darwin.c
+===================================================================
+--- backend/usb-darwin.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/usb-darwin.c (.../branches/branch-1.4) (wersja 8809)
+@@ -292,9 +292,8 @@
+ #if defined(__i386__) || defined(__x86_64__)
+ static pid_t child_pid; /* Child PID */
+ static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
+-#endif /* __i386__ || __x86_64__ */
+-static int job_canceled = 0; /* Was the job canceled? */
+ static void sigterm_handler(int sig); /* SIGTERM handler */
++#endif /* __i386__ || __x86_64__ */
+
+ #ifdef PARSE_PS_ERRORS
+ static const char *next_line (const char *buffer);
+@@ -461,9 +460,9 @@
+ fputs("STATE: -connecting-to-device\n", stderr);
+
+ /*
+- * Now that we are "connected" to the port, catch SIGTERM so that we
++ * Now that we are "connected" to the port, ignore SIGTERM so that we
+ * can finish out any page data the driver sends (e.g. to eject the
+- * current page... Only catch SIGTERM if we are printing data from
++ * current page... Only ignore SIGTERM if we are printing data from
+ * stdin (otherwise you can't cancel raw jobs...)
+ */
+
+@@ -475,7 +474,7 @@
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+- action.sa_handler = sigterm_handler;
++ action.sa_handler = SIG_IGN;
+ sigaction(SIGTERM, &action, NULL);
+ }
+
+@@ -725,7 +724,7 @@
+ fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n",
+ err);
+
+- status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
++ status = CUPS_BACKEND_FAILED;
+ break;
+ }
+ else if (bytes > 0)
+@@ -944,7 +943,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- continue;
++ break;
+
+ switch (command)
+ {
+@@ -2020,9 +2019,7 @@
+
+ exit(exitstatus);
+ }
+-#endif /* __i386__ || __x86_64__ */
+
+-
+ /*
+ * 'sigterm_handler()' - SIGTERM handler.
+ */
+@@ -2030,7 +2027,8 @@
+ static void
+ sigterm_handler(int sig) /* I - Signal */
+ {
+-#if defined(__i386__) || defined(__x86_64__)
++ /* If we started a child process pass the signal on to it...
++ */
+ if (child_pid)
+ {
+ /*
+@@ -2052,16 +2050,11 @@
+ exit(CUPS_BACKEND_STOP);
+ }
+ }
+-#endif /* __i386__ || __x86_64__ */
+-
+- /*
+- * Otherwise just flag that the job has been canceled...
+- */
+-
+- job_canceled = 1;
+ }
+
++#endif /* __i386__ || __x86_64__ */
+
++
+ #ifdef PARSE_PS_ERRORS
+ /*
+ * 'next_line()' - Find the next line in a buffer.
+Index: backend/serial.c
+===================================================================
+--- backend/serial.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/serial.c (.../branches/branch-1.4) (wersja 8809)
+@@ -84,7 +84,7 @@
+ */
+
+ static void list_devices(void);
+-static void side_cb(int print_fd, int device_fd, int use_bc);
++static int side_cb(int print_fd, int device_fd, int use_bc);
+
+
+ /*
+@@ -109,7 +109,8 @@
+ sep; /* Option separator */
+ int port; /* Port number (not used) */
+ int copies; /* Number of copies to print */
+- int print_fd, /* Print file */
++ int side_eof = 0, /* Saw EOF on side-channel? */
++ print_fd, /* Print file */
+ device_fd; /* Serial device */
+ int nfds; /* Maximum file descriptor value + 1 */
+ fd_set input, /* Input set for reading */
+@@ -558,7 +559,7 @@
+ if (!print_bytes)
+ FD_SET(print_fd, &input);
+ FD_SET(device_fd, &input);
+- if (!print_bytes)
++ if (!print_bytes && !side_eof)
+ FD_SET(CUPS_SC_FD, &input);
+
+ FD_ZERO(&output);
+@@ -579,7 +580,8 @@
+ * loop since it may have read from print_fd...
+ */
+
+- side_cb(print_fd, device_fd, 1);
++ if (side_cb(print_fd, device_fd, 1))
++ side_eof = 1;
+ continue;
+ }
+
+@@ -1278,7 +1280,7 @@
+ * 'side_cb()' - Handle side-channel requests...
+ */
+
+-static void
++static int /* O - 0 on success, -1 on error */
+ side_cb(int print_fd, /* I - Print file */
+ int device_fd, /* I - Device file */
+ int use_bc) /* I - Using back-channel? */
+@@ -1292,11 +1294,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- _cupsLangPuts(stderr,
+- _("WARNING: Failed to read side-channel request!\n"));
+- return;
+- }
++ return (-1);
+
+ switch (command)
+ {
+@@ -1323,7 +1321,7 @@
+ break;
+ }
+
+- cupsSideChannelWrite(command, status, data, datalen, 1.0);
++ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+ }
+
+
+Index: backend/snmp-supplies.c
+===================================================================
+--- backend/snmp-supplies.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/snmp-supplies.c (.../branches/branch-1.4) (wersja 8809)
+@@ -229,8 +229,11 @@
+ packet.object_type != CUPS_ASN1_OCTET_STRING)
+ return (-1);
+
+- new_state = (packet.object_value.string.bytes[0] << 8) |
+- packet.object_value.string.bytes[1];
++ if (packet.object_value.string.num_bytes == 2)
++ new_state = (packet.object_value.string.bytes[0] << 8) |
++ packet.object_value.string.bytes[1];
++ else
++ new_state = 0;
+
+ if (current_state < 0)
+ change_state = 0xffff;
+Index: backend/pap.c
+===================================================================
+--- backend/pap.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/pap.c (.../branches/branch-1.4) (wersja 8809)
+@@ -1278,7 +1278,7 @@
+ * 'sidechannel_request()' - Handle side-channel requests.
+ */
+
+-static void
++static int
+ sidechannel_request()
+ {
+ cups_sc_command_t command; /* Request command */
+@@ -1289,32 +1289,29 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
+- return;
+- }
++ return (-1);
+
+ switch (command)
+ {
+ case CUPS_SC_CMD_GET_BIDI: /* Is the connection bidirectional? */
+ data[0] = 1;
+- cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
++ return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
+ break;
+
+ case CUPS_SC_CMD_GET_STATE: /* Return device state */
+ data[0] = CUPS_SC_STATE_ONLINE;
+- cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0);
++ return (cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, data, 1, 1.0));
+ break;
+
+ case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */
+ case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */
+ case CUPS_SC_CMD_GET_DEVICE_ID: /* Return IEEE-1284 device ID */
+ default:
+- cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
+- NULL, 0, 1.0);
++ return (cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
++ NULL, 0, 1.0));
+ break;
+ }
+- return;
++ return (0);
+ }
+
+
+Index: backend/ipp.c
+===================================================================
+--- backend/ipp.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/ipp.c (.../branches/branch-1.4) (wersja 8809)
+@@ -45,6 +45,8 @@
+
+ static char *password = NULL; /* Password for device URI */
+ static int password_tries = 0; /* Password tries */
++static const char *auth_info_required = "none";
++ /* New auth-info-required value */
+ #ifdef __APPLE__
+ static char pstmpname[1024] = ""; /* Temporary PostScript file name */
+ #endif /* __APPLE__ */
+@@ -1049,16 +1051,21 @@
+ _cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
+ cupsLastErrorString());
+
+- if (ipp_status == IPP_NOT_AUTHORIZED)
++ if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
+ {
+ fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
+ httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
+
++ /*
++ * Normal authentication goes through the password callback, which sets
++ * auth_info_required to "username,password". Kerberos goes directly
++ * through GSSAPI, so look for Negotiate in the WWW-Authenticate header
++ * here and set auth_info_required as needed...
++ */
++
+ if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
+ "Negotiate", 9))
+- fputs("ATTR: auth-info-required=negotiate\n", stderr);
+- else
+- fputs("ATTR: auth-info-required=username,password\n", stderr);
++ auth_info_required = "negotiate";
+ }
+ }
+ }
+@@ -1239,6 +1246,19 @@
+ break;
+ }
+ }
++ else
++ {
++ /*
++ * If the printer does not return a job-state attribute, it does not
++ * conform to the IPP specification - break out immediately and fail
++ * the job...
++ */
++
++ fputs("DEBUG: No job-state available from printer - stopping queue.\n",
++ stderr);
++ ipp_status = IPP_INTERNAL_ERROR;
++ break;
++ }
+ }
+
+ ippDelete(response);
+@@ -1283,7 +1303,16 @@
+ page_count > start_count)
+ fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
+
++#ifdef HAVE_GSSAPI
+ /*
++ * See if we used Kerberos at all...
++ */
++
++ if (http->gssctx)
++ auth_info_required = "negotiate";
++#endif /* HAVE_GSSAPI */
++
++ /*
+ * Free memory...
+ */
+
+@@ -1315,8 +1344,12 @@
+ * Return the queue status...
+ */
+
+- if (ipp_status == IPP_NOT_AUTHORIZED)
++ fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
++
++ if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
+ return (CUPS_BACKEND_AUTH_REQUIRED);
++ else if (ipp_status == IPP_INTERNAL_ERROR)
++ return (CUPS_BACKEND_STOP);
+ else if (ipp_status > IPP_OK_CONFLICT)
+ return (CUPS_BACKEND_FAILED);
+ else
+@@ -1517,6 +1550,12 @@
+ {
+ (void)prompt;
+
++ /*
++ * Remember that we need to authenticate...
++ */
++
++ auth_info_required = "username,password";
++
+ if (password && *password && password_tries < 3)
+ {
+ password_tries ++;
+@@ -1526,23 +1565,10 @@
+ else
+ {
+ /*
+- * If there is no password set in the device URI, return the
+- * "authentication required" exit code...
++ * Give up after 3 tries or if we don't have a password to begin with...
+ */
+
+- if (tmpfilename[0])
+- unlink(tmpfilename);
+-
+-#ifdef __APPLE__
+- if (pstmpname[0])
+- unlink(pstmpname);
+-#endif /* __APPLE__ */
+-
+- fputs("ATTR: auth-info-required=username,password\n", stderr);
+-
+- exit(CUPS_BACKEND_AUTH_REQUIRED);
+-
+- return (NULL); /* Eliminate compiler warning */
++ return (NULL);
+ }
+ }
+
+Index: backend/network.c
+===================================================================
+--- backend/network.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/network.c (.../branches/branch-1.4) (wersja 8809)
+@@ -61,7 +61,7 @@
+ * 'backendNetworkSideCB()' - Handle common network side-channel commands.
+ */
+
+-void
++int /* O - -1 on error, 0 on success */
+ backendNetworkSideCB(
+ int print_fd, /* I - Print file or -1 */
+ int device_fd, /* I - Device file or -1 */
+@@ -79,10 +79,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
+- return;
+- }
++ return (-1);
+
+ switch (command)
+ {
+@@ -284,7 +281,7 @@
+ break;
+ }
+
+- cupsSideChannelWrite(command, status, data, datalen, 1.0);
++ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+ }
+
+
+Index: backend/parallel.c
+===================================================================
+--- backend/parallel.c (.../tags/release-1.4.0) (wersja 8809)
++++ backend/parallel.c (.../branches/branch-1.4) (wersja 8809)
+@@ -59,7 +59,7 @@
+ */
+
+ static void list_devices(void);
+-static void side_cb(int print_fd, int device_fd, int snmp_fd,
++static int side_cb(int print_fd, int device_fd, int snmp_fd,
+ http_addr_t *addr, int use_bc);
+
+
+@@ -615,7 +615,7 @@
+ * 'side_cb()' - Handle side-channel requests...
+ */
+
+-static void
++static int /* O - 0 on success, -1 on error */
+ side_cb(int print_fd, /* I - Print file */
+ int device_fd, /* I - Device file */
+ int snmp_fd, /* I - SNMP socket (unused) */
+@@ -634,10 +634,7 @@
+ datalen = sizeof(data);
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
+- {
+- _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
+- return;
+- }
++ return (-1);
+
+ switch (command)
+ {
+@@ -680,7 +677,7 @@
+ break;
+ }
+
+- cupsSideChannelWrite(command, status, data, datalen, 1.0);
++ return (cupsSideChannelWrite(command, status, data, datalen, 1.0));
+ }
+
+
+Index: config-scripts/cups-dnssd.m4
+===================================================================
+--- config-scripts/cups-dnssd.m4 (.../tags/release-1.4.0) (wersja 8809)
++++ config-scripts/cups-dnssd.m4 (.../branches/branch-1.4) (wersja 8809)
+@@ -43,7 +43,7 @@
+ AC_MSG_CHECKING(for current version of dns_sd library)
+ SAVELIBS="$LIBS"
+ LIBS="$LIBS -ldns_sd"
+- AC_TRY_COMPILE([#include <dns_sd.h],
++ AC_TRY_COMPILE([#include <dns_sd.h>],
+ [int constant = kDNSServiceFlagsShareConnection;
+ unsigned char txtRecord[100];
+ uint8_t valueLen;
+Index: doc/help/spec-ipp.html
+===================================================================
+--- doc/help/spec-ipp.html (.../tags/release-1.4.0) (wersja 8809)
++++ doc/help/spec-ipp.html (.../branches/branch-1.4) (wersja 8809)
+@@ -1603,8 +1603,8 @@
+
+ <dt>"timeout" (integer (1:MAX)) :<span class='info'>CUPS 1.4/Mac OS X 10.6</span>
+
+- <dd>The client OPTIONALLY supplies this attribute limiting the number of
+- devices that are returned.
++ <dd>The client OPTIONALLY supplies this attribute to limit the duration
++ of the lookup. The default timeout is 15 seconds.
+
+ </dl>
+
+
+Zmiany atrybutów dla: doc/eu
+___________________________________________________________________
+Dodane: svn:ignore
+ + index.html
+
+
+Index: cups/dest.c
+===================================================================
+--- cups/dest.c (.../tags/release-1.4.0) (wersja 8809)
++++ cups/dest.c (.../branches/branch-1.4) (wersja 8809)
+@@ -557,7 +557,7 @@
+ * configuration file does not exist. Find out the real default.
+ */
+
+- if (!cups_get_sdests(http, CUPS_GET_DEFAULT, name, 0, &dest))
++ if (!cups_get_sdests(http, CUPS_GET_DEFAULT, NULL, 0, &dest))
+ return (NULL);
+ }
+
+@@ -1800,7 +1800,7 @@
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, cupsUser());
+
+- if (name)
++ if (name && op != CUPS_GET_DEFAULT)
+ {
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ "localhost", ippPort(), "/printers/%s", name);
+Index: cups/cups.h
+===================================================================
+--- cups/cups.h (.../tags/release-1.4.0) (wersja 8809)
++++ cups/cups.h (.../branches/branch-1.4) (wersja 8809)
+@@ -59,10 +59,10 @@
+ * Constants...
+ */
+
+-# define CUPS_VERSION 1.0400
++# define CUPS_VERSION 1.0401
+ # define CUPS_VERSION_MAJOR 1
+ # define CUPS_VERSION_MINOR 4
+-# define CUPS_VERSION_PATCH 0
++# define CUPS_VERSION_PATCH 1
+
+ # define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
+ # define CUPS_DATE_ANY (time_t)-1
+Index: cups/adminutil.c
+===================================================================
+--- cups/adminutil.c (.../tags/release-1.4.0) (wersja 8809)
++++ cups/adminutil.c (.../branches/branch-1.4) (wersja 8809)
+@@ -1553,7 +1553,7 @@
+ const char *remotep = cupsGetOption("BrowseRemoteProtocols",
+ num_settings, settings);
+
+- if (!localp)
++ if (!localp || !localp[0])
+ localp = cupsGetOption("BrowseLocalProtocols", cupsd_num_settings,
+ cupsd_settings);
+
+Index: cups/request.c
+===================================================================
+--- cups/request.c (.../tags/release-1.4.0) (wersja 8809)
++++ cups/request.c (.../branches/branch-1.4) (wersja 8809)
+@@ -266,7 +266,9 @@
+
+ DEBUG_printf(("2cupsDoIORequest: status=%d", status));
+
+- if (status == HTTP_FORBIDDEN || status >= HTTP_SERVER_ERROR)
++ if (status >= HTTP_BAD_REQUEST &&
++ status != HTTP_UNAUTHORIZED &&
++ status != HTTP_UPGRADE_REQUIRED)
+ {
+ httpFlush(http);
+ _cupsSetHTTPError(status);
+Index: cups/snmp.c
+===================================================================
+--- cups/snmp.c (.../tags/release-1.4.0) (wersja 8809)
++++ cups/snmp.c (.../branches/branch-1.4) (wersja 8809)
+@@ -1280,7 +1280,7 @@
+ int value; /* Integer value */
+
+
+- for (value = 0;
++ for (value = (**buffer & 0x80) ? -1 : 0;
+ length > 0 && *buffer < bufend;
+ length --, (*buffer) ++)
+ value = (value << 8) | **buffer;
+Index: man/lprm.man
+===================================================================
+--- man/lprm.man (.../tags/release-1.4.0) (wersja 8809)
++++ man/lprm.man (.../branches/branch-1.4) (wersja 8809)
+@@ -12,7 +12,7 @@
+ .\" 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 lprm 1 "CUPS" "12 February 2006" "Apple Inc."
++.TH lprm 1 "CUPS" "28 August 2009" "Apple Inc."
+ .SH NAME
+ lprm \- cancel print jobs
+ .SH SYNOPSIS
+@@ -49,7 +49,7 @@
+ .TP 5
+ -h server[:port]
+ .br
+-Specifies and alternate server.
++Specifies an alternate server.
+ .SH COMPATIBILITY
+ The CUPS version of \fIlprm\fR is compatible with the standard
+ Berkeley \fIlprm\fR command.
+Index: test/run-stp-tests.sh
+===================================================================
+--- test/run-stp-tests.sh (.../tags/release-1.4.0) (wersja 8809)
++++ test/run-stp-tests.sh (.../branches/branch-1.4) (wersja 8809)
+@@ -251,6 +251,7 @@
+ ln -s $root/scheduler /tmp/cups-$user/bin/daemon
+ ln -s $root/filter/bannertops /tmp/cups-$user/bin/filter
+ ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter
++ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter
+ ln -s $root/filter/hpgltops /tmp/cups-$user/bin/filter
+ ln -s $root/filter/pstops /tmp/cups-$user/bin/filter
+ ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter
+Index: CHANGES.txt
+===================================================================
+--- CHANGES.txt (.../tags/release-1.4.0) (wersja 8809)
++++ CHANGES.txt (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,43 @@
+-CHANGES.txt - 2009-08-07
++CHANGES.txt - 2009-08-31
+ ------------------------
+
++CHANGES IN CUPS V1.4.1
++
++ - Documention fixes (STR #3296)
++ - SNMP supply levels and states were wrong for some printers.
++ - The IPP backend did not update the auth-info-required value.
++ - The libusb-based USB backend would hang at the end of the job
++ (STR #3315)
++ - DNS-SD registrations for raw queues had an empty "ty" key (STR #3299)
++ - The JPEG and BMP MIME type rules were broken (STR #3284)
++ - cupsGetNamedDest returned the default printer when the named
++ destination did not exist (STR #3285)
++ - The JobKillDelay was not triggered for canceled jobs (STR #3292)
++ - The PPD compiler could get in an infinite loop (STR #3293)
++ - The configure check for dns-sd.h was broken (STR #3297)
++ - The "Query Printer for Default Options" page did not go away if the
++ query job was held (STR #3302)
++ - Boolean options did not show up as selected in the web interface
++ (STR #3303)
++ - The scheduler did not cache or report driver information files
++ correctly, leading to a variety of issues (STR #3283, STR #3297,
++ STR #3305)
++ - cupsDoIORequest() did not abort on permanent errors (STR #3311)
++ - Modifying a class in the web interface did not work (STR #3312)
++ - BrowseLocalProtocols could be cleared when changing the sharing
++ setting (STR #3287)
++ - The scheduler could return an empty supported document format
++ (STR #3308)
++ - The PPD compiler generated invalid PPD files when the locale used
++ something other than "." for the decimal point (STR #3300)
++ - The IPP backend did not handle some non-comforming IPP printer
++ implementations (STR #3262)
++ - The scheduler leaked three file descriptors to each job filter
++ (STR #3263)
++ - The scheduler now uses a default CUPS-Get-Devices timeout of 15
++ seconds (STR #3307)
++
++
+ CHANGES IN CUPS V1.4.0
+
+ - Localization updates (STR #3223, STR #3246, STR #3248, STR #3250)
+Index: ppdc/ppdc-driver.cxx
+===================================================================
+--- ppdc/ppdc-driver.cxx (.../tags/release-1.4.0) (wersja 8809)
++++ ppdc/ppdc-driver.cxx (.../branches/branch-1.4) (wersja 8809)
+@@ -554,6 +554,8 @@
+ else if (type != PPDC_DRIVER_PS)
+ cupsFilePrintf(fp, "*TTRasterizer: Type42%s", lf);
+
++ struct lconv *loc = localeconv();
++
+ if (attrs->count)
+ {
+ // Write driver-defined attributes...
+@@ -679,16 +681,23 @@
+ for (p = (ppdcProfile *)profiles->first();
+ p;
+ p = (ppdcProfile *)profiles->next())
++ {
++ char density[255], gamma[255], profile[9][255];
++
++ _cupsStrFormatd(density, density + sizeof(density), p->density, loc);
++ _cupsStrFormatd(gamma, gamma + sizeof(gamma), p->gamma, loc);
++
++ for (int i = 0; i < 9; i ++)
++ _cupsStrFormatd(profile[i], profile[i] + sizeof(profile[0]),
++ p->profile[i], loc);
++
+ cupsFilePrintf(fp,
+- "*cupsColorProfile %s/%s: \"%.3f %.3f %.3f %.3f %.3f %.3f "
+- "%.3f %.3f %.3f %.3f %.3f\"%s",
+- p->resolution->value, p->media_type->value,
+- p->density, p->gamma,
+- p->profile[0], p->profile[1],
+- p->profile[2], p->profile[3],
+- p->profile[4], p->profile[5],
+- p->profile[6], p->profile[7],
+- p->profile[8], lf);
++ "*cupsColorProfile %s/%s: \"%s %s %s %s %s %s %s %s %s %s "
++ "%s\"%s", p->resolution->value, p->media_type->value,
++ density, gamma, profile[0], profile[1], profile[2],
++ profile[3], profile[4], profile[5], profile[6], profile[7],
++ profile[8], lf);
++ }
+ }
+
+ if (locales)
+@@ -871,13 +880,21 @@
+ cupsFilePrintf(fp, "*DefaultImageableArea: %s%s",
+ default_size ? default_size->value : "Letter", lf);
+
++ char left[255], right[255], bottom[255], top[255];
++
+ for (m = (ppdcMediaSize *)sizes->first();
+ m;
+ m = (ppdcMediaSize *)sizes->next())
+- cupsFilePrintf(fp, "*ImageableArea %s/%s: \"%.2f %.2f %.2f %.2f\"%s",
++ {
++ _cupsStrFormatd(left, left + sizeof(left), m->left, loc);
++ _cupsStrFormatd(bottom, bottom + sizeof(bottom), m->bottom, loc);
++ _cupsStrFormatd(right, right + sizeof(right), m->width - m->right, loc);
++ _cupsStrFormatd(top, top + sizeof(top), m->length - m->top, loc);
++
++ cupsFilePrintf(fp, "*ImageableArea %s/%s: \"%s %s %s %s\"%s",
+ m->name->value, catalog->find_message(m->text->value),
+- m->left, m->bottom, m->width - m->right, m->length - m->top,
+- lf);
++ left, bottom, right, top, lf);
++ }
+
+ if ((a = find_attr("?ImageableArea", NULL)) != NULL)
+ {
+@@ -892,12 +909,19 @@
+ cupsFilePrintf(fp, "*DefaultPaperDimension: %s%s",
+ default_size ? default_size->value : "Letter", lf);
+
++ char width[255], length[255];
++
+ for (m = (ppdcMediaSize *)sizes->first();
+ m;
+ m = (ppdcMediaSize *)sizes->next())
+- cupsFilePrintf(fp, "*PaperDimension %s/%s: \"%.2f %.2f\"%s",
++ {
++ _cupsStrFormatd(width, width + sizeof(width), m->width, loc);
++ _cupsStrFormatd(length, length + sizeof(length), m->length, loc);
++
++ cupsFilePrintf(fp, "*PaperDimension %s/%s: \"%s %s\"%s",
+ m->name->value, catalog->find_message(m->text->value),
+- m->width, m->length, lf);
++ width, length, lf);
++ }
+
+ if ((a = find_attr("?PaperDimension", NULL)) != NULL)
+ {
+@@ -911,11 +935,19 @@
+ // Custom size support...
+ if (variable_paper_size)
+ {
+- cupsFilePrintf(fp, "*MaxMediaWidth: \"%.2f\"%s", max_width, lf);
+- cupsFilePrintf(fp, "*MaxMediaHeight: \"%.2f\"%s", max_length, lf);
+- cupsFilePrintf(fp, "*HWMargins: %.2f %.2f %.2f %.2f\n",
+- left_margin, bottom_margin, right_margin, top_margin);
++ _cupsStrFormatd(width, width + sizeof(width), max_width, loc);
++ _cupsStrFormatd(length, length + sizeof(length), max_length, loc);
+
++ _cupsStrFormatd(left, left + sizeof(left), left_margin, loc);
++ _cupsStrFormatd(bottom, bottom + sizeof(bottom), bottom_margin, loc);
++ _cupsStrFormatd(right, right + sizeof(right), right_margin, loc);
++ _cupsStrFormatd(top, top + sizeof(top), top_margin, loc);
++
++ cupsFilePrintf(fp, "*MaxMediaWidth: \"%s\"%s", width, lf);
++ cupsFilePrintf(fp, "*MaxMediaHeight: \"%s\"%s", length, lf);
++ cupsFilePrintf(fp, "*HWMargins: %s %s %s %s%s", left, bottom, right, top,
++ lf);
++
+ if (custom_size_code && custom_size_code->value)
+ {
+ cupsFilePrintf(fp, "*CustomPageSize True: \"%s\"%s",
+@@ -934,16 +966,30 @@
+ cupsFilePrintf(fp, "*ParamCustomPageSize Width: %s%s", a->value->value,
+ lf);
+ else
+- cupsFilePrintf(fp, "*ParamCustomPageSize Width: 1 points %.2f %.2f%s",
+- min_width, max_width, lf);
++ {
++ char width0[255];
+
++ _cupsStrFormatd(width0, width0 + sizeof(width0), min_width, loc);
++ _cupsStrFormatd(width, width + sizeof(width), max_width, loc);
++
++ cupsFilePrintf(fp, "*ParamCustomPageSize Width: 1 points %s %s%s",
++ width0, width, lf);
++ }
++
+ if ((a = find_attr("ParamCustomPageSize", "Height")) != NULL)
+ cupsFilePrintf(fp, "*ParamCustomPageSize Height: %s%s", a->value->value,
+ lf);
+ else
+- cupsFilePrintf(fp, "*ParamCustomPageSize Height: 2 points %.2f %.2f%s",
+- min_length, max_length, lf);
++ {
++ char length0[255];
+
++ _cupsStrFormatd(length0, length0 + sizeof(length0), min_length, loc);
++ _cupsStrFormatd(length, length + sizeof(length), max_length, loc);
++
++ cupsFilePrintf(fp, "*ParamCustomPageSize Height: 2 points %s %s%s",
++ length0, length, lf);
++ }
++
+ if ((a = find_attr("ParamCustomPageSize", "WidthOffset")) != NULL)
+ cupsFilePrintf(fp, "*ParamCustomPageSize WidthOffset: %s%s",
+ a->value->value, lf);
+@@ -1000,7 +1046,10 @@
+ break;
+ }
+
+- cupsFilePrintf(fp, "*OrderDependency: %.1f ", o->order);
++ char order[255];
++ _cupsStrFormatd(order, order + sizeof(order), o->order, loc);
++
++ cupsFilePrintf(fp, "*OrderDependency: %s ", order);
+ switch (o->section)
+ {
+ default :
+Index: ppdc/ppdc-source.cxx
+===================================================================
+--- ppdc/ppdc-source.cxx (.../tags/release-1.4.0) (wersja 8809)
++++ ppdc/ppdc-source.cxx (.../branches/branch-1.4) (wersja 8809)
+@@ -1321,7 +1321,7 @@
+ while (*v && *v != ')')
+ {
+ // Skip leading whitespace...
+- while (*v && isspace(*v & 255));
++ while (*v && isspace(*v & 255))
+ v ++;
+
+ if (!*v || *v == ')')
+Index: templates/ja/option-boolean.tmpl
+===================================================================
+--- templates/ja/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/ja/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/ja/modify-class.tmpl
+===================================================================
+--- templates/ja/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/ja/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/ru/option-boolean.tmpl
+===================================================================
+--- templates/ru/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/ru/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/ru/modify-class.tmpl
+===================================================================
+--- templates/ru/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/ru/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/option-boolean.tmpl
+===================================================================
+--- templates/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/modify-class.tmpl
+===================================================================
+--- templates/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/de/option-boolean.tmpl
+===================================================================
+--- templates/de/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/de/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/de/modify-class.tmpl
+===================================================================
+--- templates/de/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/de/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/pl/option-boolean.tmpl
+===================================================================
+--- templates/pl/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/pl/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/pl/modify-class.tmpl
+===================================================================
+--- templates/pl/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/pl/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/es/option-boolean.tmpl
+===================================================================
+--- templates/es/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/es/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/es/modify-class.tmpl
+===================================================================
+--- templates/es/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/es/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+Index: templates/eu/option-boolean.tmpl
+===================================================================
+--- templates/eu/option-boolean.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/eu/option-boolean.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -1,6 +1,6 @@
+ <TR>
+ <TH {conflicted=1?CLASS="conflict":CLASS="label"} WIDTH="50%"><A NAME="{keyword}">{keytext}</A>:</TH>
+ <TD>
+-{[choices]<INPUT TYPE="RADIO" NAME="{keyword}" {choices={defchoice}?CHECKED:} VALUE="{choices}">{text}}
++{[choices]<INPUT TYPE="RADIO" NAME="{keyword-1}" {choices={defchoice-1}?CHECKED:} VALUE="{choices}">{text}}
+ </TD>
+ </TR>
+Index: templates/eu/modify-class.tmpl
+===================================================================
+--- templates/eu/modify-class.tmpl (.../tags/release-1.4.0) (wersja 8809)
++++ templates/eu/modify-class.tmpl (.../branches/branch-1.4) (wersja 8809)
+@@ -4,6 +4,7 @@
+
+ <FORM METHOD="POST" ACTION="/admin">
+ <INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
++<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
+
+ <TABLE>
+ <TR>
+
+Zmiany atrybutów dla: templates/eu
+___________________________________________________________________
+Dodane: svn:ignore
+ + header.tmpl
+
+
+Index: cgi-bin/ipp-var.c
+===================================================================
+--- cgi-bin/ipp-var.c (.../tags/release-1.4.0) (wersja 8809)
++++ cgi-bin/ipp-var.c (.../branches/branch-1.4) (wersja 8809)
+@@ -650,7 +650,8 @@
+ cgiSetIPPVars(response, NULL, NULL, NULL, 0);
+
+ attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
+- if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
++ if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED ||
++ attr->values[0].integer == IPP_JOB_HELD)
+ {
+ ippDelete(response);
+ break;
+Index: cgi-bin/admin.c
+===================================================================
+--- cgi-bin/admin.c (.../tags/release-1.4.0) (wersja 8809)
++++ cgi-bin/admin.c (.../branches/branch-1.4) (wersja 8809)
+@@ -634,6 +634,15 @@
+ return;
+ }
+
++ if (!name)
++ {
++ cgiStartHTML(title);
++ cgiSetVariable("ERROR", cgiText(_("Missing form variable!")));
++ cgiCopyTemplateLang("error.tmpl");
++ cgiEndHTML();
++ return;
++ }
++
+ for (ptr = name; *ptr; ptr ++)
+ if ((*ptr >= 0 && *ptr <= ' ') || *ptr == 127 || *ptr == '/' || *ptr == '#')
+ break;
+@@ -668,8 +677,7 @@
+ request = ippNewRequest(CUPS_ADD_CLASS);
+
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+- "localhost", 0, "/classes/%s",
+- cgiGetVariable("PRINTER_NAME"));
++ "localhost", 0, "/classes/%s", name);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
+ NULL, uri);
+
+Index: scheduler/cups-driverd.cxx
+===================================================================
+--- scheduler/cups-driverd.cxx (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/cups-driverd.cxx (.../branches/branch-1.4) (wersja 8809)
+@@ -328,7 +328,8 @@
+ *pc_file_name++ = '\0';
+
+ #ifdef __APPLE__
+- if (!strncmp(resource, "/Library/Printers/PPDs.drv/", 27))
++ if (!strncmp(resource, "/Library/Printers/PPDs/Contents/Resources/", 42) ||
++ !strncmp(resource, "/System/Library/Printers/PPDs/Contents/Resources/", 49))
+ strlcpy(filename, resource, sizeof(filename));
+ else
+ #endif // __APPLE__
+@@ -1493,13 +1494,21 @@
+ ppd->record.size == dent->fileinfo.st_size &&
+ ppd->record.mtime == dent->fileinfo.st_mtime)
+ {
+- do
+- {
+- ppd->found = 1;
+- }
+- while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL &&
++ /*
++ * Rewind to the first entry for this file...
++ */
++
++ while ((ppd = (ppd_info_t *)cupsArrayPrev(PPDsByName)) != NULL &&
+ !strcmp(ppd->record.filename, name));
+
++ /*
++ * Then mark all of the matches for this file as found...
++ */
++
++ while ((ppd = (ppd_info_t *)cupsArrayNext(PPDsByName)) != NULL &&
++ !strcmp(ppd->record.filename, name))
++ ppd->found = 1;
++
+ continue;
+ }
+
+@@ -1904,7 +1913,8 @@
+ *cups_fax, // cupsFax attribute
+ *nick_name; // NickName attribute
+ ppdcFilter *filter; // Current filter
+- bool product_found; // Found product?
++ ppd_info_t *ppd; // Current PPD
++ int products_found; // Number of products found
+ char uri[1024], // Driver URI
+ make_model[1024]; // Make and model
+ int type; // Driver type
+@@ -1929,7 +1939,7 @@
+ * Add a dummy entry for the file...
+ */
+
+- add_ppd(filename, filename, "", "", "", "", "", "", mtime, size, 0,
++ add_ppd(name, name, "", "", "", "", "", "", mtime, size, 0,
+ PPD_TYPE_DRV, "drv");
+ ChangedPPD = 1;
+
+@@ -1981,22 +1991,28 @@
+ type = PPD_TYPE_PDF;
+ }
+
+- for (product = (ppdcAttr *)d->attrs->first(), product_found = false;
++ for (product = (ppdcAttr *)d->attrs->first(), products_found = 0;
+ product;
+ product = (ppdcAttr *)d->attrs->next())
+ if (!strcmp(product->name->value, "Product"))
+ {
+- product_found = true;
++ if (!products_found)
++ ppd = add_ppd(name, uri, "en", d->manufacturer->value, make_model,
++ device_id ? device_id->value->value : "",
++ product->value->value,
++ ps_version ? ps_version->value->value : "(3010) 0",
++ mtime, size, d->model_number, type, "drv");
++ else if (products_found < PPD_MAX_PROD)
++ strlcpy(ppd->record.products[products_found], product->value->value,
++ sizeof(ppd->record.products[0]));
++ else
++ break;
+
+- add_ppd(filename, uri, "en", d->manufacturer->value, make_model,
+- device_id ? device_id->value->value : "",
+- product->value->value,
+- ps_version ? ps_version->value->value : "(3010) 0",
+- mtime, size, d->model_number, type, "drv");
++ products_found ++;
+ }
+
+- if (!product_found)
+- add_ppd(filename, uri, "en", d->manufacturer->value, make_model,
++ if (!products_found)
++ add_ppd(name, uri, "en", d->manufacturer->value, make_model,
+ device_id ? device_id->value->value : "",
+ d->model_name->value,
+ ps_version ? ps_version->value->value : "(3010) 0",
+Index: scheduler/ipp.c
+===================================================================
+--- scheduler/ipp.c (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/ipp.c (.../branches/branch-1.4) (wersja 8809)
+@@ -6556,7 +6556,7 @@
+ "%d+%d+%d+%d+%s%s%s%s%s",
+ con->request->request.op.request_id,
+ limit ? limit->values[0].integer : 0,
+- timeout ? timeout->values[0].integer : 10,
++ timeout ? timeout->values[0].integer : 15,
+ (int)User,
+ requested_str,
+ exclude_str[0] ? "%20" : "", exclude_str,
+Index: scheduler/dirsvc.c
+===================================================================
+--- scheduler/dirsvc.c (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/dirsvc.c (.../branches/branch-1.4) (wersja 8809)
+@@ -1558,9 +1558,12 @@
+ * Add the master connection to the select list...
+ */
+
+- cupsdAddSelect(DNSServiceRefSockFD(DNSSDRef),
+- (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
++ int fd = DNSServiceRefSockFD(DNSSDRef);
+
++ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
++
++ cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
++
+ /*
+ * Then get the port we use for registrations. If we are not listening
+ * on any non-local ports, there is no sense sharing local printers via
+@@ -2369,7 +2372,7 @@
+ (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", p->name);
+
+ keyvalue[i ][0] = "ty";
+- keyvalue[i++][1] = p->make_model;
++ keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
+
+ if (p->location && *p->location != '\0')
+ {
+Index: scheduler/printers.c
+===================================================================
+--- scheduler/printers.c (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/printers.c (.../branches/branch-1.4) (wersja 8809)
+@@ -3699,10 +3699,6 @@
+ p->name, mimetype);
+ }
+
+- cupsdLogMessage(CUPSD_LOG_DEBUG2,
+- "add_printer_formats: %s: %d supported types",
+- p->name, cupsArrayCount(p->filetypes) + 1);
+-
+ /*
+ * Add the file formats that can be filtered...
+ */
+@@ -3713,9 +3709,13 @@
+ else
+ i = 0;
+
++ cupsdLogMessage(CUPSD_LOG_DEBUG2,
++ "add_printer_formats: %s: %d supported types",
++ p->name, cupsArrayCount(p->filetypes) + i);
++
+ attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE,
+ "document-format-supported",
+- cupsArrayCount(p->filetypes) + 1, NULL, NULL);
++ cupsArrayCount(p->filetypes) + i, NULL, NULL);
+
+ if (i)
+ attr->values[0].string.text = _cupsStrAlloc("application/octet-stream");
+Index: scheduler/job.c
+===================================================================
+--- scheduler/job.c (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/job.c (.../branches/branch-1.4) (wersja 8809)
+@@ -2297,18 +2297,33 @@
+ case IPP_JOB_ABORTED :
+ case IPP_JOB_CANCELED :
+ case IPP_JOB_COMPLETED :
++ if (newstate == IPP_JOB_CANCELED)
++ {
++ /*
++ * Remove the job from the active list if there are no processes still
++ * running for it...
++ */
++
++ for (i = 0; job->filters[i] < 0; i++);
++
++ if (!job->filters[i] && job->backend <= 0)
++ cupsArrayRemove(ActiveJobs, job);
++ }
++ else
++ {
++ /*
++ * Otherwise just remove the job from the active list immediately...
++ */
++
++ cupsArrayRemove(ActiveJobs, job);
++ }
++
+ /*
+ * Expire job subscriptions since the job is now "completed"...
+ */
+
+ cupsdExpireSubscriptions(NULL, job);
+
+- /*
+- * Remove the job from the active list...
+- */
+-
+- cupsArrayRemove(ActiveJobs, job);
+-
+ #ifdef __APPLE__
+ /*
+ * If we are going to sleep and the PrintingJobs count is now 0, allow the
+@@ -3848,6 +3863,11 @@
+ fcntl(job->side_pipes[1], F_SETFL,
+ fcntl(job->side_pipes[1], F_GETFL) | O_NONBLOCK);
+
++ fcntl(job->side_pipes[0], F_SETFD,
++ fcntl(job->side_pipes[0], F_GETFD) | FD_CLOEXEC);
++ fcntl(job->side_pipes[1], F_SETFD,
++ fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
++
+ /*
+ * Now start the first file in the job...
+ */
+Index: scheduler/main.c
+===================================================================
+--- scheduler/main.c (.../tags/release-1.4.0) (wersja 8809)
++++ scheduler/main.c (.../branches/branch-1.4) (wersja 8809)
+@@ -1793,6 +1793,18 @@
+ cupsdContinueJob(job);
+ }
+ }
++ else if (job->state_value == IPP_JOB_CANCELED)
++ {
++ /*
++ * Remove the job from the active list if there are no processes still
++ * running for it...
++ */
++
++ for (i = 0; job->filters[i] < 0; i++);
++
++ if (!job->filters[i] && job->backend <= 0)
++ cupsArrayRemove(ActiveJobs, job);
++ }
+ }
+ }
+