ENGINE-94 Workaround key-election not being stored in case of expired key
authorEdouard Tisserant <edouard@pep-project.org>
Fri, 16 Sep 2016 10:21:13 +0200
changeset 116451db748bdf16
parent 1153 eaf7b2eeea87
child 1168 4d4e3ecbaf8b
child 1169 7d666711da67
child 1185 4b01328f3cf2
child 1187 8bbb80bb4323
ENGINE-94 Workaround key-election not being stored in case of expired key
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Fri Sep 09 13:07:59 2016 +0200
     1.2 +++ b/src/keymanagement.c	Fri Sep 16 10:21:13 2016 +0200
     1.3 @@ -121,6 +121,7 @@
     1.4          return PEP_ILLEGAL_VALUE;
     1.5  
     1.6      int _no_user_id = EMPTYSTR(identity->user_id);
     1.7 +    int _did_elect_new_key = 0;
     1.8  
     1.9      if (_no_user_id)
    1.10      {
    1.11 @@ -170,6 +171,8 @@
    1.12                  PEP_STATUS status = elect_pubkey(session, identity);
    1.13                  if (status != PEP_STATUS_OK)
    1.14                      goto exit_free;
    1.15 +
    1.16 +                _did_elect_new_key = 1;
    1.17              }
    1.18              else {
    1.19                  identity->comm_type = stored_identity->comm_type;
    1.20 @@ -243,7 +246,7 @@
    1.21  
    1.22          // Identity doesn't get stored if call was just about checking existing
    1.23          // user by address (i.e. no user id given but already stored)
    1.24 -        if (!(_no_user_id && stored_identity))
    1.25 +        if (!(_no_user_id && stored_identity) || _did_elect_new_key)
    1.26          {
    1.27              status = set_identity(session, identity);
    1.28              assert(status == PEP_STATUS_OK);