1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "comphelper/processfactory.hxx"
22 #include "com/sun/star/task/DocumentPasswordRequest.hpp"
23 #include "com/sun/star/task/DocumentPasswordRequest2.hpp"
24 #include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
25 #include "com/sun/star/task/DocumentMSPasswordRequest2.hpp"
26 #include "com/sun/star/task/MasterPasswordRequest.hpp"
27 #include "com/sun/star/task/XInteractionAbort.hpp"
28 #include "com/sun/star/task/XInteractionPassword.hpp"
29 #include "com/sun/star/task/XInteractionPassword2.hpp"
30 #include "com/sun/star/task/XInteractionRetry.hpp"
31 #include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
32 #include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
34 #include "osl/diagnose.h"
35 #include "rtl/digest.h"
36 #include "osl/mutex.hxx"
37 #include "tools/errcode.hxx"
38 #include "vcl/msgbox.hxx"
39 #include "vcl/abstdlg.hxx"
40 #include "vcl/svapp.hxx"
43 #include "getcontinuations.hxx"
44 #include "passwordcontainer.hxx"
45 #include "loginerr.hxx"
46 #include "logindlg.hxx"
47 #include "masterpasscrtdlg.hxx"
48 #include "masterpassworddlg.hxx"
49 #include "passworddlg.hxx"
53 #include <boost/scoped_ptr.hpp>
55 using namespace com::sun::star
;
62 LoginErrorInfo
& rInfo
,
63 OUString
const & rRealm
)
64 SAL_THROW((uno::RuntimeException
))
68 SolarMutexGuard aGuard
;
70 bool bAccount
= (rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT
) != 0;
71 bool bSavePassword
= rInfo
.GetCanRememberPassword();
72 bool bCanUseSysCreds
= rInfo
.GetCanUseSystemCredentials();
74 sal_uInt16 nFlags
= 0;
75 if (rInfo
.GetPath().Len() == 0)
77 if (rInfo
.GetErrorText().Len() == 0)
78 nFlags
|= LF_NO_ERRORTEXT
;
80 nFlags
|= LF_NO_ACCOUNT
;
81 if (!(rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME
))
82 nFlags
|= LF_USERNAME_READONLY
;
85 nFlags
|= LF_NO_SAVEPASSWORD
;
88 nFlags
|= LF_NO_USESYSCREDS
;
90 boost::scoped_ptr
< ResMgr
> xManager(ResMgr::CreateResMgr("uui"));
91 boost::scoped_ptr
< LoginDialog
> xDialog(
92 new LoginDialog( pParent
, nFlags
, rInfo
.GetServer(), rRealm
, xManager
.get()));
93 if (rInfo
.GetErrorText().Len() != 0)
94 xDialog
->SetErrorText(rInfo
.GetErrorText());
95 xDialog
->SetName(rInfo
.GetUserName());
97 xDialog
->ClearAccount();
99 xDialog
->ClearPassword();
100 xDialog
->SetPassword(rInfo
.GetPassword());
104 xDialog
->SetSavePasswordText(
105 ResId(rInfo
.GetIsRememberPersistent()
110 xDialog
->SetSavePassword(rInfo
.GetIsRememberPassword());
113 if ( bCanUseSysCreds
)
114 xDialog
->SetUseSystemCredentials( rInfo
.GetIsUseSystemCredentials() );
116 rInfo
.SetResult(xDialog
->Execute() == RET_OK
? ERRCODE_BUTTON_OK
:
117 ERRCODE_BUTTON_CANCEL
);
118 rInfo
.SetUserName(xDialog
->GetName());
119 rInfo
.SetPassword(xDialog
->GetPassword());
120 rInfo
.SetAccount(xDialog
->GetAccount());
121 rInfo
.SetIsRememberPassword(xDialog
->IsSavePassword());
123 if ( bCanUseSysCreds
)
124 rInfo
.SetIsUseSystemCredentials( xDialog
->IsUseSystemCredentials() );
126 catch (std::bad_alloc
const &)
128 throw uno::RuntimeException(OUString("out of memory"),
129 uno::Reference
< uno::XInterface
>());
133 void getRememberModes(
134 uno::Sequence
< ucb::RememberAuthentication
> const & rRememberModes
,
135 ucb::RememberAuthentication
& rPreferredMode
,
136 ucb::RememberAuthentication
& rAlternateMode
)
138 sal_Int32 nCount
= rRememberModes
.getLength();
139 OSL_ENSURE( (nCount
> 0) && (nCount
< 4),
140 "ucb::RememberAuthentication sequence size mismatch!" );
143 rPreferredMode
= rAlternateMode
= rRememberModes
[ 0 ];
148 bool bHasRememberModeSession
= false;
149 bool bHasRememberModePersistent
= false;
151 for (sal_Int32 i
= 0; i
< nCount
; ++i
)
153 switch ( rRememberModes
[i
] )
155 case ucb::RememberAuthentication_NO
:
157 case ucb::RememberAuthentication_SESSION
:
158 bHasRememberModeSession
= true;
160 case ucb::RememberAuthentication_PERSISTENT
:
161 bHasRememberModePersistent
= true;
164 OSL_TRACE( "Unsupported RememberAuthentication value" );
169 if (bHasRememberModePersistent
)
171 rPreferredMode
= ucb::RememberAuthentication_PERSISTENT
;
172 if (bHasRememberModeSession
)
173 rAlternateMode
= ucb::RememberAuthentication_SESSION
;
175 rAlternateMode
= ucb::RememberAuthentication_NO
;
179 rPreferredMode
= ucb::RememberAuthentication_SESSION
;
180 rAlternateMode
= ucb::RememberAuthentication_NO
;
186 handleAuthenticationRequest_(
188 uno::Reference
< task::XInteractionHandler2
> const & xIH
,
189 uno::Reference
< uno::XComponentContext
> const & xContext
,
190 ucb::AuthenticationRequest
const & rRequest
,
191 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
193 const OUString
& rURL
)
194 SAL_THROW((uno::RuntimeException
))
196 uno::Reference
< task::XInteractionRetry
> xRetry
;
197 uno::Reference
< task::XInteractionAbort
> xAbort
;
198 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
199 xSupplyAuthentication
;
200 uno::Reference
< ucb::XInteractionSupplyAuthentication2
>
201 xSupplyAuthentication2
;
202 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
203 if (xSupplyAuthentication
.is())
204 xSupplyAuthentication2
.set(xSupplyAuthentication
, uno::UNO_QUERY
);
206 //////////////////////////
207 // First, try to obtain credentials from password container service.
208 uui::PasswordContainerHelper
aPwContainerHelper(xContext
);
209 if (aPwContainerHelper
.handleAuthenticationRequest(rRequest
,
210 xSupplyAuthentication
,
214 xSupplyAuthentication
->select();
218 //////////////////////////
219 // Second, try to obtain credentials from user via password dialog.
220 ucb::RememberAuthentication eDefaultRememberMode
221 = ucb::RememberAuthentication_SESSION
;
222 ucb::RememberAuthentication ePreferredRememberMode
223 = eDefaultRememberMode
;
224 ucb::RememberAuthentication eAlternateRememberMode
225 = ucb::RememberAuthentication_NO
;
227 if (xSupplyAuthentication
.is())
230 xSupplyAuthentication
->getRememberPasswordModes(
231 eDefaultRememberMode
),
232 ePreferredRememberMode
,
233 eAlternateRememberMode
);
236 sal_Bool bCanUseSystemCredentials
;
237 sal_Bool bDefaultUseSystemCredentials
;
238 if (xSupplyAuthentication2
.is())
240 bCanUseSystemCredentials
241 = xSupplyAuthentication2
->canUseSystemCredentials(
242 bDefaultUseSystemCredentials
);
246 bCanUseSystemCredentials
= sal_False
;
247 bDefaultUseSystemCredentials
= sal_False
;
250 LoginErrorInfo aInfo
;
251 aInfo
.SetTitle(rRequest
.ServerName
);
252 aInfo
.SetServer(rRequest
.ServerName
);
253 if (rRequest
.HasAccount
)
254 aInfo
.SetAccount(rRequest
.Account
);
255 if (rRequest
.HasUserName
)
256 aInfo
.SetUserName(rRequest
.UserName
);
257 if (rRequest
.HasPassword
)
258 aInfo
.SetPassword(rRequest
.Password
);
259 aInfo
.SetErrorText(rRequest
.Diagnostic
);
261 aInfo
.SetCanRememberPassword(
262 ePreferredRememberMode
!= eAlternateRememberMode
);
263 aInfo
.SetIsRememberPassword(
264 ePreferredRememberMode
== eDefaultRememberMode
);
265 aInfo
.SetIsRememberPersistent(
266 ePreferredRememberMode
== ucb::RememberAuthentication_PERSISTENT
);
268 aInfo
.SetCanUseSystemCredentials(bCanUseSystemCredentials
);
269 aInfo
.SetIsUseSystemCredentials( bDefaultUseSystemCredentials
);
270 aInfo
.SetModifyAccount(rRequest
.HasAccount
271 && xSupplyAuthentication
.is()
272 && xSupplyAuthentication
->canSetAccount());
273 aInfo
.SetModifyUserName(rRequest
.HasUserName
274 && xSupplyAuthentication
.is()
275 && xSupplyAuthentication
->canSetUserName());
276 executeLoginDialog(pParent
,
278 rRequest
.HasRealm
? rRequest
.Realm
: OUString());
279 switch (aInfo
.GetResult())
281 case ERRCODE_BUTTON_OK
:
282 if (xSupplyAuthentication
.is())
284 if (xSupplyAuthentication
->canSetUserName())
285 xSupplyAuthentication
->setUserName(aInfo
.GetUserName());
286 if (xSupplyAuthentication
->canSetPassword())
287 xSupplyAuthentication
->setPassword(aInfo
.GetPassword());
289 if (ePreferredRememberMode
!= eAlternateRememberMode
)
291 // user had the choice.
292 if (aInfo
.GetIsRememberPassword())
293 xSupplyAuthentication
->setRememberPassword(
294 ePreferredRememberMode
);
296 xSupplyAuthentication
->setRememberPassword(
297 eAlternateRememberMode
);
301 // user had no choice.
302 xSupplyAuthentication
->setRememberPassword(
303 ePreferredRememberMode
);
306 if (rRequest
.HasRealm
)
308 if (xSupplyAuthentication
->canSetRealm())
309 xSupplyAuthentication
->setRealm(aInfo
.GetAccount());
311 else if (xSupplyAuthentication
->canSetAccount())
312 xSupplyAuthentication
->setAccount(aInfo
.GetAccount());
314 if ( xSupplyAuthentication2
.is() && bCanUseSystemCredentials
)
315 xSupplyAuthentication2
->setUseSystemCredentials(
316 aInfo
.GetIsUseSystemCredentials() );
318 xSupplyAuthentication
->select();
321 //////////////////////////
322 // Third, store credentials in password container.
324 if ( aInfo
.GetIsUseSystemCredentials() )
326 if (aInfo
.GetIsRememberPassword())
328 if (!aPwContainerHelper
.addRecord(
329 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
330 OUString(), // empty u/p -> sys creds
331 uno::Sequence
< OUString
>(),
333 ePreferredRememberMode
334 == ucb::RememberAuthentication_PERSISTENT
))
336 xSupplyAuthentication
->setRememberPassword(
337 ucb::RememberAuthentication_NO
);
340 else if (eAlternateRememberMode
341 == ucb::RememberAuthentication_SESSION
)
343 if (!aPwContainerHelper
.addRecord(
344 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
345 OUString(), // empty u/p -> sys creds
346 uno::Sequence
< OUString
>(),
348 false /* SESSION */))
350 xSupplyAuthentication
->setRememberPassword(
351 ucb::RememberAuthentication_NO
);
355 // Empty user name can not be valid:
356 else if (aInfo
.GetUserName().Len() != 0)
358 uno::Sequence
< OUString
>
359 aPassList(aInfo
.GetAccount().Len() == 0 ? 1 : 2);
360 aPassList
[0] = aInfo
.GetPassword();
361 if (aInfo
.GetAccount().Len() != 0)
362 aPassList
[1] = aInfo
.GetAccount();
364 if (aInfo
.GetIsRememberPassword())
366 if (!aPwContainerHelper
.addRecord(
367 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
371 ePreferredRememberMode
372 == ucb::RememberAuthentication_PERSISTENT
))
374 xSupplyAuthentication
->setRememberPassword(
375 ucb::RememberAuthentication_NO
);
378 else if (eAlternateRememberMode
379 == ucb::RememberAuthentication_SESSION
)
381 if (!aPwContainerHelper
.addRecord(
382 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
386 false /* SESSION */))
388 xSupplyAuthentication
->setRememberPassword(
389 ucb::RememberAuthentication_NO
);
395 case ERRCODE_BUTTON_RETRY
:
408 executeMasterPasswordDialog(
410 LoginErrorInfo
& rInfo
,
411 task::PasswordRequestMode nMode
)
412 SAL_THROW((uno::RuntimeException
))
417 SolarMutexGuard aGuard
;
419 boost::scoped_ptr
< ResMgr
> xManager(ResMgr::CreateResMgr("uui"));
420 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
422 boost::scoped_ptr
< MasterPasswordCreateDialog
> xDialog(
423 new MasterPasswordCreateDialog(pParent
, xManager
.get()));
424 rInfo
.SetResult(xDialog
->Execute()
425 == RET_OK
? ERRCODE_BUTTON_OK
: ERRCODE_BUTTON_CANCEL
);
426 aMaster
= OUStringToOString(
427 xDialog
->GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
431 boost::scoped_ptr
< MasterPasswordDialog
> xDialog(
432 new MasterPasswordDialog(pParent
, nMode
, xManager
.get()));
433 rInfo
.SetResult(xDialog
->Execute()
434 == RET_OK
? ERRCODE_BUTTON_OK
: ERRCODE_BUTTON_CANCEL
);
435 aMaster
= OUStringToOString(
436 xDialog
->GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
439 catch (std::bad_alloc
const &)
441 throw uno::RuntimeException(OUString("out of memory"),
442 uno::Reference
< uno::XInterface
>());
445 sal_uInt8 aKey
[RTL_DIGEST_LENGTH_MD5
];
446 rtl_digest_PBKDF2(aKey
,
447 RTL_DIGEST_LENGTH_MD5
,
448 reinterpret_cast< sal_uInt8
const * >(aMaster
.getStr()),
450 reinterpret_cast< sal_uInt8
const * >(
451 "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
455 OUStringBuffer aBuffer
;
456 for (int i
= 0; i
< RTL_DIGEST_LENGTH_MD5
; ++i
)
458 aBuffer
.append(static_cast< sal_Unicode
>('a' + (aKey
[i
] >> 4)));
459 aBuffer
.append(static_cast< sal_Unicode
>('a' + (aKey
[i
] & 15)));
461 rInfo
.SetPassword(aBuffer
.makeStringAndClear());
465 handleMasterPasswordRequest_(
467 task::PasswordRequestMode nMode
,
468 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
470 SAL_THROW((uno::RuntimeException
))
472 uno::Reference
< task::XInteractionRetry
> xRetry
;
473 uno::Reference
< task::XInteractionAbort
> xAbort
;
474 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
475 xSupplyAuthentication
;
476 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
477 LoginErrorInfo aInfo
;
479 // in case of master password a hash code is returned
480 executeMasterPasswordDialog(pParent
, aInfo
, nMode
);
482 switch (aInfo
.GetResult())
484 case ERRCODE_BUTTON_OK
:
485 if (xSupplyAuthentication
.is())
487 if (xSupplyAuthentication
->canSetPassword())
488 xSupplyAuthentication
->setPassword(aInfo
.GetPassword());
489 xSupplyAuthentication
->select();
493 case ERRCODE_BUTTON_RETRY
:
506 executePasswordDialog(
508 LoginErrorInfo
& rInfo
,
509 task::PasswordRequestMode nMode
,
512 bool bIsPasswordToModify
,
513 bool bIsSimplePasswordRequest
)
514 SAL_THROW((uno::RuntimeException
))
518 SolarMutexGuard aGuard
;
520 boost::scoped_ptr
< ResMgr
> xManager(ResMgr::CreateResMgr("uui"));
521 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
523 if (bIsSimplePasswordRequest
)
525 boost::scoped_ptr
< PasswordDialog
> pDialog(
526 new PasswordDialog( pParent
, nMode
, xManager
.get(), aDocName
,
527 bIsPasswordToModify
, bIsSimplePasswordRequest
) );
528 pDialog
->SetMinLen(0);
530 rInfo
.SetResult( pDialog
->Execute() == RET_OK
? ERRCODE_BUTTON_OK
: ERRCODE_BUTTON_CANCEL
);
531 rInfo
.SetPassword( pDialog
->GetPassword() );
535 const sal_uInt16 nMaxPasswdLen
= bMSCryptoMode
? 15 : 0; // 0 -> allow any length
537 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
538 AbstractPasswordToOpenModifyDialog
*pTmp
= pFact
->CreatePasswordToOpenModifyDialog( pParent
, 0, nMaxPasswdLen
, bIsPasswordToModify
);
539 boost::scoped_ptr
< AbstractPasswordToOpenModifyDialog
> pDialog( pTmp
);
541 rInfo
.SetResult( pDialog
->Execute() == RET_OK
? ERRCODE_BUTTON_OK
: ERRCODE_BUTTON_CANCEL
);
542 rInfo
.SetPassword( pDialog
->GetPasswordToOpen() );
543 rInfo
.SetPasswordToModify( pDialog
->GetPasswordToModify() );
544 rInfo
.SetRecommendToOpenReadonly( pDialog
->IsRecommendToOpenReadonly() );
547 else // enter password or reenter password
549 boost::scoped_ptr
< PasswordDialog
> pDialog(
550 new PasswordDialog( pParent
, nMode
, xManager
.get(), aDocName
,
551 bIsPasswordToModify
, bIsSimplePasswordRequest
) );
552 pDialog
->SetMinLen(0);
554 rInfo
.SetResult( pDialog
->Execute() == RET_OK
? ERRCODE_BUTTON_OK
: ERRCODE_BUTTON_CANCEL
);
555 rInfo
.SetPassword( bIsPasswordToModify
? String() : pDialog
->GetPassword() );
556 rInfo
.SetPasswordToModify( bIsPasswordToModify
? pDialog
->GetPassword() : String() );
559 catch (std::bad_alloc
const &)
561 throw uno::RuntimeException(OUString("out of memory"),
562 uno::Reference
< uno::XInterface
>());
567 handlePasswordRequest_(
569 task::PasswordRequestMode nMode
,
570 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
572 OUString aDocumentName
,
574 bool bIsPasswordToModify
,
575 bool bIsSimplePasswordRequest
= false )
576 SAL_THROW((uno::RuntimeException
))
578 uno::Reference
< task::XInteractionRetry
> xRetry
;
579 uno::Reference
< task::XInteractionAbort
> xAbort
;
580 uno::Reference
< task::XInteractionPassword
> xPassword
;
581 uno::Reference
< task::XInteractionPassword2
> xPassword2
;
582 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xPassword2
, &xPassword
);
584 if ( xPassword2
.is() && !xPassword
.is() )
585 xPassword
.set( xPassword2
, uno::UNO_QUERY_THROW
);
587 LoginErrorInfo aInfo
;
589 executePasswordDialog( pParent
, aInfo
, nMode
,
590 aDocumentName
, bMSCryptoMode
, bIsPasswordToModify
, bIsSimplePasswordRequest
);
592 switch (aInfo
.GetResult())
594 case ERRCODE_BUTTON_OK
:
595 OSL_ENSURE( !bIsPasswordToModify
|| xPassword2
.is(), "PasswordToModify is requested, but there is no Interaction!" );
600 xPassword2
->setPasswordToModify( aInfo
.GetPasswordToModify() );
601 xPassword2
->setRecommendReadOnly( aInfo
.IsRecommendToOpenReadonly() );
604 xPassword
->setPassword(aInfo
.GetPassword());
609 case ERRCODE_BUTTON_RETRY
:
624 UUIInteractionHelper::handleAuthenticationRequest(
625 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
626 SAL_THROW((uno::RuntimeException
))
628 uno::Any
aAnyRequest(rRequest
->getRequest());
630 ucb::URLAuthenticationRequest aURLAuthenticationRequest
;
631 if (aAnyRequest
>>= aURLAuthenticationRequest
)
633 handleAuthenticationRequest_(getParentProperty(),
634 getInteractionHandler(),
636 aURLAuthenticationRequest
,
637 rRequest
->getContinuations(),
638 aURLAuthenticationRequest
.URL
);
642 ucb::AuthenticationRequest aAuthenticationRequest
;
643 if (aAnyRequest
>>= aAuthenticationRequest
)
645 handleAuthenticationRequest_(getParentProperty(),
646 getInteractionHandler(),
648 aAuthenticationRequest
,
649 rRequest
->getContinuations(),
657 UUIInteractionHelper::handleMasterPasswordRequest(
658 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
659 SAL_THROW((uno::RuntimeException
))
661 uno::Any
aAnyRequest(rRequest
->getRequest());
663 task::MasterPasswordRequest aMasterPasswordRequest
;
664 if (aAnyRequest
>>= aMasterPasswordRequest
)
666 handleMasterPasswordRequest_(getParentProperty(),
667 aMasterPasswordRequest
.Mode
,
668 rRequest
->getContinuations());
675 UUIInteractionHelper::handlePasswordRequest(
676 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
677 SAL_THROW((uno::RuntimeException
))
679 // parameters to be filled for the call to handlePasswordRequest_
680 Window
* pParent
= getParentProperty();
681 task::PasswordRequestMode nMode
= task::PasswordRequestMode_PASSWORD_ENTER
;
682 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const & rContinuations
= rRequest
->getContinuations();
683 OUString aDocumentName
;
684 bool bMSCryptoMode
= false;
685 bool bIsPasswordToModify
= false;
687 bool bDoHandleRequest
= false;
689 uno::Any
aAnyRequest(rRequest
->getRequest());
691 task::DocumentPasswordRequest2 aDocumentPasswordRequest2
;
692 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentPasswordRequest2
))
694 nMode
= aDocumentPasswordRequest2
.Mode
;
695 aDocumentName
= aDocumentPasswordRequest2
.Name
;
696 OSL_ENSURE( bMSCryptoMode
== false, "bMSCryptoMode should be false" );
697 bIsPasswordToModify
= aDocumentPasswordRequest2
.IsRequestPasswordToModify
;
699 bDoHandleRequest
= true;
702 task::DocumentPasswordRequest aDocumentPasswordRequest
;
703 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentPasswordRequest
))
705 nMode
= aDocumentPasswordRequest
.Mode
;
706 aDocumentName
= aDocumentPasswordRequest
.Name
;
707 OSL_ENSURE( bMSCryptoMode
== false, "bMSCryptoMode should be false" );
708 OSL_ENSURE( bIsPasswordToModify
== false, "bIsPasswordToModify should be false" );
710 bDoHandleRequest
= true;
713 task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2
;
714 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentMSPasswordRequest2
))
716 nMode
= aDocumentMSPasswordRequest2
.Mode
;
717 aDocumentName
= aDocumentMSPasswordRequest2
.Name
;
718 bMSCryptoMode
= true;
719 bIsPasswordToModify
= aDocumentMSPasswordRequest2
.IsRequestPasswordToModify
;
721 bDoHandleRequest
= true;
724 task::DocumentMSPasswordRequest aDocumentMSPasswordRequest
;
725 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentMSPasswordRequest
))
727 nMode
= aDocumentMSPasswordRequest
.Mode
;
728 aDocumentName
= aDocumentMSPasswordRequest
.Name
;
729 bMSCryptoMode
= true;
730 OSL_ENSURE( bIsPasswordToModify
== false, "bIsPasswordToModify should be false" );
732 bDoHandleRequest
= true;
735 if (bDoHandleRequest
)
737 handlePasswordRequest_( pParent
, nMode
, rContinuations
,
738 aDocumentName
, bMSCryptoMode
, bIsPasswordToModify
);
742 task::PasswordRequest aPasswordRequest
;
743 if( aAnyRequest
>>= aPasswordRequest
)
745 handlePasswordRequest_(getParentProperty(),
746 aPasswordRequest
.Mode
,
747 rRequest
->getContinuations(),
749 false /* bool bMSCryptoMode */,
750 false /* bool bIsPasswordToModify */,
751 true /* bool bIsSimplePasswordRequest */ );
758 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */