sfx2/Library_sfx.mk | 1 sfx2/source/doc/docfile.cxx | 17 ------ sfx2/source/doc/sfxacldetect.cxx | 101 --------------------------------------- sfx2/source/doc/sfxacldetect.hxx | 23 -------- 4 files changed, 142 deletions(-)
New commits: commit 4f12babf52750bd07ef1a7345a428123cfd0bae5 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Tue Mar 7 00:26:18 2017 +0100 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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 6b301ba..148a9b0 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 303704d..a53ca5e 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 65fb7aa..0000000 --- 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 994e18b..0000000 --- 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: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits