From: Michael R Sweet Date: Wed, 19 Oct 2016 20:04:10 +0000 (-0400) Subject: Add additional debug information from IPP backend (logging all requests and X-Git-Tag: v2.2.2~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95e00ac365503feeed8de953423601ac13a795f6;p=thirdparty%2Fcups.git Add additional debug information from IPP backend (logging all requests and responses). --- diff --git a/backend/ipp.c b/backend/ipp.c index 67383c71c4..de998a5dcc 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -160,6 +160,7 @@ static void cancel_job(http_t *http, const char *uri, int id, static ipp_pstate_t check_printer_state(http_t *http, const char *uri, const char *resource, const char *user, int version); +static void debug_attributes(ipp_t *ipp); static void *monitor_printer(_cups_monitor_t *monitor); static ipp_t *new_request(ipp_op_t op, int version, const char *uri, const char *user, const char *title, @@ -1499,6 +1500,7 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "DEBUG: Validate-Job: %s (%s)\n", ippErrorString(ipp_status), cupsLastErrorString()); + debug_attributes(response); if ((job_auth = ippFindAttribute(response, "job-authorization-uri", IPP_TAG_URI)) != NULL) @@ -1669,6 +1671,7 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "DEBUG: %s: %s (%s)\n", (num_files > 1 || create_job) ? "Create-Job" : "Print-Job", ippErrorString(ipp_status), cupsLastErrorString()); + debug_attributes(response); if (ipp_status > IPP_OK_CONFLICT) { @@ -1803,6 +1806,9 @@ main(int argc, /* I - Number of command-line args */ "compression", NULL, compression); fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1); + fprintf(stderr, "DEBUG: IPP/%d.%d %s #%d\n", version / 10, version % 10, ippOpString(ippGetOperation(request)), ippGetRequestId(request)); + debug_attributes(request); + http_status = cupsSendRequest(http, request, resource, 0); if (http_status == HTTP_CONTINUE && request->state == IPP_DATA) { @@ -1852,11 +1858,13 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "DEBUG: Error writing document data for " "Send-Document: %s\n", strerror(httpError(http))); - ippDelete(cupsGetResponse(http, resource)); + response = cupsGetResponse(http, resource); ippDelete(request); fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString()); + debug_attributes(response); + ippDelete(response); if (cupsLastError() > IPP_OK_CONFLICT && !job_canceled) { @@ -2023,6 +2031,9 @@ main(int argc, /* I - Number of command-line args */ "requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]), NULL, jattrs); + fprintf(stderr, "DEBUG: IPP/%d.%d %s #%d\n", version / 10, version % 10, ippOpString(ippGetOperation(request)), ippGetRequestId(request)); + debug_attributes(request); + /* * Do the request... */ @@ -2047,6 +2058,7 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n", ippErrorString(ipp_status), cupsLastErrorString()); + debug_attributes(response); if (ipp_status <= IPP_OK_CONFLICT) password_tries = 0; @@ -2323,6 +2335,9 @@ check_printer_state( "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs); + fprintf(stderr, "DEBUG: IPP/%d.%d %s #%d\n", version / 10, version % 10, ippOpString(ippGetOperation(request)), ippGetRequestId(request)); + debug_attributes(request); + if ((response = cupsDoRequest(http, request, resource)) != NULL) { report_printer_state(response); @@ -2336,6 +2351,7 @@ check_printer_state( fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString()); + debug_attributes(response); /* * Return the printer-state value... @@ -2345,6 +2361,51 @@ check_printer_state( } +/* + * 'debug_attributes()' - Print out the request or response attributes as DEBUG + * messages... + */ + +static void +debug_attributes(ipp_t *ipp) /* I - Request or response message */ +{ + ipp_tag_t group; /* Current group */ + ipp_attribute_t *attr; /* Current attribute */ + char buffer[1024]; /* Value buffer */ + + + for (group = IPP_TAG_ZERO, attr = ippFirstAttribute(ipp); + attr; + attr = ippNextAttribute(ipp)) + { + const char *name = ippGetName(attr); + + if (!name) + { + group = IPP_TAG_ZERO; + continue; + } + + if (group != ippGetGroupTag(attr)) + { + group = ippGetGroupTag(attr); + fprintf(stderr, "DEBUG: ---- %s ----\n", ippTagString(group)); + } + + if (!strcmp(name, "job-password")) + strlcpy(buffer, "---", sizeof(buffer)); + else + ippAttributeString(attr, buffer, sizeof(buffer)); + + fprintf(stderr, "DEBUG: %s %s%s %s\n", name, + ippGetCount(attr) > 1 ? "1setOf " : "", + ippTagString(ippGetValueTag(attr)), buffer); + } + + fprintf(stderr, "DEBUG: ---- %s ----\n", ippTagString(IPP_TAG_END)); +} + + /* * 'monitor_printer()' - Monitor the printer state. */ @@ -2646,9 +2707,6 @@ new_request( { ipp_t *request; /* Request data */ const char *keyword; /* PWG keyword */ - ipp_tag_t group; /* Current group */ - ipp_attribute_t *attr; /* Current attribute */ - char buffer[1024]; /* Value buffer */ /* @@ -2772,33 +2830,8 @@ new_request( ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", copies); } - fprintf(stderr, "DEBUG: IPP/%d.%d %s #%d\n", version / 10, version % 10, - ippOpString(ippGetOperation(request)), ippGetRequestId(request)); - for (group = IPP_TAG_ZERO, attr = ippFirstAttribute(request); - attr; - attr = ippNextAttribute(request)) - { - const char *name = ippGetName(attr); - - if (!name) - { - group = IPP_TAG_ZERO; - continue; - } - - if (group != ippGetGroupTag(attr)) - { - group = ippGetGroupTag(attr); - fprintf(stderr, "DEBUG: ---- %s ----\n", ippTagString(group)); - } - - ippAttributeString(attr, buffer, sizeof(buffer)); - fprintf(stderr, "DEBUG: %s %s%s %s\n", name, - ippGetCount(attr) > 1 ? "1setOf " : "", - ippTagString(ippGetValueTag(attr)), buffer); - } - - fprintf(stderr, "DEBUG: ---- %s ----\n", ippTagString(IPP_TAG_END)); + fprintf(stderr, "DEBUG: IPP/%d.%d %s #%d\n", version / 10, version % 10, ippOpString(ippGetOperation(request)), ippGetRequestId(request)); + debug_attributes(request); return (request); } diff --git a/doc/help/man-client.conf.html b/doc/help/man-client.conf.html index 16c1919e34..6febe5e327 100644 --- a/doc/help/man-client.conf.html +++ b/doc/help/man-client.conf.html @@ -37,7 +37,7 @@ CUPS adds the remote hostname ("name@server.example.com") for you. The default n
ServerName hostname-or-ip-address[:port]
ServerName /domain/socket
Specifies the address and optionally the port to use when connecting to the server. -Note: This directive it not supported on macOS 10.7 or later. +Note: This directive is not supported on macOS 10.7 or later.
ServerName hostname-or-ip-address[:port]/version=1.1
Specifies the address and optionally the port to use when connecting to a server running CUPS 1.3.12 and earlier.
SSLOptions [AllowDH] [AllowRC4] [AllowSSL3] [DenyTLS1.0] diff --git a/doc/help/man-cups-files.conf.html b/doc/help/man-cups-files.conf.html index 093ba6f4f4..7dfcd211db 100644 --- a/doc/help/man-cups-files.conf.html +++ b/doc/help/man-cups-files.conf.html @@ -44,6 +44,10 @@ The default is "0644" on macOS and "0640" on all other operating systems. This is done because printer device URIs sometimes contain sensitive authentication information that should not be generally known on the system. There is no way to disable this security feature.
+
CreateSelfSignedCerts yes +
CreateSelfSignedCerts no +
Specifies whether the scheduler automatically creates self-signed certificates for client connections using TLS. +The default is yes.
DataDir path
Specifies the directory where data files can be found. The default is usually "/usr/share/cups". diff --git a/doc/help/man-cups-lpd.html b/doc/help/man-cups-lpd.html index e81a01e63d..7a6b6396dc 100644 --- a/doc/help/man-cups-lpd.html +++ b/doc/help/man-cups-lpd.html @@ -94,7 +94,7 @@ program to register the changes to the inetd.conf file. launchd(8), systemd(8), and -xinetd(8). +xinetd(8). Simply enable the cups-lpd service using the corresponding control program. diff --git a/doc/help/man-cupsd.conf.html b/doc/help/man-cupsd.conf.html index bfe8e3dbb3..2fae0b7f9d 100644 --- a/doc/help/man-cupsd.conf.html +++ b/doc/help/man-cupsd.conf.html @@ -155,10 +155,10 @@ The default is "Yes".
Specifies how long an idle client connection remains open. The default is "30".
<Limit operation ...> ... </Limit> -
Specifies the IPP operations that are being limited inside a Policy section. IPP operation names are listed below in the section "IPP OPERATIONS". +
Specifies the IPP operations that are being limited inside a Policy section. IPP operation names are listed below in the section "IPP OPERATION NAMES".
<Limit method ...> ... </Limit>
<LimitExcept method ...> ... </LimitExcept> -
Specifies the HTTP methods that are being limited inside a Location section. HTTP method names are listed below in the section "HTTP METHODS". +
Specifies the HTTP methods that are being limited inside a Location section. HTTP method names are listed below in the section "HTTP METHOD NAMES".
LimitRequestBody size
Specifies the maximum size of print files, IPP requests, and HTML form data. The default is "0" which disables the limit check. @@ -457,7 +457,7 @@ The following paths are commonly used when configuring
/jobs
The path for all jobs (hold-job, release-job, etc.)
/jobs/id -
The path for the specified job. +
The path for the specified job
/printers
The path for all printers
/printers/name diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 28a97bf52f..a94bc2b25f 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -11052,7 +11052,6 @@ ENABLE_TESTABILITY = YES; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -11085,7 +11084,6 @@ CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;