Browse Source

ENGINE-716: moved fix into pgp_sequoia.c, now check for address==username

b0rken_crypto
parent
commit
3abc859b37
5 changed files with 122 additions and 11 deletions
  1. +0
    -10
      src/keymanagement.c
  2. +10
    -1
      src/pgp_sequoia.c
  3. +23
    -0
      test/src/KeyResetMessageTest.cc
  4. +58
    -0
      test/test_keys/priv/SYSTEMB-0xD47A817B3_priv.asc
  5. +31
    -0
      test/test_keys/pub/SYSTEMB-0xD47A817B3_pub.asc

+ 0
- 10
src/keymanagement.c View File

@ -1074,8 +1074,6 @@ PEP_STATUS _myself(PEP_SESSION session,
char* default_own_id = NULL;
status = get_default_own_userid(session, &default_own_id);
bool no_uname_on_entry = EMPTYSTR(identity->username);
// Deal with non-default user_ids.
// FIXME: if non-default and read-only, reject totally?
if (default_own_id && strcmp(default_own_id, identity->user_id) != 0) {
@ -1199,15 +1197,7 @@ PEP_STATUS _myself(PEP_SESSION session,
free(identity->fpr);
identity->fpr = NULL;
char* namecache = NULL;
if (no_uname_on_entry) {
namecache = identity->username;
identity->username = NULL;
}
status = generate_keypair(session, identity);
if (namecache) {
identity->username = namecache;
}
assert(status != PEP_OUT_OF_MEMORY);
if (status != PEP_STATUS_OK) {


+ 10
- 1
src/pgp_sequoia.c View File

@ -2023,9 +2023,18 @@ PEP_STATUS pgp_generate_keypair(PEP_SESSION session, pEp_identity *identity)
assert(identity->fpr == NULL || identity->fpr[0] == 0);
// assert(identity->username);
char* cached_username = identity->username;
if (identity->username && strcmp(identity->address, identity->username) == 0) {
cached_username = identity->username;
identity->username = NULL;
}
userid_packet = pgp_user_id_from_unchecked_address(&err,
identity->username, NULL,
identity->address);
identity->address);
identity->username = cached_username;
if (!userid_packet)
ERROR_OUT(err, PEP_UNKNOWN_ERROR, "pgp_user_id_from_other_address");


+ 23
- 0
test/src/KeyResetMessageTest.cc View File

@ -2410,6 +2410,29 @@ TEST_F(KeyResetMessageTest, check_reset_mistrust_next_msg_have_not_mailed) {
ASSERT_EQ(rating, PEP_rating_reliable);
}
// ENGINE-716
TEST_F(KeyResetMessageTest, check_reset_all_own_keys_one_URI_partner) {
// me
pEp_identity* me = new_identity("payto://BIC/SYSTEMA", NULL, "SystemA", NULL);
PEP_STATUS status = myself(session, me);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NE(me->fpr, nullptr);
char* copy_fpr = strdup(me->fpr);
// I don't think this is relevant.
pEp_identity* you = new_identity("payto://BIC/SYSTEMB", NULL, "SystemB", NULL);
ASSERT_TRUE(slurp_and_import_key(session, "test_keys/pub/SYSTEMB-0xD47A817B3_pub.asc"));
status = update_identity(session, you);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NE(you->fpr, nullptr);
status = key_reset_all_own_keys(session);
ASSERT_EQ(status, PEP_STATUS_OK);
status = myself(session, me);
ASSERT_STRNE(me->fpr, copy_fpr);
}
/*
TEST_F(KeyResetMessageTest, check_reset_own_with_revocations) {
pEp_identity* id1 = new_identity("krista-not-real@darthmama.org", NULL, PEP_OWN_USERID, "Krista at Home");


+ 58
- 0
test/test_keys/priv/SYSTEMB-0xD47A817B3_priv.asc View File

@ -0,0 +1,58 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBF5xGNABCACsyQrsxfLL9/5b4Gm8A1jqkRh80j8keizf2iOJ4rp4SWEE6o62
bR69OS/UM7NN5tTaYBYACXWd2lr8Gi+IypkWe9xyfrq26nJVtLRj6hV3+IIrpzg9
G7o1nKGAv4qMqWDhrFNM0veiHf680rWSkk/8HkWQMZHXxPQCgMt4sSRbvkepgn4C
6rn7YkC5yyvlcfn252AEkGwa+5q+incXkAoxx8viph6sInr1w8cCR3iBS3+2/zXy
tQ+q4IhFHYAesu4IxA+/XN+nyKIrWAQnFZEygq4/icgPsjc6rSJXlaefLYgEHG3k
qjqdwxjvzew9B+VzpUyEwZ8aMy0W6/6IyCsTABEBAAEAB/wId4uZAbQ9qYfl4a/c
vj8/s1+DUlw0weXsDEj8i0c++L2P25yltOAyPpio6eWp9htNHjNFyjD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