Remove ancient StarPortal leftovers

No UNO bridge has a "user" token in its description anyway, so
needsSecurityRestrictions always returned false.

Change-Id: Ibc3aa25212a2e8b245c13578fa29582be42791e6
This commit is contained in:
Stephan Bergmann
2016-03-08 15:04:58 +01:00
parent 6326d76101
commit 29cb1f1923
4 changed files with 0 additions and 160 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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 )

View File

@@ -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 );