]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add debug information for encrypted connections.
authorMichael R Sweet <michaelrsweet@gmail.com>
Tue, 26 Jul 2016 18:32:16 +0000 (14:32 -0400)
committerMichael R Sweet <michaelrsweet@gmail.com>
Tue, 26 Jul 2016 18:32:16 +0000 (14:32 -0400)
backend/ipp.c
xcode/CUPS.xcodeproj/project.pbxproj

index 1ac2eea0754cacfa51b6273669038f03b13fb774..b42b0dff1a55ff27e855d2e2cb95afe743b250d3 100644 (file)
@@ -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);
     }
index 5c31c7ac9ae2c56cc9826a56c9aba2b00363da04..1d8af901207038d4b213e67d2a195a6b2fb5487d 100644 (file)
                                727EF04F192E3602001EF690 /* testsub.c */,
                                724FA65D1CC0389F0092477B /* testsupplies.c */,
                                727EF03F192E3498001EF690 /* testtemplate.c */,
+                               271286681CC130BD00E517C7 /* tlscheck.c */,
                        );
                        name = tests;
                        sourceTree = "<group>";
                274FF67313333B0A00317ECB /* commands */ = {
                        isa = PBXGroup;
                        children = (
-                               271286681CC130BD00E517C7 /* tlscheck.c */,
                                2732E089137A3F5200FAFEF6 /* cancel.c */,
                                2732E08A137A3F5200FAFEF6 /* cupsaccept.c */,
                                276684101337FA7C000D33D0 /* cupsaddsmb.c */,