Deprecated and replaced misspellings of 'compromised' and 'secret' in the API and constants. Nothing should be broken for existing implementations. ENGINE-420
authorKrista Bennett <krista@pep-project.org>
Wed, 11 Apr 2018 16:54:09 +0200
branchENGINE-420
changeset 25930876c1a73ae1
parent 2592 d1cb6fd3ded2
child 2594 1b45507f4696
Deprecated and replaced misspellings of 'compromised' and 'secret' in the API and constants. Nothing should be broken for existing implementations.
src/keymanagement.c
src/message_api.c
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
src/sync_impl.c
test/test_util.cc
     1.1 --- a/src/keymanagement.c	Wed Apr 11 16:43:33 2018 +0200
     1.2 +++ b/src/keymanagement.c	Wed Apr 11 16:54:09 2018 +0200
     1.3 @@ -70,7 +70,7 @@
     1.4                  return PEP_OUT_OF_MEMORY;
     1.5              }
     1.6  
     1.7 -            if (_comm_type_key != PEP_ct_compromized &&
     1.8 +            if (_comm_type_key != PEP_ct_compromised &&
     1.9                  _comm_type_key != PEP_ct_unknown)
    1.10              {
    1.11                  if (identity->comm_type == PEP_ct_unknown ||
    1.12 @@ -341,7 +341,7 @@
    1.13          case PEP_ct_key_revoked:
    1.14          case PEP_ct_key_b0rken:
    1.15          case PEP_ct_key_expired:
    1.16 -        case PEP_ct_compromized:
    1.17 +        case PEP_ct_compromised:
    1.18          case PEP_ct_mistrusted:
    1.19              // this only happens when it's all there is
    1.20              status = first_reject_status;
    1.21 @@ -787,7 +787,7 @@
    1.22      
    1.23      // FIXME: This is legacy. I presume it's a notification for the caller...
    1.24      // Revisit once I can talk to Volker
    1.25 -    if (identity->comm_type != PEP_ct_compromized &&
    1.26 +    if (identity->comm_type != PEP_ct_compromised &&
    1.27          identity->comm_type < PEP_ct_strong_but_unconfirmed)
    1.28          if (session->examine_identity)
    1.29              session->examine_identity(identity, session->examine_management);
    1.30 @@ -845,7 +845,7 @@
    1.31                      return PEP_OUT_OF_MEMORY;
    1.32                  }
    1.33                  
    1.34 -                if (_comm_type_key != PEP_ct_compromized &&
    1.35 +                if (_comm_type_key != PEP_ct_compromised &&
    1.36                      _comm_type_key != PEP_ct_unknown)
    1.37                  {
    1.38                      if (identity->comm_type == PEP_ct_unknown ||
    1.39 @@ -1185,7 +1185,7 @@
    1.40          
    1.41          if (status == PEP_STATUS_OK)
    1.42              // cascade that mistrust for anyone using this key
    1.43 -            status = mark_as_compromized(session, ident->fpr);
    1.44 +            status = mark_as_compromised(session, ident->fpr);
    1.45          if (status == PEP_STATUS_OK)
    1.46              status = remove_fpr_as_default(session, ident->fpr);
    1.47          if (status == PEP_STATUS_OK)
     2.1 --- a/src/message_api.c	Wed Apr 11 16:43:33 2018 +0200
     2.2 +++ b/src/message_api.c	Wed Apr 11 16:54:09 2018 +0200
     2.3 @@ -1059,7 +1059,7 @@
     2.4      else if (ct == PEP_ct_key_not_found)
     2.5          return PEP_rating_have_no_key;
     2.6  
     2.7 -    else if (ct == PEP_ct_compromized)
     2.8 +    else if (ct == PEP_ct_compromised)
     2.9          return PEP_rating_under_attack;
    2.10  
    2.11      else if (ct == PEP_ct_mistrusted)
    2.12 @@ -1259,8 +1259,8 @@
    2.13  {
    2.14      PEP_STATUS status = PEP_STATUS_OK;
    2.15  
    2.16 -    if (max_comm_type == PEP_ct_compromized)
    2.17 -        return PEP_ct_compromized;
    2.18 +    if (max_comm_type == PEP_ct_compromised)
    2.19 +        return PEP_ct_compromised;
    2.20  
    2.21      if (max_comm_type == PEP_ct_mistrusted)
    2.22          return PEP_ct_mistrusted;
    2.23 @@ -1271,8 +1271,8 @@
    2.24          status = myself(session, ident);
    2.25  
    2.26      if (status == PEP_STATUS_OK) {
    2.27 -        if (ident->comm_type == PEP_ct_compromized)
    2.28 -            return PEP_ct_compromized;
    2.29 +        if (ident->comm_type == PEP_ct_compromised)
    2.30 +            return PEP_ct_compromised;
    2.31          else if (ident->comm_type == PEP_ct_mistrusted)
    2.32              return PEP_ct_mistrusted;
    2.33          else
    2.34 @@ -1889,7 +1889,7 @@
    2.35      char* priv_key_data = NULL;
    2.36      size_t priv_key_size = 0;
    2.37      
    2.38 -    status = export_secrect_key(session, own_private_fpr, &priv_key_data, 
    2.39 +    status = export_secret_key(session, own_private_fpr, &priv_key_data, 
    2.40                                  &priv_key_size);
    2.41  
    2.42      if (status != PEP_STATUS_OK)
     3.1 --- a/src/pEpEngine.c	Wed Apr 11 16:43:33 2018 +0200
     3.2 +++ b/src/pEpEngine.c	Wed Apr 11 16:54:09 2018 +0200
     3.3 @@ -311,7 +311,7 @@
     3.4      " and comm_type != 0;"; // ignores PEP_ct_unknown
     3.5      // returns PEP_ct_unknown only when no known trust is recorded
     3.6  
     3.7 -static const char *sql_mark_as_compromized = 
     3.8 +static const char *sql_mark_as_compromised = 
     3.9      "update trust not indexed set comm_type = 15"
    3.10      " where pgp_keypair_fpr = upper(replace(?1,' ','')) ;";
    3.11      
    3.12 @@ -1195,8 +1195,8 @@
    3.13              (int)strlen(sql_least_trust), &_session->least_trust, NULL);
    3.14      assert(int_result == SQLITE_OK);
    3.15  
    3.16 -    int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromized,
    3.17 -            (int)strlen(sql_mark_as_compromized), &_session->mark_compromized,
    3.18 +    int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromised,
    3.19 +            (int)strlen(sql_mark_as_compromised), &_session->mark_compromised,
    3.20              NULL);
    3.21      assert(int_result == SQLITE_OK);
    3.22  
    3.23 @@ -1428,8 +1428,8 @@
    3.24                  sqlite3_finalize(session->get_trust);
    3.25              if (session->least_trust)
    3.26                  sqlite3_finalize(session->least_trust);
    3.27 -            if (session->mark_compromized)
    3.28 -                sqlite3_finalize(session->mark_compromized);
    3.29 +            if (session->mark_compromised)
    3.30 +                sqlite3_finalize(session->mark_compromised);
    3.31              if (session->crashdump)
    3.32                  sqlite3_finalize(session->crashdump);
    3.33              if (session->languagelist)
    3.34 @@ -2926,12 +2926,20 @@
    3.35      return status;
    3.36  }
    3.37  
    3.38 -
    3.39 +// Deprecated
    3.40  DYNAMIC_API PEP_STATUS mark_as_compromized(
    3.41          PEP_SESSION session,
    3.42          const char *fpr
    3.43      )
    3.44  {
    3.45 +    return mark_as_compromised(session, fpr);
    3.46 +}
    3.47 +
    3.48 +DYNAMIC_API PEP_STATUS mark_as_compromised(
    3.49 +        PEP_SESSION session,
    3.50 +        const char *fpr
    3.51 +    )
    3.52 +{
    3.53      int result;
    3.54  
    3.55      assert(session);
    3.56 @@ -2940,11 +2948,11 @@
    3.57      if (!(session && fpr && fpr[0]))
    3.58          return PEP_ILLEGAL_VALUE;
    3.59  
    3.60 -    sqlite3_reset(session->mark_compromized);
    3.61 -    sqlite3_bind_text(session->mark_compromized, 1, fpr, -1,
    3.62 +    sqlite3_reset(session->mark_compromised);
    3.63 +    sqlite3_bind_text(session->mark_compromised, 1, fpr, -1,
    3.64              SQLITE_STATIC);
    3.65 -    result = sqlite3_step(session->mark_compromized);
    3.66 -    sqlite3_reset(session->mark_compromized);
    3.67 +    result = sqlite3_step(session->mark_compromised);
    3.68 +    sqlite3_reset(session->mark_compromised);
    3.69  
    3.70      if (result != SQLITE_DONE)
    3.71          return PEP_CANNOT_SET_TRUST;
    3.72 @@ -3142,7 +3150,7 @@
    3.73              key_data, size, false);
    3.74  }
    3.75  
    3.76 -DYNAMIC_API PEP_STATUS export_secrect_key(
    3.77 +DYNAMIC_API PEP_STATUS export_secret_key(
    3.78          PEP_SESSION session, const char *fpr, char **key_data, size_t *size
    3.79      )
    3.80  {
    3.81 @@ -3162,6 +3170,14 @@
    3.82              key_data, size, true);
    3.83  }
    3.84  
    3.85 +// Deprecated
    3.86 +DYNAMIC_API PEP_STATUS export_secrect_key(
    3.87 +        PEP_SESSION session, const char *fpr, char **key_data, size_t *size
    3.88 +    )
    3.89 +{
    3.90 +    return export_secret_key(session, fpr, key_data, size);
    3.91 +}
    3.92 +
    3.93  DYNAMIC_API PEP_STATUS find_keys(
    3.94          PEP_SESSION session, const char *pattern, stringlist_t **keylist
    3.95      )
     4.1 --- a/src/pEpEngine.h	Wed Apr 11 16:43:33 2018 +0200
     4.2 +++ b/src/pEpEngine.h	Wed Apr 11 16:54:09 2018 +0200
     4.3 @@ -431,7 +431,8 @@
     4.4      PEP_ct_b0rken_crypto = 0x0b,
     4.5      PEP_ct_key_too_short = 0x0c,
     4.6  
     4.7 -    PEP_ct_compromized = 0x0e,                  // known compromized connection
     4.8 +    PEP_ct_compromised = 0x0e,                  // known compromised connection
     4.9 +    PEP_ct_compromized = 0x0e,                  // deprecated misspelling
    4.10      PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
    4.11  
    4.12      // range 0x10 to 0x3f: unconfirmed encryption
    4.13 @@ -742,12 +743,21 @@
    4.14          identity_flags_t flags
    4.15      );
    4.16  
    4.17 -// mark_as_compromized() - mark key in trust db as compromized
    4.18 +// mark_as_compromised() - mark key in trust db as compromised
    4.19  //
    4.20  //    parameters:
    4.21  //        session (in)        session handle
    4.22  //        fpr (in)            fingerprint of key to mark
    4.23  
    4.24 +DYNAMIC_API PEP_STATUS mark_as_compromised(
    4.25 +        PEP_SESSION session,
    4.26 +        const char *fpr
    4.27 +    );
    4.28 +
    4.29 +
    4.30 +// mark_as_compromized() - deprecated to fix misspelling. Please move to
    4.31 +//                         mark_as_compromised();
    4.32 +
    4.33  DYNAMIC_API PEP_STATUS mark_as_compromized(
    4.34          PEP_SESSION session,
    4.35          const char *fpr
    4.36 @@ -861,6 +871,14 @@
    4.37  //      the caller is responsible to free() it (on Windoze use pEp_free())
    4.38  //      beware of leaking secret key data - overwrite it in memory after use
    4.39  
    4.40 +DYNAMIC_API PEP_STATUS export_secret_key(
    4.41 +        PEP_SESSION session, const char *fpr, char **key_data, size_t *size
    4.42 +    );
    4.43 +
    4.44 +
    4.45 +// export_secrect_key() - deprecated misspelled function. Please replace with
    4.46 +//                        export_secret_key
    4.47 +
    4.48  DYNAMIC_API PEP_STATUS export_secrect_key(
    4.49          PEP_SESSION session, const char *fpr, char **key_data, size_t *size
    4.50      );
     5.1 --- a/src/pEp_internal.h	Wed Apr 11 16:43:33 2018 +0200
     5.2 +++ b/src/pEp_internal.h	Wed Apr 11 16:54:09 2018 +0200
     5.3 @@ -150,7 +150,7 @@
     5.4      sqlite3_stmt *update_trust_for_fpr;
     5.5      sqlite3_stmt *get_trust;
     5.6      sqlite3_stmt *least_trust;
     5.7 -    sqlite3_stmt *mark_compromized;
     5.8 +    sqlite3_stmt *mark_compromised;
     5.9      sqlite3_stmt *reset_trust;
    5.10      sqlite3_stmt *crashdump;
    5.11      sqlite3_stmt *languagelist;
     6.1 --- a/src/sync_impl.c	Wed Apr 11 16:43:33 2018 +0200
     6.2 +++ b/src/sync_impl.c	Wed Apr 11 16:54:09 2018 +0200
     6.3 @@ -894,7 +894,7 @@
     6.4                      goto enomem;
     6.5                  char *key = NULL;
     6.6                  size_t size = 0;
     6.7 -                status = export_secrect_key(session, fpr, &key, &size);
     6.8 +                status = export_secret_key(session, fpr, &key, &size);
     6.9                  if (status != PEP_STATUS_OK)
    6.10                      goto error;
    6.11                  bloblist_t *bl = bloblist_add(_message->attachments,
     7.1 --- a/test/test_util.cc	Wed Apr 11 16:43:33 2018 +0200
     7.2 +++ b/test/test_util.cc	Wed Apr 11 16:54:09 2018 +0200
     7.3 @@ -266,8 +266,9 @@
     7.4              return "PEP_ct_b0rken_crypto";
     7.5          case PEP_ct_key_too_short:
     7.6              return "PEP_ct_key_too_short";
     7.7 +        case PEP_ct_compromised:
     7.8          case PEP_ct_compromized:
     7.9 -            return "PEP_ct_compromized";
    7.10 +            return "PEP_ct_compromised";
    7.11          case PEP_ct_mistrusted:
    7.12              return "PEP_ct_mistrusted";
    7.13          case PEP_ct_unconfirmed_encryption: