0

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.

Harald
  • 4,575
  • 5
  • 33
  • 72

1 Answers1

1

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.)

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • With tweaking I was not targeting the JVM/JDK itself but was just referring to my own Java code where I may have made stupid mistakes. But anyway `jar tvf .\jre\lib\rt.jar|grep -i windows|grep -i attribute` is indeed completely empty on Linux while showing a handful of classes on Windows. That would have been the last place I would have looked. A pity, but likely understandable in hindsight :-( – Harald Sep 01 '17 at 07:43