test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh
Print this page
*** 102,123 ****
mp=-Dcom.sun.management.config.file=${CONFIG}
pp=-Dcom.sun.management.jmxremote.port=4888
go() {
echo ''
! sh -xc "$JAVA ${TESTVMOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
}
# Test 1 - password file is secure - VM should start
chmod 700 ${PASSWD}
! sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
# Test 2 - password file is not secure - VM should fail to start
chmod o+rx ${PASSWD}
! sh -xc "$JAVA ${TESTVMOPTS} $mp $pp Null" 2>&1
if [ $? = 0 ]; then failures=`expr $failures + 1`; fi
# Reset the file permissions on the generated password file
chmod 777 ${PASSWD}
--- 102,123 ----
mp=-Dcom.sun.management.config.file=${CONFIG}
pp=-Dcom.sun.management.jmxremote.port=4888
go() {
echo ''
! sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} $1 $2 $3 $4 $5 $6 $7 $8" 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
}
# Test 1 - password file is secure - VM should start
chmod 700 ${PASSWD}
! sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} $mp $pp Null" 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
# Test 2 - password file is not secure - VM should fail to start
chmod o+rx ${PASSWD}
! sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} $mp $pp Null" 2>&1
if [ $? = 0 ]; then failures=`expr $failures + 1`; fi
# Reset the file permissions on the generated password file
chmod 777 ${PASSWD}