summaryrefslogtreecommitdiffstats
path: root/mailnews
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-11 01:35:01 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-11 01:35:01 -0500
commit2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b (patch)
treed316174fa53937d0a93e8a06e3df03aa91e37a59 /mailnews
parentdc46cd9eccfd6555626868e9d526ad52927ec1ef (diff)
downloadUXP-2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b.tar
UXP-2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b.tar.gz
UXP-2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b.tar.lz
UXP-2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b.tar.xz
UXP-2732b1a0b51cb6ee3e9e831d59ad933dc70ccf2b.zip
Bug 1558595
Tag #1273
Diffstat (limited to 'mailnews')
-rw-r--r--mailnews/extensions/smime/public/nsIMsgSMIMEHeaderSink.idl10
-rw-r--r--mailnews/mime/src/mimecms.cpp50
-rw-r--r--mailnews/mime/src/mimemcms.cpp19
3 files changed, 51 insertions, 28 deletions
diff --git a/mailnews/extensions/smime/public/nsIMsgSMIMEHeaderSink.idl b/mailnews/extensions/smime/public/nsIMsgSMIMEHeaderSink.idl
index 9bfa41a04..ec449769a 100644
--- a/mailnews/extensions/smime/public/nsIMsgSMIMEHeaderSink.idl
+++ b/mailnews/extensions/smime/public/nsIMsgSMIMEHeaderSink.idl
@@ -16,8 +16,14 @@ interface nsIX509Cert;
[scriptable, uuid(25380FA1-E70C-4e82-B0BC-F31C2F41C470)]
interface nsIMsgSMIMEHeaderSink : nsISupports
{
- void signedStatus(in long aNestingLevel, in long aSignatureStatus, in nsIX509Cert aSignerCert);
- void encryptionStatus(in long aNestingLevel, in long aEncryptionStatus, in nsIX509Cert aReceipientCert);
+ void signedStatus(in long aNestingLevel,
+ in long aSignatureStatus,
+ in nsIX509Cert aSignerCert,
+ in AUTF8String aMsgNeckoURL);
+ void encryptionStatus(in long aNestingLevel,
+ in long aEncryptionStatus,
+ in nsIX509Cert aReceipientCert,
+ in AUTF8String aMsgNeckoURL);
long maxWantedNesting(); // 1 == only info on outermost nesting level wanted
};
diff --git a/mailnews/mime/src/mimecms.cpp b/mailnews/mime/src/mimecms.cpp
index a3a3c4739..9289c0c33 100644
--- a/mailnews/mime/src/mimecms.cpp
+++ b/mailnews/mime/src/mimecms.cpp
@@ -73,6 +73,7 @@ typedef struct MimeCMSdata
bool parent_is_encrypted_p;
bool parent_holds_stamp_p;
nsCOMPtr<nsIMsgSMIMEHeaderSink> smimeHeaderSink;
+ nsCString url;
MimeCMSdata()
:output_fn(nullptr),
@@ -214,7 +215,9 @@ public:
nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
const char *aSenderAddr, const char *aSenderName,
- nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel);
+ nsIMsgSMIMEHeaderSink *aHeaderSink,
+ int32_t aMimeNestingLevel,
+ const nsCString &aMsgNeckoURL);
protected:
virtual ~nsSMimeVerificationListener() {}
@@ -234,6 +237,7 @@ protected:
bool mSinkIsNull;
nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> mHeaderSink;
int32_t mMimeNestingLevel;
+ nsCString mMsgNeckoURL;
nsCString mFromAddr;
nsCString mFromName;
@@ -245,37 +249,43 @@ class SignedStatusRunnable : public mozilla::Runnable
{
public:
SignedStatusRunnable(const nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> &aSink, int32_t aNestingLevel,
- int32_t aSignatureStatus, nsIX509Cert *aSignerCert);
+ int32_t aSignatureStatus, nsIX509Cert *aSignerCert,
+ const nsCString &aMsgNeckoURL);
NS_DECL_NSIRUNNABLE
protected:
nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> m_sink;
int32_t m_nestingLevel;
int32_t m_signatureStatus;
nsCOMPtr<nsIX509Cert> m_signerCert;
+ nsCString m_msgNeckoURL;
};
SignedStatusRunnable::SignedStatusRunnable(const nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> &aSink,
int32_t aNestingLevel,
int32_t aSignatureStatus,
- nsIX509Cert *aSignerCert) :
+ nsIX509Cert *aSignerCert,
+ const nsCString &aMsgNeckoURL) :
m_sink(aSink), m_nestingLevel(aNestingLevel),
- m_signatureStatus(aSignatureStatus), m_signerCert(aSignerCert)
+ m_signatureStatus(aSignatureStatus), m_signerCert(aSignerCert),
+ m_msgNeckoURL(aMsgNeckoURL)
{
}
NS_IMETHODIMP SignedStatusRunnable::Run()
{
- return m_sink->SignedStatus(m_nestingLevel, m_signatureStatus, m_signerCert);
+ return m_sink->SignedStatus(m_nestingLevel, m_signatureStatus, m_signerCert,
+ m_msgNeckoURL);
}
nsresult ProxySignedStatus(const nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> &aSink,
int32_t aNestingLevel,
int32_t aSignatureStatus,
- nsIX509Cert *aSignerCert)
+ nsIX509Cert *aSignerCert,
+ const nsCString &aMsgNeckoURL)
{
RefPtr<SignedStatusRunnable> signedStatus =
- new SignedStatusRunnable(aSink, aNestingLevel, aSignatureStatus, aSignerCert);
+ new SignedStatusRunnable(aSink, aNestingLevel, aSignatureStatus, aSignerCert, aMsgNeckoURL);
return NS_DispatchToMainThread(signedStatus, NS_DISPATCH_SYNC);
}
@@ -283,7 +293,9 @@ NS_IMPL_ISUPPORTS(nsSMimeVerificationListener, nsISMimeVerificationListener)
nsSMimeVerificationListener::nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
const char *aSenderAddr, const char *aSenderName,
- nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel)
+ nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel,
+ const nsCString &aMsgNeckoURL)
+ : mMsgNeckoURL(aMsgNeckoURL)
{
mHeaderSink = new nsMainThreadPtrHolder<nsIMsgSMIMEHeaderSink>(aHeaderSink);
mSinkIsNull = !aHeaderSink;
@@ -337,7 +349,8 @@ NS_IMETHODIMP nsSMimeVerificationListener::Notify(nsICMSMessage2 *aVerifiedMessa
signature_status = nsICMSMessageErrors::SUCCESS;
}
- ProxySignedStatus(mHeaderSink, mMimeNestingLevel, signature_status, signerCert);
+ ProxySignedStatus(mHeaderSink, mMimeNestingLevel, signature_status,
+ signerCert, mMsgNeckoURL);
return NS_OK;
}
@@ -473,8 +486,7 @@ static void *MimeCMS_init(MimeObject *obj,
channel->GetURI(getter_AddRefs(uri));
if (uri)
{
- nsAutoCString urlSpec;
- rv = uri->GetSpec(urlSpec);
+ rv = uri->GetSpec(data->url);
// We only want to update the UI if the current mime transaction
// is intended for display.
@@ -488,10 +500,10 @@ static void *MimeCMS_init(MimeObject *obj,
// If we do not find header=filter, we assume the result of the
// processing will be shown in the UI.
- if (!strstr(urlSpec.get(), "?header=filter") &&
- !strstr(urlSpec.get(), "&header=filter") &&
- !strstr(urlSpec.get(), "?header=attach") &&
- !strstr(urlSpec.get(), "&header=attach"))
+ if (!strstr(data->url.get(), "?header=filter") &&
+ !strstr(data->url.get(), "&header=filter") &&
+ !strstr(data->url.get(), "?header=attach") &&
+ !strstr(data->url.get(), "&header=attach"))
{
msgurl = do_QueryInterface(uri);
if (msgurl)
@@ -567,6 +579,7 @@ void MimeCMSRequestAsyncSignatureVerification(nsICMSMessage *aCMSMsg,
const char *aFromAddr, const char *aFromName,
const char *aSenderAddr, const char *aSenderName,
nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel,
+ const nsCString &aMsgNeckoURL,
unsigned char* item_data, uint32_t item_len,
int16_t digest_type)
{
@@ -576,7 +589,7 @@ void MimeCMSRequestAsyncSignatureVerification(nsICMSMessage *aCMSMsg,
RefPtr<nsSMimeVerificationListener> listener =
new nsSMimeVerificationListener(aFromAddr, aFromName, aSenderAddr, aSenderName,
- aHeaderSink, aMimeNestingLevel);
+ aHeaderSink, aMimeNestingLevel, aMsgNeckoURL);
if (!listener)
return;
@@ -684,7 +697,7 @@ MimeCMS_eof (void *crypto_closure, bool abort_p)
from_addr.get(), from_name.get(),
sender_addr.get(), sender_name.get(),
data->smimeHeaderSink, aRelativeNestLevel,
- nullptr, 0, 0);
+ data->url, nullptr, 0, 0);
}
}
@@ -693,7 +706,8 @@ MimeCMS_eof (void *crypto_closure, bool abort_p)
data->smimeHeaderSink->EncryptionStatus(
aRelativeNestLevel,
status,
- certOfInterest
+ certOfInterest,
+ data->url
);
}
diff --git a/mailnews/mime/src/mimemcms.cpp b/mailnews/mime/src/mimemcms.cpp
index b8b6a8669..1a281b162 100644
--- a/mailnews/mime/src/mimemcms.cpp
+++ b/mailnews/mime/src/mimemcms.cpp
@@ -83,6 +83,7 @@ typedef struct MimeMultCMSdata
bool parent_is_encrypted_p;
bool parent_holds_stamp_p;
nsCOMPtr<nsIMsgSMIMEHeaderSink> smimeHeaderSink;
+ nsCString url;
MimeMultCMSdata()
:hash_type(0),
@@ -125,6 +126,7 @@ extern void MimeCMSRequestAsyncSignatureVerification(nsICMSMessage *aCMSMsg,
const char *aFromAddr, const char *aFromName,
const char *aSenderAddr, const char *aSenderName,
nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel,
+ const nsCString &aMsgNeckoURL,
unsigned char* item_data, uint32_t item_len,
int16_t digest_type);
extern char *MimeCMS_MakeSAURL(MimeObject *obj);
@@ -231,8 +233,7 @@ MimeMultCMS_init (MimeObject *obj)
channel->GetURI(getter_AddRefs(uri));
if (uri)
{
- nsAutoCString urlSpec;
- rv = uri->GetSpec(urlSpec);
+ rv = uri->GetSpec(data->url);
// We only want to update the UI if the current mime transaction
// is intended for display.
@@ -246,10 +247,10 @@ MimeMultCMS_init (MimeObject *obj)
// If we do not find header=filter, we assume the result of the
// processing will be shown in the UI.
- if (!strstr(urlSpec.get(), "?header=filter") &&
- !strstr(urlSpec.get(), "&header=filter")&&
- !strstr(urlSpec.get(), "?header=attach") &&
- !strstr(urlSpec.get(), "&header=attach"))
+ if (!strstr(data->url.get(), "?header=filter") &&
+ !strstr(data->url.get(), "&header=filter") &&
+ !strstr(data->url.get(), "?header=attach") &&
+ !strstr(data->url.get(), "&header=attach"))
{
msgurl = do_QueryInterface(uri);
if (msgurl)
@@ -425,10 +426,11 @@ MimeMultCMS_generate (void *crypto_closure)
// We were not given all parts of the message.
// We are therefore unable to verify correctness of the signature.
- if (data->smimeHeaderSink)
+ if (data->smimeHeaderSink) {
data->smimeHeaderSink->SignedStatus(aRelativeNestLevel,
nsICMSMessageErrors::VERIFY_NOT_YET_ATTEMPTED,
- nullptr);
+ nullptr, data->url);
+ }
return nullptr;
}
@@ -455,6 +457,7 @@ MimeMultCMS_generate (void *crypto_closure)
from_addr.get(), from_name.get(),
sender_addr.get(), sender_name.get(),
data->smimeHeaderSink, aRelativeNestLevel,
+ data->url,
data->item_data, data->item_len,
data->hash_type);