简体   繁体   English

从Java中的CIFS挂载文件系统读取ACL

[英]Read ACLs from CIFS mounted file system in Java

On a Linux box I mounted a CIFS file system with 在Linux机器上,我使用以下命令安装了CIFS文件系统:

mount ... cifs ...,cifsacl

and I am able to read out ACLs with /usr/bin/getcifsacl . 并且我能够使用/usr/bin/getcifsacl读取ACL。 Further, on a Windows box, reading out ACLs in Java works with: 此外,在Windows机器上,用Java读取ACL可以使用:

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 . 但是,当我将相同的Java代码应用于Linux上的CIFS挂载时,该viewnull

Is there a chance to tweak the CIFS mount or the Java code such that I can read ACLs? 是否有机会调整CIFS挂载或Java代码,以便我可以读取ACL? (I know jCIFS, but need to do without any additional Java class library.) (我知道jCIFS,但是不需要任何其他Java类库。)

An answer would likely help here too . 一个答案在这里也可能会有所帮助

Is there a chance to tweak ... the Java code such that I can read ACLs? 是否有机会调整Java代码,使我可以读取ACL?

You could always download the OpenJDK source code, figure out how to build it, then develop changes to do what you want. 您始终可以下载OpenJDK源代码,弄清楚如何构建它,然后进行更改以完成所需的工作。 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. 作为记录,Linux的OpenJDK构建中的“ rt.jar”文件不包括Windows文件属性视图提供程序类。 They are not there. 他们不在那里。 So you wouldn't be able to use (hypothetical) reflective tweaks to use the Windows views. 因此,您将无法使用(假设的)反射性调整来使用Windows视图。 Maybe you could compile them and add them to the bootclasspath. 也许您可以编译它们并将它们添加到bootclasspath中。


Note that if you are unwilling to use jCIFS for licensing reasons, the same reasoning should prevent you from "tweaking" OpenJDK. 请注意,如果出于许可原因不愿使用jCIFS,则相同的理由也应防止您“调整” OpenJDK。 OpenJDK is licensed as GPLv2 (with the "classpath exception"), and your tweaks would be covered as well. OpenJDK被许可为GPLv2(带有“ classpath异常”),并且您的调整也将涵盖在内。 (Note that jCIFS is LGPLv2.1 ... which should be less problematic than GPLv2.) (请注意,JCIFS是LGPLv2.1 ......这应该是比GPLv2的问题较少 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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