From: Michael R Sweet Date: Tue, 26 Jul 2016 18:32:16 +0000 (-0400) Subject: Add debug information for encrypted connections. X-Git-Tag: v2.2rc1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ff02b0da25a703647a927da2d32be0c44a44bf8;p=thirdparty%2Fcups.git Add debug information for encrypted connections. --- diff --git a/backend/ipp.c b/backend/ipp.c index 1ac2eea075..b42b0dff1a 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -827,16 +827,37 @@ main(int argc, /* I - Number of command-line args */ cups_array_t *creds; /* TLS credentials */ cups_array_t *lcreds = NULL; /* Loaded credentials */ http_trust_t trust; /* Trust level */ - static const char *trusts[] = { NULL, "+cups-pki-invalid", "+cups-pki-changed", "+cups-pki-expired", NULL, "+cups-pki-unknown" }; + char credinfo[1024], /* Information on credentials */ + lcredinfo[1024];/* Information on saved credentials */ + static const char * const trusts[] = { NULL, "+cups-pki-invalid", "+cups-pki-changed", "+cups-pki-expired", NULL, "+cups-pki-unknown" }; /* Trust keywords */ + static const char * const trust_msgs[] = + { + "Credentials are OK/trusted", + "Credentials are invalid", + "Credentials have changed", + "Credentials are expired", + "Credentials have been renewed", + "Credentials are unknown/new" + }; fputs("DEBUG: Connection is encrypted.\n", stderr); if (!httpCopyCredentials(http, &creds)) { trust = httpCredentialsGetTrust(creds, hostname); + httpCredentialsString(creds, credinfo, sizeof(credinfo)); + + fprintf(stderr, "DEBUG: %s\n", trust_msgs[trust]); + fprintf(stderr, "DEBUG: Printer credentials: %s\n", credinfo); - fprintf(stderr, "DEBUG: trust=%d\n", (int)trust); + if (!httpLoadCredentials(NULL, &lcreds, hostname)) + { + httpCredentialsString(lcreds, lcredinfo, sizeof(lcredinfo)); + fprintf(stderr, "DEBUG: Stored credentials: %s\n", lcredinfo); + } + else + fputs("DEBUG: No stored credentials.\n", stderr); update_reasons(NULL, "-cups-pki-invalid,cups-pki-changed,cups-pki-expired,cups-pki-unknown"); if (trusts[trust]) @@ -845,7 +866,7 @@ main(int argc, /* I - Number of command-line args */ return (CUPS_BACKEND_STOP); } - if (httpLoadCredentials(NULL, &lcreds, hostname)) + if (!lcreds) { /* * Could not load the credentials, let's save the ones we have so we @@ -860,6 +881,8 @@ main(int argc, /* I - Number of command-line args */ } else { + fputs("DEBUG: No printer credentials.\n", stderr); + update_reasons(NULL, "cups-pki-unknown"); return (CUPS_BACKEND_STOP); } diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 5c31c7ac9a..1d8af90120 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -4630,6 +4630,7 @@ 727EF04F192E3602001EF690 /* testsub.c */, 724FA65D1CC0389F0092477B /* testsupplies.c */, 727EF03F192E3498001EF690 /* testtemplate.c */, + 271286681CC130BD00E517C7 /* tlscheck.c */, ); name = tests; sourceTree = ""; @@ -4680,7 +4681,6 @@ 274FF67313333B0A00317ECB /* commands */ = { isa = PBXGroup; children = ( - 271286681CC130BD00E517C7 /* tlscheck.c */, 2732E089137A3F5200FAFEF6 /* cancel.c */, 2732E08A137A3F5200FAFEF6 /* cupsaccept.c */, 276684101337FA7C000D33D0 /* cupsaddsmb.c */,