ENGINE-179 ENGINE-179
authorMarkus Schaber <markus@pep-security.net>
Fri, 16 Jun 2017 23:49:49 +0200
branchENGINE-179
changeset 25470e5127cfb62
parent 252 abfbe0f74ce1
child 255 612df53e077a
child 256 8c2f10c81423
ENGINE-179

Fix freeing of wrong variable.
Move method to the end of IpEpEngine2 (preserve COM backwards compatibility
for existing clients. Forward compatibility does not matter yet, as we install
plugin and adapter together, and there are no 3rd party clients yet).
Fix some naming conventions of parameters.
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
     1.1 --- a/CpEpEngine.cpp	Fri Jun 16 21:57:36 2017 +0200
     1.2 +++ b/CpEpEngine.cpp	Fri Jun 16 23:49:49 2017 +0200
     1.3 @@ -863,18 +863,18 @@
     1.4  }
     1.5  
     1.6  
     1.7 -STDMETHODIMP CpEpEngine::EncryptMessageForSelf(pEpIdentity * target_id, TextMessage * src, TextMessage * dst, pEpEncryptFlags flags)
     1.8 +STDMETHODIMP CpEpEngine::EncryptMessageForSelf(pEpIdentity * targetId, TextMessage * src, TextMessage * dst, pEpEncryptFlags flags)
     1.9  {
    1.10 -    assert(target_id);
    1.11 +    assert(targetId);
    1.12      assert(src);
    1.13      assert(dst);
    1.14  
    1.15 -    if (!(target_id && src && dst))
    1.16 +    if (!(targetId && src && dst))
    1.17          return E_INVALIDARG;
    1.18  
    1.19      PEP_encrypt_flags_t engineFlags = (PEP_encrypt_flags_t)flags;
    1.20  
    1.21 -    ::pEp_identity *_target_id = new_identity(target_id);
    1.22 +    ::pEp_identity *_target_id = new_identity(targetId);
    1.23  
    1.24      ::message *_src = text_message_to_C(src);
    1.25  
    1.26 @@ -944,25 +944,25 @@
    1.27      return S_OK;
    1.28  }
    1.29  
    1.30 -STDMETHODIMP CpEpEngine::ReEvaluateMessageRating(TextMessage * msg, SAFEARRAY * x_keylist, pEpRating x_enc_status, pEpRating *rating)
    1.31 +STDMETHODIMP CpEpEngine::ReEvaluateMessageRating(TextMessage * msg, SAFEARRAY * x_KeyList, pEpRating x_EncStatus, pEpRating *rating)
    1.32  {
    1.33      assert(msg);
    1.34 -    assert(x_keylist);
    1.35 -    assert(x_enc_status != PEP_rating_undefined);
    1.36 +    assert(x_KeyList);
    1.37 +    assert(x_EncStatus != PEP_rating_undefined);
    1.38      assert(rating);
    1.39  
    1.40 -    if (!(msg && x_keylist && x_enc_status != PEP_rating_undefined && rating))
    1.41 +    if (!(msg && x_KeyList && x_EncStatus != PEP_rating_undefined && rating))
    1.42          return E_INVALIDARG;
    1.43  
    1.44      *rating = pEpRatingUndefined;
    1.45  
    1.46      ::message *_msg = text_message_to_C(msg);
    1.47 -    ::stringlist_t *_keylist = new_stringlist(x_keylist);
    1.48 +    ::stringlist_t *_keylist = new_stringlist(x_KeyList);
    1.49      ::PEP_rating _rating = PEP_rating_undefined;
    1.50  
    1.51 -    PEP_STATUS status = ::re_evaluate_message_rating(get_session(), _msg, _keylist, (PEP_rating)x_enc_status, &_rating);
    1.52 +    PEP_STATUS status = ::re_evaluate_message_rating(get_session(), _msg, _keylist, (PEP_rating)x_EncStatus, &_rating);
    1.53  
    1.54 -    ::free_stringlist(x_keylist);
    1.55 +    ::free_stringlist(_keylist);
    1.56      ::free_message(_msg);
    1.57  
    1.58      *rating = (pEpRating)_rating;
    1.59 @@ -1035,13 +1035,13 @@
    1.60      return S_OK;
    1.61  }
    1.62  
    1.63 -STDMETHODIMP CpEpEngine::OwnIdentitiesRetrieve(LPSAFEARRAY* own_identities)
    1.64 +STDMETHODIMP CpEpEngine::OwnIdentitiesRetrieve(LPSAFEARRAY* ownIdentities)
    1.65  {
    1.66 -    assert(own_identities);
    1.67 -    if (!own_identities)
    1.68 +    assert(ownIdentities);
    1.69 +    if (!ownIdentities)
    1.70          return E_INVALIDARG;
    1.71  
    1.72 -    *own_identities = nullptr;
    1.73 +    *ownIdentities = nullptr;
    1.74  
    1.75      ::identity_list *il = nullptr;
    1.76      PEP_STATUS status = ::own_identities_retrieve(get_session(), &il);
    1.77 @@ -1071,7 +1071,7 @@
    1.78      }
    1.79      free_identity_list(il);
    1.80  
    1.81 -    *own_identities = _own_identities;
    1.82 +    *ownIdentities = _own_identities;
    1.83      return S_OK;
    1.84  }
    1.85  
     2.1 --- a/CpEpEngine.h	Fri Jun 16 21:57:36 2017 +0200
     2.2 +++ b/CpEpEngine.h	Fri Jun 16 23:49:49 2017 +0200
     2.3 @@ -197,7 +197,7 @@
     2.4      STDMETHOD(KeyMistrusted)(struct pEpIdentity *ident);
     2.5      STDMETHOD(KeyResetTrust)(struct pEpIdentity *ident);
     2.6      STDMETHOD(TrustPersonalKey)(struct pEpIdentity *ident, struct pEpIdentity *result);
     2.7 -	STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* own_identities);
     2.8 +	STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* ownIdentities);
     2.9  
    2.10      // Blacklist API
    2.11  
    2.12 @@ -210,13 +210,13 @@
    2.13  
    2.14      STDMETHOD(EncryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY * extra, pEpEncryptFlags flags);
    2.15      STDMETHOD(DecryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY ** keylist, pEpDecryptFlags* flags, pEpRating *rating);
    2.16 -    STDMETHOD(ReEvaluateMessageRating)(TextMessage * msg, SAFEARRAY * x_keylist, pEpRating x_enc_status, pEpRating *rating);
    2.17 +    STDMETHOD(ReEvaluateMessageRating)(TextMessage * msg, SAFEARRAY * x_KeyList, pEpRating x_EncStatus, pEpRating *rating);
    2.18      STDMETHOD(OutgoingMessageRating)(TextMessage *msg, pEpRating * pVal);
    2.19      STDMETHOD(IdentityRating)(pEpIdentity * ident, pEpRating * pVal);
    2.20  	STDMETHOD(ColorFromRating)(pEpRating rating, pEpColor * pVal);
    2.21  
    2.22      STDMETHOD(EncryptMessageForSelf)(
    2.23 -        pEpIdentity * target_id, 
    2.24 +        pEpIdentity * targetId, 
    2.25          TextMessage* src,
    2.26          TextMessage *dst,
    2.27          pEpEncryptFlags flags
    2.28 @@ -233,12 +233,6 @@
    2.29  protected:
    2.30  	HRESULT Fire_MessageToSend(
    2.31  		/* [in] */ struct TextMessage *msg);
    2.32 -
    2.33 -	HRESULT Fire_NotifyHandshake(
    2.34 -		/* [in] */ struct pEpIdentity *self,
    2.35 -		/* [in] */ struct pEpIdentity *partner,
    2.36 -		/* [in] */ SyncHandshakeSignal signal,
    2.37 -		/* [retval][out] */ SyncHandshakeResult *result);
    2.38  };
    2.39  
    2.40  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)
     3.1 --- a/pEpCOMServerAdapter.idl	Fri Jun 16 21:57:36 2017 +0200
     3.2 +++ b/pEpCOMServerAdapter.idl	Fri Jun 16 23:49:49 2017 +0200
     3.3 @@ -176,7 +176,7 @@
     3.4      HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
     3.5      HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
     3.6      HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
     3.7 -    HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* own_identities);
     3.8 +    HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* ownIdentities);
     3.9  
    3.10      // Blacklist API
    3.11  
    3.12 @@ -286,12 +286,6 @@
    3.13          [out] pEpDecryptFlags* flags,
    3.14          [out, retval] pEpRating *rating);
    3.15  
    3.16 -    HRESULT ReEvaluateMessageRating(
    3.17 -        [in] struct TextMessage *src,
    3.18 -        [in] SAFEARRAY(BSTR) x_keylist,
    3.19 -        [in] pEpRating x_enc_status,
    3.20 -        [out, retval] pEpRating *rating);
    3.21 -
    3.22      HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
    3.23      HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
    3.24      HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
    3.25 @@ -320,11 +314,18 @@
    3.26      );
    3.27  
    3.28      HRESULT EncryptMessageForSelf(
    3.29 -        [in] struct pEpIdentity* target_id,
    3.30 +        [in] struct pEpIdentity* targetId,
    3.31          [in] struct TextMessage* src, 
    3.32          [out] struct TextMessage* dst,
    3.33          [in, defaultvalue(pEpEncryptFlagDefault)] pEpEncryptFlags flags
    3.34      );
    3.35 +
    3.36 +    HRESULT ReEvaluateMessageRating(
    3.37 +        [in] struct TextMessage *src,
    3.38 +        [in] SAFEARRAY(BSTR) x_KeyList, // referring to X-KeyList mail header
    3.39 +        [in] pEpRating x_EncStatus, // referring to X-EncStatus mail header
    3.40 +        [out, retval] pEpRating *rating
    3.41 +    );
    3.42  };
    3.43  
    3.44  [