Methods Summary |
---|
public static final native boolean | checkSELinuxAccess(java.lang.String scon, java.lang.String tcon, java.lang.String tclass, java.lang.String perm)Check permissions between two security contexts.
|
public static final native java.lang.String[] | getBooleanNames()Gets a list of the SELinux boolean names.
|
public static final native boolean | getBooleanValue(java.lang.String name)Gets the value for the given SELinux boolean name.
|
public static final native java.lang.String | getContext()Gets the security context of the current process.
|
public static final native java.lang.String | getFileContext(java.lang.String path)Get the security context of a file object.
|
public static final native java.lang.String | getPeerContext(java.io.FileDescriptor fd)Get the security context of a peer socket.
|
public static final native java.lang.String | getPidContext(int pid)Gets the security context of a given process id.
|
public static final native boolean | isSELinuxEnabled()Determine whether SELinux is disabled or enabled.
|
public static final native boolean | isSELinuxEnforced()Determine whether SELinux is permissive or enforcing.
|
private static native boolean | native_restorecon(java.lang.String pathname, int flags)Restores a file to its default SELinux security context.
If the system is not compiled with SELinux, then {@code true}
is automatically returned.
If SELinux is compiled in, but disabled, then {@code true} is
returned.
|
public static boolean | restorecon(java.lang.String pathname)Restores a file to its default SELinux security context.
If the system is not compiled with SELinux, then {@code true}
is automatically returned.
If SELinux is compiled in, but disabled, then {@code true} is
returned.
if (pathname == null) { throw new NullPointerException(); }
return native_restorecon(pathname, 0);
|
public static boolean | restorecon(java.io.File file)Restores a file to its default SELinux security context.
If the system is not compiled with SELinux, then {@code true}
is automatically returned.
If SELinux is compiled in, but disabled, then {@code true} is
returned.
try {
return native_restorecon(file.getCanonicalPath(), 0);
} catch (IOException e) {
Slog.e(TAG, "Error getting canonical path. Restorecon failed for " +
file.getPath(), e);
return false;
}
|
public static boolean | restoreconRecursive(java.io.File file)Recursively restores all files under the given path to their default
SELinux security context. If the system is not compiled with SELinux,
then {@code true} is automatically returned. If SELinux is compiled in,
but disabled, then {@code true} is returned.
try {
return native_restorecon(file.getCanonicalPath(), SELINUX_ANDROID_RESTORECON_RECURSE);
} catch (IOException e) {
Slog.e(TAG, "Error getting canonical path. Restorecon failed for " +
file.getPath(), e);
return false;
}
|
public static final native boolean | setBooleanValue(java.lang.String name, boolean value)Sets the value for the given SELinux boolean name.
|
public static final native boolean | setFSCreateContext(java.lang.String context)Sets the security context for newly created file objects.
|
public static final native boolean | setFileContext(java.lang.String path, java.lang.String context)Change the security context of an existing file object.
|
public static final native boolean | setSELinuxEnforce(boolean value)Set whether SELinux is permissive or enforcing.
|