sequoia: Improve tracing output for pgp_key_expired sync
authorNeal H. Walfield <neal@pep.foundation>
Mon, 01 Jul 2019 22:00:52 +0200
branchsync
changeset 38949dbd6ed542da
parent 3893 cfd6d87846d3
child 3895 eeb2f18965e1
child 3897 688eb9375ece
child 3899 f37db118e0b0
sequoia: Improve tracing output for pgp_key_expired
src/pgp_sequoia.c
     1.1 --- a/src/pgp_sequoia.c	Mon Jul 01 11:22:29 2019 +0200
     1.2 +++ b/src/pgp_sequoia.c	Mon Jul 01 22:00:52 2019 +0200
     1.3 @@ -2578,6 +2578,22 @@
     1.4  
     1.5      // Is the TPK live?
     1.6      *expired = !pgp_tpk_alive_at(tpk, when);
     1.7 +#ifdef TRACING
     1.8 +    {
     1.9 +        char buffer[26];
    1.10 +        time_t now = time(NULL);
    1.11 +
    1.12 +        if (when == now || when == now - 1) {
    1.13 +            sprintf(buffer, "now");
    1.14 +        } else {
    1.15 +            struct tm tm;
    1.16 +            gmtime_r(&when, &tm);
    1.17 +            strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tm);
    1.18 +        }
    1.19 +
    1.20 +        T("TPK is %slive as of %s", *expired ? "not " : "", buffer);
    1.21 +    }
    1.22 +#endif
    1.23      if (*expired)
    1.24          goto out;
    1.25  
    1.26 @@ -2608,9 +2624,15 @@
    1.27  
    1.28      *expired = !(can_encrypt && can_sign && can_certify);
    1.29  
    1.30 +    T("Key can%s encrypt, can%s sign, can%s certify => %sexpired",
    1.31 +      can_encrypt ? "" : "not",
    1.32 +      can_sign ? "" : "not",
    1.33 +      can_certify ? "" : "not",
    1.34 +      *expired ? "" : "not ");
    1.35 +
    1.36   out:
    1.37      pgp_tpk_free(tpk);
    1.38 -    T("(%s) -> %s", fpr, pEp_status_to_string(status));
    1.39 +    T("(%s) -> %s (expired: %d)", fpr, pEp_status_to_string(status), *expired);
    1.40      return status;
    1.41  }
    1.42