diff options
-rw-r--r-- | svtools/inc/pch/precompiled_svtools.hxx | 3 | ||||
-rw-r--r-- | svtools/source/dialogs/filedlg2.cxx | 4 | ||||
-rw-r--r-- | vos/inc/vos/pipe.hxx | 6 | ||||
-rw-r--r-- | vos/inc/vos/process.hxx | 6 | ||||
-rw-r--r-- | vos/inc/vos/security.hxx | 123 | ||||
-rw-r--r-- | vos/source/makefile.mk | 2 | ||||
-rw-r--r-- | vos/source/pipe.cxx | 8 | ||||
-rw-r--r-- | vos/source/process.cxx | 4 | ||||
-rw-r--r-- | vos/source/security.cxx | 118 |
9 files changed, 15 insertions, 259 deletions
diff --git a/svtools/inc/pch/precompiled_svtools.hxx b/svtools/inc/pch/precompiled_svtools.hxx index d865b3f2eb78..96df529cf86e 100644 --- a/svtools/inc/pch/precompiled_svtools.hxx +++ b/svtools/inc/pch/precompiled_svtools.hxx @@ -362,6 +362,7 @@ #include <osl/mutex.h> #include <osl/mutex.hxx> #include <osl/process.h> +#include <osl/security.hxx> #include <osl/thread.h> #include <osl/thread.hxx> @@ -427,8 +428,6 @@ #include <vos/process.hxx> #include <vos/ref.hxx> #include <vos/refernce.hxx> -#include <vos/security.hxx> -#include <osl/thread.hxx> #include <vos/timer.hxx> //---MARKER--- diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index f4d2c45fc5ee..a4502631595e 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -39,7 +39,7 @@ #include <filedlg.hxx> #include <filedlg2.hrc> #include <vcl/msgbox.hxx> -#include <vos/security.hxx> +#include <osl/security.hxx> #include <com/sun/star/i18n/XCollator.hpp> #include <svtools/stdctrl.hxx> @@ -346,7 +346,7 @@ IMPL_LINK( ImpPathDialog, ClickHdl, Button*, pBtn ) if ( pBtn == pHomeBtn ) { ::rtl::OUString aHomeDir; - NAMESPACE_VOS( OSecurity ) aSecurity; + osl::Security aSecurity; if ( aSecurity.getHomeDir( aHomeDir ) ) { DirEntry aFile ( aHomeDir ); diff --git a/vos/inc/vos/pipe.hxx b/vos/inc/vos/pipe.hxx index bfd57ab12acf..68a0062d2dae 100644 --- a/vos/inc/vos/pipe.hxx +++ b/vos/inc/vos/pipe.hxx @@ -38,7 +38,7 @@ # include <vos/refernce.hxx> #endif # include <vos/refobj.hxx> -# include <vos/security.hxx> +#include <osl/security.hxx> # include <rtl/ustring.hxx> @@ -102,7 +102,7 @@ public: @param Security */ OPipe(const ::rtl::OUString& strName, TPipeOption Options, - const NAMESPACE_VOS(OSecurity)& rSecurity); + const osl::Security& rSecurity); /** Copy constructor. */ @@ -133,7 +133,7 @@ public: @return True if socket was successfully created. */ sal_Bool SAL_CALL create(const ::rtl::OUString& strName, TPipeOption Options, - const NAMESPACE_VOS(OSecurity)& rSecurity); + const osl::Security& rSecurity); /** Assignment operator. If pipe was already created, the old one will be discarded. diff --git a/vos/inc/vos/process.hxx b/vos/inc/vos/process.hxx index acb85af90948..1cf6d0fa2ecb 100644 --- a/vos/inc/vos/process.hxx +++ b/vos/inc/vos/process.hxx @@ -31,9 +31,9 @@ # include <rtl/ustring.hxx> # include <vos/mutex.hxx> -# include <vos/security.hxx> +#include <osl/security.hxx> # include <vos/object.hxx> -# include <osl/process.h> +#include <osl/process.h> namespace vos { @@ -194,7 +194,7 @@ public: @see OStartupInfo::acceptIOResource */ TProcessError SAL_CALL execute(TProcessOption Options, - const OSecurity &Security, + const osl::Security &Security, const OArgumentList& aArgumentList = OArgumentList(), const OEnvironment& aEnvironment = OEnvironment() ); diff --git a/vos/inc/vos/security.hxx b/vos/inc/vos/security.hxx deleted file mode 100644 index 4915f7078b26..000000000000 --- a/vos/inc/vos/security.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _VOS_SECURITY_HXX_ -#define _VOS_SECURITY_HXX_ - -# include <vos/object.hxx> -# include <rtl/ustring.hxx> -# include <osl/security.h> - -namespace vos -{ - -/** capsulate security informations for one user. - A object of this class is used to execute a process with the rights an - security options of a scecified user. - @see OProcess::executeProcess - @author Bernd Hofner - @version 1.0 - -*/ -class OSecurity : public OObject -{ - VOS_DECLARE_CLASSINFO(VOS_NAMESPACE(OSecurity, vos)); - -public: - /// constructor - OSecurity(); - /// destructor - virtual ~OSecurity(); - /** get the security information for one user. - The underlying operating system is asked for this information. - @param strName [in] denotes the name of the user - @param strPasswd [in] denotes the password of this user - @return True, if the specified user is known by the underlying operating system, - otherwise False - */ - sal_Bool SAL_CALL logonUser(const ::rtl::OUString& strName, - const ::rtl::OUString& strPasswd); - /** get the security information for one user. - This method will try to login the user at the denoted file server. - If a network resource named \\server\username exists and this resource - could be connected by this user, the methos will return true and getHomeDir - will return \\server\username. - @param strName [in] denotes the name of the user - @param strPasswd [in] denotes the password of this user - @return True, if the specified user is known by file server and the - could be connected, otherwise False - */ - sal_Bool SAL_CALL logonUser(const ::rtl::OUString& strName, - const ::rtl::OUString& strPasswd, - const ::rtl::OUString& strFileServer); - - /** get the ident of the logged in user. - @param strName [out] is the buffer which returns the name - @param max [in] is the size of this buffer - @return True, if any user is successfuly logged in, otherwise False - */ - sal_Bool SAL_CALL getUserIdent(::rtl::OUString& strIdent) const; - - /** get the name of the logged in user. - @param strName [out] is the buffer which returns the name - @param max [in] is the size of this buffer - @return True, if any user is successfuly logged in, otherwise False - */ - sal_Bool SAL_CALL getUserName(::rtl::OUString& strName) const; - - /** get the home directory of the logged in user. - @param strDirectory [out] is the buffer which returns the directory name - @param max [in] is the size of this buffer - @return True, if any user is successfuly logged in, otherwise False - */ - sal_Bool SAL_CALL getHomeDir(::rtl::OUString& strDirectory) const; - - /** get the directory for configuration data of the logged in user. - @param strDirectory [out] is the buffer which returns the directory name - @param max [in] is the size of this buffer - @return True, if any user is successfuly logged in, otherwise False - */ - sal_Bool SAL_CALL getConfigDir(::rtl::OUString& strDirectory) const; - - /** Query if the user who is logged inhas administrator rigths. - @return True, if the user has administrator rights, otherwise false. - */ - sal_Bool SAL_CALL isAdministrator() const; - - virtual SAL_CALL operator oslSecurity() const; - -protected: - - oslSecurity m_oslSecurity; -}; - -} - -#endif // _VOS_SECURITY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vos/source/makefile.mk b/vos/source/makefile.mk index 3ef05023b528..5b9a8c7ad997 100644 --- a/vos/source/makefile.mk +++ b/vos/source/makefile.mk @@ -46,7 +46,6 @@ SLOFILES= $(SLO)$/conditn.obj \ $(SLO)$/module.obj \ $(SLO)$/timer.obj \ $(SLO)$/process.obj \ - $(SLO)$/security.obj \ $(SLO)$/signal.obj \ $(SLO)$/pipe.obj \ $(SLO)$/xception.obj @@ -62,7 +61,6 @@ OBJFILES= $(OBJ)$/conditn.obj \ $(OBJ)$/module.obj \ $(OBJ)$/timer.obj \ $(OBJ)$/process.obj \ - $(OBJ)$/security.obj \ $(OBJ)$/signal.obj \ $(OBJ)$/pipe.obj \ $(OBJ)$/xception.obj diff --git a/vos/source/pipe.cxx b/vos/source/pipe.cxx index e05d73440093..c4eb6a5aea04 100644 --- a/vos/source/pipe.cxx +++ b/vos/source/pipe.cxx @@ -69,12 +69,12 @@ OPipe::OPipe( const rtl::OUString& strName, TPipeOption Options) OPipe::OPipe( const rtl::OUString& strName, TPipeOption Options, - const OSecurity& rSecurity) + const osl::Security& rSecurity) { m_pPipeRef= new PipeRef(osl_createPipe(strName.pData, (oslPipeOptions)Options, - (oslSecurity)rSecurity)); + rSecurity.getHandle())); OSL_POSTCOND(m_pPipeRef != 0, "OPipe(): new failed.\n"); OSL_POSTCOND((*m_pPipeRef)(), "OPipe(): creation of pipe failed!\n"); @@ -139,7 +139,7 @@ sal_Bool OPipe::create( const rtl::OUString& strName, TPipeOption Options ) /*****************************************************************************/ sal_Bool OPipe::create( const rtl::OUString& strName, TPipeOption Options, - const NAMESPACE_VOS(OSecurity)& rSecurity ) + const osl::Security& rSecurity ) { // if this was a valid pipe, decrease reference if ((m_pPipeRef) && (m_pPipeRef->release() == 0)) @@ -152,7 +152,7 @@ sal_Bool OPipe::create( const rtl::OUString& strName, m_pPipeRef= new PipeRef(osl_createPipe(strName.pData, (oslPipeOptions)Options, - (oslSecurity)rSecurity)); + rSecurity.getHandle())); OSL_POSTCOND(m_pPipeRef != 0, "OPipe(): new failed.\n"); diff --git a/vos/source/process.cxx b/vos/source/process.cxx index f435f6d425dd..a062e1585ad7 100644 --- a/vos/source/process.cxx +++ b/vos/source/process.cxx @@ -286,7 +286,7 @@ OProcess::TProcessError OProcess::execute(TProcessOption Options, OProcess::TProcessError OProcess::execute( TProcessOption Options, - const OSecurity &Security, + const osl::Security& Security, const OArgumentList& aArgumentList, const OEnvironment& aEnvironment ) { @@ -294,7 +294,7 @@ OProcess::TProcessError OProcess::execute( TProcessOption Options, aArgumentList.m_aVec, aArgumentList.n_Args, Options, - Security, + Security.getHandle(), m_strDirectory.pData, aEnvironment.m_aVec, aEnvironment.n_Vars, diff --git a/vos/source/security.cxx b/vos/source/security.cxx deleted file mode 100644 index 8767da6d6c00..000000000000 --- a/vos/source/security.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <vos/security.hxx> -#include <osl/diagnose.h> - -using namespace vos; - -///////////////////////////////////////////////////////////////////////////// -// Object super class - -VOS_IMPLEMENT_CLASSINFO(VOS_CLASSNAME(OSecurity, vos), VOS_NAMESPACE(OSecurity, vos), VOS_NAMESPACE(OObject, vos), 0); - -OSecurity::OSecurity() -{ - m_oslSecurity = osl_getCurrentSecurity(); -} - -OSecurity::~OSecurity() -{ - osl_freeSecurityHandle(m_oslSecurity); -} - -sal_Bool OSecurity::logonUser(const rtl::OUString& strName, - const rtl::OUString& strPasswd) -{ - osl_freeSecurityHandle(m_oslSecurity); - - m_oslSecurity = NULL; - - return (osl_loginUser( strName.pData, strPasswd.pData, &m_oslSecurity) - == osl_Security_E_None); -} - - -sal_Bool OSecurity::logonUser( const rtl::OUString& strName, - const rtl::OUString& strPasswd, - const rtl::OUString& strFileServer ) -{ - osl_freeSecurityHandle(m_oslSecurity); - - m_oslSecurity = NULL; - - return (osl_loginUserOnFileServer(strName.pData, strPasswd.pData, strFileServer.pData, &m_oslSecurity) - == osl_Security_E_None); -} - - -sal_Bool OSecurity::getUserIdent( rtl::OUString& strIdent) const -{ - OSL_ASSERT(m_oslSecurity); - - return osl_getUserIdent( m_oslSecurity, &strIdent.pData ); -} - - -sal_Bool OSecurity::getUserName( rtl::OUString& strName ) const -{ - OSL_ASSERT(m_oslSecurity); - - return osl_getUserName( m_oslSecurity, &strName.pData ); -} - - -sal_Bool OSecurity::getHomeDir( rtl::OUString& strDirectory) const -{ - OSL_ASSERT(m_oslSecurity); - - return osl_getHomeDir(m_oslSecurity, &strDirectory.pData ); -} - - -sal_Bool OSecurity::getConfigDir( rtl::OUString& strDirectory ) const -{ - OSL_ASSERT(m_oslSecurity); - - return osl_getConfigDir( m_oslSecurity, &strDirectory.pData ); -} - -sal_Bool OSecurity::isAdministrator() const -{ - OSL_ASSERT(m_oslSecurity); - - return osl_isAdministrator(m_oslSecurity); -} - -OSecurity::operator oslSecurity() const -{ - return m_oslSecurity; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |