src/keymanagement.c
changeset 215 fac4aa582acf
parent 214 79333debeee0
child 216 e949c98e45e5
     1.1 --- a/src/keymanagement.c	Tue Apr 21 15:19:47 2015 +0200
     1.2 +++ b/src/keymanagement.c	Tue Apr 21 15:40:18 2015 +0200
     1.3 @@ -19,6 +19,13 @@
     1.4  
     1.5  #define KEY_EXPIRE_DELTA (60 * 60 * 24 * 365)
     1.6  
     1.7 +#ifdef NDEBUG
     1.8 +#define DEBUG_LOG(TITLE, ENTITY, DESC)
     1.9 +#else
    1.10 +#define DEBUG_LOG(TITLE, ENTITY, DESC) \
    1.11 +    log_event(session, (TITLE), (ENTITY), (DESC), "debug");
    1.12 +#endif
    1.13 +
    1.14  DYNAMIC_API PEP_STATUS update_identity(
    1.15          PEP_SESSION session, pEp_identity * identity
    1.16      )
    1.17 @@ -204,7 +211,7 @@
    1.18  
    1.19      pEp_identity *_identity;
    1.20  
    1.21 -    log_event(session, "myself", "debug", identity->address, NULL);
    1.22 +    DEBUG_LOG("myself", "debug", identity->address);
    1.23      status = get_identity(session, identity->address, &_identity);
    1.24      assert(status != PEP_OUT_OF_MEMORY);
    1.25      if (status == PEP_OUT_OF_MEMORY)
    1.26 @@ -216,13 +223,13 @@
    1.27          return PEP_OUT_OF_MEMORY;
    1.28  
    1.29      if (keylist == NULL || keylist->value == NULL) {
    1.30 -        log_event(session, "generating key pair", "debug", identity->address, NULL);
    1.31 +        DEBUG_LOG("generating key pair", "debug", identity->address);
    1.32          status = generate_keypair(session, identity);
    1.33          assert(status != PEP_OUT_OF_MEMORY);
    1.34          if (status != PEP_STATUS_OK) {
    1.35              char buf[11];
    1.36              snprintf(buf, 11, "%d", status);
    1.37 -            log_event(session, "generating key pair failed", "debug", buf, NULL);
    1.38 +            DEBUG_LOG("generating key pair failed", "debug", buf);
    1.39              return status;
    1.40          }
    1.41  
    1.42 @@ -280,7 +287,7 @@
    1.43  
    1.44      while ((identity = retrieve_next_identity(management))) {
    1.45          assert(identity->address);
    1.46 -        log_event(session, "do_keymanagement", "debug", identity->address, NULL);
    1.47 +        DEBUG_LOG("do_keymanagement", "debug", identity->address);
    1.48          if (identity->me) {
    1.49              status = myself(session, identity);
    1.50              assert(status != PEP_OUT_OF_MEMORY);
    1.51 @@ -297,3 +304,14 @@
    1.52      return PEP_STATUS_OK;
    1.53  }
    1.54  
    1.55 +DYNAMIC_API PEP_STATUS key_compromized(PEP_SESSION session, const char *fpr)
    1.56 +{
    1.57 +    assert(session);
    1.58 +    assert(fpr);
    1.59 +
    1.60 +    if (!(session && fpr))
    1.61 +        return PEP_ILLEGAL_VALUE;
    1.62 +
    1.63 +    return PEP_STATUS_OK;
    1.64 +}
    1.65 +