ENGINE-84: merge with default ENGINE-84
authorKrista Grothoff <krista@pep-project.org>
Fri, 11 Nov 2016 14:10:30 +0100
branchENGINE-84
changeset 1378b2b2c6d361c9
parent 1377 20be7d9a7536
parent 1376 0404bdfa9beb
child 1379 7c35b268a922
child 1380 2e0727e9df42
ENGINE-84: merge with default
src/keymanagement.c
src/keymanagement.h
     1.1 --- a/src/Makefile	Fri Nov 11 14:08:20 2016 +0100
     1.2 +++ b/src/Makefile	Fri Nov 11 14:10:30 2016 +0100
     1.3 @@ -88,7 +88,7 @@
     1.4  install: $(TARGET)
     1.5  	cp $< $(PREFIX)/lib/
     1.6  	mkdir -p $(PREFIX)/include/pEp
     1.7 -	cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h cryptotech.h sync.h sync_fsm.h $(PREFIX)/include/pEp/
     1.8 +	cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h cryptotech.h sync.h sync_fsm.h blacklist.h openpgp_compat.h $(PREFIX)/include/pEp/
     1.9  
    1.10  uninstall:
    1.11  	rm -f $(PREFIX)/lib/$(TARGET)
     2.1 --- a/src/keymanagement.c	Fri Nov 11 14:08:20 2016 +0100
     2.2 +++ b/src/keymanagement.c	Fri Nov 11 14:10:30 2016 +0100
     2.3 @@ -73,8 +73,8 @@
     2.4      return PEP_STATUS_OK;
     2.5  }
     2.6  
     2.7 -DYNAMIC_API PEP_STATUS update_identity(
     2.8 -        PEP_SESSION session, pEp_identity * identity
     2.9 +PEP_STATUS _update_identity(
    2.10 +        PEP_SESSION session, pEp_identity * identity, bool with_myself
    2.11      )
    2.12  {
    2.13      pEp_identity *stored_identity;
    2.14 @@ -89,8 +89,13 @@
    2.15          return PEP_ILLEGAL_VALUE;
    2.16  
    2.17      if (identity->me || (identity->user_id && strcmp(identity->user_id, PEP_OWN_USERID) == 0)) {
    2.18 -        identity->me = true;
    2.19 -        return myself(session, identity);
    2.20 +        if (with_myself) {
    2.21 +            identity->me = true;
    2.22 +            return myself(session, identity);
    2.23 +        }
    2.24 +        else {
    2.25 +            return PEP_ILLEGAL_VALUE;
    2.26 +        }
    2.27      }
    2.28  
    2.29      int _no_user_id = EMPTYSTR(identity->user_id);
    2.30 @@ -303,6 +308,13 @@
    2.31      return status;
    2.32  }
    2.33  
    2.34 +DYNAMIC_API PEP_STATUS update_identity(
    2.35 +        PEP_SESSION session, pEp_identity * identity
    2.36 +    )
    2.37 +{
    2.38 +    return _update_identity(session, identity, true);
    2.39 +}
    2.40 +
    2.41  PEP_STATUS elect_ownkey(
    2.42          PEP_SESSION session, pEp_identity * identity
    2.43      )
     3.1 --- a/src/keymanagement.h	Fri Nov 11 14:08:20 2016 +0100
     3.2 +++ b/src/keymanagement.h	Fri Nov 11 14:10:30 2016 +0100
     3.3 @@ -6,6 +6,10 @@
     3.4  extern "C" {
     3.5  #endif
     3.6  
     3.7 +PEP_STATUS _update_identity(
     3.8 +        PEP_SESSION session, pEp_identity * identity, bool with_myself
     3.9 +    );
    3.10 +
    3.11  // update_identity() - update identity information
    3.12  //
    3.13  //  parameters:
     4.1 --- a/src/message_api.c	Fri Nov 11 14:08:20 2016 +0100
     4.2 +++ b/src/message_api.c	Fri Nov 11 14:10:30 2016 +0100
     4.3 @@ -1774,8 +1774,6 @@
     4.4      }
     4.5  
     4.6      free_identity_list(private_il);
     4.7 -    free_stringlist(keylist);
     4.8 -    free_message(dst);
     4.9  
    4.10      return status;
    4.11  
    4.12 @@ -1793,7 +1791,7 @@
    4.13      {
    4.14          if (il->ident)
    4.15          {
    4.16 -            PEP_STATUS status = update_identity(session, il->ident);
    4.17 +            PEP_STATUS status = _update_identity(session, il->ident, false);
    4.18              if (status == PEP_STATUS_OK)
    4.19              {
    4.20                  *max_comm_type = _get_comm_type(session, *max_comm_type,
    4.21 @@ -1810,28 +1808,22 @@
    4.22          PEP_rating *rating
    4.23      )
    4.24  {
    4.25 -    PEP_STATUS status = PEP_STATUS_OK;
    4.26      PEP_comm_type max_comm_type = PEP_ct_pEp;
    4.27      bool comm_type_determined = false;
    4.28  
    4.29      assert(session);
    4.30      assert(msg);
    4.31 -    assert(msg->from);
    4.32      assert(msg->dir == PEP_dir_outgoing);
    4.33      assert(rating);
    4.34  
    4.35      if (!(session && msg && rating))
    4.36          return PEP_ILLEGAL_VALUE;
    4.37  
    4.38 -    if (msg->from == NULL || msg->dir != PEP_dir_outgoing)
    4.39 +    if (msg->dir != PEP_dir_outgoing)
    4.40          return PEP_ILLEGAL_VALUE;
    4.41  
    4.42      *rating = PEP_rating_undefined;
    4.43  
    4.44 -    status = myself(session, msg->from);
    4.45 -    if (status != PEP_STATUS_OK)
    4.46 -        return status;
    4.47 -
    4.48      _max_comm_type_from_identity_list(msg->to, session,
    4.49                                        &max_comm_type, &comm_type_determined);
    4.50