summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-11-30 01:26:32 +0100
committerEike Rathke <erack@redhat.com>2019-11-30 02:50:34 +0100
commitadb7106a7c805d332c8098891996a75e6ec4caf8 (patch)
tree73bbf8660aafd4c46a92aaec1a8dac6035398d2e /uui
parentecc56435094e23165eb30db4d7f6a7e6aab0b47e (diff)
Resolves: tdf#97086 Allow "unlimited" password length for OOXML encryption
Change-Id: I51175424e19ad02b81120c3fdea22732cd481a8d Reviewed-on: https://gerrit.libreoffice.org/84097 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'uui')
-rw-r--r--uui/source/iahndl-authentication.cxx90
1 files changed, 47 insertions, 43 deletions
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index b6c74f4926db..4835a485dd2a 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -488,7 +488,7 @@ executePasswordDialog(
LoginErrorInfo & rInfo,
task::PasswordRequestMode nMode,
const OUString& aDocName,
- bool bMSCryptoMode,
+ sal_uInt16 nMaxPasswordLen,
bool bIsPasswordToModify,
bool bIsSimplePasswordRequest )
{
@@ -508,11 +508,9 @@ executePasswordDialog(
}
else
{
- const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length
-
VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create();
ScopedVclPtr<AbstractPasswordToOpenModifyDialog> const pDialog(
- pFact->CreatePasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify));
+ pFact->CreatePasswordToOpenModifyDialog(pParent, nMaxPasswordLen, bIsPasswordToModify));
rInfo.SetResult( pDialog->Execute() == RET_OK ? DialogMask::ButtonsOk : DialogMask::ButtonsCancel );
rInfo.SetPassword( pDialog->GetPasswordToOpen() );
@@ -539,7 +537,7 @@ handlePasswordRequest_(
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
rContinuations,
const OUString& aDocumentName,
- bool bMSCryptoMode,
+ sal_uInt16 nMaxPasswordLen,
bool bIsPasswordToModify,
bool bIsSimplePasswordRequest = false )
{
@@ -555,7 +553,7 @@ handlePasswordRequest_(
LoginErrorInfo aInfo;
executePasswordDialog( pParent, aInfo, nMode,
- aDocumentName, bMSCryptoMode, bIsPasswordToModify, bIsSimplePasswordRequest );
+ aDocumentName, nMaxPasswordLen, bIsPasswordToModify, bIsSimplePasswordRequest );
switch (aInfo.GetResult())
{
@@ -649,61 +647,67 @@ UUIInteractionHelper::handlePasswordRequest(
task::PasswordRequestMode nMode = task::PasswordRequestMode_PASSWORD_ENTER;
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations = rRequest->getContinuations();
OUString aDocumentName;
- bool bMSCryptoMode = false;
+ sal_uInt16 nMaxPasswordLen = 0; // any length
bool bIsPasswordToModify = false;
bool bDoHandleRequest = false;
uno::Any aAnyRequest(rRequest->getRequest());
- task::DocumentPasswordRequest2 aDocumentPasswordRequest2;
- if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest2))
+ do
{
- nMode = aDocumentPasswordRequest2.Mode;
- aDocumentName = aDocumentPasswordRequest2.Name;
- OSL_ENSURE( !bMSCryptoMode, "bMSCryptoMode should be false" );
- bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify;
+ task::DocumentPasswordRequest2 aDocumentPasswordRequest2;
+ if (aAnyRequest >>= aDocumentPasswordRequest2)
+ {
+ nMode = aDocumentPasswordRequest2.Mode;
+ aDocumentName = aDocumentPasswordRequest2.Name;
+ bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify;
- bDoHandleRequest = true;
- }
+ bDoHandleRequest = true;
+ break; // do
+ }
- task::DocumentPasswordRequest aDocumentPasswordRequest;
- if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest))
- {
- nMode = aDocumentPasswordRequest.Mode;
- aDocumentName = aDocumentPasswordRequest.Name;
- OSL_ENSURE( !bMSCryptoMode, "bMSCryptoMode should be false" );
- OSL_ENSURE( !bIsPasswordToModify, "bIsPasswordToModify should be false" );
+ task::DocumentPasswordRequest aDocumentPasswordRequest;
+ if (aAnyRequest >>= aDocumentPasswordRequest)
+ {
+ nMode = aDocumentPasswordRequest.Mode;
+ aDocumentName = aDocumentPasswordRequest.Name;
+ OSL_ENSURE( !bIsPasswordToModify, "bIsPasswordToModify should be false" );
- bDoHandleRequest = true;
- }
+ bDoHandleRequest = true;
+ break; // do
+ }
- task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2;
- if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest2))
- {
- nMode = aDocumentMSPasswordRequest2.Mode;
- aDocumentName = aDocumentMSPasswordRequest2.Name;
- bMSCryptoMode = true;
- bIsPasswordToModify = aDocumentMSPasswordRequest2.IsRequestPasswordToModify;
+ task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2;
+ if (aAnyRequest >>= aDocumentMSPasswordRequest2)
+ {
+ nMode = aDocumentMSPasswordRequest2.Mode;
+ aDocumentName = aDocumentMSPasswordRequest2.Name;
+ nMaxPasswordLen = 15;
+ bIsPasswordToModify = aDocumentMSPasswordRequest2.IsRequestPasswordToModify;
- bDoHandleRequest = true;
- }
+ bDoHandleRequest = true;
+ break; // do
+ }
- task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
- if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest))
- {
- nMode = aDocumentMSPasswordRequest.Mode;
- aDocumentName = aDocumentMSPasswordRequest.Name;
- bMSCryptoMode = true;
- OSL_ENSURE( !bIsPasswordToModify, "bIsPasswordToModify should be false" );
+ task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+ if (aAnyRequest >>= aDocumentMSPasswordRequest)
+ {
+ nMode = aDocumentMSPasswordRequest.Mode;
+ aDocumentName = aDocumentMSPasswordRequest.Name;
+ nMaxPasswordLen = 15;
+ OSL_ENSURE( !bIsPasswordToModify, "bIsPasswordToModify should be false" );
- bDoHandleRequest = true;
+ bDoHandleRequest = true;
+ break; // do
+ }
}
+ while (false);
if (bDoHandleRequest)
{
handlePasswordRequest_( Application::GetFrameWeld(xParent), nMode, rContinuations,
- aDocumentName, bMSCryptoMode, bIsPasswordToModify );
+ aDocumentName, nMaxPasswordLen, bIsPasswordToModify );
return true;
}
@@ -714,7 +718,7 @@ UUIInteractionHelper::handlePasswordRequest(
aPasswordRequest.Mode,
rRequest->getContinuations(),
OUString(),
- false /* bool bMSCryptoMode */,
+ 0 /* sal_uInt16 nMaxPasswordLen */,
false /* bool bIsPasswordToModify */,
true /* bool bIsSimplePasswordRequest */ );
return true;