From 49c5701fbbc6a93ca0410719564ee22b5166ee48 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Thu, 17 Sep 2009 14:41:33 +0000 Subject: 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 --- .../schema/org/openoffice/Office/Common.xcs | 6 + sfx2/inc/pch/precompiled_sfx2.hxx | 1 - sfx2/source/appl/appdata.cxx | 1 - svx/source/cui/webconninfo.cxx | 103 ++++-- svx/source/cui/webconninfo.hxx | 1 + ucb/source/ucp/ftp/ftpcontent.cxx | 1 + ucb/source/ucp/gio/gio_mount.cxx | 2 +- ucb/source/ucp/gvfs/content.cxx | 3 +- ucb/source/ucp/webdav/DAVAuthListener.hxx | 3 +- ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx | 13 +- ucb/source/ucp/webdav/DAVResourceAccess.cxx | 60 ++-- ucb/source/ucp/webdav/NeonSession.cxx | 255 ++++++++------- uui/source/iahndl.cxx | 354 +++++++++++++++------ uui/source/iahndl.hxx | 9 +- uui/source/logindlg.cxx | 70 ++++ uui/source/logindlg.hrc | 1 + uui/source/logindlg.hxx | 7 + uui/source/logindlg.src | 8 +- 18 files changed, 620 insertions(+), 278 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 18668aea5f64..72c0b768ed84 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -903,6 +903,12 @@ Dymamic border coloring means that when the mouse is hovered over a control, and Contains a list of passwords encoded with the master password. + + + KSO + Contains a list of URLs that should be accessed using system credentials of the user. + + diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index ad70b76f27ff..0de2e2e208d1 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -542,7 +542,6 @@ #include "svtools/lckbitem.hxx" #include "svtools/localisationoptions.hxx" #include "svtools/localresaccess.hxx" -#include "svtools/loginerr.hxx" #include "svtools/lstner.hxx" #include "svtools/memberid.hrc" #include "svtools/menuoptions.hxx" diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index 243c4c325fcd..23de7317c379 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -42,7 +42,6 @@ #include #include -#include #include #include #include diff --git a/svx/source/cui/webconninfo.cxx b/svx/source/cui/webconninfo.cxx index 0298a8fc7e93..997c246abf1e 100644 --- a/svx/source/cui/webconninfo.cxx +++ b/svx/source/cui/webconninfo.cxx @@ -44,6 +44,7 @@ #include #include #include +#include "com/sun/star/task/XUrlContainer.hpp" #include #include @@ -116,7 +117,7 @@ WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) : ,m_aButtonsFL ( this, SVX_RES( FL_BUTTONS ) ) ,m_aCloseBtn ( this, SVX_RES( PB_CLOSE ) ) ,m_aHelpBtn ( this, SVX_RES( PB_HELP ) ) - + ,m_nPos ( -1 ) { static long aStaticTabs[]= { 3, 0, 150, 250 }; m_aPasswordsLB.SetTabs( aStaticTabs ); @@ -211,6 +212,7 @@ void WebConnectionInfoDialog::FillPasswordList() uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler ); sal_Int32 nCount = 0; for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ ) + { for ( sal_Int32 nUserInd = 0; nUserInd < aURLEntries[nURLInd].UserList.getLength(); nUserInd++ ) { ::rtl::OUString aUIEntry( aURLEntries[nURLInd].Url ); @@ -219,6 +221,25 @@ void WebConnectionInfoDialog::FillPasswordList() SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); pEntry->SetUserData( (void*)(nCount++) ); } + } + + // remember pos of first url container entry. + m_nPos = nCount; + + uno::Reference< task::XUrlContainer > xUrlContainer( + xPasswdContainer, uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aUrls + = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); + + for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) + { + ::rtl::OUString aUIEntry( aUrls[ nURLIdx ] ); + aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' ); + aUIEntry += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*" ) ); + SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); + pEntry->SetUserData( (void*)(nCount++) ); + } } } catch( uno::Exception& ) @@ -230,22 +251,29 @@ IMPL_LINK( WebConnectionInfoDialog, RemovePasswordHdl, PushButton*, EMPTYARG ) { try { - uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY_THROW ); - - uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); - SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); if ( pEntry ) { ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - xPasswdContainer->removePersistent( aURL, aUserName ); + + uno::Reference< task::XPasswordContainer > xPasswdContainer( + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.task.PasswordContainer" ) ) ), + uno::UNO_QUERY_THROW ); + + sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); + if ( nPos < m_nPos ) + { + xPasswdContainer->removePersistent( aURL, aUserName ); + } + else + { + uno::Reference< task::XUrlContainer > xUrlContainer( + xPasswdContainer, uno::UNO_QUERY_THROW ); + xUrlContainer->removeUrl( aURL ); + } m_aPasswordsLB.RemoveEntry( pEntry ); } } @@ -262,11 +290,20 @@ IMPL_LINK( WebConnectionInfoDialog, RemoveAllPasswordsHdl, PushButton*, EMPTYARG { uno::Reference< task::XPasswordContainer > xPasswdContainer( comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.task.PasswordContainer" ) ) ), uno::UNO_QUERY_THROW ); // should the master password be requested before? xPasswdContainer->removeAllPersistent(); + + uno::Reference< task::XUrlContainer > xUrlContainer( + xPasswdContainer, uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aUrls + = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); + for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) + xUrlContainer->removeUrl( aUrls[ nURLIdx ] ); + m_aPasswordsLB.Clear(); } catch( uno::Exception& ) @@ -280,34 +317,38 @@ IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG ) { try { - uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY_THROW ); - - uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); - - SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); if ( pEntry ) { ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( - ::comphelper::DocPasswordRequestType_STANDARD, task::PasswordRequestMode_PASSWORD_CREATE, aURL ); - + ::comphelper::DocPasswordRequest* pPasswordRequest + = new ::comphelper::DocPasswordRequest( + ::comphelper::DocPasswordRequestType_STANDARD, + task::PasswordRequestMode_PASSWORD_CREATE, aURL ); uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); + + uno::Reference< task::XInteractionHandler > xInteractionHandler( + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.task.InteractionHandler" ) ) ), + uno::UNO_QUERY_THROW ); xInteractionHandler->handle( rRequest ); + if ( pPasswordRequest->isPassword() ) { String aNewPass = pPasswordRequest->getPassword(); uno::Sequence< ::rtl::OUString > aPasswd( 1 ); aPasswd[0] = aNewPass; - xPasswdContainer->addPersistent( aURL, aUserName, aPasswd, xInteractionHandler ); + + uno::Reference< task::XPasswordContainer > xPasswdContainer( + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.task.PasswordContainer" ) ) ), + uno::UNO_QUERY_THROW ); + xPasswdContainer->addPersistent( + aURL, aUserName, aPasswd, xInteractionHandler ); } } } @@ -329,7 +370,11 @@ IMPL_LINK( WebConnectionInfoDialog, EntrySelectedHdl, void*, EMPTYARG ) else { m_aRemoveBtn.Enable( TRUE ); - m_aChangeBtn.Enable( TRUE ); + + // url container entries (-> use system credentials) have + // no password + sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); + m_aChangeBtn.Enable( nPos < m_nPos ); } return 0; diff --git a/svx/source/cui/webconninfo.hxx b/svx/source/cui/webconninfo.hxx index 775d5072393c..f24b9f0dd4c8 100644 --- a/svx/source/cui/webconninfo.hxx +++ b/svx/source/cui/webconninfo.hxx @@ -65,6 +65,7 @@ namespace svx FixedLine m_aButtonsFL; CancelButton m_aCloseBtn; HelpButton m_aHelpBtn; + sal_Int32 m_nPos; DECL_LINK( HeaderBarClickedHdl, SvxSimpleTable* ); DECL_LINK( RemovePasswordHdl, PushButton* ); diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index c90afa97bf3c..e4533d872275 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -322,6 +322,7 @@ Any SAL_CALL FTPContent::execute( aAccount); rtl::Reference p( new ucbhelper::SimpleAuthenticationRequest( + m_aFTPURL.ident(false, false), m_aFTPURL.host(), // ServerName ucbhelper::SimpleAuthenticationRequest::ENTITY_NA, aRealm, diff --git a/ucb/source/ucp/gio/gio_mount.cxx b/ucb/source/ucp/gio/gio_mount.cxx index b3f562e503fc..2756262ce91d 100644 --- a/ucb/source/ucp/gio/gio_mount.cxx +++ b/ucb/source/ucp/gio/gio_mount.cxx @@ -123,7 +123,7 @@ static void ooo_mount_operation_ask_password (GMountOperation *op, aDomain = rtl::OUString(default_domain, strlen(default_domain), RTL_TEXTENCODING_UTF8); uno::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest - = new ucbhelper::SimpleAuthenticationRequest (aHostName, eDomain, aDomain, eUserName, aUserName, ePassword, aPassword); + = new ucbhelper::SimpleAuthenticationRequest (rtl::OUString() /* FIXME: provide URL here */, aHostName, eDomain, aDomain, eUserName, aUserName, ePassword, aPassword); xIH->handle( xRequest.get() ); diff --git a/ucb/source/ucp/gvfs/content.cxx b/ucb/source/ucp/gvfs/content.cxx index ab00cec0907e..743043c09fc7 100644 --- a/ucb/source/ucp/gvfs/content.cxx +++ b/ucb/source/ucp/gvfs/content.cxx @@ -1609,7 +1609,8 @@ extern "C" { } rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest - = new ucbhelper::SimpleAuthenticationRequest (aHostName, eDomain, aDomain, + = new ucbhelper::SimpleAuthenticationRequest (GnomeToOUString(in->uri), + aHostName, eDomain, aDomain, eUserName, aUserName, ePassword, aPassword); diff --git a/ucb/source/ucp/webdav/DAVAuthListener.hxx b/ucb/source/ucp/webdav/DAVAuthListener.hxx index 4744b06f9649..548a4a0a97fa 100644 --- a/ucb/source/ucp/webdav/DAVAuthListener.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListener.hxx @@ -49,7 +49,8 @@ class DAVAuthListener : public salhelper::SimpleReferenceObject const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - const sal_Bool & bAllowPersistentStoring) = 0; + sal_Bool bAllowPersistentStoring, + sal_Bool bCanUseSystemCredentials ) = 0; }; } // namespace webdav_ucp diff --git a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx index e697773eb198..db06b24b22bc 100644 --- a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx @@ -54,9 +54,9 @@ namespace webdav_ucp DAVAuthListener_Impl( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment>& xEnv ) - : m_xEnv( xEnv - ) + com::sun::star::ucb::XCommandEnvironment>& xEnv, + const ::rtl::OUString & inURL ) + : m_xEnv( xEnv ), m_aURL( inURL ) { } @@ -64,11 +64,14 @@ namespace webdav_ucp const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - const sal_Bool & bAllowPersistentStoring); + sal_Bool bAllowPersistentStoring, + sal_Bool bCanUseSystemCredentials ); private: - com::sun::star::uno::Reference< + const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xEnv; + const rtl::OUString m_aURL; + rtl::OUString m_aPrevPassword; rtl::OUString m_aPrevUsername; }; diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index 0def59082476..67f8e5a386f0 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -60,7 +60,8 @@ int DAVAuthListener_Impl::authenticate( const ::rtl::OUString & inHostName, ::rtl::OUString & inoutUserName, ::rtl::OUString & outPassWord, - const sal_Bool & bAllowPersistentStoring) + sal_Bool bAllowPersistentStoring, + sal_Bool bCanUseSystemCredentials ) { if ( m_xEnv.is() ) { @@ -77,12 +78,14 @@ int DAVAuthListener_Impl::authenticate( outPassWord = m_aPrevPassword; rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest - = new ucbhelper::SimpleAuthenticationRequest( inHostName, + = new ucbhelper::SimpleAuthenticationRequest( m_aURL, + inHostName, inRealm, inoutUserName, outPassWord, ::rtl::OUString(), - bAllowPersistentStoring); + bAllowPersistentStoring, + bCanUseSystemCredentials ); xIH->handle( xRequest.get() ); rtl::Reference< ucbhelper::InteractionContinuation > xSelection @@ -99,8 +102,23 @@ int DAVAuthListener_Impl::authenticate( ucbhelper::InteractionSupplyAuthentication > & xSupp = xRequest->getAuthenticationSupplier(); - inoutUserName = xSupp->getUserName(); - outPassWord = xSupp->getPassword(); + sal_Bool bUseSystemCredentials = sal_False; + + if ( bCanUseSystemCredentials ) + bUseSystemCredentials = xSupp->getUseSystemCredentials(); + + if ( bUseSystemCredentials ) + { + // This is the (strange) way to tell neon to use + // system credentials. + inoutUserName = rtl::OUString(); + outPassWord = rtl::OUString(); + } + else + { + inoutUserName = xSupp->getUserName(); + outPassWord = xSupp->getPassword(); + } // #102871# - Remember username and password. m_aPrevUsername = inoutUserName; @@ -186,7 +204,7 @@ void DAVResourceAccess::OPTIONS( rCapabilities, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv) ); } catch ( DAVException & e ) @@ -231,7 +249,7 @@ void DAVResourceAccess::PROPFIND( rResources, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -273,7 +291,7 @@ void DAVResourceAccess::PROPFIND( rResInfo, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ) ; } catch ( DAVException & e ) @@ -313,7 +331,7 @@ void DAVResourceAccess::PROPPATCH( rValues, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -353,7 +371,7 @@ void DAVResourceAccess::HEAD( rResource, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -391,7 +409,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( xStream = m_xSession->GET( getRequestURI(), DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -432,7 +450,7 @@ void DAVResourceAccess::GET( rStream, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -474,7 +492,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( rResource, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -519,7 +537,7 @@ void DAVResourceAccess::GET( rResource, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -601,7 +619,7 @@ void DAVResourceAccess::PUT( xSeekableStream, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -655,7 +673,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST( xSeekableStream, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -719,7 +737,7 @@ void DAVResourceAccess::POST( rOutputStream, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -762,7 +780,7 @@ void DAVResourceAccess::MKCOL( m_xSession->MKCOL( getRequestURI(), DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -802,7 +820,7 @@ void DAVResourceAccess::COPY( rDestinationURI, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ), bOverwrite ); } @@ -843,7 +861,7 @@ void DAVResourceAccess::MOVE( rDestinationURI, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ), bOverwrite ); } @@ -882,7 +900,7 @@ void DAVResourceAccess::DESTROY( m_xSession->DESTROY( getRequestURI(), DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv ), + new DAVAuthListener_Impl( xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index f1028f0dc535..b455ffebbb9b 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -41,8 +41,9 @@ #include #include #include "libxml/parser.h" -#include +#include "rtl/ustrbuf.hxx" #include "comphelper/sequence.hxx" +#include "ucbhelper/simplecertificatevalidationrequest.hxx" #include "DAVAuthListener.hxx" #include "NeonTypes.hxx" @@ -51,12 +52,9 @@ #include "NeonPropFindRequest.hxx" #include "NeonHeadRequest.hxx" #include "NeonUri.hxx" -#ifndef _LINKSEQUENCE_HXX_ #include "LinkSequence.hxx" -#endif - -#include #include "UCBDeadPropertyValue.hxx" + #include #include #include @@ -64,18 +62,10 @@ #include #include #include - - -#ifndef _SIMPLECERTIFICATIONVALIDATIONREQUEST_HXX_ -#include "ucbhelper/simplecertificatevalidationrequest.hxx" -#endif - -#include - +#include using namespace com::sun::star; using namespace webdav_ucp; -using namespace com::sun::star::security; #define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer" @@ -258,6 +248,9 @@ extern "C" void NeonSession_ResponseBlockWriter( void * inUserData, // ------------------------------------------------------------------- extern "C" int NeonSession_NeonAuth( void * inUserData, +#ifdef NE_FEATURE_SSPI + const char * inAuthProtocol, +#endif const char * inRealm, int attempt, char * inoutUserName, @@ -274,8 +267,6 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, * cancel the request. (if non-zero, username and password are * ignored.) */ - - #if 0 // Give'em only a limited mumber of retries.. if ( attempt > 9 ) @@ -333,18 +324,41 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, //thePassWord = rtl::OUString::createFromAscii( inoutPassWord ); } - //i97003 (tkr): Ask XMasterPasswordHandling if we should store the credentials persistently and give this information to the SimpleAuthenticationRequest - uno::Reference< ::com::sun::star::task::XMasterPasswordHandling > xMasterPasswordHandling = - uno::Reference< ::com::sun::star::task::XMasterPasswordHandling >( - theSession->getMSF().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.task.PasswordContainer" )), uno::UNO_QUERY ); - // - + bool bCanUseSystemCreds = false; + +#ifdef NE_FEATURE_SSPI + bCanUseSystemCreds = (attempt == 0) && // avoid endless loops + ne_has_support( NE_FEATURE_SSPI ) && // Windows-only feature. + ( ne_strcasecmp( inAuthProtocol, "NTLM" ) == 0 ) || + ( 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); + xMasterPasswordHandling.is() + ? xMasterPasswordHandling-> + isPersistentStoringAllowed() + : sal_False, + bCanUseSystemCreds); rtl::OString aUser( rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) ); @@ -371,7 +385,6 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) ); return theRetVal; - } // ------------------------------------------------------------------- @@ -381,128 +394,144 @@ namespace { // Helper function ::rtl::OUString GetHostnamePart( const ::rtl::OUString& _rRawString ) { - ::rtl::OUString sPart; - ::rtl::OUString sPartId = ::rtl::OUString::createFromAscii( "CN=" ); - sal_Int32 nContStart = _rRawString.indexOf( sPartId ); - if ( nContStart != -1 ) - { - nContStart = nContStart + sPartId.getLength(); - sal_Int32 nContEnd = _rRawString.indexOf( sal_Unicode( ',' ), nContStart ); - sPart = _rRawString.copy( nContStart, nContEnd - nContStart ); - } - return sPart; + ::rtl::OUString sPart; + ::rtl::OUString sPartId = ::rtl::OUString::createFromAscii( "CN=" ); + sal_Int32 nContStart = _rRawString.indexOf( sPartId ); + if ( nContStart != -1 ) + { + nContStart = nContStart + sPartId.getLength(); + sal_Int32 nContEnd + = _rRawString.indexOf( sal_Unicode( ',' ), nContStart ); + sPart = _rRawString.copy( nContStart, nContEnd - nContStart ); + } + return sPart; } } + // ------------------------------------------------------------------- extern "C" int NeonSession_CertificationNotify( void *userdata, int failures, const ne_ssl_certificate *cert ) { - OSL_ASSERT(cert); - NeonSession * pSession = static_cast< NeonSession * >( userdata ); - uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > xSecurityEnv; - uno::Reference< ::com::sun::star::security::XCertificateContainer > xCertificateContainer; - + OSL_ASSERT( cert ); - xCertificateContainer = uno::Reference< ::com::sun::star::security::XCertificateContainer >( - pSession->getMSF().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.CertificateContainer" )), uno::UNO_QUERY ); + NeonSession * pSession = static_cast< NeonSession * >( userdata ); + uno::Reference< security::XCertificateContainer > xCertificateContainer; + try + { + xCertificateContainer + = uno::Reference< security::XCertificateContainer >( + pSession->getMSF()->createInstance( + rtl::OUString::createFromAscii( + "com.sun.star.security.CertificateContainer" ) ), + uno::UNO_QUERY ); + } + catch ( uno::Exception const & ) + { + } - // YD if xmlsecurity is not built (os2), we cannot continue. - if (!xCertificateContainer.is()) + if ( !xCertificateContainer.is() ) return 1; - char * dn; - failures = 0; - dn = ne_ssl_readable_dname( ne_ssl_cert_subject( cert ) ); - + char * dn = ne_ssl_readable_dname( ne_ssl_cert_subject( cert ) ); rtl::OUString cert_subject( dn, strlen( dn ), RTL_TEXTENCODING_UTF8, 0 ); free( dn ); - CertificateContainerStatus certificateContainer; - certificateContainer = xCertificateContainer.get()->hasCertificate( pSession->getHostName(), cert_subject ); + security::CertificateContainerStatus certificateContainer( + xCertificateContainer->hasCertificate( + pSession->getHostName(), cert_subject ) ); + + if ( certificateContainer != security::CertificateContainerStatus_NOCERT ) + return + certificateContainer == security::CertificateContainerStatus_TRUSTED + ? 0 + : 1; - if( certificateContainer != CertificateContainerStatus_NOCERT ) + uno::Reference< xml::crypto::XSEInitializer > xSEInitializer; + try + { + xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >( + pSession->getMSF()->createInstance( + rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT ) ), + uno::UNO_QUERY ); + } + catch ( uno::Exception const & ) { - if( certificateContainer == CertificateContainerStatus_TRUSTED ) - return 0; - else - return 1; } - rtl::OUString sSEInitializer; - ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::XSEInitializer > mxSEInitializer; - ::com::sun::star::uno::Reference< com::sun::star::xml::crypto::XXMLSecurityContext > mxSecurityContext; - - sSEInitializer = rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT ); - mxSEInitializer = uno::Reference< com::sun::star::xml::crypto::XSEInitializer > ( - pSession->getMSF().get()->createInstance( sSEInitializer ), uno::UNO_QUERY ); - - if ( mxSEInitializer.is() ) - mxSecurityContext = mxSEInitializer->createSecurityContext( rtl::OUString::createFromAscii( "" ) ); + if ( !xSEInitializer.is() ) + return 1; - xSecurityEnv = mxSecurityContext->getSecurityEnvironment(); + uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext( + xSEInitializer->createSecurityContext( rtl::OUString() ) ); + uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv( + xSecurityContext->getSecurityEnvironment() ); //The end entity certificate char * eeCertB64 = ne_ssl_cert_export( cert ); - ::rtl::OString sEECertB64( eeCertB64 ); + rtl::OString sEECertB64( eeCertB64 ); - uno::Reference< com::sun::star::security::XCertificate> xEECert = + uno::Reference< com::sun::star::security::XCertificate > xEECert( xSecurityEnv->createCertificateFromAscii( - ::rtl::OStringToOUString( sEECertB64, RTL_TEXTENCODING_ASCII_US ) ); + rtl::OStringToOUString( sEECertB64, RTL_TEXTENCODING_ASCII_US ) ) ); - free(eeCertB64); - eeCertB64 = NULL; + ne_free( eeCertB64 ); + eeCertB64 = 0; - std::vector > vecCerts; + std::vector< uno::Reference< security::XCertificate > > vecCerts; const ne_ssl_certificate * issuerCert = cert; do { //get the intermediate certificate //the returned value is const ! Therfore it does not need to be freed //with ne_ssl_cert_free, which takes a non-const argument - issuerCert = ne_ssl_cert_signedby(issuerCert); - if (NULL == issuerCert) + issuerCert = ne_ssl_cert_signedby( issuerCert ); + if ( NULL == issuerCert ) break; - char * imCertB64 = ne_ssl_cert_export(issuerCert); - ::rtl::OString sInterMediateCertB64(imCertB64); - free(imCertB64); - uno::Reference< com::sun::star::security::XCertificate> xImCert = + char * imCertB64 = ne_ssl_cert_export( issuerCert ); + rtl::OString sInterMediateCertB64( imCertB64 ); + ne_free( imCertB64 ); + + uno::Reference< security::XCertificate> xImCert( xSecurityEnv->createCertificateFromAscii( - ::rtl::OStringToOUString( sInterMediateCertB64, RTL_TEXTENCODING_ASCII_US ) ); - if (xImCert.is()) - vecCerts.push_back(xImCert); - }while (1); + rtl::OStringToOUString( + sInterMediateCertB64, RTL_TEXTENCODING_ASCII_US ) ) ); + if ( xImCert.is() ) + vecCerts.push_back( xImCert ); + } + while ( 1 ); sal_Int64 certValidity = xSecurityEnv->verifyCertificate( xEECert, - ::comphelper::containerToSequence(vecCerts) ); + ::comphelper::containerToSequence( vecCerts ) ); - - if ( pSession->isDomainMatch( GetHostnamePart( xEECert.get()->getSubjectName())) ) + if ( pSession->isDomainMatch( + GetHostnamePart( xEECert.get()->getSubjectName() ) ) ) { - //if host name matched with certificate then look if the certificate was ok - if( certValidity == ::security::CertificateValidity::VALID ) + // if host name matched with certificate then look if the + // certificate was ok + if( certValidity == security::CertificateValidity::VALID ) return 0; } - const uno::Reference< ucb::XCommandEnvironment > xEnv = - pSession->getRequestEnvironment().m_xEnv.get(); - + const uno::Reference< ucb::XCommandEnvironment > xEnv( + pSession->getRequestEnvironment().m_xEnv ); if ( xEnv.is() ) { - failures = static_cast(certValidity); + failures = static_cast< int >( certValidity ); - uno::Reference< task::XInteractionHandler > xIH - = xEnv->getInteractionHandler(); + uno::Reference< task::XInteractionHandler > xIH( + xEnv->getInteractionHandler() ); if ( xIH.is() ) { - rtl::Reference< ucbhelper::SimpleCertificateValidationRequest > xRequest - = new ucbhelper::SimpleCertificateValidationRequest((sal_Int32)failures, xEECert, pSession->getHostName() ); + rtl::Reference< ucbhelper::SimpleCertificateValidationRequest > + xRequest( new ucbhelper::SimpleCertificateValidationRequest( + (sal_Int32)failures, xEECert, pSession->getHostName() ) ); xIH->handle( xRequest.get() ); rtl::Reference< ucbhelper::InteractionContinuation > xSelection @@ -510,31 +539,34 @@ extern "C" int NeonSession_CertificationNotify( void *userdata, if ( xSelection.is() ) { - uno::Reference< task::XInteractionApprove > xApprove( + uno::Reference< task::XInteractionApprove > xApprove( xSelection.get(), uno::UNO_QUERY ); - if ( xApprove.is() ) + if ( xApprove.is() ) { - xCertificateContainer->addCertificate(pSession->getHostName(), cert_subject, sal_True ); + xCertificateContainer->addCertificate( + pSession->getHostName(), cert_subject, sal_True ); return 0; - } else { - // Dont trust Cert - xCertificateContainer->addCertificate(pSession->getHostName(), cert_subject, sal_False ); + } + else + { + // Don't trust cert + xCertificateContainer->addCertificate( + pSession->getHostName(), cert_subject, sal_False ); return 1; } - } - } else + } + else { - // Dont trust Cert - xCertificateContainer->addCertificate(pSession->getHostName(), cert_subject, sal_False ); + // Don't trust cert + xCertificateContainer->addCertificate( + pSession->getHostName(), cert_subject, sal_False ); return 1; } - - } - return 1; } + // ------------------------------------------------------------------- extern "C" void NeonSession_PreSendRequest( ne_request * req, void * userdata, @@ -604,9 +636,10 @@ extern "C" void NeonSession_PreSendRequest( ne_request * req, ++it1; } - } } +} // namespace + // ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- @@ -755,7 +788,6 @@ void NeonSession::Init() // ne_buffer *header); ne_hook_pre_send( m_pHttpSession, NeonSession_PreSendRequest, this ); - #if 0 /* Hook called after the request is sent. May return: * NE_OK everything is okay @@ -802,15 +834,8 @@ void NeonSession::Init() ne_redirect_register( m_pHttpSession ); // authentication callbacks. - - // Note: Calling ne_set_[server|proxy]_auth more than once per - // m_pHttpSession instance sometimes(?) crashes Neon! ( last - // checked: 0.22.0) - //ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); - //ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); - } } diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index ff7022fd241e..8ea299289986 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -77,8 +77,10 @@ #include "com/sun/star/task/XInteractionRequest.hpp" #include "com/sun/star/task/XInteractionRetry.hpp" #include "com/sun/star/task/XPasswordContainer.hpp" +#include "com/sun/star/task/XUrlContainer.hpp" #include "com/sun/star/task/XInteractionAskLater.hpp" #include "com/sun/star/ucb/AuthenticationRequest.hpp" +#include "com/sun/star/ucb/URLAuthenticationRequest.hpp" #include "com/sun/star/ucb/CertificateValidationRequest.hpp" #include "com/sun/star/ucb/HandleCookiesRequest.hpp" #include "com/sun/star/ucb/InteractiveAppException.hpp" @@ -99,6 +101,7 @@ #include "com/sun/star/ucb/XInteractionCookieHandling.hpp" #include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp" #include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" +#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp" #include "com/sun/star/ucb/XInteractionSupplyName.hpp" #include #include "com/sun/star/uno/RuntimeException.hpp" @@ -110,7 +113,6 @@ #include "tools/rcid.h" #include "vcl/svapp.hxx" #include "svtools/svtools.hrc" -#include "svtools/loginerr.hxx" #include "svtools/httpcook.hxx" #include "svtools/sfxecode.hxx" #include "toolkit/helper/vclunohelper.hxx" @@ -134,6 +136,8 @@ #include "filechanged.hxx" #include "trylater.hxx" #include "lockfailed.hxx" +#include "loginerr.hxx" + #include #include using namespace com::sun; @@ -201,6 +205,8 @@ getContinuations( star::uno::Reference< star::task::XInteractionAbort > * pAbort, star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > * pSupplyAuthentication, + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > * + pSupplyAuthentication2, star::uno::Reference< star::task::XInteractionPassword > * pPassword, star::uno::Reference< star::ucb::XInteractionSupplyName > * pSupplyName, @@ -247,7 +253,16 @@ getContinuations( star::ucb::XInteractionSupplyAuthentication >( rContinuations[i], star::uno::UNO_QUERY); if (pSupplyAuthentication->is()) + { + // is it even a supplyauthentication2, which is derived from + // supplyauthentication? + if (pSupplyAuthentication2 && !pSupplyAuthentication2->is()) + *pSupplyAuthentication2 + = star::uno::Reference< + star::ucb::XInteractionSupplyAuthentication2 >( + rContinuations[i], star::uno::UNO_QUERY); continue; + } } if (pPassword && !pPassword->is()) { @@ -610,7 +625,7 @@ bool UUIInteractionHelper::handleMessageboxRequests( star::task::XInteractionDisapprove > xDisapprove; getContinuations( rRequest->getContinuations(), - &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0); + &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0, 0); if( xApprove.is() && xDisapprove.is() ) { @@ -1097,11 +1112,21 @@ bool UUIInteractionHelper::handleDialogRequests( { star::uno::Any aAnyRequest(rRequest->getRequest()); + star::ucb::URLAuthenticationRequest aURLAuthenticationRequest; + if (aAnyRequest >>= aURLAuthenticationRequest) + { + handleAuthenticationRequest(aURLAuthenticationRequest, + rRequest->getContinuations(), + aURLAuthenticationRequest.URL); + return true; + } + star::ucb::AuthenticationRequest aAuthenticationRequest; if (aAnyRequest >>= aAuthenticationRequest) { handleAuthenticationRequest(aAuthenticationRequest, - rRequest->getContinuations()); + rRequest->getContinuations(), + rtl::OUString()); return true; } @@ -1345,10 +1370,12 @@ UUIInteractionHelper::handle_impl( Reference< uno::XInterface > xIfc = m_xServiceFactory->createInstance(aIt->ServiceName); - Reference< com::sun::star::task::XInteractionHandler2 > xInteractionHandler = - Reference< com::sun::star::task::XInteractionHandler2 >( xIfc, UNO_QUERY ); + Reference< task::XInteractionHandler2 > + xInteractionHandler( xIfc, UNO_QUERY ); - OSL_ENSURE( xInteractionHandler.is(), "Custom Interactionhandler does not implement mandatory interface XInteractionHandler2!" ); + OSL_ENSURE( xInteractionHandler.is(), + "Custom Interactionhandler does not implement " + "mandatory interface XInteractionHandler2!" ); if (xInteractionHandler.is()) if (xInteractionHandler->handleInteractionRequest(rRequest)) return true; @@ -1512,7 +1539,8 @@ rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(()) bool UUIInteractionHelper::initPasswordContainer( - star::uno::Reference< star::task::XPasswordContainer > * pContainer) + star::uno::Reference< star::task::XPasswordContainer > * pContainer, + star::uno::Reference< star::task::XUrlContainer > * pUrlContainer) const SAL_THROW(()) { OSL_ENSURE(pContainer, "specification violation"); @@ -1527,11 +1555,17 @@ UUIInteractionHelper::initPasswordContainer( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.PasswordContainer"))), star::uno::UNO_QUERY); + + if ( pContainer->is() ) + { + *pUrlContainer = star::uno::Reference< star::task::XUrlContainer >( *pContainer, UNO_QUERY ); + OSL_ENSURE( pUrlContainer->is(), "Got no XUrlContainer!" ); + } } catch (star::uno::Exception const &) {} OSL_ENSURE(pContainer->is(), "unexpected situation"); - return pContainer->is(); + return pContainer->is() && pUrlContainer->is(); } @@ -1710,6 +1744,7 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, != 0; bool bSavePassword = rInfo.GetIsPersistentPassword() || rInfo.GetIsSavePassword(); + bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials(); sal_uInt16 nFlags = 0; if (rInfo.GetPath().Len() == 0) @@ -1724,6 +1759,9 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, if (!bSavePassword) nFlags |= LF_NO_SAVEPASSWORD; + if (!bCanUseSysCreds) + nFlags |= LF_NO_USESYSCREDS; + std::auto_ptr< ResMgr > xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui))); UniString aRealm(rRealm); // Forte compiler needs it spelled out... @@ -1752,12 +1790,18 @@ void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo, xDialog->SetSavePassword(rInfo.GetIsSavePassword()); } + if ( bCanUseSysCreds ) + xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() ); + rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL); rInfo.SetUserName(xDialog->GetName()); rInfo.SetPassword(xDialog->GetPassword()); rInfo.SetAccount(xDialog->GetAccount()); rInfo.SetSavePassword(xDialog->IsSavePassword()); + + if ( bCanUseSysCreds ) + rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() ); } catch (std::bad_alloc const &) { @@ -2119,12 +2163,87 @@ UUIInteractionHelper::getInteractionHandler() const return xIH; } +namespace +{ +bool fillContinuation( + bool bUseSystemCredentials, + const star::ucb::AuthenticationRequest & rRequest, + const star::task::UrlRecord & aRec, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > & + xSupplyAuthentication, + const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > & + xSupplyAuthentication2, + bool bCanUseSystemCredentials, + bool bCheckForEqualPasswords ) +{ + if ( bUseSystemCredentials ) + { + // "use system creds" record found. + // Wants client that we use it? + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + { + xSupplyAuthentication2->setUseSystemCredentials( sal_True ); + return true; + } + return false; + } + else if (aRec.UserList.getLength() != 0) + { + if (aRec.UserList[0].Passwords.getLength() == 0) + { + // Password sequence can be empty, for instance if master + // password was not given (e.g. master pw dialog canceled) + // pw container does not throw NoMasterException in this case. + // bug??? + return false; + } + + // "user/pass" record found. + if (!bCheckForEqualPasswords || !rRequest.HasPassword + || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt? + { + if (xSupplyAuthentication->canSetUserName()) + xSupplyAuthentication-> + setUserName(aRec.UserList[0].UserName.getStr()); + + if (xSupplyAuthentication->canSetPassword()) + xSupplyAuthentication-> + setPassword(aRec.UserList[0].Passwords[0].getStr()); + if (aRec.UserList[0].Passwords.getLength() > 1) + { + if (rRequest.HasRealm) + { + if (xSupplyAuthentication->canSetRealm()) + xSupplyAuthentication-> + setRealm(aRec.UserList[0].Passwords[1]. + getStr()); + } + else if (xSupplyAuthentication->canSetAccount()) + xSupplyAuthentication-> + setAccount(aRec.UserList[0].Passwords[1]. + getStr()); + } + + if ( xSupplyAuthentication2.is() && + bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( sal_False ); + + return true; + } + } + return false; +} + +} + void UUIInteractionHelper::handleAuthenticationRequest( star::ucb::AuthenticationRequest const & rRequest, star::uno::Sequence< star::uno::Reference< star::task::XInteractionContinuation > > const & - rContinuations) + rContinuations, + const rtl::OUString & rURL) SAL_THROW((star::uno::RuntimeException)) { star::uno::Reference< star::task::XInteractionHandler > xIH; @@ -2133,9 +2252,12 @@ UUIInteractionHelper::handleAuthenticationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > xSupplyAuthentication; + star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > + xSupplyAuthentication2; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0 ); + 0, 0, &xRetry, &xAbort, + &xSupplyAuthentication, &xSupplyAuthentication2, 0, 0, 0 ); bool bRemember; bool bRememberPersistent; if (xSupplyAuthentication.is()) @@ -2158,90 +2280,103 @@ UUIInteractionHelper::handleAuthenticationRequest( bRememberPersistent = false; } + sal_Bool bCanUseSystemCredentials; + sal_Bool bDefaultUseSystemCredentials; + if (xSupplyAuthentication2.is()) + { + bCanUseSystemCredentials + = xSupplyAuthentication2->canUseSystemCredentials( + bDefaultUseSystemCredentials ); + } + else + { + bCanUseSystemCredentials = sal_False; + bDefaultUseSystemCredentials = sal_False; + } + com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > xContainer; + com::sun::star::uno::Reference< com::sun::star::task::XUrlContainer > + xUrlContainer; + + if ( bCanUseSystemCredentials && initPasswordContainer( &xContainer, &xUrlContainer ) ) + { + // Runtime / Persistent info avail for current auth request? + + rtl::OUString aResult = xUrlContainer->findUrl( + rURL.getLength() ? rURL : rRequest.ServerName ); + if ( aResult.getLength() > 0 ) + { + if ( fillContinuation( true, + rRequest, + star::task::UrlRecord(), + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) + { + xSupplyAuthentication->select(); + return; + } + } + } // xContainer works with userName passwdSequences pairs: if (rRequest.HasUserName && rRequest.HasPassword - && initPasswordContainer(&xContainer)) + && initPasswordContainer(&xContainer, &xUrlContainer)) { xIH = getInteractionHandler(); try { if (rRequest.UserName.getLength() == 0) { - star::task::UrlRecord - aRec(xContainer->find(rRequest.ServerName, xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->find(rURL, xIH); + + if ( aRec.UserList.getLength() == 0 ) + { + // compat: try server name. + aRec = xContainer->find(rRequest.ServerName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + false ) ) { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName(aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - xSupplyAuthentication-> - setPassword( - aRec.UserList[0].Passwords[0].getStr()); - } - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } xSupplyAuthentication->select(); return; } } else { - star::task::UrlRecord - aRec(xContainer->findForName(rRequest.ServerName, - rRequest.UserName, - xIH)); - if (aRec.UserList.getLength() != 0) + star::task::UrlRecord aRec; + if ( rURL.getLength() ) + aRec = xContainer->findForName( + rURL, rRequest.UserName, xIH); + + if ( aRec.UserList.getLength() == 0 ) { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - if (!rRequest.HasPassword - || rRequest.Password != aRec.UserList[0].Passwords[0]) - { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName( - aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - xSupplyAuthentication-> - setPassword(aRec.UserList[0].Passwords[0]. - getStr()); - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } - xSupplyAuthentication->select(); - return; - } + // compat: try server name. + aRec = xContainer->findForName( + rRequest.ServerName, rRequest.UserName, xIH); + } + + if ( fillContinuation( false, + rRequest, + aRec, + xSupplyAuthentication, + xSupplyAuthentication2, + bCanUseSystemCredentials, + true ) ) + { + xSupplyAuthentication->select(); + return; } } } @@ -2261,6 +2396,8 @@ UUIInteractionHelper::handleAuthenticationRequest( aInfo.SetErrorText(rRequest.Diagnostic); aInfo.SetPersistentPassword(bRememberPersistent); aInfo.SetSavePassword(bRemember); + aInfo.SetCanUseSystemCredentials( bCanUseSystemCredentials ); + aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials ); aInfo.SetModifyAccount(rRequest.HasAccount && xSupplyAuthentication.is() && xSupplyAuthentication->canSetAccount()); @@ -2293,34 +2430,51 @@ UUIInteractionHelper::handleAuthenticationRequest( else if (xSupplyAuthentication->canSetAccount()) xSupplyAuthentication->setAccount(aInfo.GetAccount()); + if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials ) + xSupplyAuthentication2->setUseSystemCredentials( + aInfo.GetIsUseSystemCredentials() ); + xSupplyAuthentication->select(); } - // Empty user name can not be valid: - if (aInfo.GetUserName().Len() != 0 - && initPasswordContainer(&xContainer)) + + if ( aInfo.GetIsUseSystemCredentials() ) + { + if (aInfo.GetIsSavePassword()) + { + if ( initPasswordContainer(&xContainer, &xUrlContainer) ) + xUrlContainer->addUrl( + rURL.getLength() ? rURL : rRequest.ServerName, + bRememberPersistent ); + } + } + else if (aInfo.GetUserName().Len() != 0 // Empty user name can not be valid: + && initPasswordContainer(&xContainer, &xUrlContainer)) { - star::uno::Sequence< rtl::OUString > - aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2); - aPassList[0] = aInfo.GetPassword(); - if (aInfo.GetAccount().Len() != 0) - aPassList[1] = aInfo.GetAccount(); try { if (aInfo.GetIsSavePassword()) { + star::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 (!xIH.is()) xIH = getInteractionHandler(); if (bRememberPersistent) - xContainer->addPersistent(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->addPersistent( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); else - xContainer->add(rRequest.ServerName, - aInfo.GetUserName(), - aPassList, - xIH); + xContainer->add( + rURL.getLength() ? rURL : rRequest.ServerName, + aInfo.GetUserName(), + aPassList, + xIH); } } catch (star::task::NoMasterException const &) @@ -2375,7 +2529,7 @@ UUIInteractionHelper::handleCertificateValidationRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); sal_Int32 failures = rRequest.CertificateValidity; @@ -2502,7 +2656,7 @@ UUIInteractionHelper::handleNameClashResolveRequest( xReplaceExistingData; getContinuations( rContinuations, - 0, 0, 0, &xAbort, 0, 0, &xSupplyName, &xReplaceExistingData); + 0, 0, 0, &xAbort, 0, 0, 0, &xSupplyName, &xReplaceExistingData); OSL_ENSURE( xAbort.is(), "NameClashResolveRequest must contain Abort continuation" ); @@ -2563,7 +2717,7 @@ UUIInteractionHelper::handleMasterPasswordRequest( xSupplyAuthentication; getContinuations( rContinuations, - 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0); + 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0, 0); LoginErrorInfo aInfo; // in case of master password a hash code is returned @@ -2606,7 +2760,7 @@ UUIInteractionHelper::handlePasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executePasswordDialog(aInfo, nMode, aDocumentName); @@ -2647,7 +2801,7 @@ UUIInteractionHelper::handleMSPasswordRequest( star::uno::Reference< star::task::XInteractionPassword > xPassword; getContinuations( - rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0); + rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0); LoginErrorInfo aInfo; executeMSPasswordDialog(aInfo, nMode, aDocumentName); @@ -3408,7 +3562,7 @@ UUIInteractionHelper::handleErrorRequest( star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( rContinuations, - &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0); + &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0, 0); // The following mapping uses the bit mask // Approve = 8, @@ -3526,7 +3680,7 @@ UUIInteractionHelper::handleBrokenPackageRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); ErrCode nErrorCode; if( xApprove.is() && xDisapprove.is() ) @@ -3631,7 +3785,7 @@ UUIInteractionHelper::handleLockedDocumentRequest( star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() ) return; @@ -3709,7 +3863,7 @@ UUIInteractionHelper::handleChangedByOthersRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; @@ -3749,7 +3903,7 @@ UUIInteractionHelper::handleLockFileIgnoreRequest( star::uno::Reference< star::task::XInteractionApprove > xApprove; star::uno::Reference< star::task::XInteractionAbort > xAbort; getContinuations( - rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0); + rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0); if ( !xApprove.is() || !xAbort.is() ) return; diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index f390e70674ea..dadac27b63a4 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -100,6 +100,7 @@ namespace com { namespace sun { namespace star { class XInteractionHandler; class XInteractionRequest; class XPasswordContainer; + class XUrlContainer; } namespace ucb { class AuthenticationRequest; @@ -181,7 +182,10 @@ private: bool initPasswordContainer(com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > * - pContainer) + pContainer, + com::sun::star::uno::Reference< + com::sun::star::task::XUrlContainer > * + pUrlContainer) const SAL_THROW(()); com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > @@ -248,7 +252,8 @@ private: com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > const & - rContinuations) + rContinuations, + rtl::OUString const & rURL) SAL_THROW((com::sun::star::uno::RuntimeException)); void diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx index 4d58e07e37da..195dcaaf2648 100644 --- a/uui/source/logindlg.cxx +++ b/uui/source/logindlg.cxx @@ -55,6 +55,7 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) FASTBOOL bPathHide = FALSE; FASTBOOL bErrorHide = FALSE; FASTBOOL bAccountHide = FALSE; + FASTBOOL bUseSysCredsHide = FALSE; if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH ) { @@ -104,6 +105,12 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) bAccountHide = TRUE; } + if ( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) + { + aUseSysCredsCB.Hide(); + bUseSysCredsHide = TRUE; + } + if ( bErrorHide ) { long nOffset = aLoginGB.GetPosPixel().Y() - @@ -147,6 +154,9 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) aNewPnt = aSavePasswdBtn.GetPosPixel(); aNewPnt.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aNewPnt ); + aNewPnt = aUseSysCredsCB.GetPosPixel(); + aNewPnt.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aNewPnt ); aNewPnt = aLoginGB.GetPosPixel(); aNewPnt.Y() -= nOffset; aLoginGB.SetPosPixel( aNewPnt ); @@ -174,6 +184,9 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) aTmpPnt1 = aSavePasswdBtn.GetPosPixel(); aTmpPnt1.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aTmpPnt1 ); + aTmpPnt1 = aUseSysCredsCB.GetPosPixel(); + aTmpPnt1.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aTmpPnt1 ); Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); @@ -186,12 +199,44 @@ void LoginDialog::HideControls_Impl( USHORT nFlags ) Point aTmpPnt = aSavePasswdBtn.GetPosPixel(); aTmpPnt.Y() -= nOffset; aSavePasswdBtn.SetPosPixel( aTmpPnt ); + aTmpPnt = aUseSysCredsCB.GetPosPixel(); + aTmpPnt.Y() -= nOffset; + aUseSysCredsCB.SetPosPixel( aTmpPnt ); + Size aNewSz = GetSizePixel(); + aNewSz.Height() -= nOffset; + SetSizePixel( aNewSz ); + } + + if ( bUseSysCredsHide ) + { + long nOffset = aUseSysCredsCB.GetPosPixel().Y() - + aSavePasswdBtn.GetPosPixel().Y(); + Size aNewSz = GetSizePixel(); aNewSz.Height() -= nOffset; SetSizePixel( aNewSz ); } }; +// ----------------------------------------------------------------------- +void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ) +{ + aErrorInfo.Enable( !bUseSysCredsEnabled ); + aErrorGB.Enable( !bUseSysCredsEnabled ); + aRequestInfo.Enable( !bUseSysCredsEnabled ); + aPathFT.Enable( !bUseSysCredsEnabled ); + aPathED.Enable( !bUseSysCredsEnabled ); + aPathInfo.Enable( !bUseSysCredsEnabled ); + aPathBtn.Enable( !bUseSysCredsEnabled ); + aNameFT.Enable( !bUseSysCredsEnabled ); + aNameED.Enable( !bUseSysCredsEnabled ); + aNameInfo.Enable( !bUseSysCredsEnabled ); + aPasswordFT.Enable( !bUseSysCredsEnabled ); + aPasswordED.Enable( !bUseSysCredsEnabled ); + aAccountFT.Enable( !bUseSysCredsEnabled ); + aAccountED.Enable( !bUseSysCredsEnabled ); +} + // ----------------------------------------------------------------------- IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG ) @@ -221,6 +266,14 @@ IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG ) // ----------------------------------------------------------------------- +IMPL_LINK( LoginDialog, UseSysCredsHdl_Impl, CheckBox *, EMPTYARG ) +{ + EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() ); + return 1; +} + +// ----------------------------------------------------------------------- + LoginDialog::LoginDialog ( Window* pParent, @@ -247,6 +300,7 @@ LoginDialog::LoginDialog aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ), aAccountED ( this, ResId( ED_LOGIN_ACCOUNT, *pResMgr ) ), aSavePasswdBtn ( this, ResId( CB_LOGIN_SAVEPASSWORD, *pResMgr ) ), + aUseSysCredsCB ( this, ResId( CB_LOGIN_USESYSCREDS, *pResMgr ) ), aLoginGB ( this, ResId( GB_LOGIN_LOGIN, *pResMgr ) ), aOKBtn ( this, ResId( BTN_LOGIN_OK, *pResMgr ) ), aCancelBtn ( this, ResId( BTN_LOGIN_CANCEL, *pResMgr ) ), @@ -261,6 +315,10 @@ LoginDialog::LoginDialog } else aRequest = aRequestInfo.GetText(); + + if ( !( ( nFlags & LF_NO_USESYSCREDS ) == LF_NO_USESYSCREDS ) ) + EnableUseSysCredsControls_Impl( aUseSysCredsCB.IsChecked() ); + aRequest.SearchAndReplaceAscii("%1", rServer); aRequestInfo.SetText(aRequest); @@ -271,6 +329,7 @@ LoginDialog::LoginDialog aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) ); aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) ); + aUseSysCredsCB.SetClickHdl( LINK( this, LoginDialog, UseSysCredsHdl_Impl ) ); HideControls_Impl( nFlags ); }; @@ -285,6 +344,17 @@ void LoginDialog::SetName( const String& rNewName ) // ----------------------------------------------------------------------- +void LoginDialog::SetUseSystemCredentials( BOOL bUse ) +{ + if ( aUseSysCredsCB.IsVisible() ) + { + aUseSysCredsCB.Check( bUse ); + EnableUseSysCredsControls_Impl( bUse ); + } +} + +// ----------------------------------------------------------------------- + void LoginDialog::ClearPassword() { aPasswordED.SetText( String() ); diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc index 20b5a5c86d46..a9c1ff853d85 100644 --- a/uui/source/logindlg.hrc +++ b/uui/source/logindlg.hrc @@ -50,6 +50,7 @@ #define ED_LOGIN_ACCOUNT 31 #define CB_LOGIN_SAVEPASSWORD 32 #define GB_LOGIN_LOGIN 33 +#define CB_LOGIN_USESYSCREDS 34 #define BTN_LOGIN_OK 50 #define BTN_LOGIN_CANCEL 51 diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx index a6e92797d26f..c88bc7a93aad 100644 --- a/uui/source/logindlg.hxx +++ b/uui/source/logindlg.hxx @@ -48,6 +48,7 @@ #define LF_PATH_READONLY 0x0020 // "path" readonly #define LF_USERNAME_READONLY 0x0040 // "name" readonly #define LF_NO_ACCOUNT 0x0080 // hide "account" +#define LF_NO_USESYSCREDS 0x0100 // hide "use system cedentials" //............................................................................ //............................................................................ @@ -70,15 +71,18 @@ class LoginDialog : public ModalDialog FixedText aAccountFT; Edit aAccountED; CheckBox aSavePasswdBtn; + CheckBox aUseSysCredsCB; FixedLine aLoginGB; OKButton aOKBtn; CancelButton aCancelBtn; HelpButton aHelpBtn; void HideControls_Impl( USHORT nFlags ); + void EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled ); DECL_LINK( OKHdl_Impl, OKButton * ); DECL_LINK( PathHdl_Impl, PushButton * ); + DECL_LINK( UseSysCredsHdl_Impl, CheckBox * ); public: LoginDialog( Window* pParent, USHORT nFlags, @@ -103,6 +107,9 @@ public: { aSavePasswdBtn.Check( bSave ); } void SetSavePasswordText( const String& rTxt ) { aSavePasswdBtn.SetText( rTxt ); } + BOOL IsUseSystemCredentials() const + { return aUseSysCredsCB.IsChecked(); } + void SetUseSystemCredentials( BOOL bUse ); void SetErrorText( const String& rTxt ) { aErrorInfo.SetText( rTxt ); } void SetLoginRequestText( const String& rTxt ) diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src index 39b98ffea1a4..7450a389e7e5 100644 --- a/uui/source/logindlg.src +++ b/uui/source/logindlg.src @@ -45,7 +45,7 @@ ModalDialog DLG_UUI_LOGIN Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 265 , 158 ) ; + Size = MAP_APPFONT ( 265 , 170 ) ; FixedText INFO_LOGIN_ERROR { Pos = MAP_APPFONT ( 12 , 14 ) ; @@ -139,6 +139,12 @@ ModalDialog DLG_UUI_LOGIN Size = MAP_APPFONT ( 185 , 10 ) ; Text [ en-US ] = "~Save password" ; }; + CheckBox CB_LOGIN_USESYSCREDS + { + Pos = MAP_APPFONT ( 12 , 148 ) ; + Size = MAP_APPFONT ( 185 , 10 ) ; + Text [ en-US ] = "~Use System Credentials" ; + }; FixedLine GB_LOGIN_LOGIN { Pos = MAP_APPFONT ( 7 , 44 ) ; -- cgit v1.2.3