basic/source/inc/runtime.hxx | 7 -- basic/source/runtime/iosys.cxx | 97 --------------------------------------- basic/source/runtime/methods.cxx | 49 ------------------- basic/source/runtime/runtime.cxx | 7 -- 4 files changed, 160 deletions(-)
New commits: commit 29cb1f192312d395067b5024e40aea3388f7674d Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Mar 8 15:04:58 2016 +0100 Remove ancient StarPortal leftovers No UNO bridge has a "user" token in its description anyway, so needsSecurityRestrictions always returned false. Change-Id: Ibc3aa25212a2e8b245c13578fa29582be42791e6 diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index aef620b..94e2aeb 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -435,13 +435,6 @@ inline void checkArithmeticOverflow( SbxVariable* pVar ) StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ); -// Get information if security restrictions should be -// used (File IO based on UCB, no RTL function SHELL -// no DDE functionality, no DLLCALL) in basic because -// of portal "virtual" users (portal user != UNIX user) -// (Implemented in iosys.cxx) -bool needSecurityRestrictions(); - // Returns true if UNO is available, otherwise the old // file system implementation has to be used // (Implemented in iosys.cxx) diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 46c90be..8e72688 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -23,7 +23,6 @@ #include <vcl/button.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#include <osl/security.h> #include <osl/file.hxx> #include <tools/urlobj.hxx> #include <osl/mutex.hxx> @@ -175,102 +174,6 @@ void SbiStream::MapError() } } -// TODO: Code is copied from daemons2/source/uno/asciiEncoder.cxx - -OUString findUserInDescription( const OUString& aDescription ) -{ - OUString user; - - sal_Int32 index; - sal_Int32 lastIndex = 0; - - do - { - index = aDescription.indexOf((sal_Unicode) ',', lastIndex); - OUString token = (index == -1) ? aDescription.copy(lastIndex) : aDescription.copy(lastIndex, index - lastIndex); - - lastIndex = index + 1; - - sal_Int32 eindex = token.indexOf((sal_Unicode)'='); - OUString left = token.copy(0, eindex).toAsciiLowerCase().trim(); - OUString right = INetURLObject::decode( token.copy(eindex + 1).trim(), - INetURLObject::DECODE_WITH_CHARSET ); - - if( left == "user" ) - { - user = right; - break; - } - } - while(index != -1); - - return user; -} - -bool needSecurityRestrictions() -{ - static bool bNeedInit = true; - static bool bRetVal = true; - - if( bNeedInit ) - { - bNeedInit = false; - - // Get system user to compare to portal user - oslSecurity aSecurity = osl_getCurrentSecurity(); - OUString aSystemUser; - bool bRet = osl_getUserName( aSecurity, &aSystemUser.pData ); - osl_freeSecurityHandle(aSecurity); - if( !bRet ) - { - // No valid security! -> Secure mode! - return true; - } - - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - Reference< XBridgeFactory2 > xBridgeFac( BridgeFactory::create(xContext) ); - - Sequence< Reference< XBridge > > aBridgeSeq = xBridgeFac->getExistingBridges(); - sal_Int32 nBridgeCount = aBridgeSeq.getLength(); - - if( nBridgeCount == 0 ) - { - // No bridges -> local - bRetVal = false; - return bRetVal; - } - - // Iterate through all bridges to find (portal) user property - const Reference< XBridge >* pBridges = aBridgeSeq.getConstArray(); - bRetVal = false; // Now only sal_True if user different from portal user is found - sal_Int32 i; - for( i = 0 ; i < nBridgeCount ; i++ ) - { - const Reference< XBridge >& rxBridge = pBridges[ i ]; - OUString aDescription = rxBridge->getDescription(); - OUString aPortalUser = findUserInDescription( aDescription ); - if( !aPortalUser.isEmpty() ) - { - // User Found, compare to system user - if( aPortalUser == aSystemUser ) - { - // Same user -> system security is ok, bRetVal stays FALSE - break; - } - else - { - // Different user -> Secure mode! - bRetVal = true; - break; - } - } - } - // No user found or PortalUser != SystemUser -> Secure mode! (Keep default value) - } - - return bRetVal; -} - // Returns sal_True if UNO is available, otherwise the old file // system implementation has to be used // #89378 New semantic: Don't just ask for UNO but for UCB diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 97e1eca..6e83e1c 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3602,13 +3602,6 @@ RTLFUNC(Shell) (void)pBasic; (void)bWrite; - // No shell command for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - sal_Size nArgCount = rPar.Count(); if ( nArgCount < 2 || nArgCount > 5 ) { @@ -3964,13 +3957,6 @@ RTLFUNC(DDEInitiate) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - int nArgs = (int)rPar.Count(); if ( nArgs != 3 ) { @@ -3998,13 +3984,6 @@ RTLFUNC(DDETerminate) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - rPar.Get(0)->PutEmpty(); int nArgs = (int)rPar.Count(); if ( nArgs != 2 ) @@ -4026,13 +4005,6 @@ RTLFUNC(DDETerminateAll) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - rPar.Get(0)->PutEmpty(); int nArgs = (int)rPar.Count(); if ( nArgs != 1 ) @@ -4054,13 +4026,6 @@ RTLFUNC(DDERequest) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - int nArgs = (int)rPar.Count(); if ( nArgs != 3 ) { @@ -4087,13 +4052,6 @@ RTLFUNC(DDEExecute) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - rPar.Get(0)->PutEmpty(); int nArgs = (int)rPar.Count(); if ( nArgs != 3 ) @@ -4116,13 +4074,6 @@ RTLFUNC(DDEPoke) (void)pBasic; (void)bWrite; - // No DDE for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - rPar.Get(0)->PutEmpty(); int nArgs = (int)rPar.Count(); if ( nArgs != 4 ) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index e6dfa20..239d707 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1285,13 +1285,6 @@ void SbiRuntime::DllCall SbxDataType eResType, // return value bool bCDecl ) // true: according to C-conventions { - // No DllCall for "virtual" portal users - if( needSecurityRestrictions() ) - { - StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); - return; - } - // NOT YET IMPLEMENTED SbxVariable* pRes = new SbxVariable( eResType ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits