From 0fa6c7fa54164ee70ee9ccfa936b889a637d5ecd Mon Sep 17 00:00:00 2001 From: msweet Date: Thu, 10 Jan 2013 17:01:44 +0000 Subject: [PATCH] Merge changes from CUPS 1.7svn-r10791. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@4120 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.6.txt | 15 +- CHANGES-IPPTOOL.txt | 12 +- IPPTOOL.txt | 4 +- README.txt | 2 +- backend/ipp.c | 40 +- backend/usb-darwin.c | 13 +- backend/usb-libusb.c | 19 +- cgi-bin/Makefile | 1 + conf/cups-files.conf.in | 4 +- config-scripts/cups-common.m4 | 4 +- config-scripts/cups-gssapi.m4 | 13 +- config.h.in | 3 - cups/dest-options.c | 2 +- cups/http-private.h | 28 +- cups/http-support.c | 34 +- cups/http.c | 833 ++++++++++++++++++---------------- cups/http.h | 4 + cups/ipp-support.c | 20 +- cups/ipp.c | 8 + cups/request.c | 19 + cups/versioning.h | 85 +++- doc/Makefile | 1 - doc/ca/index.html.in | 2 +- doc/es/index.html.in | 2 +- doc/help/man-ipptoolfile.html | 10 +- doc/help/spec-browsing.html | 118 ----- doc/index.html.in | 2 +- doc/ja/index.html.in | 2 +- filter/Makefile | 1 + filter/pstops.c | 3 +- man/backend.man | 4 +- man/cancel.man | 4 +- man/classes.conf.man | 4 +- man/client.conf.man.in | 4 +- man/cups-config.man | 4 +- man/cups-deviced.man.in | 4 +- man/cups-driverd.man.in | 4 +- man/cups-files.conf.man.in | 4 +- man/cups-lpd.man.in | 4 +- man/cups-snmp.conf.man | 4 +- man/cups-snmp.man.in | 4 +- man/cupsaccept.man | 4 +- man/cupsaddsmb.man.in | 4 +- man/cupsctl.man | 4 +- man/cupsd.conf.man.in | 4 +- man/cupsd.man.in | 4 +- man/cupsenable.man | 4 +- man/cupsfilter.man | 4 +- man/cupstestdsc.man | 4 +- man/cupstestppd.man | 4 +- man/filter.man | 4 +- man/ipptool.man | 4 +- man/ipptoolfile.man | 12 +- man/lp.man | 4 +- man/lpadmin.man | 4 +- man/lpc.man | 4 +- man/lpinfo.man | 4 +- man/lpmove.man | 4 +- man/lpoptions.man.in | 4 +- man/lppasswd.man | 4 +- man/lpq.man | 4 +- man/lpr.man | 4 +- man/lprm.man | 4 +- man/lpstat.man | 4 +- man/mailto.conf.man | 4 +- man/mime.convs.man | 4 +- man/mime.types.man | 4 +- man/notifier.man | 4 +- man/ppdc.man | 4 +- man/ppdcfile.man | 4 +- man/ppdhtml.man | 4 +- man/ppdi.man | 4 +- man/ppdmerge.man | 4 +- man/ppdpo.man | 4 +- man/printers.conf.man | 4 +- man/subscriptions.conf.man | 4 +- ppdc/Makefile | 1 + scheduler/Makefile | 1 + scheduler/auth.c | 27 +- scheduler/cert.c | 28 +- scheduler/cert.h | 9 +- scheduler/client.c | 10 +- scheduler/colorman.c | 2 +- scheduler/conf.c | 23 +- scheduler/cupsd.h | 7 - scheduler/cupsfilter.c | 2 + scheduler/job.c | 14 +- scheduler/main.c | 19 +- templates/ca/trailer.tmpl | 2 +- templates/es/trailer.tmpl | 2 +- templates/ja/trailer.tmpl | 2 +- templates/trailer.tmpl | 2 +- test/ippserver.c | 1 + test/ipptool.c | 59 ++- 94 files changed, 868 insertions(+), 839 deletions(-) diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index c59c1ca54..57cb441e1 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -3,10 +3,23 @@ CHANGES-1.6.txt CHANGES IN CUPS V1.6.2 - - Documentation fixes (STR #4239) + - Documentation fixes (STR #4239, STR #4234) - Security: All file, directory, user, and group settings are now stored in a separate cups-files.conf configuration file that cannot be set through the CUPS web interface or APIs (STR #4223) + - The ipptool program now supports DEFINE-MATCH and DEFINE-NO-MATCH + predicates for STATUS directives. + - Fixed a problem with local Kerberos authentication (STR #4140) + - Coverity scan: fixed some minor issues (STR #4242) + - The scheduler did not remove color profiles after deleting a printer + (STR #4232) + - The CUPS library did not always detect a timed out connection to the + server which could cause temporary loss of printing from applications + (STR #4187) + - The ipptool program now supports variable substitution in OPERATION + and DELAY directives (STR #4175) + - The IPP backend now stops queues when the server configuration + prevents successful job submission (STR #4125) - The XML output of ipptool contained empty dictionaries (STR #4136) - The scheduler did not delete job control backup files (STR #4244) - cupsGetPPD3 could return a local PPD instead of the correct remote diff --git a/CHANGES-IPPTOOL.txt b/CHANGES-IPPTOOL.txt index a0b9176da..22264c519 100644 --- a/CHANGES-IPPTOOL.txt +++ b/CHANGES-IPPTOOL.txt @@ -1,17 +1,19 @@ -CHANGES-IPPTOOL.txt - 2012-11-16 +CHANGES-IPPTOOL.txt - 2013-01-10 -------------------------------- This file provides a list of changes to the ipptool binary distribution posted on cups.org. -2012-MM-DD +2013-MM-DD - - ipptool did not support octetString values. + - Added support for DEFINE-MATCH and DEFINE-NO-MATCH as STATUS + predicates. + - Added support for octetString values. + - Added support for document compression in Print-Job and Send-Document + requests. - Fixed REPEAT-MATCH for STATUS and EXPECT - was incorrectly erroring out. - - ipptool did not support compressing documents in Print-Job or - Send-Document requests. 2012-02-28 diff --git a/IPPTOOL.txt b/IPPTOOL.txt index 5aa027f1e..93eda28c0 100644 --- a/IPPTOOL.txt +++ b/IPPTOOL.txt @@ -1,4 +1,4 @@ -IPPTOOL.txt - 2012-11-16 +IPPTOOL.txt - 2013-01-10 ------------------------ See the file CHANGES-IPPTOOL.txt for a list of changes to this software. @@ -174,7 +174,7 @@ REPORTING BUGS LEGAL STUFF - CUPS is Copyright 2007-2012 by Apple Inc. CUPS and the CUPS logo are + CUPS is Copyright 2007-2013 by Apple Inc. CUPS and the CUPS logo are trademarks of Apple Inc. The MD5 Digest code is Copyright 1999 Aladdin Enterprises. diff --git a/README.txt b/README.txt index fede61b6e..024b7f23e 100644 --- a/README.txt +++ b/README.txt @@ -150,7 +150,7 @@ PRINTING FILES LEGAL STUFF - CUPS is Copyright 2007-2012 by Apple Inc. CUPS and the CUPS logo are + CUPS is Copyright 2007-2013 by Apple Inc. CUPS and the CUPS logo are trademarks of Apple Inc. The MD5 Digest code is Copyright 1999 Aladdin Enterprises. diff --git a/backend/ipp.c b/backend/ipp.c index d3dd8de9c..19ce3f2d3 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -3,7 +3,7 @@ * * IPP backend for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1066,10 +1066,10 @@ main(int argc, /* I - Number of command-line args */ } else if (!compression) { - if (ippContainsString(compression_sup, "deflate")) - compression = "deflate"; - else if (ippContainsString(compression_sup, "gzip")) + if (ippContainsString(compression_sup, "gzip")) compression = "gzip"; + else if (ippContainsString(compression_sup, "deflate")) + compression = "deflate"; if (compression) fprintf(stderr, "DEBUG: Automatically using \"%s\" compression.\n", @@ -1354,8 +1354,9 @@ main(int argc, /* I - Number of command-line args */ /* * If the printer only claims to support IPP/1.0, or if the user specifically * included version=1.0 in the URI, then do not try to use Create-Job or - * Send-Document. This is another dreaded compatibility hack, but unfortunately - * there are enough broken printers out there that we need this for now... + * Send-Document. This is another dreaded compatibility hack, but + * unfortunately there are enough broken printers out there that we need + * this for now... */ if (version == 10) @@ -1812,6 +1813,27 @@ main(int argc, /* I - Number of command-line args */ goto cleanup; } + else if (ipp_status == IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED) + { + /* + * Server is configured incorrectly; the policy for Create-Job and + * Send-Document has to be the same (auth or no auth, encryption or + * no encryption). Force the queue to stop since printing will never + * work. + */ + + fputs("DEBUG: The server or printer is configured incorrectly.\n", + stderr); + fputs("DEBUG: The policy for Create-Job and Send-Document must have the " + "same authentication and encryption requirements.\n", stderr); + + ipp_status = IPP_STATUS_ERROR_INTERNAL; + + if (job_id > 0) + cancel_job(http, uri, job_id, resource, argv[2], version); + + goto cleanup; + } else if (ipp_status == IPP_NOT_FOUND) { /* @@ -1850,6 +1872,12 @@ main(int argc, /* I - Number of command-line args */ backendCheckSideChannel(snmp_fd, http->hostaddr); + /* + * Check printer state... + */ + + check_printer_state(http, uri, resource, argv[2], version); + /* * Build an IPP_GET_JOB_ATTRIBUTES request... */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 98cf9804a..33f1fb648 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -151,9 +151,9 @@ struct crashreporter_annotations_t { uint64_t dialog_mode; // unsigned int }; -CRASH_REPORTER_CLIENT_HIDDEN -struct crashreporter_annotations_t gCRAnnotations - __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) +CRASH_REPORTER_CLIENT_HIDDEN +struct crashreporter_annotations_t gCRAnnotations + __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 }; /* @@ -280,6 +280,7 @@ typedef struct globals_s */ globals_t g = { 0 }; /* Globals */ +int Iterating = 0; /* Are we iterating the bus? */ /* @@ -1106,6 +1107,8 @@ sidechannel_thread(void *reference) static void iterate_printers(iterator_callback_t callBack, void *userdata) { + Iterating = 1; + mach_port_t masterPort = 0x0; kern_return_t kr = IOMasterPort (bootstrap_port, &masterPort); @@ -1143,6 +1146,8 @@ static void iterate_printers(iterator_callback_t callBack, } mach_port_deallocate(mach_task_self(), masterPort); } + + Iterating = 0; } @@ -1431,7 +1436,7 @@ static kern_return_t load_classdriver(CFStringRef driverPath, _cups_fc_result_t result = _cupsFileCheck(bundlestr, _CUPS_FILE_CHECK_DIRECTORY, 1, - _cupsFileCheckFilter, NULL); + Iterating ? NULL : _cupsFileCheckFilter, NULL); if (result && driverPath) return (load_classdriver(NULL, interface, printerDriver)); diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index da7e0cce9..0d472ed25 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -672,10 +672,10 @@ print_device(const char *uri, /* I - Device URI */ * If it didn't exit abort the pending read and wait an additional * second... */ - + if (!g.read_thread_done) { - fputs("DEBUG: Read thread still active, aborting the pending read...\n", + fputs("DEBUG: Read thread still active, aborting the pending read...\n", stderr); g.wait_eof = 0; @@ -683,7 +683,7 @@ print_device(const char *uri, /* I - Device URI */ gettimeofday(&tv, NULL); cond_timeout.tv_sec = tv.tv_sec + 1; cond_timeout.tv_nsec = tv.tv_usec * 1000; - + while (!g.read_thread_done) { if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex, @@ -696,9 +696,6 @@ print_device(const char *uri, /* I - Device URI */ pthread_mutex_unlock(&g.read_thread_mutex); } - if (print_fd) - close(print_fd); - /* * Close the connection and input file and general clean up... */ @@ -758,7 +755,7 @@ close_device(usb_printer_t *printer) /* I - Printer */ */ if (printer->origconf > 0 && printer->origconf != number2) { - fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n", + fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n", number2, printer->origconf); if ((errcode = libusb_set_configuration(printer->handle, printer->origconf)) < 0) @@ -919,7 +916,7 @@ find_device(usb_cb_t cb, /* I - Callback function */ */ if (((altptr->bInterfaceClass != LIBUSB_CLASS_PRINTER || - altptr->bInterfaceSubClass != 1) && + altptr->bInterfaceSubClass != 1) && ((printer.quirks & USBLP_QUIRK_BAD_CLASS) == 0)) || (altptr->bInterfaceProtocol != 1 && /* Unidirectional */ altptr->bInterfaceProtocol != 2) || /* Bidirectional */ @@ -997,7 +994,7 @@ find_device(usb_cb_t cb, /* I - Callback function */ bEndpointAddress; } else - fprintf(stderr, "DEBUG: Uni-directional USB communication " + fprintf(stderr, "DEBUG: Uni-directional USB communication " "only!\n"); printer.write_endp = confptr->interface[printer.iface]. altsetting[printer.altset]. @@ -1376,7 +1373,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ printer->origconf = current; - if ((errcode = + if ((errcode = libusb_get_config_descriptor (printer->device, printer->conf, &confptr)) < 0) { @@ -1388,7 +1385,7 @@ open_device(usb_printer_t *printer, /* I - Printer */ if (number1 != current) { - fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n", + fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n", current, number1); if ((errcode = libusb_set_configuration(printer->handle, number1)) < 0) { diff --git a/cgi-bin/Makefile b/cgi-bin/Makefile index 152604202..e9c682c02 100644 --- a/cgi-bin/Makefile +++ b/cgi-bin/Makefile @@ -154,6 +154,7 @@ install-libs: $(INSTALLSTATIC) if test "x$(SYMROOT)" != "x"; then \ $(INSTALL_DIR) $(SYMROOT); \ cp $(LIBCUPSCGI) $(SYMROOT); \ + dsymutil $(SYMROOT)/$(LIBCUPSCGI); \ fi installstatic: diff --git a/conf/cups-files.conf.in b/conf/cups-files.conf.in index 01ee93317..123812cf8 100644 --- a/conf/cups-files.conf.in +++ b/conf/cups-files.conf.in @@ -24,8 +24,8 @@ SystemGroup @CUPS_SYSTEM_GROUPS@ #FileDevice No # Permissions for configuration and log files... -#ConfigFilePerm @CUPS_CONFIG_FILE_PERM@ -#LogFilePerm @CUPS_LOG_FILE_PERM@ +#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@ +#LogFilePerm 0@CUPS_LOG_FILE_PERM@ # Location of the file logging all access to the scheduler; may be the name # "syslog". If not an absolute path, the value of ServerRoot is used as the diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index d5a22ce67..60614de01 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -403,8 +403,8 @@ case $uname in if test $uversion -ge 100; then AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H)) fi - if test $uversion -ge 110; then - # Broken public headers in 10.7... + if test $uversion -ge 110 -a $uversion -lt 120; then + # Broken public headers in 10.7.x... AC_MSG_CHECKING(for sandbox/private.h presence) if test -f /usr/local/include/sandbox/private.h; then AC_MSG_RESULT(yes) diff --git a/config-scripts/cups-gssapi.m4 b/config-scripts/cups-gssapi.m4 index 36c878cf0..d378bbfab 100644 --- a/config-scripts/cups-gssapi.m4 +++ b/config-scripts/cups-gssapi.m4 @@ -86,13 +86,6 @@ if test x$enable_gssapi != xno; then else AC_MSG_RESULT(no) fi - AC_MSG_CHECKING(for GSS/gssapi_krb5.h presence) - if test -f $gssdir/Headers/gssapi_krb5.h; then - AC_DEFINE(HAVE_GSSAPI_KRB5_H) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi AC_MSG_CHECKING(for GSS/gssapi_spi.h presence) if test -f $gssdir/PrivateHeaders/gssapi_spi.h; then AC_MSG_RESULT(yes) @@ -105,16 +98,14 @@ if test x$enable_gssapi != xno; then fi else AC_MSG_RESULT(no) - if test $uversion -ge 110; then - # Broken public headers in 10.7... + if test $uversion -ge 110 -a $uversion -lt 120; then + # Broken public headers in 10.7.x... AC_MSG_ERROR(Run 'sudo mkdir -p $gssdir/PrivateHeaders' and 'sudo touch $gssdir/PrivateHeaders/gssapi_spi.h' to build CUPS.) fi fi 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" diff --git a/config.h.in b/config.h.in index 34af9141c..d054fc3fa 100644 --- a/config.h.in +++ b/config.h.in @@ -582,11 +582,8 @@ #undef HAVE_GSS_GSSAPI_H #undef HAVE_GSS_GSSAPI_SPI_H #undef HAVE_GSSAPI -#undef HAVE_GSSAPI_GENERIC_H #undef HAVE_GSSAPI_GSSAPI_H #undef HAVE_GSSAPI_H -#undef HAVE_GSSAPI_KRB5_H -#undef HAVE_KRB5_H /* diff --git a/cups/dest-options.c b/cups/dest-options.c index d8eff72e5..8477ab30a 100644 --- a/cups/dest-options.c +++ b/cups/dest-options.c @@ -485,7 +485,7 @@ cupsCopyDestConflicts( active = NULL; } - if (tries >= 0) + if (tries >= 100) { DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve after 100 tries."); have_conflicts = -1; diff --git a/cups/http-private.h b/cups/http-private.h index a789917de..9259b1f4a 100644 --- a/cups/http-private.h +++ b/cups/http-private.h @@ -3,7 +3,7 @@ * * Private HTTP definitions for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -44,29 +44,14 @@ # ifdef HAVE_GSSAPI # ifdef HAVE_GSS_GSSAPI_H # include -# ifdef HAVE_GSSAPI_GENERIC_H -# include -# endif /* HAVE_GSSAPI_GENERIC_H */ -# ifdef HAVE_GSSAPI_KRB5_H -# include -# endif /* HAVE_GSSAPI_KRB5_H */ # elif defined(HAVE_GSSAPI_GSSAPI_H) # include -# ifdef HAVE_GSSAPI_GENERIC_H -# include -# endif /* HAVE_GSSAPI_GENERIC_H */ -# ifdef HAVE_GSSAPI_KRB5_H -# include -# endif /* HAVE_GSSAPI_KRB5_H */ # elif defined(HAVE_GSSAPI_H) # include # endif /* HAVE_GSS_GSSAPI_H */ # ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE # define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name # endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */ -# ifdef HAVE_KRB5_H -# include -# endif /* HAVE_KRB5_H */ # endif /* HAVE_GSSAPI */ # ifdef HAVE_AUTHORIZATION_H @@ -341,6 +326,7 @@ struct _http_s /**** HTTP connection structure ****/ # ifdef HAVE_LIBZ _http_coding_t coding; /* _HTTP_CODING_xxx */ z_stream stream; /* (De)compression stream */ + Bytef *dbuffer; /* Decompression buffer */ # endif /* HAVE_LIBZ */ }; @@ -407,14 +393,18 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs); */ #define _httpAddrFamily(addrp) (addrp)->addr.sa_family +extern int _httpAddrPort(http_addr_t *addr) + _CUPS_INTERNAL_MSG("Use httpAddrPort instead."); extern void _httpAddrSetPort(http_addr_t *addr, int port); extern char *_httpAssembleUUID(const char *server, int port, const char *name, int number, - char *buffer, size_t bufsize); + char *buffer, size_t bufsize) + _CUPS_INTERNAL_MSG("Use httpAssembleUUID instead."); extern http_t *_httpCreate(const char *host, int port, http_addrlist_t *addrlist, int family, http_encryption_t encryption, - int blocking, _http_mode_t mode); + int blocking, _http_mode_t mode) + _CUPS_INTERNAL_MSG("Use httpConnect2 or httpAccept instead."); extern http_tls_credentials_t _httpCreateCredentials(cups_array_t *credentials); extern char *_httpDecodeURI(char *dst, const char *src, @@ -423,6 +413,8 @@ extern void _httpDisconnect(http_t *http); extern char *_httpEncodeURI(char *dst, const char *src, size_t dstsize); extern void _httpFreeCredentials(http_tls_credentials_t credentials); +extern ssize_t _httpPeek(http_t *http, char *buffer, size_t length) + _CUPS_INTERNAL_MSG("Use httpPeek instead."); extern const char *_httpResolveURI(const char *uri, char *resolved_uri, size_t resolved_size, int options, int (*cb)(void *context), diff --git a/cups/http-support.c b/cups/http-support.c index d0f36c3e1..cd1565ded 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -3,7 +3,7 @@ * * HTTP support routines for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -20,7 +20,8 @@ * components. * httpAssembleURIf() - Assemble a uniform resource identifier from its * components with a formatted resource. - * _httpAssembleUUID() - Make a UUID URI conforming to RFC 4122. + * httpAssembleUUID() - Assemble a name-based UUID URN conforming to RFC + * 4122. * httpDecode64() - Base64-decode a string. * httpDecode64_2() - Base64-decode a string. * httpEncode64() - Base64-encode a string. @@ -466,18 +467,22 @@ httpAssembleURIf( /* - * '_httpAssembleUUID()' - Make a UUID URI conforming to RFC 4122. + * 'httpAssembleUUID()' - Assemble a name-based UUID URN conforming to RFC 4122. + * + * This function creates a unique 128-bit identifying number using the server + * name, port number, random data, and optionally an object name and/or object + * number. The result is formatted as a UUID URN as defined in RFC 4122. * * The buffer needs to be at least 46 bytes in size. */ char * /* I - UUID string */ -_httpAssembleUUID(const char *server, /* I - Server name */ - int port, /* I - Port number */ - const char *name, /* I - Object name or NULL */ - int number, /* I - Object number or 0 */ - char *buffer, /* I - String buffer */ - size_t bufsize) /* I - Size of buffer */ +httpAssembleUUID(const char *server, /* I - Server name */ + int port, /* I - Port number */ + const char *name, /* I - Object name or NULL */ + int number, /* I - Object number or 0 */ + char *buffer, /* I - String buffer */ + size_t bufsize) /* I - Size of buffer */ { char data[1024]; /* Source string for MD5 */ _cups_md5_state_t md5state; /* MD5 state */ @@ -514,6 +519,13 @@ _httpAssembleUUID(const char *server, /* I - Server name */ return (buffer); } +/* For OS X 10.8 and earlier */ +char *_httpAssembleUUID(const char *server, int port, const char *name, + int number, char *buffer, size_t bufsize) +{ + return (httpAssembleUUID(server, port, name, number, buffer, bufsize)); +} + /* * 'httpDecode64()' - Base64-decode a string. @@ -2064,6 +2076,8 @@ http_resolve_cb( error)); #endif /* DEBUG */ } + + httpAddrFreeList(addrlist); } } @@ -2279,6 +2293,8 @@ http_resolve_cb( error)); #endif /* DEBUG */ } + + httpAddrFreeList(addrlist); } } diff --git a/cups/http.c b/cups/http.c index 12e7338ad..35b2799dd 100644 --- a/cups/http.c +++ b/cups/http.c @@ -48,13 +48,13 @@ * _httpFreeCredentials() - Free internal credentials. * httpFreeCredentials() - Free an array of credentials. * httpGet() - Send a GET request to the server. - * httpGetContentEncoding() - Get a common content encoding, if any, - * between the client and server. + * httpGetContentEncoding() - Get a common content encoding, if any, + * between the client and server. * httpGetAuthString() - Get the current authorization string. * httpGetBlocking() - Get the blocking/non-block state of a * connection. * httpGetCookie() - Get any cookie data from the response. - * httpGetExpect() - Get the value of the Expect header, if any. + * httpGetExpect() - Get the value of the Expect header, if any. * httpGetFd() - Get the file descriptor associated with a * connection. * httpGetField() - Get a field value from a request/response. @@ -89,6 +89,7 @@ * httpSetCredentials() - Set the credentials associated with an * encrypted connection. * httpSetCookie() - Set the cookie value(s). + * httpSetDefaultField() - Set the default value of an HTTP header. * httpSetExpect() - Set the Expect: header in a request. * httpSetField() - Set the value of an HTTP header. * httpSetLength() - Set the content-length and @@ -119,12 +120,15 @@ * http_content_coding_start() - Start doing content encoding. * http_debug_hex() - Do a hex dump of a buffer. * http_field() - Return the field index for a field name. + * http_read() - Read a buffer from a HTTP connection. + * http_read_buffered() - Do a buffered read from a HTTP connection. + * http_read_chunk() - Read a chunk from a HTTP connection. * http_read_ssl() - Read from a SSL/TLS connection. * http_send() - Send a request with all fields and the * trailing blank line. * http_set_credentials() - Set the SSL/TLS credentials. - * http_set_length() - Set the data_encoding and data_remaining - * values. + * http_set_length() - Set the data_encoding and data_remaining + * values. * http_set_timeout() - Set the socket timeout values. * http_set_wait() - Set the default wait value for reads. * http_setup_ssl() - Set up SSL/TLS support on a connection. @@ -168,12 +172,15 @@ static void http_debug_hex(const char *prefix, const char *buffer, int bytes); #endif /* DEBUG */ static http_field_t http_field(const char *name); +static ssize_t http_read(http_t *http, char *buffer, size_t length); +static ssize_t http_read_buffered(http_t *http, char *buffer, size_t length); +static ssize_t http_read_chunk(http_t *http, char *buffer, size_t length); static int http_send(http_t *http, http_state_t request, const char *uri); -static int http_write(http_t *http, const char *buffer, - int length); -static int http_write_chunk(http_t *http, const char *buffer, - int length); +static ssize_t http_write(http_t *http, const char *buffer, + size_t length); +static ssize_t http_write_chunk(http_t *http, const char *buffer, + size_t length); #ifdef HAVE_SSL static int http_read_ssl(http_t *http, char *buf, int len); # ifdef HAVE_CDSASSL @@ -1449,7 +1456,7 @@ httpGets(char *line, /* I - Line to read into */ DEBUG_printf(("2httpGets(line=%p, length=%d, http=%p)", line, length, http)); - if (http == NULL || line == NULL) + if (!http || !line || length <= 1) return (NULL); /* @@ -1493,20 +1500,10 @@ httpGets(char *line, /* I - Line to read into */ return (NULL); } -#ifdef HAVE_SSL - if (http->tls) - bytes = http_read_ssl(http, http->buffer + http->used, - HTTP_MAX_BUFFER - http->used); - else -#endif /* HAVE_SSL */ - bytes = recv(http->fd, http->buffer + http->used, - HTTP_MAX_BUFFER - http->used, 0); + bytes = http_read(http, http->buffer + http->used, + HTTP_MAX_BUFFER - http->used); - DEBUG_printf(("4httpGets: read %d bytes...", bytes)); - -#ifdef DEBUG - http_debug_hex("httpGets", http->buffer + http->used, bytes); -#endif /* DEBUG */ + DEBUG_printf(("4httpGets: read %d bytes.", bytes)); if (bytes < 0) { @@ -1918,8 +1915,8 @@ httpOptions(http_t *http, /* I - Connection to server */ ssize_t /* O - Number of bytes copied */ httpPeek(http_t *http, /* I - Connection to server */ - char *buffer, /* I - Buffer for data */ - size_t length) /* I - Maximum number of bytes */ + char *buffer, /* I - Buffer for data */ + size_t length) /* I - Maximum number of bytes */ { ssize_t bytes; /* Bytes read */ char len[32]; /* Length string */ @@ -1959,21 +1956,21 @@ httpPeek(http_t *http, /* I - Connection to server */ DEBUG_printf(("2httpPeek: data_remaining=" CUPS_LLFMT, CUPS_LLCAST http->data_remaining)); - if (http->data_remaining <= 0) + if (http->data_remaining <= 0 && http->data_encoding != HTTP_ENCODING_FIELDS) { /* * A zero-length chunk ends a transfer; unless we are reading POST * data, go idle... */ - if (http->data_encoding == HTTP_ENCODING_CHUNKED) - httpGets(len, sizeof(len), http); - #ifdef HAVE_LIBZ if (http->coding) http_content_coding_finish(http); #endif /* HAVE_LIBZ */ + if (http->data_encoding == HTTP_ENCODING_CHUNKED) + httpGets(len, sizeof(len), http); + if (http->state == HTTP_STATE_POST_RECV) http->state ++; else @@ -1990,12 +1987,15 @@ httpPeek(http_t *http, /* I - Connection to server */ return (0); } - else if ((http->data_encoding == HTTP_ENCODING_LENGTH || - http->coding == _HTTP_CODING_IDENTITY) && - length > (size_t)http->data_remaining) + else if (length > (size_t)http->data_remaining) length = (size_t)http->data_remaining; +#ifdef HAVE_LIBZ + if (http->used == 0 && + (http->coding == _HTTP_CODING_IDENTITY || http->stream.avail_in == 0)) +#else if (http->used == 0) +#endif /* HAVE_LIBZ */ { /* * Buffer small reads for better performance... @@ -2084,16 +2084,39 @@ httpPeek(http_t *http, /* I - Connection to server */ if (http->coding) { int zerr; /* Decompressor error */ - off_t comp_avail; /* Maximum bytes for decompression */ z_stream stream; /* Copy of decompressor stream */ - if (http->used > http->data_remaining) - comp_avail = http->data_remaining; - else - comp_avail = http->used; + if (http->used > 0 && http->stream.avail_in < HTTP_MAX_BUFFER) + { + size_t buflen = buflen = HTTP_MAX_BUFFER - http->stream.avail_in; + /* Number of bytes to copy */ + + if (http->stream.avail_in > 0 && + http->stream.next_in > http->dbuffer) + memmove(http->dbuffer, http->stream.next_in, http->stream.avail_in); + + http->stream.next_in = http->dbuffer; + + if (buflen > http->data_remaining) + buflen = http->data_remaining; + + if (buflen > http->used) + buflen = http->used; + + DEBUG_printf(("1httpPeek: Copying %d more bytes of data into " + "decompression buffer.", (int)buflen)); + + memcpy(http->dbuffer + http->stream.avail_in, http->buffer, buflen); + http->stream.avail_in += buflen; + http->used -= buflen; + http->data_remaining -= buflen; + + if (http->used > 0) + memmove(http->buffer, http->buffer + buflen, http->used); + } DEBUG_printf(("2httpPeek: length=%d, avail_in=%d", (int)length, - (int)comp_avail)); + (int)http->stream.avail_in)); if (inflateCopy(&stream, &(http->stream)) != Z_OK) { @@ -2102,8 +2125,6 @@ httpPeek(http_t *http, /* I - Connection to server */ return (-1); } - stream.next_in = (Bytef *)http->buffer; - stream.avail_in = comp_avail; stream.next_out = (Bytef *)buffer; stream.avail_out = length; @@ -2113,6 +2134,11 @@ httpPeek(http_t *http, /* I - Connection to server */ if (zerr < Z_OK) { DEBUG_printf(("2httpPeek: zerr=%d", zerr)); +#ifdef DEBUG + http_debug_hex("2httpPeek", (char *)http->dbuffer, + http->stream.avail_in); +#endif /* DEBUG */ + http->error = EIO; return (-1); } @@ -2264,12 +2290,12 @@ httpRead2(http_t *http, /* I - Connection to server */ size_t length) /* I - Maximum number of bytes */ { ssize_t bytes; /* Bytes read */ - char len[32]; /* Length string */ DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT - ") coding=%d", http, buffer, CUPS_LLCAST length, - http->coding)); + ") coding=%d data_encoding=%d data_remaining=" CUPS_LLFMT, + http, buffer, CUPS_LLCAST length, http->coding, + http->data_encoding, CUPS_LLCAST http->data_remaining)); if (http == NULL || buffer == NULL) return (-1); @@ -2280,371 +2306,135 @@ httpRead2(http_t *http, /* I - Connection to server */ if (length <= 0) return (0); - if (http->data_encoding == HTTP_ENCODING_CHUNKED && - http->data_remaining <= 0) - { - if (!httpGets(len, sizeof(len), http)) - { - DEBUG_puts("1httpRead2: Could not get chunk length."); - return (0); - } - - if (!len[0]) - { - DEBUG_puts("1httpRead2: Blank chunk length, trying again..."); - if (!httpGets(len, sizeof(len), http)) - { - DEBUG_puts("1httpRead2: Could not get chunk length."); - return (0); - } - } - - http->data_remaining = strtoll(len, NULL, 16); - - if (http->data_remaining < 0) - { - DEBUG_printf(("1httpRead2: Negative chunk length \"%s\" (" CUPS_LLFMT ")", - len, CUPS_LLCAST http->data_remaining)); - return (0); - } - - DEBUG_printf(("2httpRead2: Got chunk length \"%s\" (" CUPS_LLFMT ")", len, - CUPS_LLCAST http->data_remaining)); - } - - DEBUG_printf(("2httpRead2: data_remaining=" CUPS_LLFMT ", used=%d", - CUPS_LLCAST http->data_remaining, http->used)); - - if (http->data_remaining <= 0 && http->data_encoding != HTTP_ENCODING_FIELDS) - { - /* - * A zero-length chunk ends a transfer; unless we are reading POST - * data, go idle... - */ - #ifdef HAVE_LIBZ - if (http->coding) - http_content_coding_finish(http); -#endif /* HAVE_LIBZ */ - - if (http->data_encoding == HTTP_ENCODING_CHUNKED) - httpGets(len, sizeof(len), http); - - if (http->state == HTTP_STATE_POST_RECV) - http->state ++; - else - http->state = HTTP_STATE_WAITING; - - DEBUG_printf(("1httpRead2: 0-length chunk, set state to %s.", - http_states[http->state + 1])); - - /* - * Prevent future reads for this request... - */ - - http->data_encoding = HTTP_ENCODING_FIELDS; - - return (0); - } - else if ((http->data_encoding == HTTP_ENCODING_LENGTH || - http->coding == _HTTP_CODING_IDENTITY) && - length > (size_t)http->data_remaining) - length = (size_t)http->data_remaining; - -#ifdef HAVE_LIBZ - if (http->used == 0 && (length <= 256 || http->coding)) -#else - if (http->used == 0 && length <= 256) -#endif /* HAVE_LIBZ */ + if (http->coding) { - /* - * Buffer small/compressed reads for better performance... - */ - - ssize_t buflen; /* Length of read for buffer */ - - if (!http->blocking) + do { - while (!httpWait(http, http->wait_value)) + if (http->stream.avail_in > 0) { - if (http->timeout_cb && (*http->timeout_cb)(http, http->timeout_data)) - continue; + int zerr; /* Decompressor error */ - return (0); - } - } + DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d", + (int)http->stream.avail_in, (int)length)); - if (http->data_remaining > sizeof(http->buffer)) - buflen = sizeof(http->buffer); - else - buflen = http->data_remaining; - - DEBUG_printf(("2httpRead2: Reading %d bytes into buffer.", (int)buflen)); + http->stream.next_out = (Bytef *)buffer; + http->stream.avail_out = length; - do - { -#ifdef HAVE_SSL - if (http->tls) - bytes = http_read_ssl(http, http->buffer, buflen); - else -#endif /* HAVE_SSL */ - bytes = recv(http->fd, http->buffer, buflen, 0); - - if (bytes < 0) - { -#ifdef WIN32 - if (WSAGetLastError() != WSAEINTR) - { - http->error = WSAGetLastError(); - return (-1); - } - else if (WSAGetLastError() == WSAEWOULDBLOCK) + if ((zerr = inflate(&(http->stream), Z_SYNC_FLUSH)) < Z_OK) { - if (!http->timeout_cb || - !(*http->timeout_cb)(http, http->timeout_data)) - { - http->error = WSAEWOULDBLOCK; - return (-1); - } - } -#else - if (errno == EWOULDBLOCK || errno == EAGAIN) - { - if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data)) - { - http->error = errno; - return (-1); - } - else if (!http->timeout_cb && errno != EAGAIN) - { - http->error = errno; - return (-1); - } - } - else if (errno != EINTR) - { - http->error = errno; - return (-1); - } -#endif /* WIN32 */ - } - } - while (bytes < 0); - - DEBUG_printf(("2httpRead2: Read " CUPS_LLFMT " bytes into buffer.", - CUPS_LLCAST bytes)); + DEBUG_printf(("2httpRead2: zerr=%d", zerr)); #ifdef DEBUG - http_debug_hex("httpRead2", http->buffer, (int)bytes); + http_debug_hex("2httpRead2", (char *)http->dbuffer, + http->stream.avail_in); #endif /* DEBUG */ - http->used = bytes; - } - -#ifdef HAVE_LIBZ - if (http->coding) - { - int zerr; /* Decompressor error */ - off_t comp_avail, /* Maximum bytes for decompression */ - comp_bytes; /* Compressed bytes "used" */ - - if (http->used > http->data_remaining) - comp_avail = http->data_remaining; - else - comp_avail = http->used; - - DEBUG_printf(("2httpRead2: length=%d, avail_in=%d", (int)length, - (int)comp_avail)); + http->error = EIO; + return (-1); + } - http->stream.next_in = (Bytef *)http->buffer; - http->stream.avail_in = comp_avail; - http->stream.next_out = (Bytef *)buffer; - http->stream.avail_out = length; + bytes = length - http->stream.avail_out; - if ((zerr = inflate(&(http->stream), Z_SYNC_FLUSH)) < Z_OK) - { - DEBUG_printf(("2httpRead2: zerr=%d", zerr)); - http->error = EIO; - return (-1); - } - - bytes = length - http->stream.avail_out; - comp_bytes = comp_avail - http->stream.avail_in; + DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d, bytes=%d", + http->stream.avail_in, http->stream.avail_out, + (int)bytes)); + } + else + bytes = 0; - DEBUG_printf(("2httpRead2: avail_in=%d, avail_out=%d, bytes=%d, " - "comp_bytes=%d", http->stream.avail_in, - http->stream.avail_out, (int)bytes, (int)comp_bytes)); + if (bytes == 0) + { + ssize_t buflen = HTTP_MAX_BUFFER - http->stream.avail_in; + /* Additional bytes for buffer */ - if ((http->used - comp_bytes) > 0) - { - http->used -= comp_bytes; - memmove(http->buffer, http->stream.next_in, http->used); + if (buflen > 0) + { + if (http->stream.avail_in > 0 && + http->stream.next_in > http->dbuffer) + memmove(http->dbuffer, http->stream.next_in, http->stream.avail_in); + + http->stream.next_in = http->dbuffer; + + DEBUG_printf(("1httpRead2: Reading up to %d more bytes of data into " + "decompression buffer.", (int)buflen)); + + if (http->data_remaining > 0) + { + if (buflen > http->data_remaining) + buflen = http->data_remaining; + + bytes = http_read_buffered(http, + (char *)http->dbuffer + + http->stream.avail_in, buflen); + } + else if (http->data_encoding == HTTP_ENCODING_CHUNKED) + bytes = http_read_chunk(http, + (char *)http->dbuffer + + http->stream.avail_in, buflen); + else + bytes = 0; + + if (bytes < 0) + return (bytes); + else if (bytes == 0) + break; + + http->data_remaining -= bytes; + http->stream.avail_in += bytes; + } + else + return (0); + } } - else - http->used = 0; - - /* - * Adjust remaining bytes since chunk/content lengths are compressed while - * CUPS HTTP APIs return uncompressed sizes... - */ - - http->data_remaining += bytes - comp_bytes; + while (bytes == 0); } else #endif /* HAVE_LIBZ */ - if (http->used > 0) + if (http->data_remaining == 0 && http->data_encoding == HTTP_ENCODING_CHUNKED) { - if (length > (size_t)http->used) - length = (size_t)http->used; - - bytes = (ssize_t)length; - - DEBUG_printf(("2httpRead2: grabbing %d bytes from input buffer...", - (int)bytes)); - - memcpy(buffer, http->buffer, length); - http->used -= (int)length; - - if (http->used > 0) - memmove(http->buffer, http->buffer + length, http->used); + if ((bytes = http_read_chunk(http, buffer, length)) > 0) + http->data_remaining -= bytes; } -#ifdef HAVE_SSL - else if (http->tls) + else if (http->data_remaining <= 0) { - if (!http->blocking) - { - while (!httpWait(http, http->wait_value)) - { - if (http->timeout_cb && (*http->timeout_cb)(http, http->timeout_data)) - continue; - - return (0); - } - } + /* + * No more data to read... + */ - while ((bytes = (ssize_t)http_read_ssl(http, buffer, (int)length)) < 0) - { -#ifdef WIN32 - if (WSAGetLastError() == WSAEWOULDBLOCK) - { - if (!http->timeout_cb || !(*http->timeout_cb)(http, http->timeout_data)) - break; - } - else if (WSAGetLastError() != WSAEINTR) - break; -#else - if (errno == EWOULDBLOCK || errno == EAGAIN) - { - if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data)) - break; - else if (!http->timeout_cb && errno != EAGAIN) - break; - } - else if (errno != EINTR) - break; -#endif /* WIN32 */ - } + return (0); } -#endif /* HAVE_SSL */ else { - if (!http->blocking) - { - while (!httpWait(http, http->wait_value)) - { - if (http->timeout_cb && (*http->timeout_cb)(http, http->timeout_data)) - continue; - - return (0); - } - } - - DEBUG_printf(("2httpRead2: reading " CUPS_LLFMT " bytes from socket...", - CUPS_LLCAST length)); - -#ifdef WIN32 - while ((bytes = (ssize_t)recv(http->fd, buffer, (int)length, 0)) < 0) - { - if (WSAGetLastError() == WSAEWOULDBLOCK) - { - if (!http->timeout_cb || !(*http->timeout_cb)(http, http->timeout_data)) - break; - } - else if (WSAGetLastError() != WSAEINTR) - break; - } -#else - while ((bytes = recv(http->fd, buffer, length, 0)) < 0) - { - if (errno == EWOULDBLOCK || errno == EAGAIN) - { - if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data)) - break; - else if (!http->timeout_cb && errno != EAGAIN) - break; - } - else if (errno != EINTR) - break; - } -#endif /* WIN32 */ - - DEBUG_printf(("2httpRead2: read " CUPS_LLFMT " bytes from socket...", - CUPS_LLCAST bytes)); -#ifdef DEBUG - http_debug_hex("httpRead2", buffer, (int)bytes); -#endif /* DEBUG */ - } + DEBUG_printf(("1httpRead2: Reading up to %d bytes into buffer.", + (int)length)); - if (bytes > 0) - { - http->data_remaining -= bytes; + if (length > http->data_remaining) + length = http->data_remaining; - if (http->data_remaining <= INT_MAX) - http->_data_remaining = (int)http->data_remaining; - else - http->_data_remaining = INT_MAX; - } - else if (bytes < 0) - { -#ifdef WIN32 - if (WSAGetLastError() == WSAEINTR) - bytes = 0; - else - http->error = WSAGetLastError(); -#else - if (errno == EINTR || (errno == EAGAIN && !http->timeout_cb)) - bytes = 0; - else - http->error = errno; -#endif /* WIN32 */ - } - else - { - http->error = EPIPE; - return (0); + if ((bytes = http_read_buffered(http, buffer, length)) > 0) + http->data_remaining -= bytes; } - if (http->data_remaining <= 0) + if ( +#ifdef HAVE_LIBZ + (http->coding == _HTTP_CODING_IDENTITY || http->stream.avail_in == 0) && +#endif /* HAVE_LIBZ */ + ((http->data_remaining <= 0 && + http->data_encoding == HTTP_ENCODING_LENGTH) || + (http->data_encoding == HTTP_ENCODING_CHUNKED && bytes == 0))) { - if (http->data_encoding == HTTP_ENCODING_CHUNKED) - { - DEBUG_puts("1httpRead2: Reading trailing line for chunk."); - httpGets(len, sizeof(len), http); - } - else - { #ifdef HAVE_LIBZ - if (http->coding) - http_content_coding_finish(http); + if (http->coding) + http_content_coding_finish(http); #endif /* HAVE_LIBZ */ - if (http->state == HTTP_STATE_POST_RECV) - http->state ++; - else - http->state = HTTP_STATE_WAITING; + if (http->state == HTTP_STATE_POST_RECV) + http->state ++; + else + http->state = HTTP_STATE_WAITING; - DEBUG_printf(("1httpRead2: End of content, set state to %s.", - http_states[http->state + 1])); - } + DEBUG_printf(("1httpRead2: End of content, set state to %s.", + http_states[http->state + 1])); } return (bytes); @@ -3809,6 +3599,14 @@ httpWait(http_t *http, /* I - Connection to server */ return (1); } +#ifdef HAVE_LIBZ + if (http->coding >= _HTTP_CODING_GUNZIP && http->stream.avail_in > 0) + { + DEBUG_puts("3httpWait: Returning 1 since there is buffered data ready."); + return (1); + } +#endif /* HAVE_LIBZ */ + /* * Flush pending data, if any... */ @@ -4475,6 +4273,8 @@ http_content_coding_finish( case _HTTP_CODING_INFLATE : case _HTTP_CODING_GUNZIP : inflateEnd(&(http->stream)); + free(http->dbuffer); + http->dbuffer = NULL; break; default : @@ -4563,12 +4363,26 @@ http_content_coding_start( case _HTTP_CODING_INFLATE : case _HTTP_CODING_GUNZIP : - if ((zerr = inflateInit2(&(http->stream), 32 + 15)) < Z_OK) + if ((http->dbuffer = malloc(HTTP_MAX_BUFFER)) == NULL) { http->status = HTTP_ERROR; - http->error = zerr == Z_MEM_ERROR ? ENOMEM : EINVAL; + http->error = errno; return; } + + if ((zerr = inflateInit2(&(http->stream), + coding == _HTTP_CODING_INFLATE ? 15 : 31)) + < Z_OK) + { + free(http->dbuffer); + http->dbuffer = NULL; + http->status = HTTP_ERROR; + http->error = zerr == Z_MEM_ERROR ? ENOMEM : EINVAL; + return; + } + + http->stream.avail_in = 0; + http->stream.next_in = http->dbuffer; break; default : @@ -4658,6 +4472,231 @@ http_field(const char *name) /* I - String name */ } +/* + * 'http_read()' - Read a buffer from a HTTP connection. + * + * This function does the low-level read from the socket, retrying and timing + * out as needed. + */ + +static ssize_t /* O - Number of bytes read or -1 on error */ +http_read(http_t *http, /* I - Connection to server */ + char *buffer, /* I - Buffer */ + size_t length) /* I - Maximum bytes to read */ +{ + ssize_t bytes; /* Bytes read */ + + + DEBUG_printf(("http_read(http=%p, buffer=%p, length=" CUPS_LLFMT ")", http, + buffer, CUPS_LLCAST length)); + + if (!http->blocking) + { + while (!httpWait(http, http->wait_value)) + { + if (http->timeout_cb && (*http->timeout_cb)(http, http->timeout_data)) + continue; + + DEBUG_puts("2http_read: Timeout."); + return (0); + } + } + + DEBUG_printf(("2http_read: Reading %d bytes into buffer.", (int)length)); + + do + { +#ifdef HAVE_SSL + if (http->tls) + bytes = http_read_ssl(http, buffer, length); + else +#endif /* HAVE_SSL */ + bytes = recv(http->fd, buffer, length, 0); + + if (bytes < 0) + { +#ifdef WIN32 + if (WSAGetLastError() != WSAEINTR) + { + http->error = WSAGetLastError(); + return (-1); + } + else if (WSAGetLastError() == WSAEWOULDBLOCK) + { + if (!http->timeout_cb || + !(*http->timeout_cb)(http, http->timeout_data)) + { + http->error = WSAEWOULDBLOCK; + return (-1); + } + } +#else + DEBUG_printf(("2http_read: %s", strerror(errno))); + + if (errno == EWOULDBLOCK || errno == EAGAIN) + { + if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data)) + { + http->error = errno; + return (-1); + } + else if (!http->timeout_cb && errno != EAGAIN) + { + http->error = errno; + return (-1); + } + } + else if (errno != EINTR) + { + http->error = errno; + return (-1); + } +#endif /* WIN32 */ + } + } + while (bytes < 0); + + DEBUG_printf(("2http_read: Read " CUPS_LLFMT " bytes into buffer.", + CUPS_LLCAST bytes)); +#ifdef DEBUG + if (bytes > 0) + http_debug_hex("http_read", http->buffer, (int)bytes); +#endif /* DEBUG */ + + if (bytes < 0) + { +#ifdef WIN32 + if (WSAGetLastError() == WSAEINTR) + bytes = 0; + else + http->error = WSAGetLastError(); +#else + if (errno == EINTR || (errno == EAGAIN && !http->timeout_cb)) + bytes = 0; + else + http->error = errno; +#endif /* WIN32 */ + } + else if (bytes == 0) + { + http->error = EPIPE; + return (0); + } + + return (bytes); +} + + +/* + * 'http_read_buffered()' - Do a buffered read from a HTTP connection. + * + * This function reads data from the HTTP buffer or from the socket, as needed. + */ + +static ssize_t /* O - Number of bytes read or -1 on error */ +http_read_buffered(http_t *http, /* I - Connection to server */ + char *buffer, /* I - Buffer */ + size_t length) /* I - Maximum bytes to read */ +{ + ssize_t bytes; /* Bytes read */ + + + DEBUG_printf(("http_read_buffered(http=%p, buffer=%p, length=" CUPS_LLFMT + ") used=%d", + http, buffer, CUPS_LLCAST length, http->used)); + + if (http->used > 0) + { + if (length > (size_t)http->used) + bytes = (size_t)http->used; + else + bytes = length; + + DEBUG_printf(("2http_read: Grabbing %d bytes from input buffer.", + (int)bytes)); + + memcpy(buffer, http->buffer, bytes); + http->used -= (int)bytes; + + if (http->used > 0) + memmove(http->buffer, http->buffer + bytes, http->used); + } + else + bytes = http_read(http, buffer, length); + + return (bytes); +} + + +/* + * 'http_read_chunk()' - Read a chunk from a HTTP connection. + * + * This function reads and validates the chunk length, then does a buffered read + * returning the number of bytes placed in the buffer. + */ + +static ssize_t /* O - Number of bytes read or -1 on error */ +http_read_chunk(http_t *http, /* I - Connection to server */ + char *buffer, /* I - Buffer */ + size_t length) /* I - Maximum bytes to read */ +{ + DEBUG_printf(("http_read_chunk(http=%p, buffer=%p, length=" CUPS_LLFMT ")", + http, buffer, CUPS_LLCAST length)); + + if (http->data_remaining <= 0) + { + char len[32]; /* Length string */ + + if (!httpGets(len, sizeof(len), http)) + { + DEBUG_puts("1http_read_chunk: Could not get chunk length."); + return (0); + } + + if (!len[0]) + { + DEBUG_puts("1http_read_chunk: Blank chunk length, trying again..."); + if (!httpGets(len, sizeof(len), http)) + { + DEBUG_puts("1http_read_chunk: Could not get chunk length."); + return (0); + } + } + + http->data_remaining = strtoll(len, NULL, 16); + + if (http->data_remaining < 0) + { + DEBUG_printf(("1http_read_chunk: Negative chunk length \"%s\" (" + CUPS_LLFMT ")", len, CUPS_LLCAST http->data_remaining)); + return (0); + } + + DEBUG_printf(("2http_read_chunk: Got chunk length \"%s\" (" CUPS_LLFMT ")", + len, CUPS_LLCAST http->data_remaining)); + + if (http->data_remaining == 0) + { + /* + * 0-length chunk, grab trailing blank line... + */ + + httpGets(len, sizeof(len), http); + } + } + + DEBUG_printf(("2http_read_chunk: data_remaining=" CUPS_LLFMT, + CUPS_LLCAST http->data_remaining)); + + if (http->data_remaining <= 0) + return (0); + else if (length > (size_t)http->data_remaining) + length = (size_t)http->data_remaining; + + return (http_read_buffered(http, buffer, length)); +} + + #ifdef HAVE_SSL /* * 'http_read_ssl()' - Read from a SSL/TLS connection. @@ -5124,8 +5163,6 @@ http_set_wait(http_t *http) /* I - Connection to server */ static int /* O - 0 on success, -1 on failure */ http_setup_ssl(http_t *http) /* I - Connection to server */ { - _cups_globals_t *cg = _cupsGlobals(); - /* Pointer to library globals */ char hostname[256], /* Hostname */ *hostptr; /* Pointer into hostname */ @@ -5138,6 +5175,8 @@ http_setup_ssl(http_t *http) /* I - Connection to server */ gnutls_certificate_client_credentials *credentials; /* TLS credentials */ # elif defined(HAVE_CDSASSL) + _cups_globals_t *cg = _cupsGlobals(); + /* Pointer to library globals */ OSStatus error; /* Error code */ const char *message = NULL;/* Error message */ cups_array_t *credentials; /* Credentials array */ @@ -5667,17 +5706,17 @@ http_upgrade(http_t *http) /* I - Connection to server */ * 'http_write()' - Write a buffer to a HTTP connection. */ -static int /* O - Number of bytes written */ +static ssize_t /* O - Number of bytes written */ http_write(http_t *http, /* I - Connection to server */ const char *buffer, /* I - Buffer for data */ - int length) /* I - Number of bytes to write */ + size_t length) /* I - Number of bytes to write */ { - int tbytes, /* Total bytes sent */ - bytes; /* Bytes sent */ + ssize_t tbytes, /* Total bytes sent */ + bytes; /* Bytes sent */ - DEBUG_printf(("2http_write(http=%p, buffer=%p, length=%d)", http, buffer, - length)); + DEBUG_printf(("2http_write(http=%p, buffer=%p, length=" CUPS_LLFMT ")", http, + buffer, CUPS_LLCAST length)); http->error = 0; tbytes = 0; @@ -5749,8 +5788,8 @@ http_write(http_t *http, /* I - Connection to server */ #endif /* HAVE_SSL */ bytes = send(http->fd, buffer, length, 0); - DEBUG_printf(("3http_write: Write of %d bytes returned %d.", (int)length, - (int)bytes)); + DEBUG_printf(("3http_write: Write of " CUPS_LLFMT " bytes returned " + CUPS_LLFMT ".", CUPS_LLCAST length, CUPS_LLCAST bytes)); if (bytes < 0) { @@ -5805,7 +5844,7 @@ http_write(http_t *http, /* I - Connection to server */ http_debug_hex("http_write", buffer - tbytes, tbytes); #endif /* DEBUG */ - DEBUG_printf(("3http_write: Returning %d.", tbytes)); + DEBUG_printf(("3http_write: Returning " CUPS_LLFMT ".", CUPS_LLCAST tbytes)); return (tbytes); } @@ -5815,38 +5854,38 @@ http_write(http_t *http, /* I - Connection to server */ * 'http_write_chunk()' - Write a chunked buffer. */ -static int /* O - Number bytes written */ +static ssize_t /* O - Number bytes written */ http_write_chunk(http_t *http, /* I - Connection to server */ const char *buffer, /* I - Buffer to write */ - int length) /* I - Length of buffer */ + size_t length) /* I - Length of buffer */ { - char header[255]; /* Chunk header */ - int bytes; /* Bytes written */ + char header[16]; /* Chunk header */ + ssize_t bytes; /* Bytes written */ - DEBUG_printf(("7http_write_chunk(http=%p, buffer=%p, length=%d)", - http, buffer, length)); + DEBUG_printf(("7http_write_chunk(http=%p, buffer=%p, length=" CUPS_LLFMT ")", + http, buffer, CUPS_LLCAST length)); /* * Write the chunk header, data, and trailer. */ - sprintf(header, "%x\r\n", length); - if (http_write(http, header, (int)strlen(header)) < 0) + snprintf(header, sizeof(header), "%x\r\n", (unsigned)length); + if (http_write(http, header, strlen(header)) < 0) { - DEBUG_puts("8http_write_chunk: http_write of length failed!"); + DEBUG_puts("8http_write_chunk: http_write of length failed."); return (-1); } if ((bytes = http_write(http, buffer, length)) < 0) { - DEBUG_puts("8http_write_chunk: http_write of buffer failed!"); + DEBUG_puts("8http_write_chunk: http_write of buffer failed."); return (-1); } if (http_write(http, "\r\n", 2) < 0) { - DEBUG_puts("8http_write_chunk: http_write of CR LF failed!"); + DEBUG_puts("8http_write_chunk: http_write of CR LF failed."); return (-1); } diff --git a/cups/http.h b/cups/http.h index de782aaa3..345bf27f9 100644 --- a/cups/http.h +++ b/cups/http.h @@ -591,6 +591,10 @@ extern http_addrlist_t *httpAddrCopyList(http_addrlist_t *src) _CUPS_API_1_7; extern int httpAddrListen(http_addr_t *addr, int port) _CUPS_API_1_7; extern int httpAddrPort(http_addr_t *addr) _CUPS_API_1_7; +extern char *httpAssembleUUID(const char *server, int port, + const char *name, int number, + char *buffer, size_t bufsize) + _CUPS_API_1_7; extern http_t *httpConnect2(const char *host, int port, http_addrlist_t *addrlist, int family, http_encryption_t encryption, diff --git a/cups/ipp-support.c b/cups/ipp-support.c index dfe610352..28abbba00 100644 --- a/cups/ipp-support.c +++ b/cups/ipp-support.c @@ -777,8 +777,8 @@ ippEnumString(const char *attrname, /* I - Attribute name */ if (!strcmp(attrname, "document-state") && enumvalue >= 3 && - enumvalue <= (3 + (int)(sizeof(ipp_document_states) / - sizeof(ipp_document_states[0])))) + enumvalue < (3 + (int)(sizeof(ipp_document_states) / + sizeof(ipp_document_states[0])))) return (ipp_document_states[enumvalue - 3]); else if (!strcmp(attrname, "finishings") || !strcmp(attrname, "finishings-actual") || @@ -787,8 +787,8 @@ ippEnumString(const char *attrname, /* I - Attribute name */ !strcmp(attrname, "finishings-supported")) { if (enumvalue >= 3 && - enumvalue <= (3 + (int)(sizeof(ipp_finishings) / - sizeof(ipp_finishings[0])))) + enumvalue < (3 + (int)(sizeof(ipp_finishings) / + sizeof(ipp_finishings[0])))) return (ipp_finishings[enumvalue - 3]); else if (enumvalue >= 0x40000000 && enumvalue <= (0x40000000 + (int)(sizeof(ipp_finishings_vendor) / @@ -798,8 +798,8 @@ ippEnumString(const char *attrname, /* I - Attribute name */ else if ((!strcmp(attrname, "job-collation-type") || !strcmp(attrname, "job-collation-type-actual")) && enumvalue >= 3 && - enumvalue <= (3 + (int)(sizeof(ipp_job_collation_types) / - sizeof(ipp_job_collation_types[0])))) + enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) / + sizeof(ipp_job_collation_types[0])))) return (ipp_job_collation_types[enumvalue - 3]); else if (!strcmp(attrname, "job-state") && enumvalue >= IPP_JOB_PENDING && enumvalue <= IPP_JOB_COMPLETED) @@ -811,16 +811,16 @@ ippEnumString(const char *attrname, /* I - Attribute name */ !strcmp(attrname, "orientation-requested-default") || !strcmp(attrname, "orientation-requested-supported")) && enumvalue >= 3 && - enumvalue <= (3 + (int)(sizeof(ipp_orientation_requesteds) / - sizeof(ipp_orientation_requesteds[0])))) + enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) / + sizeof(ipp_orientation_requesteds[0])))) return (ipp_orientation_requesteds[enumvalue - 3]); else if ((!strcmp(attrname, "print-quality") || !strcmp(attrname, "print-quality-actual") || !strcmp(attrname, "print-quality-default") || !strcmp(attrname, "print-quality-supported")) && enumvalue >= 3 && - enumvalue <= (3 + (int)(sizeof(ipp_print_qualities) / - sizeof(ipp_print_qualities[0])))) + enumvalue < (3 + (int)(sizeof(ipp_print_qualities) / + sizeof(ipp_print_qualities[0])))) return (ipp_print_qualities[enumvalue - 3]); else if (!strcmp(attrname, "printer-state") && enumvalue >= IPP_PRINTER_IDLE && enumvalue <= IPP_PRINTER_STOPPED) diff --git a/cups/ipp.c b/cups/ipp.c index 76ee409d3..28b8961d7 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -3239,6 +3239,13 @@ ippReadIO(void *src, /* I - Data source */ ipp->prev = ipp->current; attr = ipp->current = ipp_add_attr(ipp, NULL, ipp->curtag, IPP_TAG_ZERO, 1); + if (!attr) + { + _cupsSetHTTPError(HTTP_ERROR); + DEBUG_puts("1ippReadIO: unable to allocate attribute."); + _cupsBufferRelease((char *)buffer); + return (IPP_ERROR); + } DEBUG_printf(("2ippReadIO: membername, ipp->current=%p, ipp->prev=%p", ipp->current, ipp->prev)); @@ -6364,6 +6371,7 @@ ipp_free_values(ipp_attribute_t *attr, /* I - Attribute to free values from */ _cupsStrFree(attr->values[0].string.language); attr->values[0].string.language = NULL; } + /* Fall through to other string values */ case IPP_TAG_TEXT : case IPP_TAG_NAME : diff --git a/cups/request.c b/cups/request.c index 01b8764ef..c1fbb5a04 100644 --- a/cups/request.c +++ b/cups/request.c @@ -1007,6 +1007,25 @@ _cupsConnect(void) httpClose(cg->http); cg->http = NULL; } + else + { + /* + * Same server, see if the connection is still established... + */ + + char ch; /* Connection check byte */ + + if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 && + errno != EWOULDBLOCK) + { + /* + * Nope, close the connection... + */ + + httpClose(cg->http); + cg->http = NULL; + } + } } /* diff --git a/cups/versioning.h b/cups/versioning.h index 808a10c2e..a9aab7246 100644 --- a/cups/versioning.h +++ b/cups/versioning.h @@ -3,7 +3,7 @@ * * API versioning definitions for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -19,10 +19,11 @@ /* * This header defines several constants - _CUPS_DEPRECATED, - * _CUPS_API_1_1, _CUPS_API_1_1_19, _CUPS_API_1_1_20, _CUPS_API_1_1_21, - * _CUPS_API_1_2, _CUPS_API_1_3, _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, - * and _CUPS_API_1_7 - which add compiler-specific attributes that flag - * functions that are deprecated or added in particular releases. + * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_1_1, _CUPS_API_1_1_19, + * _CUPS_API_1_1_20, _CUPS_API_1_1_21, _CUPS_API_1_2, _CUPS_API_1_3, + * _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, and _CUPS_API_1_7 - which add + * compiler-specific attributes that flag functions that are deprecated, added + * in particular releases, or internal to CUPS. * * On OS X, the _CUPS_API_* constants are defined based on the values of * the MAC_OS_X_VERSION_MIN_ALLOWED and MAC_OS_X_VERSION_MAX_ALLOWED constants @@ -74,28 +75,66 @@ # endif /* __APPLE__ && !_CUPS_SOURCE */ /* - * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get - * a warning at compile-time. + * With GCC and Clang we can mark old APIs as "deprecated" or "unavailable" with + * messages so you get warnings/errors are compile-time... */ -# if defined(__GNUC__) && __GNUC__ > 2 -# ifndef __has_extension -# define __has_extension(x) 0 -# endif /* !__has_extension */ -# if __has_extension(attribute_unavailable_with_message) && defined(_CUPS_NO_DEPRECATED) -# define _CUPS_DEPRECATED __attribute__ ((unavailable)) -# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m))) -# elif !defined(_CUPS_SOURCE) || defined(_CUPS_NO_DEPRECATED) -# define _CUPS_DEPRECATED __attribute__ ((deprecated)) -# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m))) -# else -# define _CUPS_DEPRECATED -# define _CUPS_DEPRECATED_MSG(m) -# endif /* !_CUPS_SOURCE || _CUPS_NO_DEPRECATED */ -# else +# ifdef __has_extension /* Clang */ +# define _CUPS_HAS_DEPRECATED +# if __has_extension(attribute_deprecated_with_message) +# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE +# endif +# if __has_extension(attribute_unavailable_with_message) +# define _CUPS_HAS_UNAVAILABLE_WITH_MESSAGE +# endif +# elif defined(__GNUC__) /* GCC and compatible */ +# if __GNUC__ >= 3 /* GCC 3.0 or higher */ +# define _CUPS_HAS_DEPRECATED +# endif /* __GNUC__ >= 3 */ +# if __GNUC__ >= 5 /* GCC 5.x */ +# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE +# elif __GNUC__ == 4 && __GNUC_MINOR__ >= 5 + /* GCC 4.5 or higher */ +# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE +# endif /* __GNUC__ >= 5 */ +# endif /* __has_extension */ + +# if !defined(_CUPS_HAS_DEPRECATED) || (defined(_CUPS_SOURCE) && !defined(_CUPS_NO_DEPRECATED)) + /* + * Don't mark functions deprecated if the compiler doesn't support it + * or we are building CUPS source that doesn't care. + */ # define _CUPS_DEPRECATED # define _CUPS_DEPRECATED_MSG(m) -# endif /* __GNUC__ && __GNUC__ > 2 */ +# define _CUPS_INTERNAL_MSG(m) +# elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) && defined(_CUPS_NO_DEPRECATED) + /* + * Compiler supports the unsupported attribute, so use it when the code + * wants to exclude the use of deprecated API. + */ +# define _CUPS_DEPRECATED __attribute__ ((unavailable)) +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m))) +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) +# else + /* + * Compiler supports the deprecated attribute, so use it. + */ +# define _CUPS_DEPRECATED __attribute__ ((deprecated)) +# ifdef _CUPS_HAS_DEPRECATED_WITH_MESSAGE +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m))) +# else +# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated)) +# endif /* _CUPS_HAS_DEPRECATED_WITH_MESSAGE */ +# ifdef _CUPS_SOURCE +# define _CUPS_INTERNAL_MSG(m) +# elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) +# elif defined(_CUPS_HAS_DEPRECATED_WITH_MESSAGE) +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated(m))) +# else +# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated)) +# endif /* _CUPS_SOURCE */ +# endif /* !_CUPS_HAS_DEPRECATED || (_CUPS_SOURCE && !_CUPS_NO_DEPRECATED) */ # ifndef __GNUC__ # define __attribute__(x) diff --git a/doc/Makefile b/doc/Makefile index ae0109485..be7fe3d6a 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -116,7 +116,6 @@ HELPFILES = \ help/security.html \ help/sharing.html \ help/spec-banner.html \ - help/spec-browsing.html \ help/spec-cmp.html \ help/spec-command.html \ help/spec-design.html \ diff --git a/doc/ca/index.html.in b/doc/ca/index.html.in index 3cd2c33fc..77542d3ba 100644 --- a/doc/ca/index.html.in +++ b/doc/ca/index.html.in @@ -100,7 +100,7 @@ HEIGHT="128" ALT="CUPS">   CUPS i el seu logotip són marques registrades de -Apple Inc. CUPS té copyright 2007-2012 d'Apple +Apple Inc. CUPS té copyright 2007-2013 d'Apple Inc. Tots els drets reservats. diff --git a/doc/es/index.html.in b/doc/es/index.html.in index 4c57ed5a8..d4ef79759 100644 --- a/doc/es/index.html.in +++ b/doc/es/index.html.in @@ -101,7 +101,7 @@ HEIGHT="128" ALT="CUPS">   CUPS y el logo de CUPS son marcas registradas de Apple Inc. Los derechos -de copia de CUPS 2007-2012 son de Apple Inc. Todos los derechos reservados. +de copia de CUPS 2007-2013 son de Apple Inc. Todos los derechos reservados. diff --git a/doc/help/man-ipptoolfile.html b/doc/help/man-ipptoolfile.html index 1c7c75b9e..7011a9730 100644 --- a/doc/help/man-ipptoolfile.html +++ b/doc/help/man-ipptoolfile.html @@ -414,6 +414,14 @@ parallel attribute.

Status Predicates

The following predicates are understood following the STATUS test directive:
+
DEFINE-MATCH variable-name +
+
Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test. +
+
DEFINE-NO-MATCH variable-name +
+
Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test. +
IF-DEFINED variable-name
Makes the STATUS apply only if the specified variable is defined. @@ -674,7 +682,7 @@ no notify-subscription-id has been seen. http://localhost:631/help

Copyright

-Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. diff --git a/doc/help/spec-browsing.html b/doc/help/spec-browsing.html index 92c0259ee..e69de29bb 100644 --- a/doc/help/spec-browsing.html +++ b/doc/help/spec-browsing.html @@ -1,118 +0,0 @@ - - - - - CUPS Browse Protocol - - - - - - -
Note: - -

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

- -
- -

CUPS Browse Protocol

- -

Introduction

- -

This specification describes the CUPS browsing protocol which is used for -printer sharing. The protocol is a UDP/IP-based broadcast service that -operates on IP service port 631 by default. Each broadcast packet describes -a single printer or class being shared.

- -

For simple networks with a single subnet, a CUPS system sharing a printer -(the server) will periodically broadcast that printer's availability -and status information to the subnet. Every other CUPS system on the subnet -(the clients) will receive the broadcast and make that printer -available to local users. If a client stops receiving broadcasts from the -server, or if the server sends a special "deleted" broadcast message, the -client will remove its copy of the printer.

- -

For larger networks with multiple subnets, a relay configuration can be used -where one or more client systems poll the server and then broadcast the -availability and status information for the server's shared printers to the -clients' local subnets.

- -

A key feature of CUPS printer sharing is support for implicit -classes, which are automatically-created classes for printers that are -shared by multiple servers. These implicit classes provide automatic load -balancing and fail-safe printing functionality transparently to the user.

- - -

Security Considerations

- -

Like most discovery protocols, CUPS browse packets are not encrypted or -signed, so it is possible for malicious systems on a network to advertise -or remove printers on that network to cause denial of service or information -disclosure. In order to combat this, CUPS logs incoming browse packets and -provides access controls to limit browse packet reception to known hosts.

- - -

Browse Packet Format

- -

Each broadcast packet is an ASCII text string of up to 1450 bytes ending -with a line feed (0x0a). The general format is:

- -

-printer-type printer-state printer-uri "printer-location" "printer-info" -"printer-make-and-model" name=value name2=value2 ... -

- -

Each of the fields contains the value of the corresponding IPP attribute. -The trailing "name=value" information is used to convey default job template -attribute values (job-sheets-default, media-default, etc.), authentication -requirements (auth-info-required), and additional IPP URI options that are -requested by the server (ipp-options).

- -

ABNF Definition

- -

The following ABNF definition [RFC4234, RFC3986] defines the format of each -browse packet:

- -
-PACKET         = TYPE WSP STATE WSP URI WSP LOCATION WSP INFO WSP
-                 MAKE-AND-MODEL WSP *[ WSP ATTR-NAME "=" ATTR-VALUE ] LF
-
-TYPE           = 1*HEXDIG
-
-STATE          = "3" / "4" / "5"
-
-URI            = "ipp://" ( 1*NAMECHAR / IP-literal / IPv4address )
-                 [ ":" 1*DIGIT ] ( "/printers/" / "/classes/" ) 1*NAMECHAR
-NAMECHAR       = %x21.22.24.26-2E.30-7E / %x25 HEXDIG HEXDIG
-IP-literal     = See RFC 3986
-IPv4address    = See RFC 3986
-
-LOCATION       = QUOTED-STRING
-INFO           = QUOTED-STRING
-MAKE-AND-MODEL = QUOTED-STRING
-
-ATTR-NAME      = 1*( ALPHA / DIGIT / "-" / "." )
-ATTR-VALUE     = QUOTED-STRING / 1*UNQUOTE-CHAR
-
-QUOTED-STRING  = DQUOTE *QUOTED-CHAR DQUOTE
-QUOTED-CHAR    = %x20.21.23-5B.5D-7E / UTF8-CHAR / %x5C %x5C / %x5C %x22
-UNQUOTE-CHAR   = %x21.23-26.28-5B.5D-7E / UTF8-CHAR
-UTF8-CHAR      = %xC0.DF %x80.BF / %xE0.EF %x80.BF %x80.BF /
-                 %xF0.F7 %x80.BF %x80.BF %x80.BF
-
- - - diff --git a/doc/index.html.in b/doc/index.html.in index 2691b8541..857a43049 100644 --- a/doc/index.html.in +++ b/doc/index.html.in @@ -100,7 +100,7 @@ HEIGHT="128" ALT="CUPS">   CUPS and the CUPS logo are trademarks of -Apple Inc. CUPS is copyright 2007-2012 Apple +Apple Inc. Copyright 2007-2013 Apple Inc. All rights reserved. diff --git a/doc/ja/index.html.in b/doc/ja/index.html.in index d43a2ac7f..e62d8f1e9 100644 --- a/doc/ja/index.html.in +++ b/doc/ja/index.html.in @@ -100,7 +100,7 @@ HEIGHT="128" ALT="CUPS">   CUPS and the CUPS logo are trademarks of -Apple Inc. CUPS is copyright 2007-2012 Apple +Apple Inc. CUPS is copyright 2007-2013 Apple Inc. All rights reserved. diff --git a/filter/Makefile b/filter/Makefile index 85f9d8a33..5360c1654 100644 --- a/filter/Makefile +++ b/filter/Makefile @@ -139,6 +139,7 @@ install-libs: $(INSTALLSTATIC) if test "x$(SYMROOT)" != "x"; then \ $(INSTALL_DIR) $(SYMROOT); \ cp $(LIBCUPSIMAGE) $(SYMROOT); \ + dsymutil $(SYMROOT)/$(LIBCUPSIMAGE); \ fi installstatic: diff --git a/filter/pstops.c b/filter/pstops.c index bcc8d2b4d..8f406fe57 100644 --- a/filter/pstops.c +++ b/filter/pstops.c @@ -1303,7 +1303,8 @@ copy_page(cups_file_t *fp, /* I - File to read from */ if (doc->ap_input_slot || doc->ap_manual_feed) { - if (doc->page == 1) + if ((doc->page == 1 && (!doc->slow_order || !Duplex)) || + (doc->page == 2 && doc->slow_order && Duplex)) { /* * First page/sheet gets AP_FIRSTPAGE_* options... diff --git a/man/backend.man b/man/backend.man index 156e06174..b97ab4ae9 100644 --- a/man/backend.man +++ b/man/backend.man @@ -3,7 +3,7 @@ .\" .\" Backend man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -166,7 +166,7 @@ All other exit code values are reserved. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: backend.man 7810 2008-07-29 01:11:15Z mike $". .\" diff --git a/man/cancel.man b/man/cancel.man index b9a6fd231..5134d1fef 100644 --- a/man/cancel.man +++ b/man/cancel.man @@ -3,7 +3,7 @@ .\" .\" cancel man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -69,7 +69,7 @@ Cancel-Jobs operations in \fIcupsd.conf(5)\fR. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cancel.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/classes.conf.man b/man/classes.conf.man index 269ddc4d9..8149d1539 100644 --- a/man/classes.conf.man +++ b/man/classes.conf.man @@ -3,7 +3,7 @@ .\" .\" classes.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -104,7 +104,7 @@ Specifies the date/time associated with the state. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: classes.conf.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/client.conf.man.in b/man/client.conf.man.in index ef5233fb9..dc120677f 100644 --- a/man/client.conf.man.in +++ b/man/client.conf.man.in @@ -3,7 +3,7 @@ .\" .\" client.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -53,7 +53,7 @@ Specifies the default user name to use for requests. .SH SEE ALSO http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: client.conf.man.in 6649 2007-07-11 21:46:42Z mike $". .\" diff --git a/man/cups-config.man b/man/cups-config.man index 44c8857df..c13e93579 100644 --- a/man/cups-config.man +++ b/man/cups-config.man @@ -3,7 +3,7 @@ .\" .\" cups-config man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -111,7 +111,7 @@ Displays the full version number of the CUPS installation .SH SEE ALSO http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cups-config.man 7646 2008-06-16 17:26:20Z mike $". .\" diff --git a/man/cups-deviced.man.in b/man/cups-deviced.man.in index a89cf056b..ab9a871a2 100644 --- a/man/cups-deviced.man.in +++ b/man/cups-deviced.man.in @@ -3,7 +3,7 @@ .\" .\" cups-deviced man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -38,7 +38,7 @@ backend(7), cupsd(8), cupsd.conf(5), .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cups-deviced.man.in 7646 2008-06-16 17:26:20Z mike $". .\" diff --git a/man/cups-driverd.man.in b/man/cups-driverd.man.in index 93d779337..3f015a437 100644 --- a/man/cups-driverd.man.in +++ b/man/cups-driverd.man.in @@ -3,7 +3,7 @@ .\" .\" cups-driverd man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -116,7 +116,7 @@ cupsd(8), cupsd.conf(5), cupstestppd(1), lpinfo(8), .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cups-driverd.man.in 7662 2008-06-17 14:34:20Z mike $". .\" diff --git a/man/cups-files.conf.man.in b/man/cups-files.conf.man.in index d873d537b..58da102d0 100644 --- a/man/cups-files.conf.man.in +++ b/man/cups-files.conf.man.in @@ -3,7 +3,7 @@ .\" .\" cupsd.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -140,7 +140,7 @@ Specifies the user name or ID that is used when running external programs. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/cups-lpd.man.in b/man/cups-lpd.man.in index 6e16dca7b..4289962b4 100644 --- a/man/cups-lpd.man.in +++ b/man/cups-lpd.man.in @@ -3,7 +3,7 @@ .\" .\" cups-lpd man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -118,7 +118,7 @@ clients may be unreliable. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cups-lpd.man.in 7835 2008-08-09 06:37:04Z mike $". .\" diff --git a/man/cups-snmp.conf.man b/man/cups-snmp.conf.man index f951b646c..608a2b5bc 100644 --- a/man/cups-snmp.conf.man +++ b/man/cups-snmp.conf.man @@ -3,7 +3,7 @@ .\" .\" snmp.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -72,7 +72,7 @@ cups-snmp(8), .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cups-snmp.conf.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/cups-snmp.man.in b/man/cups-snmp.man.in index f34170db4..e6f6c7448 100644 --- a/man/cups-snmp.man.in +++ b/man/cups-snmp.man.in @@ -3,7 +3,7 @@ .\" .\" SNMP backend man page for CUPS. .\" -.\" Copyright 2012 by Apple Inc. +.\" Copyright 2012-2013 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -53,7 +53,7 @@ environment variable. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/cupsaccept.man b/man/cupsaccept.man index a03ae5d50..0c8ba03be 100644 --- a/man/cupsaccept.man +++ b/man/cupsaccept.man @@ -3,7 +3,7 @@ .\" .\" accept/reject man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -73,7 +73,7 @@ require the root user to execute these commands. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsaccept.man 7930 2008-09-10 22:25:54Z mike $". .\" diff --git a/man/cupsaddsmb.man.in b/man/cupsaddsmb.man.in index a8134142d..75598ab69 100644 --- a/man/cupsaddsmb.man.in +++ b/man/cupsaddsmb.man.in @@ -3,7 +3,7 @@ .\" .\" cupsaddsmb man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -208,7 +208,7 @@ http://localhost:631/help http://www.cups.org/windows/ .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsaddsmb.man.in 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/cupsctl.man b/man/cupsctl.man index 50517a251..ef1a3fb1e 100644 --- a/man/cupsctl.man +++ b/man/cupsctl.man @@ -3,7 +3,7 @@ .\" .\" cupsctl man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -91,7 +91,7 @@ You cannot set the Listen or Port directives using \fIcupsctl\fR. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsctl.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/cupsd.conf.man.in b/man/cupsd.conf.man.in index 7d8ebc883..a29d36c13 100644 --- a/man/cupsd.conf.man.in +++ b/man/cupsd.conf.man.in @@ -3,7 +3,7 @@ .\" .\" cupsd.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -519,7 +519,7 @@ Specifies whether the web interface is enabled. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsd.conf.man.in 7935 2008-09-11 01:54:11Z mike $". .\" diff --git a/man/cupsd.man.in b/man/cupsd.man.in index 2e4b8cd12..3ab21e727 100644 --- a/man/cupsd.man.in +++ b/man/cupsd.man.in @@ -3,7 +3,7 @@ .\" .\" cupsd man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -66,7 +66,7 @@ operations. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsd.man.in 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/cupsenable.man b/man/cupsenable.man index 6ed5ee846..482a1e32d 100644 --- a/man/cupsenable.man +++ b/man/cupsenable.man @@ -3,7 +3,7 @@ .\" .\" cupsenable/cupsdisable man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -86,7 +86,7 @@ require the root user to execute these commands. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsenable.man 7600 2008-05-20 21:06:23Z mike $". diff --git a/man/cupsfilter.man b/man/cupsfilter.man index f39a7fdf3..5a67e4da5 100644 --- a/man/cupsfilter.man +++ b/man/cupsfilter.man @@ -3,7 +3,7 @@ .\" .\" cupsfilter man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -103,7 +103,7 @@ Delete the PPD file after conversion. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupsfilter.man 7936 2008-09-11 03:12:59Z mike $". .\" diff --git a/man/cupstestdsc.man b/man/cupstestdsc.man index 62bc25bc9..ec08797a5 100644 --- a/man/cupstestdsc.man +++ b/man/cupstestdsc.man @@ -3,7 +3,7 @@ .\" .\" cupstestdsc man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -44,7 +44,7 @@ http://localhost:631/help Adobe PostScript Language Document Structuring Conventions Specification, Version 3.0. .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupstestdsc.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/cupstestppd.man b/man/cupstestppd.man index f1d90f258..2d66116fd 100644 --- a/man/cupstestppd.man +++ b/man/cupstestppd.man @@ -3,7 +3,7 @@ .\" .\" cupstestppd man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -159,7 +159,7 @@ http://localhost:631/help .br Adobe PostScript Printer Description File Format Specification, Version 4.3. .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: cupstestppd.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/filter.man b/man/filter.man index 1acff4b4e..9a79dbd24 100644 --- a/man/filter.man +++ b/man/filter.man @@ -3,7 +3,7 @@ .\" .\" filter man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -232,7 +232,7 @@ only filter. Typically the interface script will be provided via the .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: filter.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/ipptool.man b/man/ipptool.man index 3fb0f8f44..16b12764b 100644 --- a/man/ipptool.man +++ b/man/ipptool.man @@ -3,7 +3,7 @@ .\" .\" ipptool man page for CUPS. .\" -.\" Copyright 2010-2012 by Apple Inc. +.\" Copyright 2010-2013 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -137,7 +137,7 @@ The following standard files are available: .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/ipptoolfile.man b/man/ipptoolfile.man index aea8d80cd..a4bba335e 100644 --- a/man/ipptoolfile.man +++ b/man/ipptoolfile.man @@ -3,7 +3,7 @@ .\" .\" ipptoolfile man page for CUPS. .\" -.\" Copyright 2010-2012 by Apple Inc. +.\" Copyright 2010-2013 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -11,7 +11,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 ipptoolfile 5 "CUPS" "3 December 2012" "Apple Inc." +.TH ipptoolfile 5 "CUPS" "10 January 2013" "Apple Inc." .SH NAME ipptoolfile \- ipptool file format @@ -332,6 +332,12 @@ Requires that at least one value of the EXPECT attribute matches the regular exp .SH STATUS PREDICATES The following predicates are understood following the STATUS test directive: .TP 5 +DEFINE-MATCH variable-name +Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test. +.TP 5 +DEFINE-NO-MATCH variable-name +Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test. +.TP 5 IF-DEFINED variable-name Makes the STATUS apply only if the specified variable is defined. .TP 5 @@ -571,7 +577,7 @@ Inserts the username from the URI provided to \fIipptool\fR, if any. http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/lp.man b/man/lp.man index 2ef61cabf..98466240c 100644 --- a/man/lp.man +++ b/man/lp.man @@ -3,7 +3,7 @@ .\" .\" lp man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -246,7 +246,7 @@ is highest priority). .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lp.man 7889 2008-08-29 22:03:35Z mike $". .\" diff --git a/man/lpadmin.man b/man/lpadmin.man index d2ebbbec7..0ec81b012 100644 --- a/man/lpadmin.man +++ b/man/lpadmin.man @@ -3,7 +3,7 @@ .\" .\" lpadmin man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -221,7 +221,7 @@ System V or Solaris printing system configuration options. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpadmin.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpc.man b/man/lpc.man index d38011991..8d5245c6d 100644 --- a/man/lpc.man +++ b/man/lpc.man @@ -3,7 +3,7 @@ .\" .\" lpc man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -65,7 +65,7 @@ standard Berkeley or LPRng commands. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpc.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpinfo.man b/man/lpinfo.man index 4a8324228..e45a7f35d 100644 --- a/man/lpinfo.man +++ b/man/lpinfo.man @@ -3,7 +3,7 @@ .\" .\" lpinfo man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -109,7 +109,7 @@ The \fIlpinfo\fR command is unique to CUPS. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpinfo.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpmove.man b/man/lpmove.man index 2100e0a30..23ea0987d 100644 --- a/man/lpmove.man +++ b/man/lpmove.man @@ -3,7 +3,7 @@ .\" .\" lpmove man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -60,7 +60,7 @@ Specifies an alternate server. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpmove.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpoptions.man.in b/man/lpoptions.man.in index 3658f8f5e..6007071c9 100644 --- a/man/lpoptions.man.in +++ b/man/lpoptions.man.in @@ -3,7 +3,7 @@ .\" .\" lpoptions man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -129,7 +129,7 @@ created by the root user. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpoptions.man.in 7889 2008-08-29 22:03:35Z mike $". .\" diff --git a/man/lppasswd.man b/man/lppasswd.man index b64d642d8..1edb0d8b9 100644 --- a/man/lppasswd.man +++ b/man/lppasswd.man @@ -3,7 +3,7 @@ .\" .\" lpadmin man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -62,7 +62,7 @@ accounts managed by PAM instead. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lppasswd.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpq.man b/man/lpq.man index f1d87ae01..97630e919 100644 --- a/man/lpq.man +++ b/man/lpq.man @@ -3,7 +3,7 @@ .\" .\" lpq man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -66,7 +66,7 @@ Requests a more verbose (long) reporting format. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpq.man 7646 2008-06-16 17:26:20Z mike $". .\" diff --git a/man/lpr.man b/man/lpr.man index 1dcc937d0..c6392c77c 100644 --- a/man/lpr.man +++ b/man/lpr.man @@ -3,7 +3,7 @@ .\" .\" lpr man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -116,7 +116,7 @@ are not supported by CUPS and produce a warning message if used. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpr.man 7889 2008-08-29 22:03:35Z mike $". .\" diff --git a/man/lprm.man b/man/lprm.man index 36e90841f..3d3f30f27 100644 --- a/man/lprm.man +++ b/man/lprm.man @@ -3,7 +3,7 @@ .\" .\" lprm man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -59,7 +59,7 @@ Berkeley \fIlprm\fR command. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lprm.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/lpstat.man b/man/lpstat.man index 92f611283..37c39d767 100644 --- a/man/lpstat.man +++ b/man/lpstat.man @@ -3,7 +3,7 @@ .\" .\" lpstat man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -137,7 +137,7 @@ The Solaris "-f", "-P", and "-S" options are silently ignored. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: lpstat.man 7921 2008-09-10 15:42:24Z mike $". .\" diff --git a/man/mailto.conf.man b/man/mailto.conf.man index d603dd0dd..aa6038686 100644 --- a/man/mailto.conf.man +++ b/man/mailto.conf.man @@ -3,7 +3,7 @@ .\" .\" mailto.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -54,7 +54,7 @@ Specifies a prefix string for the subject line of an email notification. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: mailto.conf.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/mime.convs.man b/man/mime.convs.man index 14622a992..311353a6d 100644 --- a/man/mime.convs.man +++ b/man/mime.convs.man @@ -3,7 +3,7 @@ .\" .\" mime.convs man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -40,7 +40,7 @@ application/postscript application/vnd.cups-raster 50 pstoraster .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: mime.convs.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/mime.types.man b/man/mime.types.man index 5ed9ebdf6..bf1dd9b73 100644 --- a/man/mime.types.man +++ b/man/mime.types.man @@ -3,7 +3,7 @@ .\" .\" mime.types man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -109,7 +109,7 @@ higher priority than "text/bar", "text/foo" will be chosen instead. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: mime.types.man 7670 2008-06-17 22:42:08Z mike $". .\" diff --git a/man/notifier.man b/man/notifier.man index cc6e800c2..411287868 100644 --- a/man/notifier.man +++ b/man/notifier.man @@ -3,7 +3,7 @@ .\" .\" notifier man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -151,7 +151,7 @@ file for the current setting. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/ppdc.man b/man/ppdc.man index 8f30bfb56..933e7d118 100644 --- a/man/ppdc.man +++ b/man/ppdc.man @@ -3,7 +3,7 @@ .\" .\" ppdc man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -75,7 +75,7 @@ ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdc.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/ppdcfile.man b/man/ppdcfile.man index 571acaa97..a7a56a8d9 100644 --- a/man/ppdcfile.man +++ b/man/ppdcfile.man @@ -3,7 +3,7 @@ .\" .\" ppdcfile man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -164,7 +164,7 @@ ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdcfile.man 7607 2008-05-21 01:06:23Z mike $". .\" diff --git a/man/ppdhtml.man b/man/ppdhtml.man index bb3d57a26..78df7d392 100644 --- a/man/ppdhtml.man +++ b/man/ppdhtml.man @@ -3,7 +3,7 @@ .\" .\" ppdhtml man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -40,7 +40,7 @@ ppdc(1), ppdcfile(5), ppdi(1), ppdmerge(1), ppdpo(1) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdhtml.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/ppdi.man b/man/ppdi.man index dea64ec74..38658e02e 100644 --- a/man/ppdi.man +++ b/man/ppdi.man @@ -3,7 +3,7 @@ .\" .\" ppdi man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -40,7 +40,7 @@ ppdc(1), ppdhtml(1), ppdmerge(1), ppdpo(1), ppdcfile(5) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdi.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/ppdmerge.man b/man/ppdmerge.man index fcd495fd4..397314eca 100644 --- a/man/ppdmerge.man +++ b/man/ppdmerge.man @@ -3,7 +3,7 @@ .\" .\" ppdmerge man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -41,7 +41,7 @@ cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdpo(1), ppdcfile(5) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdmerge.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/ppdpo.man b/man/ppdpo.man index 8e6c5f544..c6378bc41 100644 --- a/man/ppdpo.man +++ b/man/ppdpo.man @@ -3,7 +3,7 @@ .\" .\" ppdpo man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -46,7 +46,7 @@ ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdcfile(5) .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: ppdpo.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/printers.conf.man b/man/printers.conf.man index d6902f7e8..6d8609fcb 100644 --- a/man/printers.conf.man +++ b/man/printers.conf.man @@ -3,7 +3,7 @@ .\" .\" printers.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 1997-2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -118,7 +118,7 @@ Specifies the date/time associated with the state. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: printers.conf.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/man/subscriptions.conf.man b/man/subscriptions.conf.man index 2642ee7d8..5531c6a5f 100644 --- a/man/subscriptions.conf.man +++ b/man/subscriptions.conf.man @@ -3,7 +3,7 @@ .\" .\" subscriptions.conf man page for CUPS. .\" -.\" Copyright 2007-2012 by Apple Inc. +.\" Copyright 2007-2013 by Apple Inc. .\" Copyright 2006 by Easy Software Products. .\" .\" These coded instructions, statements, and computer programs are the @@ -83,7 +83,7 @@ is typically the "from" address in mailto: notifications. .br http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. .\" .\" End of "$Id: subscriptions.conf.man 7600 2008-05-20 21:06:23Z mike $". .\" diff --git a/ppdc/Makefile b/ppdc/Makefile index c1fbb8f67..c038a5f58 100644 --- a/ppdc/Makefile +++ b/ppdc/Makefile @@ -178,6 +178,7 @@ install-libs: $(INSTALLSTATIC) if test "x$(SYMROOT)" != "x"; then \ $(INSTALL_DIR) $(SYMROOT); \ cp $(LIBCUPSPPDC) $(SYMROOT); \ + dsymutil $(SYMROOT)/$(LIBCUPSPPDC); \ fi installstatic: diff --git a/scheduler/Makefile b/scheduler/Makefile index d6035e0aa..094505f62 100644 --- a/scheduler/Makefile +++ b/scheduler/Makefile @@ -257,6 +257,7 @@ install-libs: $(INSTALLSTATIC) if test "x$(SYMROOT)" != "x"; then \ $(INSTALL_DIR) $(SYMROOT); \ cp $(LIBCUPSMIME) $(SYMROOT); \ + dsymutil $(SYMROOT)/$(LIBCUPSMIME); \ fi installstatic: diff --git a/scheduler/auth.c b/scheduler/auth.c index 8aff4f21e..c8e89b9ce 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -96,11 +96,6 @@ typedef struct sockpeercred cupsd_ucred_t; # endif # define CUPSD_UCRED_UID(c) (c).uid #endif /* HAVE_SYS_UCRED_H */ -#ifdef HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID -/* Not in public headers... */ -extern void krb5_ipc_client_set_target_uid(uid_t); -extern void krb5_ipc_client_clear_target(void); -#endif /* HAVE_KRB5_IPC_CLIENT_SET_TARGET_UID */ /* @@ -597,15 +592,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ while (isspace(*authorization & 255)) authorization ++; - if ((localuser = cupsdFindCert(authorization)) != NULL) - { - strlcpy(username, localuser->username, sizeof(username)); - - cupsdLogMessage(CUPSD_LOG_DEBUG, - "[Client %d] Authorized as %s using Local", con->http.fd, - username); - } - else + if ((localuser = cupsdFindCert(authorization)) == NULL) { cupsdLogMessage(CUPSD_LOG_ERROR, "[Client %d] Local authentication certificate not found.", @@ -613,12 +600,12 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ return; } -#ifdef HAVE_GSSAPI - if (localuser->ccache) - con->type = CUPSD_AUTH_NEGOTIATE; - else -#endif /* HAVE_GSSAPI */ - con->type = CUPSD_AUTH_BASIC; + strlcpy(username, localuser->username, sizeof(username)); + con->type = localuser->type; + + cupsdLogMessage(CUPSD_LOG_DEBUG, + "[Client %d] Authorized as %s using Local", con->http.fd, + username); } else if (!strncmp(authorization, "Basic", 5)) { diff --git a/scheduler/cert.c b/scheduler/cert.c index a25f3092a..fa956034a 100644 --- a/scheduler/cert.c +++ b/scheduler/cert.c @@ -3,7 +3,7 @@ * * Authentication certificate routines for the CUPS scheduler. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -42,7 +42,7 @@ void cupsdAddCert(int pid, /* I - Process ID */ const char *username, /* I - Username */ - void *ccache) /* I - Kerberos credentials or NULL */ + int type) /* I - AuthType for username */ { int i; /* Looping var */ cupsd_cert_t *cert; /* Current certificate */ @@ -66,7 +66,8 @@ cupsdAddCert(int pid, /* I - Process ID */ * Fill in the certificate information... */ - cert->pid = pid; + cert->pid = pid; + cert->type = type; strlcpy(cert->username, username, sizeof(cert->username)); for (i = 0; i < 32; i ++) @@ -259,16 +260,6 @@ cupsdAddCert(int pid, /* I - Process ID */ write(fd, cert->certificate, strlen(cert->certificate)); close(fd); - /* - * Add Kerberos credentials as needed... - */ - -#ifdef HAVE_GSSAPI - cert->ccache = (krb5_ccache)ccache; -#else - (void)ccache; -#endif /* HAVE_GSSAPI */ - /* * Insert the certificate at the front of the list... */ @@ -308,15 +299,6 @@ cupsdDeleteCert(int pid) /* I - Process ID */ else prev->next = cert->next; -#ifdef HAVE_GSSAPI - /* - * Release Kerberos credentials as needed... - */ - - if (cert->ccache) - krb5_cc_destroy(KerberosContext, cert->ccache); -#endif /* HAVE_GSSAPI */ - free(cert); /* @@ -449,7 +431,7 @@ cupsdInitCerts(void) */ if (!RunUser) - cupsdAddCert(0, "root", NULL); + cupsdAddCert(0, "root", cupsdDefaultAuthType()); } diff --git a/scheduler/cert.h b/scheduler/cert.h index 444897ebd..d479b2ec9 100644 --- a/scheduler/cert.h +++ b/scheduler/cert.h @@ -3,7 +3,7 @@ * * Authentication certificate definitions for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 1997-2005 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -23,9 +23,7 @@ typedef struct cupsd_cert_s int pid; /* Process ID (0 for root certificate) */ char certificate[33]; /* 32 hex characters, or 128 bits */ char username[33]; /* Authenticated username */ -#ifdef HAVE_GSSAPI - krb5_ccache ccache; /* Kerberos credential cache */ -#endif /* HAVE_GSSAPI */ + int type; /* AuthType for username */ } cupsd_cert_t; @@ -43,8 +41,7 @@ VAR time_t RootCertTime /* Root certificate update time */ * Prototypes... */ -extern void cupsdAddCert(int pid, const char *username, - void *ccache); +extern void cupsdAddCert(int pid, const char *username, int type); extern void cupsdDeleteCert(int pid); extern void cupsdDeleteAllCerts(void); extern cupsd_cert_t *cupsdFindCert(const char *certificate); diff --git a/scheduler/client.c b/scheduler/client.c index 89bda38d7..9c84252b8 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -2580,14 +2580,7 @@ cupsdSendHeader( con->http.hostname); #ifdef HAVE_GSSAPI else if (auth_type == CUPSD_AUTH_NEGOTIATE) - { -# ifdef AF_LOCAL - if (_httpAddrFamily(con->http.hostaddr) == AF_LOCAL) - strlcpy(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str)); - else -# endif /* AF_LOCAL */ strlcpy(auth_str, "Negotiate", sizeof(auth_str)); - } #endif /* HAVE_GSSAPI */ if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE && @@ -3618,7 +3611,6 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */ server_name[1024], /* SERVER_NAME environment variable */ server_port[1024]; /* SERVER_PORT environment variable */ ipp_attribute_t *attr; /* attributes-natural-language attribute */ - void *ccache = NULL; /* Kerberos credentials */ /* @@ -3970,7 +3962,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */ */ if (con->username[0]) - cupsdAddCert(pid, con->username, ccache); + cupsdAddCert(pid, con->username, con->type); cupsdLogMessage(CUPSD_LOG_DEBUG, "[CGI] Started %s (PID %d)", command, pid); diff --git a/scheduler/colorman.c b/scheduler/colorman.c index ddb7a6fce..53cd03d8a 100644 --- a/scheduler/colorman.c +++ b/scheduler/colorman.c @@ -1128,7 +1128,7 @@ colord_delete_device( message = COLORD_DBUS_MSG(COLORD_DBUS_PATH, "DeleteDevice"); dbus_message_iter_init_append(message, &args); - dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_id); + dbus_message_iter_append_basic(&args, DBUS_TYPE_OBJECT_PATH, &device_id); /* * Send the DeleteDevice request synchronously... diff --git a/scheduler/conf.c b/scheduler/conf.c index 68b97611d..f32baa060 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -1116,11 +1116,20 @@ cupsdReadConfiguration(void) * Update TempDir to the default if it hasn't been set already... */ +#ifdef __APPLE__ + if (TempDir && !RunUser && + (!strncmp(TempDir, "/private/tmp", 12) || !strncmp(TempDir, "/tmp", 4))) + { + cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot use %s for TempDir.", TempDir); + cupsdClearString(&TempDir); + } +#endif /* __APPLE__ */ + if (!TempDir) { #ifdef __APPLE__ if ((tmpdir = getenv("TMPDIR")) != NULL && - strncmp(tmpdir, "/private/tmp", 12)) + strncmp(tmpdir, "/private/tmp", 12) && strncmp(tmpdir, "/tmp", 4)) #else if ((tmpdir = getenv("TMPDIR")) != NULL) #endif /* __APPLE__ */ @@ -1143,13 +1152,13 @@ cupsdReadConfiguration(void) else cupsdSetString(&TempDir, tmpdir); } + } - if (!TempDir) - { - cupsdLogMessage(CUPSD_LOG_INFO, "Using default TempDir of %s/tmp...", - RequestRoot); - cupsdSetStringf(&TempDir, "%s/tmp", RequestRoot); - } + if (!TempDir) + { + cupsdLogMessage(CUPSD_LOG_INFO, "Using default TempDir of %s/tmp...", + RequestRoot); + cupsdSetStringf(&TempDir, "%s/tmp", RequestRoot); } /* diff --git a/scheduler/cupsd.h b/scheduler/cupsd.h index b15336b51..8a6ffd97f 100644 --- a/scheduler/cupsd.h +++ b/scheduler/cupsd.h @@ -160,13 +160,6 @@ VAR int NeedReload VALUE(RELOAD_ALL), VAR void *DefaultProfile VALUE(0); /* Default security profile */ -#ifdef HAVE_GSSAPI -VAR int KerberosInitialized VALUE(0); - /* Has Kerberos been initialized? */ -VAR krb5_context KerberosContext VALUE(NULL); - /* Kerberos context for credentials */ -#endif /* HAVE_GSSAPI */ - #ifdef HAVE_LAUNCH_H VAR int Launchd VALUE(0); /* Running from launchd */ diff --git a/scheduler/cupsfilter.c b/scheduler/cupsfilter.c index 60f522c28..aa15702df 100644 --- a/scheduler/cupsfilter.c +++ b/scheduler/cupsfilter.c @@ -409,6 +409,7 @@ main(int argc, /* I - Number of command-line args */ if (srctype) { + /* sscanf return value already checked above */ sscanf(srctype, "%15[^/]/%255s", super, type); if ((src = mimeType(mime, super, type)) == NULL) { @@ -426,6 +427,7 @@ main(int argc, /* I - Number of command-line args */ return (1); } + /* sscanf return value already checked above */ sscanf(dsttype, "%15[^/]/%255s", super, type); if (!_cups_strcasecmp(super, "printer")) dst = printer_type; diff --git a/scheduler/job.c b/scheduler/job.c index 72ef3e869..3ef050f80 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -2469,8 +2469,10 @@ cupsdSetJobState( * Set the new job state... */ - job->state->values[0].integer = newstate; - job->state_value = newstate; + job->state_value = newstate; + + if (job->state) + job->state->values[0].integer = newstate; switch (newstate) { @@ -4286,6 +4288,8 @@ load_request_root(void) else unload_job(job); } + else + free(job); } cupsDirClose(dir); @@ -4377,7 +4381,7 @@ set_time(cupsd_job_t *job, /* I - Job to update */ if (!strcmp(name, "time-at-completed")) { - if (JobHistory < INT_MAX) + if (JobHistory < INT_MAX && attr) job->history_time = attr->values[0].integer + JobHistory; else job->history_time = INT_MAX; @@ -4385,7 +4389,7 @@ set_time(cupsd_job_t *job, /* I - Job to update */ if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate) JobHistoryUpdate = job->history_time; - if (JobFiles < INT_MAX) + if (JobFiles < INT_MAX && attr) job->file_time = attr->values[0].integer + JobFiles; else job->file_time = INT_MAX; @@ -4728,7 +4732,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */ cupsdStopPrinter(job->printer, 1); return; } - else if (cupsdSetPrinterReasons(job->printer, message)) + else if (message[0] && cupsdSetPrinterReasons(job->printer, message)) { event |= CUPSD_EVENT_PRINTER_STATE; diff --git a/scheduler/main.c b/scheduler/main.c index 0f6098963..43a4c87c2 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -952,7 +952,7 @@ main(int argc, /* I - Number of command-line args */ */ cupsdDeleteCert(0); - cupsdAddCert(0, "root", NULL); + cupsdAddCert(0, "root", cupsdDefaultAuthType()); } #endif /* !HAVE_AUTHORIZATION_H */ @@ -1144,23 +1144,6 @@ main(int argc, /* I - Number of command-line args */ cupsdStopSystemMonitor(); #endif /* __APPLE__ */ -#ifdef HAVE_GSSAPI - /* - * Free the scheduler's Kerberos context... - */ - -# ifdef __APPLE__ - /* - * If the weak-linked GSSAPI/Kerberos library is not present, don't try - * to use it... - */ - - if (krb5_init_context != NULL) -# endif /* __APPLE__ */ - if (KerberosContext) - krb5_free_context(KerberosContext); -#endif /* HAVE_GSSAPI */ - cupsdStopSelect(); return (!stop_scheduler); diff --git a/templates/ca/trailer.tmpl b/templates/ca/trailer.tmpl index 655c068d7..1c07cd0de 100644 --- a/templates/ca/trailer.tmpl +++ b/templates/ca/trailer.tmpl @@ -1,7 +1,7 @@   CUPS i el logotip de CUPS són marques registrades per -Apple Inc. CUPS té copyright 2007-2012 Apple +Apple Inc. CUPS té copyright 2007-2013 Apple Inc. Tots els drets reservats. diff --git a/templates/es/trailer.tmpl b/templates/es/trailer.tmpl index 335afd36e..6f41b6669 100644 --- a/templates/es/trailer.tmpl +++ b/templates/es/trailer.tmpl @@ -2,7 +2,7 @@   CUPS y el logo de CUPS son marcas registradas de Apple, Inc. Los derechos de copia de CUPS -2007-2012 son de Apple Inc. Todos los derechos reservados. +2007-2013 son de Apple Inc. Todos los derechos reservados. diff --git a/templates/ja/trailer.tmpl b/templates/ja/trailer.tmpl index 14412f1ca..47743e152 100644 --- a/templates/ja/trailer.tmpl +++ b/templates/ja/trailer.tmpl @@ -1,7 +1,7 @@   CUPS and the CUPS logo are trademarks of -Apple Inc. CUPS is copyright 2007-2012 Apple +Apple Inc. CUPS is copyright 2007-2013 Apple Inc. All rights reserved. diff --git a/templates/trailer.tmpl b/templates/trailer.tmpl index 14412f1ca..12217d7f5 100644 --- a/templates/trailer.tmpl +++ b/templates/trailer.tmpl @@ -1,7 +1,7 @@   CUPS and the CUPS logo are trademarks of -Apple Inc. CUPS is copyright 2007-2012 Apple +Apple Inc. Copyright 2007-2013 Apple Inc. All rights reserved. diff --git a/test/ippserver.c b/test/ippserver.c index 3b85ad6f1..eae5b7e75 100644 --- a/test/ippserver.c +++ b/test/ippserver.c @@ -93,6 +93,7 @@ #ifdef HAVE_DNSSD # include #endif /* HAVE_DNSSD */ +#include #include #include #include diff --git a/test/ipptool.c b/test/ipptool.c index 56d56df67..07c0b0435 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -3,7 +3,7 @@ * * ipptool command for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -113,7 +113,10 @@ typedef struct _cups_status_s /**** Status info ****/ { ipp_status_t status; /* Expected status code */ char *if_defined, /* Only if variable is defined */ - *if_not_defined; /* Only if variable is not defined */ + *if_not_defined, /* Only if variable is not defined */ + *define_match, /* Variable to define on match */ + *define_no_match, /* Variable to define on no-match */ + *define_value; /* Variable to define with value */ int repeat_limit, /* Maximum number of times to repeat */ repeat_match, /* Repeat the test when it does not match */ repeat_no_match; /* Repeat the test when it matches */ @@ -1185,7 +1188,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ _cups_strcasecmp(token, "WITH-VALUE")) last_expect = NULL; - if (_cups_strcasecmp(token, "IF-DEFINED") && + if (_cups_strcasecmp(token, "DEFINE-MATCH") && + _cups_strcasecmp(token, "DEFINE-NO-MATCH") && + _cups_strcasecmp(token, "IF-DEFINED") && _cups_strcasecmp(token, "IF-NOT-DEFINED") && _cups_strcasecmp(token, "REPEAT-LIMIT") && _cups_strcasecmp(token, "REPEAT-MATCH") && @@ -1494,13 +1499,15 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ * Operation... */ - if (!get_token(fp, token, sizeof(token), &linenum)) + if (!get_token(fp, temp, sizeof(temp), &linenum)) { print_fatal_error("Missing OPERATION code on line %d.", linenum); pass = 0; goto test_exit; } + expand_variables(vars, token, temp, sizeof(token)); + if ((op = ippOpValue(token)) == (ipp_op_t)-1 && (op = strtol(token, NULL, 0)) == 0) { @@ -1543,13 +1550,15 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ double delay; - if (!get_token(fp, token, sizeof(token), &linenum)) + if (!get_token(fp, temp, sizeof(temp), &linenum)) { print_fatal_error("Missing DELAY value on line %d.", linenum); pass = 0; goto test_exit; } + expand_variables(vars, token, temp, sizeof(token)); + if ((delay = _cupsStrScand(token, NULL, localeconv())) <= 0.0) { print_fatal_error("Bad DELAY value \"%s\" on line %d.", token, @@ -1932,10 +1941,12 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ if (last_expect) last_expect->define_match = strdup(token); + else if (last_status) + last_status->define_match = strdup(token); else { - print_fatal_error("DEFINE-MATCH without a preceding EXPECT on line " - "%d.", linenum); + print_fatal_error("DEFINE-MATCH without a preceding EXPECT or STATUS " + "on line %d.", linenum); pass = 0; goto test_exit; } @@ -1952,10 +1963,12 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ if (last_expect) last_expect->define_no_match = strdup(token); + else if (last_status) + last_status->define_no_match = strdup(token); else { - print_fatal_error("DEFINE-NO-MATCH without a preceding EXPECT on " - "line %d.", linenum); + print_fatal_error("DEFINE-NO-MATCH without a preceding EXPECT or " + "STATUS on line %d.", linenum); pass = 0; goto test_exit; } @@ -1974,8 +1987,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ last_expect->define_value = strdup(token); else { - print_fatal_error("DEFINE-VALUE without a preceding EXPECT on line " - "%d.", linenum); + print_fatal_error("DEFINE-VALUE without a preceding EXPECT on " + "line %d.", linenum); pass = 0; goto test_exit; } @@ -2703,11 +2716,23 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ repeat_count < statuses[i].repeat_limit) repeat_test = 1; - break; + if (statuses[i].define_match) + set_variable(vars, statuses[i].define_match, "1"); + + break; } - else if (statuses[i].repeat_no_match && - repeat_count < statuses[i].repeat_limit) - repeat_test = 1; + else + { + if (statuses[i].repeat_no_match && + repeat_count < statuses[i].repeat_limit) + repeat_test = 1; + + if (statuses[i].define_no_match) + { + set_variable(vars, statuses[i].define_no_match, "1"); + break; + } + } } if (i == num_statuses && num_statuses > 0) @@ -3058,6 +3083,10 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ free(statuses[i].if_defined); if (statuses[i].if_not_defined) free(statuses[i].if_not_defined); + if (statuses[i].define_match) + free(statuses[i].define_match); + if (statuses[i].define_no_match) + free(statuses[i].define_no_match); } num_statuses = 0; -- 2.39.2