netpgp : cleanup some debug code
authorEdouard Tisserant
Mon, 11 May 2015 15:57:16 +0200
changeset 27022984733d7a6
parent 264 22c746eab376
child 271 18b5097c4428
netpgp : cleanup some debug code
src/pgp_netpgp.c
     1.1 --- a/src/pgp_netpgp.c	Sun May 10 22:49:26 2015 +0200
     1.2 +++ b/src/pgp_netpgp.c	Mon May 11 15:57:16 2015 +0200
     1.3 @@ -17,8 +17,6 @@
     1.4  #include <pthread.h>
     1.5  #include <regex.h>
     1.6  
     1.7 -#define PEP_NETPGP_DEBUG
     1.8 -
     1.9  static netpgp_t netpgp;
    1.10  static pthread_mutex_t netpgp_mutex;
    1.11  
    1.12 @@ -231,21 +229,11 @@
    1.13      now = time(NULL);
    1.14      if (now < vresult->birthtime) {
    1.15          // signature is not valid yet
    1.16 -#ifdef PEP_NETPGP_DEBUG
    1.17 -        (void) printf(
    1.18 -            "signature not valid until %.24s\n",
    1.19 -            ctime(&vresult->birthtime));
    1.20 -#endif //PEP_NETPGP_DEBUG
    1.21          return PEP_UNENCRYPTED;
    1.22      }
    1.23      if (vresult->duration != 0 && now > vresult->birthtime + vresult->duration) {
    1.24          // signature has expired
    1.25          t = vresult->duration + vresult->birthtime;
    1.26 -#ifdef PEP_NETPGP_DEBUG
    1.27 -        (void) printf(
    1.28 -            "signature not valid after %.24s\n",
    1.29 -            ctime(&t));
    1.30 -#endif //PEP_NETPGP_DEBUG
    1.31          return PEP_UNENCRYPTED;
    1.32      }
    1.33      if (vresult->validc && vresult->valid_sigs &&
    1.34 @@ -263,16 +251,6 @@
    1.35              char id[MAX_ID_LENGTH + 1];
    1.36              const uint8_t *userid = vresult->valid_sigs[n].signer_id;
    1.37  
    1.38 -#ifdef PEP_NETPGP_DEBUG
    1.39 -            const pgp_key_t *key;
    1.40 -            pgp_pubkey_t *sigkey;
    1.41 -            unsigned from = 0;
    1.42 -            key = pgp_getkeybyid(netpgp->io, netpgp->pubring,
    1.43 -                (const uint8_t *) vresult->valid_sigs[n].signer_id,
    1.44 -                &from, &sigkey);
    1.45 -            pgp_print_keydata(netpgp->io, netpgp->pubring, key, "valid signature ", &key->key.pubkey, 0);
    1.46 -#endif //PEP_NETPGP_DEBUG
    1.47 -
    1.48              id_to_str(userid, id);
    1.49  
    1.50              k = stringlist_add(k, id);
    1.51 @@ -290,23 +268,6 @@
    1.52      
    1.53      if (vresult->invalidc) {
    1.54          // some invalid signatures
    1.55 -
    1.56 -#ifdef PEP_NETPGP_DEBUG
    1.57 -        unsigned    n;
    1.58 -        for (n = 0; n < vresult->invalidc; ++n) {
    1.59 -            const pgp_key_t *key;
    1.60 -            pgp_pubkey_t *sigkey;
    1.61 -            unsigned from = 0;
    1.62 -            key = pgp_getkeybyid(netpgp->io, netpgp->pubring,
    1.63 -                (const uint8_t *) vresult->invalid_sigs[n].signer_id,
    1.64 -                &from, &sigkey);
    1.65 -            pgp_print_keydata(netpgp->io, netpgp->pubring, key, "invalid signature ", &key->key.pubkey, 0);
    1.66 -            if (sigkey->duration != 0 && now > sigkey->birthtime + sigkey->duration) {
    1.67 -                printf("EXPIRED !\n");
    1.68 -            }
    1.69 -        }
    1.70 -#endif //PEP_NETPGP_DEBUG
    1.71 -
    1.72          return PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH;
    1.73      }
    1.74      
    1.75 @@ -577,10 +538,6 @@
    1.76              result = PEP_KEY_NOT_FOUND;
    1.77              goto free_rcpts;
    1.78          }
    1.79 -#ifdef PEP_NETPGP_DEBUG
    1.80 -        pgp_print_keydata(netpgp.io, netpgp.pubring, key,
    1.81 -                          "recipient pubkey ", &key->key.pubkey, 0);
    1.82 -#endif //PEP_NETPGP_DEBUG
    1.83  
    1.84          // add key to recipients/signers
    1.85          pgp_keyring_add(rcpts, key);