make enable_identity_for_sync() and disable_identity_for_sync() usable for a new own identity sync
authorVolker Birk <vb@pep-project.org>
Tue, 03 Dec 2019 12:18:52 +0100
branchsync
changeset 423152ef88f8da92
parent 4228 724d8085b47d
child 4234 b720642cd9e0
child 4237 3b0910bf9f0e
make enable_identity_for_sync() and disable_identity_for_sync() usable for a new own identity
src/sync_api.c
     1.1 --- a/src/sync_api.c	Thu Nov 28 15:48:41 2019 +0100
     1.2 +++ b/src/sync_api.c	Tue Dec 03 12:18:52 2019 +0100
     1.3 @@ -256,7 +256,12 @@
     1.4      if (!(session && ident))
     1.5          return PEP_ILLEGAL_VALUE;
     1.6  
     1.7 -    PEP_STATUS status = unset_identity_flags(session, ident, PEP_idf_not_for_sync);
     1.8 +    // create the identity in the database if it is not yet there
     1.9 +    PEP_STATUS status = _myself(session, ident, false, true, false);
    1.10 +    if (status)
    1.11 +        return status;
    1.12 +
    1.13 +    status = unset_identity_flags(session, ident, PEP_idf_not_for_sync);
    1.14      if (status)
    1.15          return status;
    1.16  
    1.17 @@ -277,7 +282,12 @@
    1.18      if (!(session && ident))
    1.19          return PEP_ILLEGAL_VALUE;
    1.20  
    1.21 -    PEP_STATUS status = unset_identity_flags(session, ident, PEP_idf_devicegroup);
    1.22 +    // create the identity in the database if it is not yet there
    1.23 +    PEP_STATUS status = _myself(session, ident, false, true, false);
    1.24 +    if (status)
    1.25 +        return status;
    1.26 +
    1.27 +    status = unset_identity_flags(session, ident, PEP_idf_devicegroup);
    1.28      if (status)
    1.29          return status;
    1.30