diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-03-07 00:26:18 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-07 05:51:16 +0000 |
commit | 4f12babf52750bd07ef1a7345a428123cfd0bae5 (patch) | |
tree | 819313dba5db784bffe07a9c1a4e1f5466c53775 | |
parent | dd83aa90677cab526b4ea38caaeb6e0961c1a0be (diff) |
remove dead code
was deactivated in 2010 by
commit 9334f7757330fdd113d37b3faed728e56e6330c8
Temporarily disable the extra ACL check.
Change-Id: Ia9d2b7f55285e78f0737bf798b627740ccb11979
Reviewed-on: https://gerrit.libreoffice.org/34937
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/doc/sfxacldetect.cxx | 101 | ||||
-rw-r--r-- | sfx2/source/doc/sfxacldetect.hxx | 23 |
4 files changed, 0 insertions, 142 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 6b301ba0cee1..148a9b0d45b9 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -230,7 +230,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/printhelper \ sfx2/source/doc/querytemplate \ sfx2/source/doc/docundomanager \ - sfx2/source/doc/sfxacldetect \ sfx2/source/doc/sfxbasemodel \ sfx2/source/doc/sfxmodelfactory \ sfx2/source/doc/syspath \ diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 303704dec17a..a53ca5e5b215 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -119,7 +119,6 @@ #include "doc.hrc" #include "openflag.hxx" #include <sfx2/sfxresid.hxx> -#include "sfxacldetect.hxx" #include <officecfg/Office/Common.hxx> #include <memory> @@ -1130,22 +1129,6 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) aContent.getPropertyValue("IsReadOnly") >>= bContentReadonly; } catch( const uno::Exception& ) {} - -#if EXTRA_ACL_CHECK - // This block was introduced as a fix to i#102464, but removing - // this does not make the problem re-appear. But leaving this - // part would interfere with documents saved in samba share. This - // affects Windows only. - if ( !bContentReadonly ) - { - // the file is not readonly, check the ACL - - OUString aPhysPath; - if ( osl::FileBase::getSystemPathFromFileURL( GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ), aPhysPath ) - == osl::FileBase::E_None ) - bContentReadonly = IsReadonlyAccordingACL( aPhysPath.getStr() ); - } -#endif } // do further checks only if the file not readonly in fs diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx deleted file mode 100644 index 65fb7aac1096..000000000000 --- a/sfx2/source/doc/sfxacldetect.cxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "sfxacldetect.hxx" - -#if EXTRA_ACL_CHECK - -#ifdef _WIN32 - -// necessary to include system headers without warnings -#ifdef _MSC_VER -#pragma warning(disable:4668 4917) -#endif - -#include <windows.h> -#include <lmaccess.h> -#include <sal/types.h> - -sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ) -{ - sal_Bool bResult = sal_False; - - sal_uInt32 nFDSize = 0; - GetFileSecurityW( reinterpret_cast< LPCWSTR >(pFilePath), DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, NULL, 0, &nFDSize ); - if ( nFDSize ) - { - PSECURITY_DESCRIPTOR pFileDescr = reinterpret_cast< PSECURITY_DESCRIPTOR >( malloc( nFDSize ) ); - if ( GetFileSecurityW( reinterpret_cast< LPCWSTR >(pFilePath), DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, pFileDescr, nFDSize, &nFDSize ) ) - { - HANDLE hToken = NULL; - if ( OpenThreadToken( GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken ) - || OpenProcessToken( GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken) ) - { - HANDLE hImpersonationToken = NULL; - if ( DuplicateToken( hToken, SecurityImpersonation, &hImpersonationToken) ) - { - sal_uInt32 nDesiredAccess = ACCESS_WRITE; - GENERIC_MAPPING aGenericMapping = { ACCESS_READ, ACCESS_WRITE, 0, ACCESS_READ | ACCESS_WRITE }; - MapGenericMask( &nDesiredAccess, &aGenericMapping ); - - PRIVILEGE_SET aPrivilegeSet; - sal_uInt32 nPrivilegeSetSize = sizeof( PRIVILEGE_SET ); - - sal_uInt32 nGrantedAccess; - BOOL bAccessible = TRUE; - if ( AccessCheck( pFileDescr, - hImpersonationToken, - nDesiredAccess, - &aGenericMapping, - &aPrivilegeSet, - &nPrivilegeSetSize, - &nGrantedAccess, - &bAccessible ) ) - { - bResult = !bAccessible; - } - - CloseHandle( hImpersonationToken ); - } - - CloseHandle( hToken ); - } - } - - free( pFileDescr ); - } - - return bResult; -} - -#else // this is UNX - - -sal_Bool IsReadonlyAccordingACL( const sal_Unicode* ) -{ - // to be implemented - return sal_False; -} - -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/sfxacldetect.hxx b/sfx2/source/doc/sfxacldetect.hxx deleted file mode 100644 index 994e18bd88b6..000000000000 --- a/sfx2/source/doc/sfxacldetect.hxx +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_SFX2_SOURCE_DOC_SFXACLDETECT_HXX -#define INCLUDED_SFX2_SOURCE_DOC_SFXACLDETECT_HXX - -// Let's check if this extra ACL check is still necessary... If disabling it -// causes no regressions, then we can safely remove this code. -#define EXTRA_ACL_CHECK 0 - -#if EXTRA_ACL_CHECK -sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ); -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |