summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-05-27 13:53:12 +0200
committerVladimir Glazunov <vg@openoffice.org>2010-05-27 13:53:12 +0200
commitaa2cdeaf6c79a15fb801cb205a0d5b19d5b8df7b (patch)
tree008c8301570e42e3b9c88901b0dd83611d8e8628
parent53663a5b057105466ceaa1de74bd866229a21e66 (diff)
parent3617287b26b05d5d6fe47c2b2804b3f33891a269 (diff)
CWS-TOOLING: integrate CWS kso44
-rw-r--r--ucb/source/ucp/webdav/DAVAuthListener.hxx5
-rw-r--r--ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx17
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx6
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx23
-rw-r--r--uui/source/iahndl-authentication.cxx247
-rw-r--r--uui/source/loginerr.hxx99
-rw-r--r--uui/source/passwordcontainer.cxx15
7 files changed, 258 insertions, 154 deletions
diff --git a/ucb/source/ucp/webdav/DAVAuthListener.hxx b/ucb/source/ucp/webdav/DAVAuthListener.hxx
index fb5f0d0449..71bed1c0a1 100644
--- a/ucb/source/ucp/webdav/DAVAuthListener.hxx
+++ b/ucb/source/ucp/webdav/DAVAuthListener.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,9 +30,7 @@
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ustring.hxx>
-#ifndef _COM_SUN_STAR_UCB_XREFERENCE_HPP_
#include <com/sun/star/uno/XReference.hpp>
-#endif
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
namespace webdav_ucp
@@ -46,7 +44,6 @@ class DAVAuthListener : public salhelper::SimpleReferenceObject
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
::rtl::OUString & outPassWord,
- sal_Bool bAllowPersistentStoring,
sal_Bool bCanUseSystemCredentials ) = 0;
};
diff --git a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx
index 3ee5bf152c..c0c9968613 100644
--- a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx
+++ b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,7 +33,7 @@
namespace webdav_ucp
{
-
+
//=========================================================================
//=========================================================================
@@ -43,28 +43,27 @@ namespace webdav_ucp
//
//=========================================================================
//=========================================================================
-
-
+
+
class DAVAuthListener_Impl : public DAVAuthListener
{
public:
-
+
DAVAuthListener_Impl(
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment>& xEnv,
const ::rtl::OUString & inURL )
- : m_xEnv( xEnv ), m_aURL( inURL )
+ : m_xEnv( xEnv ), m_aURL( inURL )
{
}
-
+
virtual int authenticate( const ::rtl::OUString & inRealm,
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
::rtl::OUString & outPassWord,
- sal_Bool bAllowPersistentStoring,
sal_Bool bCanUseSystemCredentials );
private:
-
+
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > m_xEnv;
const rtl::OUString m_aURL;
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 71d4eabdbf..872d454057 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -57,7 +57,6 @@ int DAVAuthListener_Impl::authenticate(
const ::rtl::OUString & inHostName,
::rtl::OUString & inoutUserName,
::rtl::OUString & outPassWord,
- sal_Bool bAllowPersistentStoring,
sal_Bool bCanUseSystemCredentials )
{
if ( m_xEnv.is() )
@@ -79,7 +78,8 @@ int DAVAuthListener_Impl::authenticate(
= new ucbhelper::SimpleAuthenticationRequest(
m_aURL, inHostName, inRealm, inoutUserName,
outPassWord, ::rtl::OUString(),
- bAllowPersistentStoring, bCanUseSystemCredentials );
+ true /*bAllowPersistentStoring*/,
+ bCanUseSystemCredentials );
xIH->handle( xRequest.get() );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 6ab782b322..254fae5469 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -60,7 +60,6 @@
#include <com/sun/star/security/CertificateContainerStatus.hpp>
#include <com/sun/star/security/CertificateContainer.hpp>
#include <com/sun/star/security/XCertificateContainer.hpp>
-#include <com/sun/star/task/XMasterPasswordHandling.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
@@ -330,31 +329,11 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) );
#endif
- // #i97003# (tkr): Ask XMasterPasswordHandling if we should store the
- // credentials persistently and give this information to the auth listener
- uno::Reference< task::XMasterPasswordHandling > xMasterPasswordHandling;
- try
- {
- xMasterPasswordHandling =
- uno::Reference< task::XMasterPasswordHandling >(
- theSession->getMSF()->createInstance(
- rtl::OUString::createFromAscii(
- "com.sun.star.task.PasswordContainer" ) ),
- uno::UNO_QUERY );
- }
- catch ( uno::Exception const & )
- {
- }
-
int theRetVal = pListener->authenticate(
rtl::OUString::createFromAscii( inRealm ),
theSession->getHostName(),
theUserName,
thePassWord,
- xMasterPasswordHandling.is()
- ? xMasterPasswordHandling->
- isPersistentStoringAllowed()
- : sal_False,
bCanUseSystemCreds);
rtl::OString aUser(
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index 70d57cebc5..4183b85273 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -67,10 +67,9 @@ executeLoginDialog(
{
vos::OGuard aGuard(Application::GetSolarMutex());
- bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT)
- != 0;
- bool bSavePassword = rInfo.GetIsPersistentPassword()
- || rInfo.GetIsSavePassword();
+ bool bAccount
+ = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
+ bool bSavePassword = rInfo.GetCanRememberPassword();
bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
sal_uInt16 nFlags = 0;
@@ -109,12 +108,13 @@ executeLoginDialog(
if (bSavePassword)
{
- xDialog->
- SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ?
- RID_SAVE_PASSWORD :
- RID_KEEP_PASSWORD,
- *xManager.get()));
- xDialog->SetSavePassword(rInfo.GetIsSavePassword());
+ xDialog->SetSavePasswordText(
+ ResId(rInfo.GetIsRememberPersistent()
+ ? RID_SAVE_PASSWORD
+ : RID_KEEP_PASSWORD,
+ *xManager.get()));
+
+ xDialog->SetSavePassword(rInfo.GetIsRememberPassword());
}
if ( bCanUseSysCreds )
@@ -126,7 +126,7 @@ executeLoginDialog(
rInfo.SetUserName(xDialog->GetName());
rInfo.SetPassword(xDialog->GetPassword());
rInfo.SetAccount(xDialog->GetAccount());
- rInfo.SetSavePassword(xDialog->IsSavePassword());
+ rInfo.SetIsRememberPassword(xDialog->IsSavePassword());
if ( bCanUseSysCreds )
rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() );
@@ -139,6 +139,60 @@ executeLoginDialog(
}
}
+void getRememberModes(
+ uno::Sequence< ucb::RememberAuthentication > const & rRememberModes,
+ ucb::RememberAuthentication & rPreferredMode,
+ ucb::RememberAuthentication & rAlternateMode )
+{
+ sal_Int32 nCount = rRememberModes.getLength();
+ OSL_ENSURE( (nCount > 0) && (nCount < 4),
+ "ucb::RememberAuthentication sequence size mismatch!" );
+ if ( nCount == 1 )
+ {
+ rPreferredMode = rAlternateMode = rRememberModes[ 0 ];
+ return;
+ }
+ else
+ {
+ //bool bHasRememberModeNo = false;
+ bool bHasRememberModeSession = false;
+ bool bHasRememberModePersistent = false;
+
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ switch ( rRememberModes[i] )
+ {
+ case ucb::RememberAuthentication_NO:
+ //bHasRememberModeNo = true;
+ break;
+ case ucb::RememberAuthentication_SESSION:
+ bHasRememberModeSession = true;
+ break;
+ case ucb::RememberAuthentication_PERSISTENT:
+ bHasRememberModePersistent = true;
+ break;
+ default:
+ OSL_TRACE( "Unsupported RememberAuthentication value" );
+ break;
+ }
+ }
+
+ if (bHasRememberModePersistent)
+ {
+ rPreferredMode = ucb::RememberAuthentication_PERSISTENT;
+ if (bHasRememberModeSession)
+ rAlternateMode = ucb::RememberAuthentication_SESSION;
+ else
+ rAlternateMode = ucb::RememberAuthentication_NO;
+ }
+ else
+ {
+ rPreferredMode = ucb::RememberAuthentication_SESSION;
+ rAlternateMode = ucb::RememberAuthentication_NO;
+ }
+ }
+}
+
void
handleAuthenticationRequest_(
Window * pParent,
@@ -161,7 +215,7 @@ handleAuthenticationRequest_(
xSupplyAuthentication2.set(xSupplyAuthentication, uno::UNO_QUERY);
//////////////////////////
- // First, try to obatin credentials from password container service.
+ // First, try to obtain credentials from password container service.
uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory);
if (aPwContainerHelper.handleAuthenticationRequest(rRequest,
xSupplyAuthentication,
@@ -174,26 +228,20 @@ handleAuthenticationRequest_(
//////////////////////////
// Second, try to obtain credentials from user via password dialog.
- bool bRemember;
- bool bRememberPersistent;
+ ucb::RememberAuthentication eDefaultRememberMode
+ = ucb::RememberAuthentication_SESSION;
+ ucb::RememberAuthentication ePreferredRememberMode
+ = eDefaultRememberMode;
+ ucb::RememberAuthentication eAlternateRememberMode
+ = ucb::RememberAuthentication_NO;
+
if (xSupplyAuthentication.is())
{
- ucb::RememberAuthentication eDefault;
- uno::Sequence< ucb::RememberAuthentication >
- aModes(xSupplyAuthentication->getRememberPasswordModes(eDefault));
- bRemember = eDefault != ucb::RememberAuthentication_NO;
- bRememberPersistent = false;
- for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
- if (aModes[i] == ucb::RememberAuthentication_PERSISTENT)
- {
- bRememberPersistent = true;
- break;
- }
- }
- else
- {
- bRemember = false;
- bRememberPersistent = false;
+ getRememberModes(
+ xSupplyAuthentication->getRememberPasswordModes(
+ eDefaultRememberMode),
+ ePreferredRememberMode,
+ eAlternateRememberMode);
}
sal_Bool bCanUseSystemCredentials;
@@ -220,8 +268,14 @@ handleAuthenticationRequest_(
if (rRequest.HasPassword)
aInfo.SetPassword(rRequest.Password);
aInfo.SetErrorText(rRequest.Diagnostic);
- aInfo.SetPersistentPassword(bRememberPersistent);
- aInfo.SetSavePassword(bRemember);
+
+ aInfo.SetCanRememberPassword(
+ ePreferredRememberMode != eAlternateRememberMode);
+ aInfo.SetIsRememberPassword(
+ eDefaultRememberMode != ucb::RememberAuthentication_NO);
+ aInfo.SetIsRememberPersistent(
+ ePreferredRememberMode == ucb::RememberAuthentication_PERSISTENT);
+
aInfo.SetCanUseSystemCredentials(bCanUseSystemCredentials);
aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials );
aInfo.SetModifyAccount(rRequest.HasAccount
@@ -242,13 +296,24 @@ handleAuthenticationRequest_(
xSupplyAuthentication->setUserName(aInfo.GetUserName());
if (xSupplyAuthentication->canSetPassword())
xSupplyAuthentication->setPassword(aInfo.GetPassword());
- xSupplyAuthentication->
- setRememberPassword(
- aInfo.GetIsSavePassword() ?
- bRememberPersistent ?
- ucb::RememberAuthentication_PERSISTENT :
- ucb::RememberAuthentication_SESSION :
- ucb::RememberAuthentication_NO);
+
+ if (ePreferredRememberMode != eAlternateRememberMode)
+ {
+ // user had te choice.
+ if (aInfo.GetIsRememberPassword())
+ xSupplyAuthentication->setRememberPassword(
+ ePreferredRememberMode);
+ else
+ xSupplyAuthentication->setRememberPassword(
+ eAlternateRememberMode);
+ }
+ else
+ {
+ // user had no choice.
+ xSupplyAuthentication->setRememberPassword(
+ ePreferredRememberMode);
+ }
+
if (rRequest.HasRealm)
{
if (xSupplyAuthentication->canSetRealm())
@@ -267,38 +332,76 @@ handleAuthenticationRequest_(
//////////////////////////
// Third, store credentials in password container.
- if ( aInfo.GetIsUseSystemCredentials() )
- {
- if (aInfo.GetIsSavePassword())
- {
- aPwContainerHelper.addRecord(
- rURL.getLength() ? rURL : rRequest.ServerName,
- rtl::OUString(), // empty u/p -> sys creds
- uno::Sequence< rtl::OUString >(),
- xIH,
- bRememberPersistent);
- }
- }
- // Empty user name can not be valid:
- else if (aInfo.GetUserName().Len() != 0)
- {
- if (aInfo.GetIsSavePassword())
- {
- uno::Sequence< rtl::OUString >
- aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2);
- aPassList[0] = aInfo.GetPassword();
- if (aInfo.GetAccount().Len() != 0)
- aPassList[1] = aInfo.GetAccount();
-
- aPwContainerHelper.addRecord(
- rURL.getLength() ? rURL : rRequest.ServerName,
- aInfo.GetUserName(),
- aPassList,
- xIH,
- bRememberPersistent);
- }
- }
- break;
+ if ( aInfo.GetIsUseSystemCredentials() )
+ {
+ if (aInfo.GetIsRememberPassword())
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ rtl::OUString(), // empty u/p -> sys creds
+ uno::Sequence< rtl::OUString >(),
+ xIH,
+ ePreferredRememberMode
+ == ucb::RememberAuthentication_PERSISTENT))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ else if (eAlternateRememberMode
+ == ucb::RememberAuthentication_SESSION)
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ rtl::OUString(), // empty u/p -> sys creds
+ uno::Sequence< rtl::OUString >(),
+ xIH,
+ false /* SESSION */))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ }
+ // Empty user name can not be valid:
+ else if (aInfo.GetUserName().Len() != 0)
+ {
+ uno::Sequence< rtl::OUString >
+ aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2);
+ aPassList[0] = aInfo.GetPassword();
+ if (aInfo.GetAccount().Len() != 0)
+ aPassList[1] = aInfo.GetAccount();
+
+ if (aInfo.GetIsRememberPassword())
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ xIH,
+ ePreferredRememberMode
+ == ucb::RememberAuthentication_PERSISTENT))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ else if (eAlternateRememberMode
+ == ucb::RememberAuthentication_SESSION)
+ {
+ if (!aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ xIH,
+ false /* SESSION */))
+ {
+ xSupplyAuthentication->setRememberPassword(
+ ucb::RememberAuthentication_NO);
+ }
+ }
+ }
+ break;
case ERRCODE_BUTTON_RETRY:
if (xRetry.is())
diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx
index 1d5451529e..39e5b81caf 100644
--- a/uui/source/loginerr.hxx
+++ b/uui/source/loginerr.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -32,12 +32,13 @@
//=========================================================================
-#define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1
-#define LOGINERROR_FLAG_MODIFY_ACCOUNT 2
-#define LOGINERROR_FLAG_MODIFY_USER_NAME 4
-#define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8
-#define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16
-#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32
+#define LOGINERROR_FLAG_MODIFY_ACCOUNT 1
+#define LOGINERROR_FLAG_MODIFY_USER_NAME 2
+#define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4
+#define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8
+#define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16
+#define LOGINERROR_FLAG_IS_USE_SYSCREDS 32
+#define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64
class LoginErrorInfo
{
@@ -56,71 +57,85 @@ public:
LoginErrorInfo()
: _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
_nRet( ERRCODE_BUTTON_CANCEL )
- {
- }
-
- const String& GetTitle() const { return _aTitle; }
- const String& GetServer() const { return _aServer; }
- const String& GetAccount() const { return _aAccount; }
- const String& GetUserName() const { return _aUserName; }
- const String& GetPassword() const { return _aPassword; }
- const String& GetPath() const { return _aPath; }
- const String& GetErrorText() const { return _aErrorText; }
- BOOL GetIsPersistentPassword() const
- { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); }
- BOOL GetIsSavePassword() const
- { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); }
+ {}
+
+ const String& GetTitle() const { return _aTitle; }
+ const String& GetServer() const { return _aServer; }
+ const String& GetAccount() const { return _aAccount; }
+ const String& GetUserName() const { return _aUserName; }
+ const String& GetPassword() const { return _aPassword; }
+ const String& GetPath() const { return _aPath; }
+ const String& GetErrorText() const { return _aErrorText; }
+
+ BOOL GetCanRememberPassword() const
+ { return ( _nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
+ BOOL GetIsRememberPersistent() const
+ { return ( _nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
+ BOOL GetIsRememberPassword() const
+ { return ( _nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
+
BOOL GetCanUseSystemCredentials() const
{ return ( _nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
BOOL GetIsUseSystemCredentials() const
{ return ( _nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
LOGINERROR_FLAG_IS_USE_SYSCREDS; }
- BYTE GetFlags() const { return _nFlags; }
- USHORT GetResult() const { return _nRet; }
+ BYTE GetFlags() const { return _nFlags; }
+ USHORT GetResult() const { return _nRet; }
- void SetTitle( const String& aTitle )
+ void SetTitle( const String& aTitle )
{ _aTitle = aTitle; }
- void SetServer( const String& aServer )
+ void SetServer( const String& aServer )
{ _aServer = aServer; }
- void SetAccount( const String& aAccount )
+ void SetAccount( const String& aAccount )
{ _aAccount = aAccount; }
- void SetUserName( const String& aUserName )
+ void SetUserName( const String& aUserName )
{ _aUserName = aUserName; }
- void SetPassword( const String& aPassword )
+ void SetPassword( const String& aPassword )
{ _aPassword = aPassword; }
- void SetPath( const String& aPath )
+ void SetPath( const String& aPath )
{ _aPath = aPath; }
- void SetErrorText( const String& aErrorText )
+ void SetErrorText( const String& aErrorText )
{ _aErrorText = aErrorText; }
void SetFlags( BYTE nFlags )
{ _nFlags = nFlags; }
- inline void SetSavePassword( BOOL bSet );
- inline void SetPersistentPassword( BOOL bSet );
+
+ inline void SetCanRememberPassword( BOOL bSet );
+ inline void SetIsRememberPassword( BOOL bSet );
+ inline void SetIsRememberPersistent( BOOL bSet );
+
inline void SetCanUseSystemCredentials( BOOL bSet );
inline void SetIsUseSystemCredentials( BOOL bSet );
- inline void SetModifyAccount( BOOL bSet );
- inline void SetModifyUserName( BOOL bSet );
+ inline void SetModifyAccount( BOOL bSet );
+ inline void SetModifyUserName( BOOL bSet );
void SetResult( USHORT nRet )
{ _nRet = nRet; }
};
-inline void LoginErrorInfo::SetSavePassword( BOOL bSet )
+inline void LoginErrorInfo::SetCanRememberPassword( BOOL bSet )
+{
+ if ( bSet )
+ _nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+ else
+ _nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+}
+
+inline void LoginErrorInfo::SetIsRememberPassword( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD;
+ _nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
else
- _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD;
+ _nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
}
-inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet )
+inline void LoginErrorInfo::SetIsRememberPersistent( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD;
+ _nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
else
- _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD;
+ _nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
}
-inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
+inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
{
if ( bSet )
_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
@@ -128,7 +143,7 @@ inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
}
-inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet )
+inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet )
{
if ( bSet )
_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index c9448bcf24..0a056289c2 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,6 +30,7 @@
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/task/NoMasterException.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XMasterPasswordHandling.hpp"
#include "com/sun/star/task/XPasswordContainer.hpp"
#include "com/sun/star/task/XUrlContainer.hpp"
#include "com/sun/star/ucb/AuthenticationRequest.hpp"
@@ -271,10 +272,20 @@ bool PasswordContainerHelper::addRecord(
return false;
if ( bPersist )
+ {
+ uno::Reference< task::XMasterPasswordHandling > xMPH(
+ m_xPasswordContainer, uno::UNO_QUERY_THROW );
+
+ // If persistent storing of passwords is not yet
+ // allowed, enable it.
+ if ( !xMPH->isPersistentStoringAllowed() )
+ xMPH->allowPersistentStoring( sal_True );
+
m_xPasswordContainer->addPersistent( rURL,
rUsername,
rPasswords,
xIH );
+ }
else
m_xPasswordContainer->add( rURL,
rUsername,
@@ -429,7 +440,7 @@ PasswordContainerInteractionHandler::handle(
// @@@ FIXME: this not able to
// handle master pw request!
// master pw request is never
- // solvabe without UI!
+ // solvable without UI!
this ) )
{
// successfully handled