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])
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
}
else
{
+ fputs("DEBUG: No printer credentials.\n", stderr);
+
update_reasons(NULL, "cups-pki-unknown");
return (CUPS_BACKEND_STOP);
}
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 */,