summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-09-17 14:41:33 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-09-17 14:41:33 +0000
commit84a850128d4dc3dc0d9fad53ac611fe3a9832c8f (patch)
tree9555291299d40db5301db2bd106c3cb5ef8c7d19 /svtools
parent85d32ee1481d3d0496c113653ed30baefea617d4 (diff)
CWS-TOOLING: integrate CWS kso32fixes2
2009-09-14 kso #i104767# - 64 bit build breaker 2009-09-14 kso #i14767# - compiler warning 2009-09-08 kso i104767# - Removed obsolete header. 2009-09-08 kso i104767# - Removed obsolete header include. 2009-09-08 kso #i104767# - Fixed build breaker. 2009-09-07 kso #i104767# - merged in dev300 m57. 2009-09-07 kso #i104767# - support for system credentials usage 2009-09-07 kso #i104767# - support for system credentials usage 2009-09-07 kso #i104767# - support for system credentials usage 2009-09-07 kso #i104767# - support for system credentials usage 2009-09-07 kso #i104767# - support for system credentials usage 2009-09-07 Kai Sommerfeld #i104767# - support for system credentials usage 2009-09-07 Kai Sommerfeld #i104767# - support for system credentials usage 2009-09-07 ks93798 #i104767# - adaptions for NTLM SSO
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/inc/passwordcontainer.hxx28
-rw-r--r--svtools/source/misc1/makefile.mk1
-rw-r--r--svtools/source/passwordcontainer/makefile.mk3
-rw-r--r--svtools/source/passwordcontainer/passwordcontainer.cxx151
4 files changed, 125 insertions, 58 deletions
diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx
index a6edea49f699..a067672f3cf6 100644
--- a/svtools/source/inc/passwordcontainer.hxx
+++ b/svtools/source/inc/passwordcontainer.hxx
@@ -34,13 +34,14 @@
#include <vector>
#include <map>
#include <com/sun/star/task/XPasswordContainer.hpp>
+#include <com/sun/star/task/XUrlContainer.hpp>
#include <com/sun/star/task/PasswordRequestMode.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/task/XMasterPasswordHandling2.hpp>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/factory.hxx>
@@ -52,6 +53,8 @@
#include <rtl/ref.hxx>
#include <osl/mutex.hxx>
+#include "syscreds.hxx"
+
#define MEMORY_RECORD 0
#define PERSISTENT_RECORD 1
@@ -241,9 +244,10 @@ enum PasswordState {
cancelled
};
-class PasswordContainer : public ::cppu::WeakImplHelper4<
+class PasswordContainer : public ::cppu::WeakImplHelper5<
::com::sun::star::task::XPasswordContainer,
::com::sun::star::task::XMasterPasswordHandling2,
+ ::com::sun::star::task::XUrlContainer,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XEventListener >
{
@@ -253,6 +257,7 @@ private:
::osl::Mutex mMutex;
::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent;
+ SysCredentialsConfig mUrlContainer;
::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence(
const ::std::list< NamePassRecord >& original,
@@ -269,6 +274,19 @@ private:
const ::rtl::OUString& name,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
throw(::com::sun::star::uno::RuntimeException);
+bool createUrlRecord(
+ const PassMap::iterator & rIter,
+ bool bName,
+ const ::rtl::OUString & aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler,
+ ::com::sun::star::task::UrlRecord & rRec )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::task::UrlRecord find(
+ const ::rtl::OUString& aURL,
+ const ::rtl::OUString& aName,
+ bool bName, // only needed to support empty user names
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString GetDefaultMasterPassword();
@@ -369,6 +387,12 @@ public:
virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException);
+ // XUrlContainer
+ virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException);
+
void Notify();
};
diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk
index e74afd81d83c..dd143ea4e972 100644
--- a/svtools/source/misc1/makefile.mk
+++ b/svtools/source/misc1/makefile.mk
@@ -54,7 +54,6 @@ SLOFILES=\
$(SLO)$/inettype.obj \
$(SLO)$/iniadrtk.obj \
$(SLO)$/lngmisc.obj \
- $(SLO)$/loginerr.obj \
$(SLO)$/PasswordHelper.obj
SRS1NAME=$(TARGET)
diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk
index 70692ecbf06b..31e1336ad966 100644
--- a/svtools/source/passwordcontainer/makefile.mk
+++ b/svtools/source/passwordcontainer/makefile.mk
@@ -43,7 +43,8 @@ DLLPRE=
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/passwordcontainer.obj
+ $(SLO)$/passwordcontainer.obj\
+ $(SLO)$/syscreds.obj
SHL1TARGET= $(TARGET)
SHL1IMPLIB= i$(TARGET)
diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx
index 9855e7e3c487..cebde0705f12 100644
--- a/svtools/source/passwordcontainer/passwordcontainer.cxx
+++ b/svtools/source/passwordcontainer/passwordcontainer.cxx
@@ -152,10 +152,17 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd )
static sal_Bool shorterUrl( ::rtl::OUString& aURL )
{
sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) );
- if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 )
+
+ if( aInd > 0 )
{
- aURL = aURL.copy( 0, aInd );
- return sal_True;
+ sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd );
+ if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) )
+ != aPrevInd - 2 ||
+ aInd != aURL.getLength() - 1 )
+ {
+ aURL = aURL.copy( 0, aInd );
+ return sal_True;
+ }
}
return sal_False;
@@ -753,37 +760,14 @@ void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUS
UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( !m_aContainer.empty() )
- {
- ::rtl::OUString aUrl( aURL );
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
-
- // each iteration remove last '/...' section from the aUrl
- // while it's possible, up to the most left '://'
- while( shorterUrl( aUrl ) )
- {
- // first look for <url>/somename and then look for <url>/somename/...
- aIter = m_aContainer.find( aUrl );
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
- else
- {
- ::rtl::OUString tmpUrl( aUrl );
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
+ return find( aURL, rtl::OUString(), false, aHandler );
+}
- aIter = m_aContainer.lower_bound( aUrl );
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
- }
- }
- }
+//-------------------------------------------------------------------------
- return UrlRecord();
+UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+{
+ return find( aURL, aName, true, aHandler );
}
//-------------------------------------------------------------------------
@@ -810,48 +794,76 @@ Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >&
//-------------------------------------------------------------------------
-UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+bool PasswordContainer::createUrlRecord(
+ const PassMap::iterator & rIter,
+ bool bName,
+ const ::rtl::OUString & aName,
+ const Reference< XInteractionHandler >& aHandler,
+ UrlRecord & rRec )
+ throw( RuntimeException )
{
+ if ( bName )
+ {
+ Sequence< UserRecord > aUsrRec
+ = FindUsr( rIter->second, aName, aHandler );
+ if( aUsrRec.getLength() )
+ {
+ rRec = UrlRecord( rIter->first, aUsrRec );
+ return true;
+ }
+ }
+ else
+ {
+ rRec = UrlRecord(
+ rIter->first,
+ CopyToUserRecordSequence( rIter->second, aHandler ) );
+ return true;
+ }
+ return false;
+}
+
+//-------------------------------------------------------------------------
+UrlRecord PasswordContainer::find(
+ const ::rtl::OUString& aURL,
+ const ::rtl::OUString& aName,
+ bool bName, // only needed to support empty user names
+ const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+{
::osl::MutexGuard aGuard( mMutex );
- if( !m_aContainer.empty() )
+
+ if( !m_aContainer.empty() && aURL.getLength() )
{
::rtl::OUString aUrl( aURL );
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter != m_aContainer.end() )
- {
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
- }
// each iteration remove last '/...' section from the aUrl
// while it's possible, up to the most left '://'
- while( shorterUrl( aUrl ) )
+ do
{
// first look for <url>/somename and then look for <url>/somename/...
- aIter = m_aContainer.find( aUrl );
+ PassMap::iterator aIter = m_aContainer.find( aUrl );
if( aIter != m_aContainer.end() )
{
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
+ UrlRecord aRec;
+ if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
+ return aRec;
}
else
{
::rtl::OUString tmpUrl( aUrl );
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
+ if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
+ tmpUrl += ::rtl::OUString::createFromAscii( "/" );
- aIter = m_aContainer.lower_bound( aUrl );
- if( aIter != m_aContainer.end() )
+ aIter = m_aContainer.lower_bound( tmpUrl );
+ if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) )
{
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
+ UrlRecord aRec;
+ if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
+ return aRec;
}
}
}
+ while( shorterUrl( aUrl ) && aUrl.getLength() );
}
return UrlRecord();
@@ -1355,6 +1367,35 @@ void SAL_CALL PasswordContainer::removeMasterPassword()
return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() );
}
+
+//-------------------------------------------------------------------------
+void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent )
+ throw (uno::RuntimeException)
+{
+ mUrlContainer.add( Url, MakePersistent );
+}
+
+//-------------------------------------------------------------------------
+::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url )
+ throw (uno::RuntimeException)
+{
+ return mUrlContainer.find( Url );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url )
+ throw (uno::RuntimeException)
+{
+ mUrlContainer.remove( Url );
+}
+
+//-------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent )
+ throw (uno::RuntimeException)
+{
+ return mUrlContainer.list( OnlyPersistent );
+}
+
//-------------------------------------------------------------------------
void PasswordContainer::Notify()
@@ -1487,7 +1528,9 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode
aRememberModes, // rRememberPasswordModes
RememberAuthentication_NO, // eDefaultRememberPasswordMode
aRememberModes, // rRememberAccountModes
- RememberAuthentication_NO // eDefaultRememberAccountMode
+ RememberAuthentication_NO, // eDefaultRememberAccountMode
+ sal_False, // bCanUseSystemCredentials
+ sal_False // bDefaultUseSystemCredentials
);
Sequence<