简体   繁体   中英

Read ACLs from CIFS mounted file system in Java

On a Linux box I mounted a CIFS file system with

mount ... cifs ...,cifsacl

and I am able to read out ACLs with /usr/bin/getcifsacl . Further, on a Windows box, reading out ACLs in Java works with:

AclFileAttributeView view = 
    Files.getFileAttributeView(path, AclFileAttributeView.class)

But when I apply the same Java code to the CIFS mount on Linux, the view is null .

Is there a chance to tweak the CIFS mount or the Java code such that I can read ACLs? (I know jCIFS, but need to do without any additional Java class library.)

An answer would likely help here too .

Is there a chance to tweak ... the Java code such that I can read ACLs?

You could always download the OpenJDK source code, figure out how to build it, then develop changes to do what you want. But that's a bad idea. You are unlikely to find anyone who is willing to take on your changes, and most folks wouldn't be willing to run them.

For the record, "rt.jar" file in OpenJDK build for Linux does not include the Windows file attribute view provider classes. They are not there. So you wouldn't be able to use (hypothetical) reflective tweaks to use the Windows views. Maybe you could compile them and add them to the bootclasspath.


Note that if you are unwilling to use jCIFS for licensing reasons, the same reasoning should prevent you from "tweaking" OpenJDK. OpenJDK is licensed as GPLv2 (with the "classpath exception"), and your tweaks would be covered as well. (Note that jCIFS is LGPLv2.1 ... which should be less problematic than GPLv2.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM