From eac3a0a01bf37d95f4129b28296cb697c54b2613 Mon Sep 17 00:00:00 2001 From: msweet Date: Wed, 11 May 2011 05:36:13 +0000 Subject: [PATCH] Merge changes from CUPS 1.5svn-r9763. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3242 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.4.txt | 2 +- CHANGES.txt | 17 +- INSTALL.txt | 3 +- Makedefs.in | 12 + Makefile | 3 - README.txt | 2 +- backend/Makefile | 29 +- backend/ipp.c | 810 ++++++++++++++++++++++----- backend/lpd.c | 12 +- backend/snmp-supplies.c | 16 +- backend/socket.c | 13 +- backend/usb-darwin.c | 10 +- berkeley/lpq.c | 5 +- cgi-bin/admin.c | 8 +- conf/mime.convs.in | 79 ++- config-scripts/cups-common.m4 | 9 +- config-scripts/cups-defaults.m4 | 10 + config-scripts/cups-gssapi.m4 | 51 +- config-scripts/cups-image.m4 | 7 +- config-scripts/cups-pdf.m4 | 29 +- config-scripts/cups-ssl.m4 | 36 +- config.h.in | 41 +- cups/Makefile | 1 + cups/api-array.shtml | 4 +- cups/api-cups.shtml | 6 +- cups/api-filedir.shtml | 4 +- cups/api-filter.shtml | 18 +- cups/api-httpipp.shtml | 4 +- cups/api-overview.shtml | 5 +- cups/api-ppd.shtml | 4 +- cups/array-private.h | 51 ++ cups/array.c | 144 ++++- cups/auth.c | 255 +++++++-- cups/backend.c | 11 +- cups/cups-private.h | 7 +- cups/http-addrlist.c | 2 +- cups/http-private.h | 46 +- cups/http-support.c | 148 +++-- cups/http.c | 70 --- cups/ppd.c | 13 +- cups/request.c | 2 +- cups/testhttp.c | 22 +- cups/usersys.c | 20 + cups/util.c | 5 +- doc/help/api-array.html | 4 +- doc/help/api-cups.html | 6 +- doc/help/api-filedir.html | 4 +- doc/help/api-filter.html | 18 +- doc/help/api-httpipp.html | 30 +- doc/help/api-overview.html | 5 +- doc/help/api-ppd.html | 4 +- doc/help/api-raster.html | 4 +- doc/help/kerberos.html | 2 +- doc/help/network.html | 4 +- doc/help/options.html | 2 +- doc/help/ref-cupsd-conf.html.in | 56 +- doc/help/ref-mailto-conf.html | 10 +- doc/help/ref-ppdcfile.html | 9 +- doc/help/ref-snmp-conf.html | 2 +- doc/help/security.html | 4 +- doc/help/spec-banner.html | 4 +- doc/help/spec-browsing.html | 10 +- doc/help/spec-cmp.html | 28 +- doc/help/spec-command.html | 5 +- doc/help/spec-ipp.html | 4 +- doc/help/spec-postscript.html | 6 +- doc/help/spec-ppd.html | 2 +- doc/help/spec-raster.html | 6 +- doc/help/spec-stp.html | 2 +- doc/help/translation.html | 8 +- filter/api-raster.shtml | 4 +- filter/image-colorspace.c | 6 +- filter/imagetops.c | 7 + filter/imagetoraster.c | 7 + filter/pdftops.c | 26 +- filter/pstops.c | 24 +- filter/raster.c | 1 + filter/spec-ppd.shtml | 2 +- locale/cups.pot | 479 ++++++++-------- locale/cups.strings | 10 +- man/lpadmin.man | 28 +- packaging/cups.list.in | 9 + scheduler/auth.c | 10 +- scheduler/client.c | 68 +-- scheduler/conf.c | 27 +- scheduler/cups-driverd.cxx | 4 +- scheduler/cups-polld.c | 5 +- scheduler/cupsfilter.c | 174 ++++-- scheduler/ipp.c | 2 +- scheduler/job.c | 45 +- scheduler/libcupsmime.exp | 2 + scheduler/mime-private.h | 48 ++ scheduler/mime.c | 121 ++-- scheduler/mime.h | 13 +- scheduler/util.c | 47 +- scheduler/util.h | 1 + systemv/lpadmin.c | 431 +++++++++----- test/ippserver.c | 6 +- test/run-stp-tests.sh | 14 +- tools/pdftops-darwin.sh | 44 ++ vcnet/config.h | 101 +++- xcode/CUPS.xcodeproj/project.pbxproj | 352 ++++++++++-- xcode/config.h | 16 +- 103 files changed, 3118 insertions(+), 1301 deletions(-) create mode 100644 cups/array-private.h create mode 100644 scheduler/mime-private.h create mode 100755 tools/pdftops-darwin.sh diff --git a/CHANGES-1.4.txt b/CHANGES-1.4.txt index 1cf3a8f22..9376825a8 100644 --- a/CHANGES-1.4.txt +++ b/CHANGES-1.4.txt @@ -4,7 +4,7 @@ CHANGES-1.4.txt CHANGES IN CUPS V1.4.7 - Documentation changes (STR #3710, STR #3720, STR #3745, STR #3750, - STR #3757, STR #3758, STR #3782, STR #3826, STR #3829) + STR #3757, STR #3758, STR #3782, STR #3826, STR #3829, STR #3837) - Web interface fixes (STR #3412, STR #3345, STR #3455, STR #3707, STR #3755, STR #3769, STR #3783) - Configure script fixes (STR #3659, STR #3691) diff --git a/CHANGES.txt b/CHANGES.txt index 8fcf44780..beadcb06c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,23 @@ -CHANGES.txt - 2011-03-31 +CHANGES.txt - 2011-05-10 ------------------------ CHANGES IN CUPS V1.5b1 + - The lpadmin command now allows default option values to be deleted + (STR #2959) + - The lpadmin command now allows the cupsIPPSupplies and + cupsSNMPSupplies keywords to be set in a PPD file (STR #3825) + - Moving a held job no longer releases it (STR #3839) + - Restored support for GNU TLS and OpenSSL with threading enabled + (STR #3605) + - Fixed a confusing error message from cups-polld (STR #3806) + - Increased the default RIPCache value to 128MB (STR #3535) + - MIME errors are now routed to the error_log file (STR #2410) + - Updated PDF filter to support new Ghostscript ps2write device + (STR #3766) + - Updated PDF filter to support new Poppler option to preserve page + sizes in PDF files when the user has not selected a particular media + size (STR #3689) - Added new PWG Raster filter for IPP Everywhere printer support. - Added printer-uuid attribute. - Added support for the cupsSingleFile PPD keyword. diff --git a/INSTALL.txt b/INSTALL.txt index bd567ee03..ec242f999 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,4 +1,4 @@ -INSTALL - CUPS v1.4.0 - 2009-06-26 +INSTALL - CUPS v1.5.0 - 2011-05-06 ---------------------------------- This file describes how to compile and install CUPS from source code. For more @@ -166,7 +166,6 @@ CREATING BINARY DISTRIBUTIONS WITH EPM deb - Builds a Debian package depot - Builds a HP-UX package (also swinstall) inst - Builds an IRIX package (also tardist) - osx - Builds a MacOS X package pkg - Builds a Solaris package rpm - Builds a RPM package setld - Build a Tru64 UNIX package diff --git a/Makedefs.in b/Makedefs.in index 10fb71da8..0d4397f5b 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -102,6 +102,18 @@ LIBZ = @LIBZ@ INSTALLSTATIC = @INSTALLSTATIC@ +# +# IPP backend aliases... +# + +IPPALIASES = @IPPALIASES@ + +# +# Install XPC backends? +# + +INSTALLXPC = @INSTALLXPC@ + # # Program options... # diff --git a/Makefile b/Makefile index 964f562e9..747955d75 100644 --- a/Makefile +++ b/Makefile @@ -302,9 +302,6 @@ aix bsd deb depot inst pkg setld slackware swinstall tardist: epm: epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list -osx: - epm $(EPMFLAGS) -f osx -s packaging/installer.tif cups packaging/cups.list - rpm: epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list diff --git a/README.txt b/README.txt index 8bfcbd4dc..3e9c6d8b5 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -README - CUPS v1.5svn - 2011-01-03 +README - CUPS v1.5svn - 2011-05-06 ---------------------------------- Looking for compile instructions? Read the file "INSTALL.txt" diff --git a/backend/Makefile b/backend/Makefile index 1cca9836d..5a0521cff 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -3,7 +3,7 @@ # # Backend makefile for CUPS. # -# Copyright 2007-2010 by Apple Inc. +# Copyright 2007-2011 by Apple Inc. # Copyright 1997-2007 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the @@ -85,7 +85,8 @@ install-data: # Install programs... # -install-exec: +install-exec: $(INSTALLXPC) + echo Installing backends in $(SERVERBIN)/backend $(INSTALL_DIR) -m 755 $(SERVERBIN)/backend for file in $(RBACKENDS); do \ $(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \ @@ -93,8 +94,10 @@ install-exec: for file in $(UBACKENDS); do \ $(INSTALL_BIN) $$file $(SERVERBIN)/backend; \ done - $(RM) $(SERVERBIN)/backend/http - $(LN) ipp $(SERVERBIN)/backend/http + for file in $(IPPALIASES); do \ + $(RM) $(SERVERBIN)/backend/$$file; \ + $(LN) ipp $(SERVERBIN)/backend/$$file; \ + done if test "x$(DNSSD_BACKEND)" != x; then \ $(RM) $(SERVERBIN)/backend/mdns; \ $(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \ @@ -106,6 +109,15 @@ install-exec: done \ fi +install-xpc: ipp + echo Installing XPC backends in $(SERVERBIN)/apple + $(INSTALL_DIR) -m 755 $(SERVERBIN)/apple + $(LIBTOOL) $(INSTALL_BIN) ipp $(SERVERBIN)/apple + for file in $(IPPALIASES); do \ + $(RM) $(SERVERBIN)/apple/$$file; \ + $(LN) ipp $(SERVERBIN)/apple/$$file; \ + done + # # Install headers... @@ -126,10 +138,17 @@ install-libs: # uninstall: + $(RM) $(SERVERBIN)/apple/ipp + for file in $(IPPALIASES); do \ + $(RM) $(SERVERBIN)/apple/$$file; \ + done + -$(RMDIR) $(SERVERBIN)/apple for file in $(RBACKENDS) $(UBACKENDS); do \ $(RM) $(SERVERBIN)/backend/$$file; \ done - $(RM) $(SERVERBIN)/backend/http + for file in $(IPPALIASES); do \ + $(RM) $(SERVERBIN)/backend/$$file; \ + done -$(RMDIR) $(SERVERBIN)/backend -$(RMDIR) $(SERVERBIN) diff --git a/backend/ipp.c b/backend/ipp.c index 7fac198ed..ca45a2f89 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 7948 2008-09-17 00:04:12Z mike $" + * "$Id: ipp.c 9759 2011-05-11 03:24:33Z mike $" * * IPP backend for CUPS. * @@ -19,13 +19,14 @@ * main() - Send a file to the printer or server. * cancel_job() - Cancel a print job. * check_printer_state() - Check the printer state. - * compress_files() - Compress print files... - * monitor_printer() - Monitor the printer state... + * compress_files() - Compress print files. + * monitor_printer() - Monitor the printer state. * new_request() - Create a new print creation or validation request. * password_cb() - Disable the password prompt for * cupsDoFileRequest(). * report_attr() - Report an IPP attribute value. * report_printer_state() - Report the printer state. + * run_as_user() - Run the IPP backend as the printing user. * sigterm_handler() - Handle 'terminate' signals that stop the backend. */ @@ -34,9 +35,18 @@ */ #include "backend-private.h" +#include #include #include #include +#if defined(HAVE_GSSAPI) && defined(HAVE_XPC) +# include +# define kPMPrintUIToolAgent "com.apple.printuitool.agent" +# define kPMStartJob 100 +# define kPMWaitForJob 101 +extern void xpc_connection_set_target_uid(xpc_connection_t connection, + uid_t uid); +#endif /* HAVE_GSSAPI && HAVE_XPC */ /* @@ -62,17 +72,28 @@ typedef struct _cups_monitor_s /**** Monitoring data ****/ * Globals... */ -static const char *auth_info_required = "none"; +static int num_attr_cache = 0; + /* Number of cached attributes */ +static cups_option_t *attr_cache = NULL; + /* Cached attributes */ +static const char *auth_info_required; /* New auth-info-required value */ +#if defined(HAVE_GSSAPI) && defined(HAVE_XPC) +static int child_pid = 0; /* Child process ID */ +#endif /* HAVE_GSSAPI && HAVE_XPC */ static const char * const jattrs[] = /* Job attributes we want */ { + "job-impressions-completed", "job-media-sheets-completed", "job-state", "job-state-reasons" }; -static int job_canceled = 0; /* Job cancelled? */ -static char *password = NULL; /* Password for device URI */ -static int password_tries = 0; /* Password tries */ +static int job_canceled = 0; + /* Job cancelled? */ +static char *password = NULL; + /* Password for device URI */ +static int password_tries = 0; + /* Password tries */ static const char * const pattrs[] = /* Printer attributes we want */ { "copies-supported", @@ -105,7 +126,11 @@ static const char * const remote_job_states[] = "cups-remote-aborted", "cups-remote-completed" }; -static char tmpfilename[1024] = ""; /* Temporary spool file name */ +static cups_array_t *state_reasons; /* Array of printe-state-reasons keywords */ +static _cups_mutex_t state_mutex = _CUPS_MUTEX_INITIALIZER; + /* Mutex to control access */ +static char tmpfilename[1024] = ""; + /* Temporary spool file name */ /* @@ -133,7 +158,12 @@ static ipp_t *new_request(ipp_op_t op, int version, const char *uri, 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); +#if defined(HAVE_GSSAPI) && defined(HAVE_XPC) +static int run_as_user(int argc, char *argv[], uid_t uid, + const char *device_uri, int fd); +#endif /* HAVE_GSSAPI && HAVE_XPC */ static void sigterm_handler(int sig); +static void update_reasons(ipp_attribute_t *attr, const char *s); /* @@ -207,7 +237,7 @@ main(int argc, /* I - Number of command-line args */ *final_content_type, /* FINAL_CONTENT_TYPE environment var */ *document_format; /* document-format value */ int fd; /* File descriptor */ - off_t bytes; /* Bytes copied */ + off_t bytes = 0; /* Bytes copied */ char buffer[16384]; /* Copy buffer */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ @@ -215,6 +245,7 @@ main(int argc, /* I - Number of command-line args */ int version; /* IPP version */ ppd_file_t *ppd; /* PPD file */ _ppd_cache_t *pc; /* PPD cache and mapping data */ + fd_set input; /* Input set for select() */ /* @@ -270,6 +301,69 @@ main(int argc, /* I - Number of command-line args */ return (CUPS_BACKEND_STOP); } + /* + * Get the device URI... + */ + + while ((device_uri = cupsBackendDeviceURI(argv)) == NULL) + { + _cupsLangPrintFilter(stderr, "INFO", _("Unable to locate printer.")); + sleep(10); + + if (getenv("CLASS") != NULL) + return (CUPS_BACKEND_FAILED); + } + + if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) == NULL) + auth_info_required = "none"; + + state_reasons = _cupsArrayNewStrings(getenv("PRINTER_STATE_REASONS")); + +#ifdef HAVE_GSSAPI + /* + * For Kerberos, become the printing user (if we can) to get the credentials + * that way. + */ + + if (!getuid() && (value = getenv("AUTH_UID")) != NULL) + { + uid_t uid = (uid_t)atoi(value); + /* User ID */ + +# ifdef HAVE_XPC + if (uid > 0) + { + if (argc == 6) + return (run_as_user(argc, argv, uid, device_uri, 0)); + else + { + int status = 0; /* Exit status */ + + for (i = 6; i < argc && !status && !job_canceled; i ++) + { + if ((fd = open(argv[i], O_RDONLY)) >= 0) + { + status = run_as_user(argc, argv, uid, device_uri, fd); + close(fd); + } + else + { + _cupsLangPrintError("ERROR", _("Unable to open print file")); + status = CUPS_BACKEND_FAILED; + } + } + + return (status); + } + } + +# else /* No XPC, just try to run as the user ID */ + if (uid > 0) + seteuid(uid); +# endif /* HAVE_XPC */ + } +#endif /* HAVE_GSSAPI */ + /* * Get the (final) content type... */ @@ -289,15 +383,6 @@ main(int argc, /* I - Number of command-line args */ * Extract the hostname and printer name from the URI... */ - while ((device_uri = cupsBackendDeviceURI(argv)) == NULL) - { - _cupsLangPrintFilter(stderr, "INFO", _("Unable to locate printer.")); - sleep(10); - - if (getenv("CLASS") != NULL) - return (CUPS_BACKEND_FAILED); - } - httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme), username, sizeof(username), hostname, sizeof(hostname), &port, resource, sizeof(resource)); @@ -522,16 +607,6 @@ main(int argc, /* I - Number of command-line args */ password = getenv("AUTH_PASSWORD"); } -#ifdef HAVE_GSSAPI - /* - * For Kerberos, become the printing user (if we can) to get the credentials - * that way. - */ - - if (!getuid() && (value = getenv("AUTH_UID")) != NULL) - seteuid(atoi(value)); -#endif /* HAVE_GSSAPI */ - /* * Try finding the remote server... */ @@ -540,7 +615,7 @@ main(int argc, /* I - Number of command-line args */ sprintf(portname, "%d", port); - fputs("STATE: +connecting-to-device\n", stderr); + update_reasons(NULL, "+connecting-to-device"); fprintf(stderr, "DEBUG: Looking up \"%s\"...\n", hostname); while ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL) @@ -551,7 +626,7 @@ main(int argc, /* I - Number of command-line args */ if (getenv("CLASS") != NULL) { - fputs("STATE: -connecting-to-device\n", stderr); + update_reasons(NULL, "-connecting-to-device"); return (CUPS_BACKEND_STOP); } } @@ -575,8 +650,12 @@ main(int argc, /* I - Number of command-line args */ */ if (num_files == 0) + { if (!backendWaitLoop(snmp_fd, &(addrlist->addr), 0, backendNetworkSideCB)) return (CUPS_BACKEND_OK); + else if ((bytes = read(0, buffer, sizeof(buffer))) <= 0) + return (CUPS_BACKEND_OK); + } /* * Try connecting to the remote server... @@ -594,7 +673,7 @@ main(int argc, /* I - Number of command-line args */ int error = errno; /* Connection error */ if (http->status == HTTP_PKI_ERROR) - fputs("STATE: +cups-certificate-error\n", stderr); + update_reasons(NULL, "+cups-certificate-error"); if (job_canceled) break; @@ -618,7 +697,7 @@ main(int argc, /* I - Number of command-line args */ sleep(5); - fputs("STATE: -connecting-to-device\n", stderr); + update_reasons(NULL, "-connecting-to-device"); return (CUPS_BACKEND_FAILED); } @@ -632,7 +711,7 @@ main(int argc, /* I - Number of command-line args */ { _cupsLangPrintFilter(stderr, "ERROR", _("The printer is not responding.")); - fputs("STATE: -connecting-to-device\n", stderr); + update_reasons(NULL, "-connecting-to-device"); return (CUPS_BACKEND_FAILED); } @@ -672,14 +751,14 @@ main(int argc, /* I - Number of command-line args */ break; } else - fputs("STATE: -cups-certificate-error\n", stderr); + update_reasons(NULL, "-cups-certificate-error"); } while (http->fd < 0); if (job_canceled || !http) return (CUPS_BACKEND_FAILED); - fputs("STATE: -connecting-to-device\n", stderr); + update_reasons(NULL, "-connecting-to-device"); _cupsLangPrintFilter(stderr, "INFO", _("Connected to printer.")); fprintf(stderr, "DEBUG: Connected to %s:%d...\n", @@ -742,11 +821,8 @@ main(int argc, /* I - Number of command-line args */ { fprintf(stderr, "DEBUG: Printer responded with HTTP version %d.%d.\n", http->version / 100, http->version % 100); - - _cupsLangPrintFilter(stderr, "ERROR", - _("This printer does not conform to the IPP " - "standard. Please contact the manufacturer of " - "your printer for assistance.")); + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-wrong-http-version"); } supported = cupsDoRequest(http, request, resource); @@ -833,39 +909,57 @@ main(int argc, /* I - Number of command-line args */ continue; } - /* - * Check printer-state-reasons for the "spool-area-full" keyword... - */ - - if ((printer_state = ippFindAttribute(supported, "printer-state-reasons", - IPP_TAG_KEYWORD)) != NULL) + if (!getenv("CLASS")) { - for (i = 0; i < printer_state->num_values; i ++) - if (!strcmp(printer_state->values[0].string.text, "spool-area-full") || - !strncmp(printer_state->values[0].string.text, "spool-area-full-", - 16)) - break; + /* + * Check printer-is-accepting-jobs = false and printer-state-reasons for the + * "spool-area-full" keyword... + */ - if (i < printer_state->num_values) + int busy = 0; + + if ((printer_accepting = ippFindAttribute(supported, + "printer-is-accepting-jobs", + IPP_TAG_BOOLEAN)) != NULL && + !printer_accepting->values[0].boolean) + busy = 1; + else if (!printer_accepting) + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-printer-is-accepting-jobs"); + + if ((printer_state = ippFindAttribute(supported, + "printer-state-reasons", + IPP_TAG_KEYWORD)) != NULL && !busy) + { + for (i = 0; i < printer_state->num_values; i ++) + if (!strcmp(printer_state->values[0].string.text, + "spool-area-full") || + !strncmp(printer_state->values[0].string.text, "spool-area-full-", + 16)) + { + busy = 1; + break; + } + } + else + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-printer-state-reasons"); + + if (busy) { _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy.")); - report_printer_state(supported, 0); + report_printer_state(supported, 0); sleep(delay); - delay = _cupsNextDelay(delay, &prev_delay); + delay = _cupsNextDelay(delay, &prev_delay); ippDelete(supported); supported = NULL; continue; } } - else - _cupsLangPrintFilter(stderr, "ERROR", - _("This printer does not conform to the IPP " - "standard. Please contact the manufacturer of " - "your printer for assistance.")); /* * Check for supported attributes... @@ -912,6 +1006,38 @@ main(int argc, /* I - Number of command-line args */ if ((operations_sup = ippFindAttribute(supported, "operations-supported", IPP_TAG_ENUM)) != NULL) { + for (i = 0; i < operations_sup->num_values; i ++) + if (operations_sup->values[i].integer == IPP_PRINT_JOB) + break; + + if (i >= operations_sup->num_values) + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-print-job"); + + for (i = 0; i < operations_sup->num_values; i ++) + if (operations_sup->values[i].integer == IPP_CANCEL_JOB) + break; + + if (i >= operations_sup->num_values) + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-cancel-job"); + + for (i = 0; i < operations_sup->num_values; i ++) + if (operations_sup->values[i].integer == IPP_GET_JOB_ATTRIBUTES) + break; + + if (i >= operations_sup->num_values) + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-get-job-attributes"); + + for (i = 0; i < operations_sup->num_values; i ++) + if (operations_sup->values[i].integer == IPP_GET_PRINTER_ATTRIBUTES) + break; + + if (i >= operations_sup->num_values) + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-get-printer-attributes"); + for (i = 0; i < operations_sup->num_values; i ++) if (operations_sup->values[i].integer == IPP_VALIDATE_JOB) { @@ -920,22 +1046,12 @@ main(int argc, /* I - Number of command-line args */ } if (!validate_job) - { - _cupsLangPrintFilter(stderr, "WARNING", - _("This printer does not conform to the IPP " - "standard and may not work.")); - fputs("DEBUG: operations-supported does not list Validate-Job.\n", - stderr); - } + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-validate-job"); } else - { - _cupsLangPrintFilter(stderr, "WARNING", - _("This printer does not conform to the IPP " - "standard and may not work.")); - fputs("DEBUG: operations-supported not returned in " - "Get-Printer-Attributes request.\n", stderr); - } + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-operations-supported"); doc_handling_sup = ippFindAttribute(supported, "multiple-document-handling-supported", @@ -1129,7 +1245,8 @@ main(int argc, /* I - Number of command-line args */ _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy.")); sleep(10); } - else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN) + else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN || + ipp_status == IPP_AUTHENTICATION_CANCELED) { /* * Update auth-info-required as needed... @@ -1153,9 +1270,12 @@ main(int argc, /* I - Number of command-line args */ } else if (ipp_status == IPP_OPERATION_NOT_SUPPORTED) { - _cupsLangPrintFilter(stderr, "WARNING", - _("This printer does not conform to the IPP " - "standard and may not work.")); + /* + * This is all too common... + */ + + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-validate-job"); break; } else if (ipp_status < IPP_REDIRECTION_OTHER_SITE) @@ -1212,21 +1332,38 @@ main(int argc, /* I - Number of command-line args */ if (num_files == 1) fd = open(files[0], O_RDONLY); else - fd = 0; + { + fd = 0; + http_status = cupsWriteRequestData(http, buffer, bytes); + } - while ((bytes = read(fd, buffer, sizeof(buffer))) > 0) + while (http_status == HTTP_CONTINUE) { - fprintf(stderr, "DEBUG: Read %d bytes...\n", (int)bytes); + /* + * Check for side-channel requests and more print data... + */ - if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE) - break; - else - { - /* - * Check for side-channel requests... - */ + FD_ZERO(&input); + FD_SET(fd, &input); + FD_SET(snmp_fd, &input); + while (select(fd > snmp_fd ? fd + 1 : snmp_fd + 1, &input, NULL, NULL, + NULL) <= 0 && !job_canceled); + + if (FD_ISSET(snmp_fd, &input)) backendCheckSideChannel(snmp_fd, http->hostaddr); + + if (FD_ISSET(fd, &input)) + { + if ((bytes = read(fd, buffer, sizeof(buffer))) > 0) + { + fprintf(stderr, "DEBUG: Read %d bytes...\n", (int)bytes); + + if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE) + break; + } + else if (bytes == 0 || (errno != EINTR && errno != EAGAIN)) + break; } } @@ -1311,6 +1448,8 @@ main(int argc, /* I - Number of command-line args */ { _cupsLangPrintFilter(stderr, "INFO", _("Print file accepted - job ID unknown.")); + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-job-id"); job_id = 0; } else @@ -1462,6 +1601,8 @@ main(int argc, /* I - Number of command-line args */ * Job has gone away and/or the server has no job history... */ + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-job-history"); ippDelete(response); ipp_status = IPP_OK; @@ -1493,18 +1634,23 @@ main(int argc, /* I - Number of command-line args */ * Reflect the remote job state in the local queue... */ - fputs("STATE: -cups-remote-pending," - "cups-remote-pending-held," - "cups-remote-processing," - "cups-remote-stopped," - "cups-remote-canceled," - "cups-remote-aborted," - "cups-remote-completed\n", stderr); - if (job_state->values[0].integer >= IPP_JOB_PENDING && + if (cups_version && + job_state->values[0].integer >= IPP_JOB_PENDING && job_state->values[0].integer <= IPP_JOB_COMPLETED) - fprintf(stderr, "STATE: +%s\n", - remote_job_states[job_state->values[0].integer - - IPP_JOB_PENDING]); + update_reasons(NULL, + remote_job_states[job_state->values[0].integer - + IPP_JOB_PENDING]); + + if ((job_sheets = ippFindAttribute(response, + "job-media-sheets-completed", + IPP_TAG_INTEGER)) == NULL) + job_sheets = ippFindAttribute(response, + "job-impressions-completed", + IPP_TAG_INTEGER); + + if (job_sheets) + fprintf(stderr, "PAGE: total %d\n", + job_sheets->values[0].integer); /* * Stop polling if the job is finished or pending-held... @@ -1512,12 +1658,6 @@ main(int argc, /* I - Number of command-line args */ if (job_state->values[0].integer > IPP_JOB_STOPPED) { - if ((job_sheets = ippFindAttribute(response, - "job-media-sheets-completed", - IPP_TAG_INTEGER)) != NULL) - fprintf(stderr, "PAGE: total %d\n", - job_sheets->values[0].integer); - ippDelete(response); break; } @@ -1530,8 +1670,8 @@ main(int argc, /* I - Number of command-line args */ * the job... */ - fputs("DEBUG: No job-state available from printer - stopping queue.\n", - stderr); + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-job-state"); ipp_status = IPP_INTERNAL_ERROR; break; } @@ -1738,7 +1878,7 @@ check_printer_state( #ifdef HAVE_LIBZ /* - * 'compress_files()' - Compress print files... + * 'compress_files()' - Compress print files. */ static void @@ -1808,7 +1948,7 @@ compress_files(int num_files, /* I - Number of files */ /* - * 'monitor_printer()' - Monitor the printer state... + * 'monitor_printer()' - Monitor the printer state. */ static void * /* O - Thread exit code */ @@ -2139,7 +2279,7 @@ new_request( collate_str = "separate-documents-collated-copies"; else collate_str = "separate-documents-uncollated-copies"; - + for (i = 0; i < doc_handling_sup->num_values; i ++) if (!strcmp(doc_handling_sup->values[i].string.text, collate_str)) { @@ -2205,10 +2345,11 @@ password_cb(const char *prompt) /* I - Prompt (not used) */ 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 */ + int i; /* Looping var */ + char value[1024], /* Value string */ + *valptr, /* Pointer into value string */ + *attrptr; /* Pointer into attribute value */ + const char *cached; /* Cached attribute */ /* @@ -2258,11 +2399,17 @@ report_attr(ipp_attribute_t *attr) /* I - Attribute */ *valptr = '\0'; - /* - * Tell the scheduler about the new values... - */ + if ((cached = cupsGetOption(attr->name, num_attr_cache, + attr_cache)) == NULL || strcmp(cached, value)) + { + /* + * Tell the scheduler about the new values... + */ - fprintf(stderr, "ATTR: %s=%s\n", attr->name, value); + num_attr_cache = cupsAddOption(attr->name, value, num_attr_cache, + &attr_cache); + fprintf(stderr, "ATTR: %s=%s\n", attr->name, value); + } } @@ -2274,15 +2421,12 @@ static int /* O - Number of reasons shown */ report_printer_state(ipp_t *ipp, /* I - IPP response */ int job_id) /* I - Current job ID */ { - int i; /* Looping var */ int count; /* Count of reasons shown... */ ipp_attribute_t *pa, /* printer-alert */ *pam, /* printer-alert-message */ *psm, /* printer-state-message */ *reasons, /* printer-state-reasons */ *marker; /* marker-* attributes */ - const char *reason; /* Current reason */ - const char *prefix; /* Prefix for STATE: line */ char value[1024], /* State/message string */ *valptr; /* Pointer into string */ static int ipp_supplies = -1; @@ -2340,31 +2484,7 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */ IPP_TAG_KEYWORD)) == NULL) return (0); - value[0] = '\0'; - prefix = "STATE: "; - - for (i = 0, count = 0, valptr = value; i < reasons->num_values; i ++) - { - reason = reasons->values[i].string.text; - - if (strcmp(reason, "paused") && - strcmp(reason, "com.apple.print.recoverable-warning")) - { - strlcpy(valptr, prefix, sizeof(value) - (valptr - value) - 1); - valptr += strlen(valptr); - strlcpy(valptr, reason, sizeof(value) - (valptr - value) - 1); - valptr += strlen(valptr); - - prefix = ","; - } - } - - if (value[0]) - { - *valptr++ = '\n'; - *valptr = '\0'; - fputs(value, stderr); - } + update_reasons(reasons, NULL); /* * Relay the current marker-* attribute values... @@ -2412,6 +2532,196 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */ } +#if defined(HAVE_GSSAPI) && defined(HAVE_XPC) +/* + * 'run_as_user()' - Run the IPP backend as the printing user. + * + * This function uses an XPC-based user agent to run the backend as the printing + * user. We need to do this in order to have access to the user's Kerberos + * credentials. + */ + +static int /* O - Exit status */ +run_as_user(int argc, /* I - Number of command-line args */ + char *argv[], /* I - Command-line arguments */ + uid_t uid, /* I - User ID */ + const char *device_uri, /* I - Device URI */ + int fd) /* I - File to print */ +{ + xpc_connection_t conn; /* Connection to XPC service */ + xpc_object_t request; /* Request message dictionary */ + __block xpc_object_t response; /* Response message dictionary */ + dispatch_semaphore_t sem; /* Semaphore for waiting for response */ + int status = CUPS_BACKEND_FAILED; + /* Status of request */ + + + fprintf(stderr, "DEBUG: Running IPP backend as UID %d.\n", (int)uid); + + /* + * Connect to the user agent for the specified UID... + */ + + conn = xpc_connection_create_mach_service(kPMPrintUIToolAgent, + dispatch_get_global_queue(0, 0), 0); + if (!conn) + { + _cupsLangPrintFilter(stderr, "ERROR", + _("Unable to start backend process.")); + fputs("DEBUG: Unable to create connection to agent.\n", stderr); + goto cleanup; + } + + xpc_connection_set_event_handler(conn, + ^(xpc_object_t event) + { + xpc_type_t messageType = xpc_get_type(event); + + if (messageType == XPC_TYPE_ERROR) + { + if (event == XPC_ERROR_CONNECTION_INTERRUPTED) + fprintf(stderr, "DEBUG: Interrupted connection to service %s.\n", + xpc_connection_get_name(conn)); + else if (event == XPC_ERROR_CONNECTION_INVALID) + fprintf(stderr, "DEBUG: Connection invalid for service %s.\n", + xpc_connection_get_name(conn)); + else + fprintf(stderr, "DEBUG: Unxpected error for service %s: %s\n", + xpc_connection_get_name(conn), + xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION)); + } + }); + xpc_connection_set_target_uid(conn, uid); + xpc_connection_resume(conn); + + /* + * Try starting the backend... + */ + + request = xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_int64(request, "command", kPMStartJob); + xpc_dictionary_set_string(request, "device-uri", device_uri); + xpc_dictionary_set_string(request, "job-id", argv[1]); + xpc_dictionary_set_string(request, "user", argv[2]); + xpc_dictionary_set_string(request, "title", argv[3]); + xpc_dictionary_set_string(request, "copies", argv[4]); + xpc_dictionary_set_string(request, "options", argv[5]); + xpc_dictionary_set_string(request, "auth-info-required", + getenv("AUTH_INFO_REQUIRED")); + xpc_dictionary_set_fd(request, "stdin", fd); + xpc_dictionary_set_fd(request, "stderr", 2); + xpc_dictionary_set_fd(request, "side-channel", CUPS_SC_FD); + + sem = dispatch_semaphore_create(0); + response = NULL; + + xpc_connection_send_message_with_reply(conn, request, + dispatch_get_global_queue(0,0), + ^(xpc_object_t reply) + { + /* Save the response and wake up */ + if (xpc_get_type(reply) + == XPC_TYPE_DICTIONARY) + response = xpc_retain(reply); + + dispatch_semaphore_signal(sem); + }); + + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + xpc_release(request); + dispatch_release(sem); + + if (response) + { + child_pid = xpc_dictionary_get_int64(response, "child-pid"); + + xpc_release(response); + + if (child_pid) + fprintf(stderr, "DEBUG: Child PID=%d.\n", child_pid); + else + { + _cupsLangPrintFilter(stderr, "ERROR", + _("Unable to start backend process.")); + fputs("DEBUG: No child PID.\n", stderr); + goto cleanup; + } + } + else + { + _cupsLangPrintFilter(stderr, "ERROR", + _("Unable to start backend process.")); + fputs("DEBUG: No reply from agent.\n", stderr); + goto cleanup; + } + + /* + * Then wait for the backend to finish... + */ + + request = xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_int64(request, "command", kPMWaitForJob); + xpc_dictionary_set_fd(request, "stderr", 2); + + sem = dispatch_semaphore_create(0); + response = NULL; + + xpc_connection_send_message_with_reply(conn, request, + dispatch_get_global_queue(0,0), + ^(xpc_object_t reply) + { + /* Save the response and wake up */ + if (xpc_get_type(reply) + == XPC_TYPE_DICTIONARY) + response = xpc_retain(reply); + + dispatch_semaphore_signal(sem); + }); + + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + xpc_release(request); + dispatch_release(sem); + + if (response) + { + status = xpc_dictionary_get_int64(response, "status"); + + if (status == SIGTERM || status == SIGKILL || status == SIGPIPE) + { + fprintf(stderr, "DEBUG: Child terminated on signal %d.\n", status); + status = CUPS_BACKEND_FAILED; + } + else if (WIFSIGNALED(status)) + { + fprintf(stderr, "DEBUG: Child crashed on signal %d.\n", status); + status = CUPS_BACKEND_STOP; + } + else if (WIFEXITED(status)) + { + status = WEXITSTATUS(status); + fprintf(stderr, "DEBUG: Child exited with status %d.\n", status); + } + + xpc_release(response); + } + else + _cupsLangPrintFilter(stderr, "ERROR", + _("Unable to get backend exit status.")); + + cleanup: + + if (conn) + { + xpc_connection_suspend(conn); + xpc_connection_cancel(conn); + xpc_release(conn); + } + + return (status); +} +#endif /* HAVE_GSSAPI && HAVE_XPC */ + + /* * 'sigterm_handler()' - Handle 'terminate' signals that stop the backend. */ @@ -2421,10 +2731,18 @@ sigterm_handler(int sig) /* I - Signal */ { (void)sig; /* remove compiler warnings... */ +#if defined(HAVE_GSSAPI) && defined(HAVE_XPC) + if (child_pid) + { + kill(child_pid, sig); + child_pid = 0; + } +#endif /* HAVE_GSSAPI && HAVE_XPC */ + if (!job_canceled) { /* - * Flag that the job should be cancelled... + * Flag that the job should be canceled... */ job_canceled = 1; @@ -2433,7 +2751,7 @@ sigterm_handler(int sig) /* I - Signal */ /* * The scheduler already tried to cancel us once, now just terminate - * after removing our temp files! + * after removing our temp file! */ if (tmpfilename[0]) @@ -2444,5 +2762,201 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 7948 2008-09-17 00:04:12Z mike $". + * 'update_reasons()' - Update the printer-state-reasons values. + */ + +static void +update_reasons(ipp_attribute_t *attr, /* I - printer-state-reasons or NULL */ + const char *s) /* I - STATE: string or NULL */ +{ + char op; /* Add (+), remove (-), replace (\0) */ + cups_array_t *new_reasons; /* New reasons array */ + char *reason, /* Current reason */ + add[2048], /* Reasons added string */ + *addptr, /* Pointer into add string */ + rem[2048], /* Reasons removed string */ + *remptr; /* Pointer into remove string */ + const char *addprefix, /* Current add string prefix */ + *remprefix; /* Current remove string prefix */ + + + fprintf(stderr, "DEBUG: update_reasons(attr=%d(%s%s), s=\"%s\")\n", + attr ? attr->num_values : 0, attr ? attr->values[0].string.text : "", + attr && attr->num_values > 1 ? ",..." : "", s ? s : "(null)"); + + /* + * Create an array of new reason keyword strings... + */ + + if (attr) + { + int i; /* Looping var */ + + new_reasons = cupsArrayNew((cups_array_func_t)strcmp, NULL); + op = '\0'; + + for (i = 0; i < attr->num_values; i ++) + { + reason = attr->values[i].string.text; + + if (strcmp(reason, "none") && + strcmp(reason, "none-report") && + strcmp(reason, "paused") && + strcmp(reason, "com.apple.print.recoverable-warning") && + strncmp(reason, "cups-", 5)) + cupsArrayAdd(new_reasons, reason); + } + } + else if (s) + { + if (*s == '+' || *s == '-') + op = *s++; + else + op = '\0'; + + new_reasons = _cupsArrayNewStrings(s); + } + else + return; + + /* + * Compute the changes... + */ + + add[0] = '\0'; + addprefix = "STATE: +"; + addptr = add; + rem[0] = '\0'; + remprefix = "STATE: -"; + remptr = rem; + + fprintf(stderr, "DEBUG2: op='%c', new_reasons=%d, state_reasons=%d\n", + op ? op : ' ', cupsArrayCount(new_reasons), + cupsArrayCount(state_reasons)); + + _cupsMutexLock(&state_mutex); + + if (op == '+') + { + /* + * Add reasons... + */ + + for (reason = (char *)cupsArrayFirst(new_reasons); + reason; + reason = (char *)cupsArrayNext(new_reasons)) + { + if (!cupsArrayFind(state_reasons, reason)) + { + if (!strncmp(reason, "cups-remote-", 12)) + { + /* + * If we are setting cups-remote-xxx, remove all other cups-remote-xxx + * keywords... + */ + + char *temp; /* Current reason in state_reasons */ + + cupsArraySave(state_reasons); + + for (temp = (char *)cupsArrayFirst(state_reasons); + temp; + temp = (char *)cupsArrayNext(state_reasons)) + if (!strncmp(temp, "cups-remote-", 12)) + { + snprintf(remptr, sizeof(rem) - (remptr - rem), "%s%s", remprefix, + temp); + remptr += strlen(remptr); + remprefix = ","; + + cupsArrayRemove(state_reasons, temp); + break; + } + + cupsArrayRestore(state_reasons); + } + + cupsArrayAdd(state_reasons, reason); + + snprintf(addptr, sizeof(add) - (addptr - add), "%s%s", addprefix, + reason); + addptr += strlen(addptr); + addprefix = ","; + } + } + } + else if (op == '-') + { + /* + * Remove reasons... + */ + + for (reason = (char *)cupsArrayFirst(new_reasons); + reason; + reason = (char *)cupsArrayNext(new_reasons)) + { + if (cupsArrayFind(state_reasons, reason)) + { + snprintf(remptr, sizeof(rem) - (remptr - rem), "%s%s", remprefix, + reason); + remptr += strlen(remptr); + remprefix = ","; + + cupsArrayRemove(state_reasons, reason); + } + } + } + else + { + /* + * Replace reasons... + */ + + for (reason = (char *)cupsArrayFirst(state_reasons); + reason; + reason = (char *)cupsArrayNext(state_reasons)) + { + if (strncmp(reason, "cups-", 5) && !cupsArrayFind(new_reasons, reason)) + { + snprintf(remptr, sizeof(rem) - (remptr - rem), "%s%s", remprefix, + reason); + remptr += strlen(remptr); + remprefix = ","; + + cupsArrayRemove(state_reasons, reason); + } + } + + for (reason = (char *)cupsArrayFirst(new_reasons); + reason; + reason = (char *)cupsArrayNext(new_reasons)) + { + if (!cupsArrayFind(state_reasons, reason)) + { + cupsArrayAdd(state_reasons, reason); + + snprintf(addptr, sizeof(add) - (addptr - add), "%s%s", addprefix, + reason); + addptr += strlen(addptr); + addprefix = ","; + } + } + } + + _cupsMutexUnlock(&state_mutex); + + /* + * Report changes and return... + */ + + if (add[0] && rem[0]) + fprintf(stderr, "%s\n%s\n", add, rem); + else if (add[0]) + fprintf(stderr, "%s\n", add); + else if (rem[0]) + fprintf(stderr, "%s\n", rem); +} + +/* + * End of "$Id: ipp.c 9759 2011-05-11 03:24:33Z mike $". */ diff --git a/backend/lpd.c b/backend/lpd.c index d17493af3..90446addf 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -141,6 +141,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ timeout, /* Timeout */ contimeout, /* Connection timeout */ copies; /* Number of copies */ + ssize_t bytes = 0; /* Initial bytes read */ + char buffer[16384]; /* Initial print buffer */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ @@ -431,8 +433,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ */ if (argc == 6) + { if (!backendWaitLoop(snmp_fd, &(addrlist->addr), 0, backendNetworkSideCB)) return (CUPS_BACKEND_OK); + else if (mode == MODE_STANDARD && + (bytes = read(0, buffer, sizeof(buffer))) <= 0) + return (CUPS_BACKEND_OK); + } /* * If we have 7 arguments, print the file named on the command-line. @@ -454,7 +461,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ _cupsLangPrintFilter(stderr, "INFO", _("Copying print data.")); - backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0, + if (bytes > 0) + write(fd, buffer, bytes); + + backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0, backendNetworkSideCB); } else if (argc == 6) diff --git a/backend/snmp-supplies.c b/backend/snmp-supplies.c index 86854b120..1d550e6e6 100644 --- a/backend/snmp-supplies.c +++ b/backend/snmp-supplies.c @@ -40,12 +40,10 @@ #define CUPS_DEVELOPER_EMPTY 2 #define CUPS_MARKER_SUPPLY_LOW 4 #define CUPS_MARKER_SUPPLY_EMPTY 8 -#define CUPS_MARKER_WASTE_ALMOST_FULL 16 -#define CUPS_MARKER_WASTE_FULL 32 -#define CUPS_OPC_NEAR_EOL 64 -#define CUPS_OPC_LIFE_OVER 128 -#define CUPS_TONER_LOW 256 -#define CUPS_TONER_EMPTY 512 +#define CUPS_OPC_NEAR_EOL 16 +#define CUPS_OPC_LIFE_OVER 32 +#define CUPS_TONER_LOW 64 +#define CUPS_TONER_EMPTY 128 /* @@ -172,8 +170,6 @@ static const backend_state_t const supply_states[] = { CUPS_DEVELOPER_EMPTY, "developer-empty-warning" }, { CUPS_MARKER_SUPPLY_LOW, "marker-supply-low-report" }, { CUPS_MARKER_SUPPLY_EMPTY, "marker-supply-empty-warning" }, - { CUPS_MARKER_WASTE_ALMOST_FULL, "marker-waste-almost-full-report" }, - { CUPS_MARKER_WASTE_FULL, "marker-waste-full-warning" }, { CUPS_OPC_NEAR_EOL, "opc-near-eol-report" }, { CUPS_OPC_LIFE_OVER, "opc-life-over-warning" }, { CUPS_TONER_LOW, "toner-low-report" }, @@ -251,10 +247,6 @@ backendSNMPSupplies( break; case CUPS_TC_wasteToner : case CUPS_TC_wasteInk : - if (percent <= 1) - new_supply_state |= CUPS_MARKER_WASTE_FULL; - else - new_supply_state |= CUPS_MARKER_WASTE_ALMOST_FULL; break; case CUPS_TC_ink : case CUPS_TC_inkCartridge : diff --git a/backend/socket.c b/backend/socket.c index d993dbabc..f6fc150ea 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,7 +1,7 @@ /* * "$Id: socket.c 7881 2008-08-28 20:21:56Z mike $" * - * AppSocket backend for the Common UNIX Printing System (CUPS). + * AppSocket backend for CUPS. * * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. @@ -91,7 +91,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ start_count, /* Page count via SNMP at start */ page_count, /* Page count via SNMP */ have_supplies; /* Printer supports supply levels? */ - ssize_t tbytes; /* Total number of bytes written */ + ssize_t bytes = 0, /* Initial bytes read */ + tbytes; /* Total number of bytes written */ + char buffer[1024]; /* Initial print buffer */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ @@ -297,8 +299,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ */ if (print_fd == 0) + { if (!backendWaitLoop(snmp_fd, &(addrlist->addr), 1, backendNetworkSideCB)) return (CUPS_BACKEND_OK); + else if ((bytes = read(0, buffer, sizeof(buffer))) <= 0) + return (CUPS_BACKEND_OK); + } /* * Connect to the printer... @@ -398,6 +404,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ tbytes = 0; + if (bytes > 0) + tbytes += write(device_fd, buffer, bytes); + while (copies > 0 && tbytes >= 0) { copies --; diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 63061fc13..2f0001997 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -271,9 +271,9 @@ static CFStringRef cfstr_create_trim(const char *cstr); static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys); static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_t ***printerDriver); static kern_return_t load_printerdriver(CFStringRef *driverBundlePath); -static kern_return_t registry_close(); +static kern_return_t registry_close(void); static kern_return_t registry_open(CFStringRef *driverBundlePath); -static kern_return_t unload_classdriver(); +static kern_return_t unload_classdriver(classdriver_t ***classdriver); static OSStatus copy_deviceid(classdriver_t **printer, CFStringRef *deviceID); static void *read_thread(void *reference); static void *sidechannel_thread(void *reference); @@ -285,7 +285,7 @@ static void iterate_printers(iterator_callback_t callBack, void *userdata); static void parse_options(char *options, char *serial, int serial_size, UInt32 *location, Boolean *wait_eof); static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial); static void setup_cfLanguage(void); -static void soft_reset(); +static void soft_reset(void); static void status_timer_cb(CFRunLoopTimerRef timer, void *info); #if defined(__i386__) || defined(__x86_64__) @@ -1567,7 +1567,7 @@ static kern_return_t registry_open(CFStringRef *driverBundlePath) * 'registry_close()' - Close the connection to the printer. */ -static kern_return_t registry_close() +static kern_return_t registry_close(void) { if (g.classdriver != NULL) (*g.classdriver)->Close(g.classdriver); @@ -2191,7 +2191,7 @@ static void parse_pserror(char *sockBuffer, * 'soft_reset()' - Send a soft reset to the device. */ -static void soft_reset() +static void soft_reset(void) { fd_set input_set; /* Input set for select() */ struct timeval tv; /* Time value */ diff --git a/berkeley/lpq.c b/berkeley/lpq.c index 9e3f73d11..24e49e423 100644 --- a/berkeley/lpq.c +++ b/berkeley/lpq.c @@ -116,7 +116,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsSetUser(argv[i]); } break; - + case 'P' : /* Printer */ if (argv[i][2]) dest = argv[i] + 2; @@ -128,7 +128,7 @@ main(int argc, /* I - Number of command-line arguments */ { httpClose(http); cupsFreeDests(num_dests, dests); - + usage(); } @@ -507,6 +507,7 @@ show_jobs(const char *command, /* I - Command name */ if (!longstatus && jobcount == 0) #ifdef __osf__ _cupsLangPuts(stdout, + /* TRANSLATORS: Pri is job priority. */ _("Rank Owner Pri Job Files" " Total Size")); #else diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index 05fa23b38..fdd1c47ac 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -3666,14 +3666,18 @@ do_set_options(http_t *http, /* I - HTTP connection */ attr = ippFindAttribute(response, "job-sheets-default", IPP_TAG_ZERO); cgiSetVariable("KEYWORD", "job_sheets_start"); - cgiSetVariable("KEYTEXT", cgiText(_("Starting Banner"))); + cgiSetVariable("KEYTEXT", + /* TRANSLATORS: Banner/cover sheet before the print job. */ + cgiText(_("Starting Banner"))); cgiSetVariable("DEFCHOICE", attr != NULL ? attr->values[0].string.text : ""); cgiCopyTemplateLang("option-pickone.tmpl"); cgiSetVariable("KEYWORD", "job_sheets_end"); - cgiSetVariable("KEYTEXT", cgiText(_("Ending Banner"))); + cgiSetVariable("KEYTEXT", + /* TRANSLATORS: Banner/cover sheet after the print job. */ + cgiText(_("Ending Banner"))); cgiSetVariable("DEFCHOICE", attr != NULL && attr->num_values > 1 ? attr->values[1].string.text : ""); diff --git a/conf/mime.convs.in b/conf/mime.convs.in index 804546c9e..83e7301ec 100644 --- a/conf/mime.convs.in +++ b/conf/mime.convs.in @@ -38,55 +38,50 @@ # PostScript filters # -application/pdf application/vnd.cups-postscript 66 pdftops +@DEFAULT_PDFTOPS@application/pdf application/vnd.cups-postscript 66 pdftops application/postscript application/vnd.cups-postscript 66 pstops -application/x-cshell application/postscript 33 texttops -application/x-csource application/postscript 33 texttops -application/x-perl application/postscript 33 texttops -application/x-shell application/postscript 33 texttops -text/plain application/postscript 33 texttops -text/css application/postscript 33 texttops -text/html application/postscript 33 texttops -image/gif application/vnd.cups-postscript 66 imagetops -image/png application/vnd.cups-postscript 66 imagetops -image/jpeg application/vnd.cups-postscript 66 imagetops -image/tiff application/vnd.cups-postscript 66 imagetops -image/x-bitmap application/vnd.cups-postscript 66 imagetops -image/x-photocd application/vnd.cups-postscript 66 imagetops -image/x-portable-anymap application/vnd.cups-postscript 66 imagetops -image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops -image/x-portable-graymap application/vnd.cups-postscript 66 imagetops -image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops -image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops -image/x-xbitmap application/vnd.cups-postscript 66 imagetops -image/x-xpixmap application/vnd.cups-postscript 66 imagetops -#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops -image/x-sun-raster application/vnd.cups-postscript 66 imagetops -application/vnd.cups-banner application/postscript 33 bannertops +@DEFAULT_TEXTTOPS@application/x-cshell application/postscript 33 texttops +@DEFAULT_TEXTTOPS@application/x-csource application/postscript 33 texttops +@DEFAULT_TEXTTOPS@application/x-perl application/postscript 33 texttops +@DEFAULT_TEXTTOPS@application/x-shell application/postscript 33 texttops +@DEFAULT_TEXTTOPS@text/plain application/postscript 33 texttops +@DEFAULT_TEXTTOPS@text/css application/postscript 33 texttops +@DEFAULT_TEXTTOPS@text/html application/postscript 33 texttops +@DEFAULT_IMAGEFILTERS@image/gif application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/png application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/jpeg application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/tiff application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-bitmap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-photocd application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-portable-anymap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-portable-graymap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-xbitmap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-xpixmap application/vnd.cups-postscript 66 imagetops +@DEFAULT_IMAGEFILTERS@image/x-sun-raster application/vnd.cups-postscript 66 imagetops +@DEFAULT_BANNERTOPS@application/vnd.cups-banner application/postscript 33 bannertops ######################################################################## # # Raster filters... # -image/gif application/vnd.cups-raster 100 imagetoraster -image/png application/vnd.cups-raster 100 imagetoraster -image/jpeg application/vnd.cups-raster 100 imagetoraster -image/tiff application/vnd.cups-raster 100 imagetoraster -image/x-bitmap application/vnd.cups-raster 100 imagetoraster -image/x-photocd application/vnd.cups-raster 100 imagetoraster -image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster -image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster -image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster -image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster -image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster -image/x-xbitmap application/vnd.cups-raster 100 imagetoraster -image/x-xpixmap application/vnd.cups-raster 100 imagetoraster -#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster -image/x-sun-raster application/vnd.cups-raster 100 imagetoraster - -# pstoraster is part of GPL Ghostscript... -application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster +@DEFAULT_IMAGEFILTERS@image/gif application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/png application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/jpeg application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/tiff application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-bitmap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-photocd application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-portable-graymap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-xbitmap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-xpixmap application/vnd.cups-raster 100 imagetoraster +@DEFAULT_IMAGEFILTERS@image/x-sun-raster application/vnd.cups-raster 100 imagetoraster # PWG Raster filter for IPP Everywhere... application/vnd.cups-raster image/pwg-raster 100 rastertopwg diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 5d4fe5bd6..88a2e4378 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -306,6 +306,7 @@ AC_SUBST(DBUS_NOTIFIERLIBS) dnl Extra platform-specific libraries... CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM" CUPS_SYSTEM_AUTHKEY="" +INSTALLXPC="" LEGACY_BACKENDS="parallel" case $uname in @@ -353,7 +354,7 @@ case $uname in 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) @@ -378,12 +379,18 @@ case $uname in if test $uversion -ge 100; then AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H)) fi + + dnl Check for XPC support + AC_CHECK_HEADER(xpc/xpc.h, + AC_DEFINE(HAVE_XPC) + INSTALLXPC="install-xpc") ;; esac AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH") AC_SUBST(CUPS_SYSTEM_AUTHKEY) +AC_SUBST(INSTALLXPC) AC_SUBST(LEGACY_BACKENDS) dnl Check for build components diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index 998574387..a568edb21 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -440,25 +440,35 @@ AC_ARG_ENABLE(texttops, [ --enable-texttops always build the text filter if test "x$enable_bannertops" = xno; then BANNERTOPS="" + DEFAULT_BANNERTOPS="#" elif test "x$enable_bannertops" = xyes; then BANNERTOPS="bannertops" + DEFAULT_BANNERTOPS="" elif test $uname = Darwin; then BANNERTOPS="" + DEFAULT_BANNERTOPS="#" else BANNERTOPS="bannertops" + DEFAULT_BANNERTOPS="" fi if test "x$enable_texttops" = xno; then TEXTTOPS="" + DEFAULT_TEXTTOPS="#" elif test "x$enable_texttops" = xyes; then TEXTTOPS="texttops" + DEFAULT_TEXTTOPS="" elif test $uname = Darwin; then TEXTTOPS="" + DEFAULT_TEXTTOPS="#" else TEXTTOPS="texttops" + DEFAULT_TEXTTOPS="" fi AC_SUBST(BANNERTOPS) +AC_SUBST(DEFAULT_BANNERTOPS) +AC_SUBST(DEFAULT_TEXTTOPS) AC_SUBST(TEXTTOPS) dnl Fonts diff --git a/config-scripts/cups-gssapi.m4 b/config-scripts/cups-gssapi.m4 index 7c61735b8..dc1092890 100644 --- a/config-scripts/cups-gssapi.m4 +++ b/config-scripts/cups-gssapi.m4 @@ -28,19 +28,26 @@ if test x$enable_gssapi != xno; then Darwin) # Mac OS X weak-links to the Kerberos framework... LIBGSSAPI="-weak_framework Kerberos" + AC_MSG_CHECKING(for GSS framework) + if test -d /System/Library/Frameworks/GSS.framework; then + AC_MSG_RESULT(yes) + LIBGSSAPI="$LIBGSSAPI -weak_framework GSS" + else + AC_MSG_RESULT(no) + fi ;; SunOS*) # Solaris has a non-standard krb5-config, don't use it! AC_CHECK_LIB(gss, gss_display_status, AC_DEFINE(HAVE_GSSAPI, 1, [Whether GSSAPI is available]) - CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS" - CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS" + CFLAGS="`$KRB5CONFIG --cflags` $CFLAGS" + CPPFLAGS="`$KRB5CONFIG --cflags` $CPPFLAGS" LIBGSSAPI="-lgss `$KRB5CONFIG --libs`") ;; *) # Other platforms just ask for GSSAPI - CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS" - CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS" + CFLAGS="`$KRB5CONFIG --cflags gssapi` $CFLAGS" + CPPFLAGS="`$KRB5CONFIG --cflags gssapi` $CPPFLAGS" LIBGSSAPI="`$KRB5CONFIG --libs gssapi`" ;; esac @@ -63,26 +70,37 @@ if test x$enable_gssapi != xno; then if test "x$LIBGSSAPI" != x; then AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H)) - AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H)) - AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H)) - AC_CHECK_HEADER(gssapi/gssapi_generic.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_GENERIC_H)) - AC_CHECK_HEADER(gssapi/gssapi_krb5.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_KRB5_H)) + if test -d /System/Library/Frameworks/GSS.framework; then + AC_CHECK_HEADER(GSS/gssapi.h, AC_DEFINE(HAVE_GSS_GSSAPI_H)) + AC_CHECK_HEADER(GSS/gssapi_generic.h, AC_DEFINE(HAVE_GSSAPI_GENERIC_H)) + AC_CHECK_HEADER(GSS/gssapi_krb5.h, AC_DEFINE(HAVE_GSSAPI_KRB5_H)) + AC_CHECK_HEADER(GSS/gssapi_spi.h, AC_DEFINE(HAVE_GSS_GSSAPI_SPI_H)) + else + AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H)) + AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H)) + AC_CHECK_HEADER(gssapi/gssapi_generic.h, AC_DEFINE(HAVE_GSSAPI_GENERIC_H)) + AC_CHECK_HEADER(gssapi/gssapi_krb5.h, AC_DEFINE(HAVE_GSSAPI_KRB5_H)) + fi SAVELIBS="$LIBS" LIBS="$LIBS $LIBGSSAPI" - AC_CHECK_FUNC(gsskrb5_register_acceptor_identity, - AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY)) - AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE)) - AC_CHECK_FUNC(krb5_ipc_client_set_target_uid, AC_DEFINE(HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID)) + AC_CHECK_FUNC(__ApplePrivate_gss_acquire_cred_ex_f, + AC_DEFINE(HAVE_GSS_ACQUIRE_CRED_EX_F)) AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE) - if test $ac_cv_header_gssapi_gssapi_h = yes; then + if test x$ac_cv_header_gssapi_gssapi_h = xyes; then AC_TRY_COMPILE([ #include ], [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) + elif test x$ac_cv_header_gss_gssapi_h = xyes; then + AC_TRY_COMPILE([ #include ], + [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], + AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) else AC_TRY_COMPILE([ #include ], [ gss_OID foo = GSS_C_NT_HOSTBASED_SERVICE; ], @@ -92,13 +110,6 @@ if test x$enable_gssapi != xno; then fi LIBS="$SAVELIBS" - - AC_MSG_CHECKING(for Heimdal Kerberos) - AC_TRY_COMPILE([ #include ], - [ char *tmp = heimdal_version; ], - AC_DEFINE(HAVE_HEIMDAL) - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no)) fi fi diff --git a/config-scripts/cups-image.m4 b/config-scripts/cups-image.m4 index f25d58732..6df7befe2 100644 --- a/config-scripts/cups-image.m4 +++ b/config-scripts/cups-image.m4 @@ -1,9 +1,9 @@ dnl dnl "$Id: cups-image.m4 6649 2007-07-11 21:46:42Z mike $" dnl -dnl Image library/filter stuff for the Common UNIX Printing System (CUPS). +dnl Image library/filter stuff for CUPS. dnl -dnl Copyright 2007-2009 by Apple Inc. +dnl Copyright 2007-2011 by Apple Inc. dnl Copyright 1997-2006 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the @@ -16,17 +16,20 @@ dnl dnl See if we want the image filters included at all... AC_ARG_ENABLE(image, [ --enable-image always build the image filters]) +DEFAULT_IMAGEFILTERS="#" IMGFILTERS="" if test "x$enable_image" != xno; then AC_MSG_CHECKING(whether to build image filters) if test "x$enable_image" = xyes -o $uname != Darwin; then IMGFILTERS="imagetops imagetoraster" + DEFAULT_IMAGEFILTERS="" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi +AC_SUBST(DEFAULT_IMAGEFILTERS) AC_SUBST(IMGFILTERS) dnl Check for image libraries... diff --git a/config-scripts/cups-pdf.m4 b/config-scripts/cups-pdf.m4 index 0421aa732..575a5bac1 100644 --- a/config-scripts/cups-pdf.m4 +++ b/config-scripts/cups-pdf.m4 @@ -1,9 +1,9 @@ dnl dnl "$Id: cups-pdf.m4 7449 2008-04-14 18:27:53Z mike $" dnl -dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS). +dnl PDF filter configuration stuff for CUPS. dnl -dnl Copyright 2007-2009 by Apple Inc. +dnl Copyright 2007-2011 by Apple Inc. dnl Copyright 2006 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the @@ -79,8 +79,33 @@ case "x$with_pdftops" in ;; esac +if test "x$CUPS_PDFTOPS" != x; then + AC_MSG_CHECKING(whether pdftops supports -origpagesizes) + if ($CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes); then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PDFTOPS_WITH_ORIGPAGESIZES) + else + AC_MSG_RESULT(no) + fi + + DEFAULT_PDFTOPS="" +elif test "x$CUPS_GHOSTSCRIPT" != x; then + AC_MSG_CHECKING(whether gs supports the ps2write device) + if ($CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write); then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GHOSTSCRIPT_PS2WRITE) + else + AC_MSG_RESULT(no) + fi + + DEFAULT_PDFTOPS="" +else + DEFAULT_PDFTOPS="#" +fi + AC_DEFINE_UNQUOTED(CUPS_PDFTOPS, "$CUPS_PDFTOPS") AC_DEFINE_UNQUOTED(CUPS_GHOSTSCRIPT, "$CUPS_GHOSTSCRIPT") +AC_SUBST(DEFAULT_PDFTOPS) AC_SUBST(PDFTOPS) dnl diff --git a/config-scripts/cups-ssl.m4 b/config-scripts/cups-ssl.m4 index ce62dfd45..461d456da 100644 --- a/config-scripts/cups-ssl.m4 +++ b/config-scripts/cups-ssl.m4 @@ -38,12 +38,15 @@ if test x$enable_ssl != xno; then AC_DEFINE(HAVE_CDSASSL) dnl Check for the various security headers... + AC_CHECK_HEADER(Security/SecureTransportPriv.h, + AC_DEFINE(HAVE_SECURETRANSPORTPRIV_H)) AC_CHECK_HEADER(Security/SecCertificate.h, AC_DEFINE(HAVE_SECCERTIFICATE_H)) AC_CHECK_HEADER(Security/SecItem.h, AC_DEFINE(HAVE_SECITEM_H)) AC_CHECK_HEADER(Security/SecItemPriv.h, - AC_DEFINE(HAVE_SECITEMPRIV_H)) + AC_DEFINE(HAVE_SECITEMPRIV_H),, + [#include ]) AC_CHECK_HEADER(Security/SecPolicy.h, AC_DEFINE(HAVE_SECPOLICY_H)) AC_CHECK_HEADER(Security/SecPolicyPriv.h, @@ -89,25 +92,17 @@ if test x$enable_ssl != xno; then AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config) AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config) if $PKGCONFIG --exists gnutls; then - if test "x$have_pthread" = xyes; then - AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.]) - else - have_ssl=1 - SSLLIBS=`$PKGCONFIG --libs gnutls` - SSLFLAGS=`$PKGCONFIG --cflags gnutls` - AC_DEFINE(HAVE_SSL) - AC_DEFINE(HAVE_GNUTLS) - fi + have_ssl=1 + SSLLIBS=`$PKGCONFIG --libs gnutls` + SSLFLAGS=`$PKGCONFIG --cflags gnutls` + AC_DEFINE(HAVE_SSL) + AC_DEFINE(HAVE_GNUTLS) elif test "x$LIBGNUTLSCONFIG" != x; then - if test "x$have_pthread" = xyes; then - AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.]) - else - have_ssl=1 - SSLLIBS=`$LIBGNUTLSCONFIG --libs` - SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` - AC_DEFINE(HAVE_SSL) - AC_DEFINE(HAVE_GNUTLS) - fi + have_ssl=1 + SSLLIBS=`$LIBGNUTLSCONFIG --libs` + SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` + AC_DEFINE(HAVE_SSL) + AC_DEFINE(HAVE_GNUTLS) fi if test $have_ssl = 1; then @@ -156,13 +151,16 @@ if test x$enable_ssl != xno; then fi fi +IPPALIASES="http" if test $have_ssl = 1; then AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"]) AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"]) + IPPALIASES="http https ipps" elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = xyes; then AC_MSG_ERROR([Unable to enable SSL support.]) fi +AC_SUBST(IPPALIASES) AC_SUBST(SSLFLAGS) AC_SUBST(SSLLIBS) diff --git a/config.h.in b/config.h.in index 0f047a474..5517c4407 100644 --- a/config.h.in +++ b/config.h.in @@ -186,6 +186,7 @@ #undef HAVE_STRINGS_H #undef HAVE_BSTRING_H + /* * Do we have the long long type? */ @@ -200,6 +201,7 @@ # define CUPS_LLCAST (long) #endif /* HAVE_LONG_LONG */ + /* * Do we have the strtoll() function? */ @@ -210,6 +212,7 @@ # define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base)) #endif /* !HAVE_STRTOLL */ + /* * Do we have the strXXX() functions? */ @@ -296,13 +299,14 @@ */ #undef HAVE_AUTHORIZATION_H +#undef HAVE_SECBASEPRIV_H #undef HAVE_SECCERTIFICATE_H +#undef HAVE_SECIDENTITYSEARCHPRIV_H #undef HAVE_SECITEM_H #undef HAVE_SECITEMPRIV_H #undef HAVE_SECPOLICY_H #undef HAVE_SECPOLICYPRIV_H -#undef HAVE_SECBASEPRIV_H -#undef HAVE_SECIDENTITYSEARCHPRIV_H +#undef HAVE_SECURETRANSPORTPRIV_H /* @@ -498,6 +502,7 @@ */ #undef HAVE_PDFTOPS +#undef HAVE_PDFTOPS_WITH_ORIGPAGESIZES #define CUPS_PDFTOPS "/usr/bin/pdftops" @@ -506,6 +511,7 @@ */ #undef HAVE_GHOSTSCRIPT +#undef HAVE_GHOSTSCRIPT_PS2WRITE #define CUPS_GHOSTSCRIPT "/usr/bin/gs" @@ -541,7 +547,7 @@ /* - * Do we have MacOSX 10.4's mbr_XXX functions? + * Do we have Mac OS X 10.4's mbr_XXX functions? */ #undef HAVE_MEMBERSHIP_H @@ -572,28 +578,20 @@ #undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND -/* - * Do we have the AppleTalk/at_proto.h header? - */ - -#undef HAVE_APPLETALK_AT_PROTO_H - - /* * Do we have the GSSAPI support library (for Kerberos support)? */ +#undef HAVE_GSS_ACQUIRE_CRED_EX_F +#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE +#undef HAVE_GSS_GSSAPI_H +#undef HAVE_GSS_GSSAPI_SPI_H #undef HAVE_GSSAPI -#undef HAVE_GSSAPI_H +#undef HAVE_GSSAPI_GENERIC_H #undef HAVE_GSSAPI_GSSAPI_H -#undef HAVE_GSSAPI_GSSAPI_GENERIC_H -#undef HAVE_GSSAPI_GSSAPI_KRB5_H -#undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY -#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE -#undef HAVE_KRB5_CC_NEW_UNIQUE -#undef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID +#undef HAVE_GSSAPI_H +#undef HAVE_GSSAPI_KRB5_H #undef HAVE_KRB5_H -#undef HAVE_HEIMDAL /* @@ -724,6 +722,13 @@ #undef HAVE_COLORSYNCREGISTERDEVICE +/* + * Do we have XPC? + */ + +#undef HAVE_XPC + + #endif /* !_CUPS_CONFIG_H_ */ /* diff --git a/cups/Makefile b/cups/Makefile index 38fdcb645..6052bec01 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -110,6 +110,7 @@ HEADERS = \ versioning.h HEADERSPRIV = \ + array-private.h \ cups-private.h \ debug-private.h \ file-private.h \ diff --git a/cups/api-array.shtml b/cups/api-array.shtml index 0872d51e7..7246a7bd6 100644 --- a/cups/api-array.shtml +++ b/cups/api-array.shtml @@ -1,9 +1,9 @@ +
Note: + +

The CUPS Browse Protocol is deprecated and will no longer be used in a future release of CUPS.

+ +
+

CUPS Browse Protocol

Introduction

diff --git a/doc/help/spec-cmp.html b/doc/help/spec-cmp.html index ab9a1329c..47f56d31d 100644 --- a/doc/help/spec-cmp.html +++ b/doc/help/spec-cmp.html @@ -211,7 +211,7 @@ Detailed list of changes.

Primary development occurs on the trunk branch, with changes merged back to release branches as needed. Table 2 -shows the URLs developers use for the various CUPS subprojects +shows the URLs developers use for the various CUPS sub-projects and branches:

@@ -232,30 +232,6 @@ and branches:

- - - - - - - - - - - - - - - - - - - - - - - - @@ -283,7 +259,7 @@ created for developer snapshots.

Files and Directories

File and directory names may not exceed 16 characters in -length to ensure compability with older UNIX filesystems. In +length to ensure compatibility with older UNIX filesystems. In addition, to avoid problems with case-insensitive filesystems, you may not use names which differ only by case, for example "ReadMe" and "README" are not allowed in the same directory.

diff --git a/doc/help/spec-command.html b/doc/help/spec-command.html index 63170e005..06093574b 100644 --- a/doc/help/spec-command.html +++ b/doc/help/spec-command.html @@ -10,10 +10,9 @@
https://svn.easysw.com/public/cups/tags/ CUPS release tags (read-only)
https://svn.easysw.com/public/cupsddk/trunk/Primary CUPS DDK development branch
https://svn.easysw.com/public/cupsddk/branches/CUPS DDK maintenance branches (merge-only)
https://svn.easysw.com/public/cupsddk/tags/CUPS DDK release tags (read-only)
https://svn.easysw.com/public/espgs/trunk/Primary ESP Ghostscript development branch
https://svn.easysw.com/public/espgs/branches/ESP Ghostscript maintenance branches (merge-only)
https://svn.easysw.com/public/espgs/tags/ESP Ghostscript release tags (read-only)
https://svn.easysw.com/public/windows/trunk/ Primary CUPS Windows Driver development branch