SmbFileHandleImpl openUnshared ( int flags, int access, int sharing, int attrs, int options ) throws CIFSException { return openUnshared(getUncPath(), flags, access, sharing, attrs, options); }
SmbFileHandleImpl openUnshared ( int flags, int access, int sharing, int attrs, int options ) throws CIFSException { return openUnshared(getUncPath(), flags, access, sharing, attrs, options); }
return dest.openUnshared( SmbConstants.O_CREAT | SmbConstants.O_WRONLY | SmbConstants.O_TRUNC, SmbConstants.FILE_WRITE_DATA | SmbConstants.FILE_WRITE_ATTRIBUTES | ( alsoRead ? SmbConstants.FILE_READ_DATA : 0 ), return dest.openUnshared( SmbConstants.O_CREAT | SmbConstants.O_WRONLY | SmbConstants.O_TRUNC, SmbConstants.FILE_WRITE_DATA | SmbConstants.FILE_WRITE_ATTRIBUTES | ( alsoRead ? SmbConstants.FILE_READ_DATA : 0 ),
return dest.openUnshared( SmbConstants.O_CREAT | SmbConstants.O_WRONLY | SmbConstants.O_TRUNC, SmbConstants.FILE_WRITE_DATA | SmbConstants.FILE_WRITE_ATTRIBUTES | ( alsoRead ? SmbConstants.FILE_READ_DATA : 0 ), return dest.openUnshared( SmbConstants.O_CREAT | SmbConstants.O_WRONLY | SmbConstants.O_TRUNC, SmbConstants.FILE_WRITE_DATA | SmbConstants.FILE_WRITE_ATTRIBUTES | ( alsoRead ? SmbConstants.FILE_READ_DATA : 0 ),
protected synchronized SmbFileHandleImpl ensureOpen () throws CIFSException { if ( !isOpen() ) { // one extra acquire to keep this open till the stream is released this.handle = this.file.openUnshared(this.openFlags, this.access, this.sharing, SmbConstants.ATTR_NORMAL, 0).acquire(); if ( this.append ) { this.fp = this.handle.getInitialSize(); if ( log.isDebugEnabled() ) { log.debug("File pointer is at " + this.fp); } } return this.handle; } log.trace("File already open"); return this.handle.acquire(); }
protected synchronized SmbFileHandleImpl ensureOpen () throws CIFSException { if ( !isOpen() ) { // one extra acquire to keep this open till the stream is released this.handle = this.file.openUnshared(this.openFlags, this.access, this.sharing, SmbConstants.ATTR_NORMAL, 0).acquire(); if ( this.append ) { this.fp = this.handle.getInitialSize(); if ( log.isDebugEnabled() ) { log.debug("File pointer is at " + this.fp); } } return this.handle; } log.trace("File already open"); return this.handle.acquire(); }
/** * @return * @throws SmbException */ synchronized SmbFileHandleImpl ensureOpen () throws CIFSException { // ensure file is open if ( this.handle == null || !this.handle.isValid() ) { // one extra acquire to keep this open till the stream is released this.handle = this.file.openUnshared(this.openFlags, this.access, this.sharing, SmbConstants.ATTR_NORMAL, this.options).acquire(); return this.handle; } return this.handle.acquire(); }
/** * @return * @throws SmbException */ synchronized SmbFileHandleImpl ensureOpen () throws CIFSException { // ensure file is open if ( this.handle == null || !this.handle.isValid() ) { // one extra acquire to keep this open till the stream is released this.handle = this.file.openUnshared(this.openFlags, this.access, this.sharing, SmbConstants.ATTR_NORMAL, this.options).acquire(); return this.handle; } return this.handle.acquire(); }
this.handle = this.file.openUnshared( SmbConstants.O_EXCL, ( (SmbNamedPipe) this.file ).getPipeType() & 0xFF0000, .openUnshared( this.openFlags, this.access,
this.handle = this.file.openUnshared( SmbConstants.O_EXCL, ( (SmbNamedPipe) this.file ).getPipeType() & 0xFF0000, .openUnshared( this.openFlags, this.access,
@Override public SmbWatchHandle watch ( int filter, boolean recursive ) throws CIFSException { if ( filter == 0 ) { throw new IllegalArgumentException("filter must not be 0"); } if ( !isDirectory() ) { throw new SmbException("Is not a directory"); } try ( SmbTreeHandleImpl th = ensureTreeConnected() ) { if ( !th.isSMB2() && !th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { throw new SmbUnsupportedOperationException("Not supported without CAP_NT_SMBS"); } return new SmbWatchHandleImpl(openUnshared(O_RDONLY, READ_CONTROL | GENERIC_READ, DEFAULT_SHARING, 0, 1), filter, recursive); } }
@Override public SmbWatchHandle watch ( int filter, boolean recursive ) throws CIFSException { if ( filter == 0 ) { throw new IllegalArgumentException("filter must not be 0"); } if ( !isDirectory() ) { throw new SmbException("Is not a directory"); } try ( SmbTreeHandleImpl th = ensureTreeConnected() ) { if ( !th.isSMB2() && !th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { throw new SmbUnsupportedOperationException("Not supported without CAP_NT_SMBS"); } return new SmbWatchHandleImpl(openUnshared(O_RDONLY, READ_CONTROL | GENERIC_READ, DEFAULT_SHARING, 0, 1), filter, recursive); } }
@Override public void createNewFile () throws SmbException { if ( this.fileLocator.isRootOrShare() ) { throw new SmbException("Invalid operation for workgroups, servers, or shares"); } try ( SmbTreeHandleImpl th = ensureTreeConnected() ) { if ( th.isSMB2() ) { withOpen(th, Smb2CreateRequest.FILE_OPEN_IF, O_RDWR, 0, null); } else { try ( SmbFileHandle fd = openUnshared(O_RDWR | O_CREAT | O_EXCL, O_RDWR, FILE_NO_SHARE, ATTR_NORMAL, 0) ) { // close explicitly fd.close(0L); } } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }
@Override public void createNewFile () throws SmbException { if ( this.fileLocator.isRootOrShare() ) { throw new SmbException("Invalid operation for workgroups, servers, or shares"); } try ( SmbTreeHandleImpl th = ensureTreeConnected() ) { if ( th.isSMB2() ) { withOpen(th, Smb2CreateRequest.FILE_OPEN_IF, O_RDWR, 0, null); } else { try ( SmbFileHandle fd = openUnshared(O_RDWR | O_CREAT | O_EXCL, O_RDWR, FILE_NO_SHARE, ATTR_NORMAL, 0) ) { // close explicitly fd.close(0L); } } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }
try ( SmbFileHandleImpl sfd = src.openUnshared(0, SmbConstants.O_RDONLY, SmbConstants.FILE_SHARE_READ, SmbConstants.ATTR_NORMAL, 0); SmbFileInputStream fis = new SmbFileInputStream(src, sh, sfd) ) { int attrs = src.getAttributes();
try ( SmbFileHandleImpl sfd = src.openUnshared(0, SmbConstants.O_RDONLY, SmbConstants.FILE_SHARE_READ, SmbConstants.ATTR_NORMAL, 0); SmbFileInputStream fis = new SmbFileInputStream(src, sh, sfd) ) { int attrs = src.getAttributes();
SecurityDescriptor querySecurity ( SmbTreeHandleImpl th, int types ) throws CIFSException { if ( th.isSMB2() ) { Smb2QueryInfoRequest req = new Smb2QueryInfoRequest(th.getConfig()); req.setInfoType(Smb2Constants.SMB2_0_INFO_SECURITY); req.setAdditionalInformation(types); Smb2QueryInfoResponse resp = withOpen(th, req); return resp.getInfo(SecurityDescriptor.class); } if ( !th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { throw new SmbUnsupportedOperationException("Not supported without CAP_NT_SMBS/SMB2"); } NtTransQuerySecurityDescResponse response = new NtTransQuerySecurityDescResponse(getContext().getConfig()); try ( SmbFileHandleImpl f = openUnshared(O_RDONLY, READ_CONTROL, DEFAULT_SHARING, 0, isDirectory() ? 1 : 0) ) { /* * NtTrans Query Security Desc Request / Response */ NtTransQuerySecurityDesc request = new NtTransQuerySecurityDesc(getContext().getConfig(), f.getFid(), types); response = th.send(request, response, RequestParam.NO_RETRY); return response.getSecurityDescriptor(); } }
SecurityDescriptor querySecurity ( SmbTreeHandleImpl th, int types ) throws CIFSException { if ( th.isSMB2() ) { Smb2QueryInfoRequest req = new Smb2QueryInfoRequest(th.getConfig()); req.setInfoType(Smb2Constants.SMB2_0_INFO_SECURITY); req.setAdditionalInformation(types); Smb2QueryInfoResponse resp = withOpen(th, req); return resp.getInfo(SecurityDescriptor.class); } if ( !th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { throw new SmbUnsupportedOperationException("Not supported without CAP_NT_SMBS/SMB2"); } NtTransQuerySecurityDescResponse response = new NtTransQuerySecurityDescResponse(getContext().getConfig()); try ( SmbFileHandleImpl f = openUnshared(O_RDONLY, READ_CONTROL, DEFAULT_SHARING, 0, isDirectory() ? 1 : 0) ) { /* * NtTrans Query Security Desc Request / Response */ NtTransQuerySecurityDesc request = new NtTransQuerySecurityDesc(getContext().getConfig(), f.getFid(), types); response = th.send(request, response, RequestParam.NO_RETRY); return response.getSecurityDescriptor(); } }
try ( SmbFileHandleImpl f = openUnshared( O_RDONLY, FILE_WRITE_ATTRIBUTES,
try ( SmbFileHandleImpl f = openUnshared( O_RDONLY, FILE_WRITE_ATTRIBUTES,