[jcifs] Problem setting attributes for directories

Thomas Bley bley at in.tum.de
Mon Jun 20 17:56:38 GMT 2005


Hi all, hi Mike,

still the same problem with changing attributes on a folder:
I'm using this (administrator is the administrator and has full rights
on the share and the folder):
Using the Windows Explorer on \\192.168.233.1\administrator and changing
the attributes (adding hidden attribute) for "ext" works.

using jcifs-1.2.0.zip:

import jcifs.smb.*;
public class SetAttrs2 {
     public static void main( String argv[] ) throws Exception {
         SmbFile f = new
SmbFile("smb://administrator:xyz@192.168.233.1:139/administrator/ext/");
         f.setAttributes( f.getAttributes() );
     }
}

gives me:
Exception in thread "main" jcifs.smb.SmbException: Access is denied.
	at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:436)
	at jcifs.smb.SmbTransport.send(SmbTransport.java:528)
	at jcifs.smb.SmbSession.send(SmbSession.java:226)
	at jcifs.smb.SmbTree.send(SmbTree.java:92)
	at jcifs.smb.SmbFile.send(SmbFile.java:687)
	at jcifs.smb.SmbFile.open0(SmbFile.java:826)
	at jcifs.smb.SmbFile.setPathInformation(SmbFile.java:2250)
	at jcifs.smb.SmbFile.setAttributes(SmbFile.java:2320)
	at SetAttrs2.main(SetAttrs2.java:7)


using:
         f.setAttributes( f.getAttributes() | f.ATTR_HIDDEN );

gives me:
Exception in thread "main" jcifs.smb.SmbException: Access is denied.
	at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:436)
	at jcifs.smb.SmbTransport.send(SmbTransport.java:528)
	at jcifs.smb.SmbSession.send(SmbSession.java:226)
	at jcifs.smb.SmbTree.send(SmbTree.java:92)
	at jcifs.smb.SmbFile.send(SmbFile.java:687)
	at jcifs.smb.SmbFile.open0(SmbFile.java:826)
	at jcifs.smb.SmbFile.setPathInformation(SmbFile.java:2250)
	at jcifs.smb.SmbFile.setAttributes(SmbFile.java:2320)
	at SetAttrs2.main(SetAttrs2.java:7)


Can someone try the same and tell me if it works on his machine ?
(Doing the same with a file instead of a directory works for me)

bye
tom

Michael B Allen wrote:
> Thomas Bley said:
>
>>Hi,
>>
>>I tried the following:
>>
>>SmbFile f = new SmbFile( "smb://user:pw@host/share/test/" );
>>f.setAttributes( f.getAttributes() );
>>
>>gives me:
>>
>>Exception in thread "main" jcifs.smb.SmbException: Access is denied.
>
>
> Check the ACL. I bet the user really doesn't have permission to set
> attribtues. If the ACL is ok and it still doesn't work, try setting
> specific attributes to see if it makes any difference. If it does 
there is
> a bug (a few revs back I allowed all bits of the AccessMask to be 
returned
> by getAttributes so setting ALL of them may not be correct).
>
> Mike
>
>




More information about the jcifs mailing list