Package net.sourceforge.jnlp.util
Class RestrictedFileUtils
- java.lang.Object
-
- net.sourceforge.jnlp.util.RestrictedFileUtils
-
public final class RestrictedFileUtils extends java.lang.ObjectThis class contains a method to create restricted files.
-
-
Field Summary
Fields Modifier and Type Field Description private static LoggerLOGprivate static java.util.List<java.lang.String>WIN_PRINCIPAL_SIDS
-
Constructor Summary
Constructors Constructor Description RestrictedFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidcreateFileOrDir(java.io.File file, boolean isDir)static voidcreateRestrictedDirectory(java.io.File directory)Creates a new directory with minimum permissions.static voidcreateRestrictedFile(java.io.File file)Creates a new file with minimum permissions.private static voidcreateRestrictedFile(java.io.File file, boolean isDir)Creates a new file or directory with minimum permissions.private static java.lang.reflect.MethodfindMethod(java.lang.Class<?> clazz, java.lang.String methodName)static java.lang.StringgetSIDForPrincipal(java.security.Principal principal)static booleanprincipalInWinSIDS(java.security.Principal principal)
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
WIN_PRINCIPAL_SIDS
private static final java.util.List<java.lang.String> WIN_PRINCIPAL_SIDS
-
-
Method Detail
-
createRestrictedDirectory
public static void createRestrictedDirectory(java.io.File directory) throws java.io.IOExceptionCreates a new directory with minimum permissions. The directory is not readable or writable by anyone other than the owner. The parent directories are not created; they must exist before this is called.- Parameters:
directory- directory to be created- Throws:
java.io.IOException- if IO fails
-
createRestrictedFile
public static void createRestrictedFile(java.io.File file) throws java.io.IOExceptionCreates a new file with minimum permissions. The file is not readable or writable by anyone other than the owner. If writeableByOwner is false, even the owner can not write to it.- Parameters:
file- path to file- Throws:
java.io.IOException- if IO fails
-
createRestrictedFile
private static void createRestrictedFile(java.io.File file, boolean isDir) throws java.io.IOExceptionCreates a new file or directory with minimum permissions. The file is not readable or writable by anyone other than the owner. If writeableByOwner is false, even the owner can not write to it. If isDir is true, then the directory can be executed by the owner- Throws:
java.io.IOException
-
createFileOrDir
private static void createFileOrDir(java.io.File file, boolean isDir) throws java.io.IOException- Throws:
java.io.IOException
-
principalInWinSIDS
public static boolean principalInWinSIDS(java.security.Principal principal)
-
getSIDForPrincipal
public static java.lang.String getSIDForPrincipal(java.security.Principal principal)
-
findMethod
private static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz, java.lang.String methodName)
-
-