all fingerprints are uppercase sync
authorVolker Birk <vb@pep-project.org>
Sat, 14 Dec 2019 11:24:04 +0100
branchsync
changeset 4277397e03959517
parent 4276 10975e6e75c7
child 4278 7f78ed8120cc
all fingerprints are uppercase
src/keyreset_command.c
test/src/KeyResetMessageTest.cc
     1.1 --- a/src/keyreset_command.c	Sat Dec 14 11:05:30 2019 +0100
     1.2 +++ b/src/keyreset_command.c	Sat Dec 14 11:24:04 2019 +0100
     1.3 @@ -27,11 +27,21 @@
     1.4      if (command->ident == NULL)
     1.5          goto enomem;
     1.6  
     1.7 +    if (command->ident && command->ident->fpr) {
     1.8 +        // make hex code uppercase
     1.9 +        for (size_t i=0; i<strlen(command->ident->fpr); i++)
    1.10 +            command->ident->fpr[i] = toupper(command->ident->fpr[i]);
    1.11 +    }
    1.12 +
    1.13      command->new_key = new_key ? strdup(new_key) : strdup("");
    1.14      assert(command->new_key);
    1.15      if (command->new_key == NULL)
    1.16          goto enomem;
    1.17  
    1.18 +    // make hex code uppercase
    1.19 +    for (size_t i=0; i<strlen(command->new_key); i++)
    1.20 +        command->new_key[i] = toupper(command->new_key[i]);
    1.21 +
    1.22      return command;
    1.23  
    1.24  enomem:
     2.1 --- a/test/src/KeyResetMessageTest.cc	Sat Dec 14 11:05:30 2019 +0100
     2.2 +++ b/test/src/KeyResetMessageTest.cc	Sat Dec 14 11:24:04 2019 +0100
     2.3 @@ -1450,9 +1450,9 @@
     2.4      keyreset_command_list *il = new_keyreset_command_list(cmd1);
     2.5      ASSERT_NE(il, nullptr);
     2.6  
     2.7 -    pEp_identity *ident2 = new_identity("alice@peptest.ch", "0123456789ABCDEF", "42", "Alice Miller");
     2.8 +    pEp_identity *ident2 = new_identity("alice@peptest.ch", "0123456789abcdef", "42", "Alice Miller");
     2.9      ASSERT_NE(ident2, nullptr);
    2.10 -    const char *key2 = "FEDCBA9876543210";
    2.11 +    const char *key2 = "fedcba9876543210";
    2.12      keyreset_command *cmd2 = new_keyreset_command(ident2, key2);
    2.13      ASSERT_NE(cmd2, nullptr);
    2.14  
    2.15 @@ -1477,10 +1477,10 @@
    2.16      ASSERT_NE(il->next->command->new_key, nullptr);
    2.17  
    2.18      ASSERT_STREQ(il->next->command->ident->address, ident2->address);
    2.19 -    ASSERT_STREQ(il->next->command->ident->fpr, ident2->fpr);
    2.20 +    ASSERT_STRCASEEQ(il->next->command->ident->fpr, ident2->fpr);
    2.21      ASSERT_STREQ(il->next->command->ident->user_id, ident2->user_id);
    2.22      ASSERT_STREQ(il->next->command->ident->username, ident2->username);
    2.23 -    ASSERT_STREQ(il->next->command->new_key, key2);
    2.24 +    ASSERT_STRCASEEQ(il->next->command->new_key, key2);
    2.25  
    2.26      ASSERT_EQ(il->next->next, nullptr);
    2.27  
    2.28 @@ -1518,10 +1518,10 @@
    2.29      ASSERT_NE(ol->next->command->new_key, nullptr);
    2.30  
    2.31      ASSERT_STREQ(ol->next->command->ident->address, ident2->address);
    2.32 -    ASSERT_STREQ(ol->next->command->ident->fpr, ident2->fpr);
    2.33 +    ASSERT_STRCASEEQ(ol->next->command->ident->fpr, ident2->fpr);
    2.34      ASSERT_STREQ(ol->next->command->ident->user_id, ident2->user_id);
    2.35      ASSERT_STREQ(ol->next->command->ident->username, ident2->username);
    2.36 -    ASSERT_STREQ(ol->next->command->new_key, key2);
    2.37 +    ASSERT_STRCASEEQ(ol->next->command->new_key, key2);
    2.38  
    2.39      ASSERT_EQ(ol->next->next, nullptr);
    2.40