8214545: sun/management/jmxremote/bootstrap tests hang in revokeall.exe on Windows

Reviewed-by: dholmes, amenkov, bulasevich, dfuchs, erikj
This commit is contained in:
Daniil Titov 2019-05-22 09:06:24 -07:00
parent ff2fa1e422
commit dc9f6b3991
5 changed files with 36 additions and 27 deletions

View File

@ -62,9 +62,11 @@ ifeq ($(call isTargetOs, windows), true)
WIN_LIB_JLI := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeJliLaunchTest := $(WIN_LIB_JLI)
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeCallerAccessTest := jvm.lib
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib
else
BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava
BUILD_JDK_JTREG_LIBRARIES_LIBS_libDirectIO := -ljava
BUILD_JDK_JTREG_EXCLUDE += exerevokeall.c
ifeq ($(call isTargetOs, linux), true)
BUILD_JDK_JTREG_LIBRARIES_LIBS_libInheritedChannel := -ljava
else ifeq ($(call isTargetOs, solaris), true)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -70,13 +70,11 @@ EOF
if [ "$OS" = "Windows_NT" ]; then
USER=`id -u -n`
CACLS="$SystemRoot/system32/cacls.exe"
TEST_SRC=`cygpath ${TESTSRC}`
REVOKEALL="$TEST_SRC/../../windows/revokeall.exe"
if [ ! -f "$REVOKEALL" ] ; then
echo "$REVOKEALL missing"
REVOKEALL="$TESTNATIVEPATH/revokeall.exe"
if [ ! -x "$REVOKEALL" ] ; then
echo "$REVOKEALL doesn't exist or is not executable"
exit 1
fi
chmod ug+x $REVOKEALL
fi
;;
*)

View File

@ -1,6 +1,29 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
This directory contains the source and the binary version of a Windows
utility to remove all non-owner Access Control Entries from a given file.
This directory contains the source of a Windows utility to remove all
non-owner Access Control Entries from a given file.
The tool is used by regression tests in the following directories :-
@ -10,18 +33,3 @@ The tests in these directories create password or ACL files that need to
be "secured" (meaning that only the owner should have access to the
files).
Both the source and the binary version are checked into SCCS. If
you require to make changes to the tool then you need to Visual
C++ to rebuild revokeall.exe after changing the source.
To rebuild the tool you need to setup your environment (by
calling the VC++ VCVARS32.BAT script), and then executing the
following command :-
cl /mt revokeall.c advapi32.lib
This will generate revokeall.exe.
Note that a 32-bit version of revokeall.exe is checked into SCCS
- this 32-bit application is also used when running on 64-bit
versions of Windows (AMD64 and IA64).

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,7 @@
#include <string.h>
/*
* Simple Windows utility to remove all non-owner access to a given
* file - suitable for NT/2000/XP only.
* Simple Windows utility to remove all non-owner access to a given file.
*/
@ -151,7 +150,7 @@ static char *getSIDString(SID* sid) {
}
if (LookupAccountSid(NULL, sid, name, &nameLen, domain, &domainLen, &use)) {
int len = strlen(name) + strlen(domain) + 3;
size_t len = strlen(name) + strlen(domain) + 3;
char* s = (char*)malloc(len);
if (s != NULL) {
strcpy(s, domain);
@ -352,6 +351,8 @@ static int revokeAll(const char* path) {
return -1;
}
if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceType != ACCESS_ALLOWED_ACE_TYPE) {
i++;
count--;
continue;
}
access = (ACCESS_ALLOWED_ACE *)ace;