void connect0() throws SmbException { try { connect(); } catch( UnknownHostException uhe ) { throw new SmbException( "Failed to connect to server", uhe ); } catch( SmbException se ) { throw se; } catch( IOException ioe ) { throw new SmbException( "Failed to connect to server", ioe ); } } void doConnect() throws IOException {
public final void readFully( byte b[], int off, int len ) throws SmbException { int n = 0, count; do { count = this.read( b, off + n, len - n ); if( count < 0 ) throw new SmbException( "EOF" ); n += count; fp += count; } while( n < len ); } public int skipBytes( int n ) throws SmbException {
public final void readFully( byte b[], int off, int len ) throws SmbException { int n = 0, count; do { count = this.read( b, off + n, len - n ); if( count < 0 ) throw new SmbException( "EOF" ); n += count; fp += count; } while( n < len ); } public int skipBytes( int n ) throws SmbException {
public final int readUnsignedByte() throws SmbException { if((read( tmp, 0, 1 )) < 0 ) { throw new SmbException( "EOF" ); } return tmp[0] & 0xFF; } public final short readShort() throws SmbException {
public void connect() throws SmbException { try { super.connect( RESPONSE_TIMEOUT ); } catch( TransportException te ) { throw new SmbException( "Failed to connect: " + address, te ); } } protected void doConnect() throws IOException {
public final float readFloat() throws SmbException { if((read( tmp, 0, 4 )) < 0 ) { throw new SmbException( "EOF" ); } return Encdec.dec_floatbe( tmp, 0 ); } public final double readDouble() throws SmbException {
public final char readChar() throws SmbException { if((read( tmp, 0, 2 )) < 0 ) { throw new SmbException( "EOF" ); } return (char)Encdec.dec_uint16be( tmp, 0 ); } public final int readInt() throws SmbException {
public final long readLong() throws SmbException { if((read( tmp, 0, 8 )) < 0 ) { throw new SmbException( "EOF" ); } return Encdec.dec_uint64be( tmp, 0 ); } public final float readFloat() throws SmbException {
public LsaPolicyHandle(DcerpcHandle handle, String server, int access) throws IOException { if (server == null) server = "\\\\"; MsrpcLsarOpenPolicy2 rpc = new MsrpcLsarOpenPolicy2(server, access, this); handle.sendrecv(rpc); if (rpc.retval != 0) throw new SmbException(rpc.retval, false); }
public SamrAliasHandle ( DcerpcHandle handle, SamrDomainHandle domainHandle, int access, int rid ) throws IOException { this.handle = handle; MsrpcSamrOpenAlias rpc = new MsrpcSamrOpenAlias(domainHandle, access, rid, this); handle.sendrecv(rpc); if ( rpc.retval != 0 ) { throw new SmbException(rpc.retval, false); } this.opened = true; }
@Override public synchronized void close () throws IOException { if ( this.opened ) { this.opened = false; MsrpcSamrCloseHandle rpc = new MsrpcSamrCloseHandle(this); this.handle.sendrecv(rpc); if ( rpc.retval != 0 ) { throw new SmbException(rpc.retval, false); } } } }
@Override public synchronized void close () throws IOException { if ( this.opened ) { this.opened = false; MsrpcSamrCloseHandle rpc = new MsrpcSamrCloseHandle(this); this.handle.sendrecv(rpc); if ( rpc.retval != 0 ) { throw new SmbException(rpc.retval, false); } } } }
public final short readShort() throws SmbException { if((read( tmp, 0, 2 )) < 0 ) { throw new SmbException( "EOF" ); } return Encdec.dec_uint16be( tmp, 0 ); } public final int readUnsignedShort() throws SmbException {
public final float readFloat() throws SmbException { if((read( tmp, 0, 4 )) < 0 ) { throw new SmbException( "EOF" ); } return Encdec.dec_floatbe( tmp, 0 ); } public final double readDouble() throws SmbException {
public final String readUTF() throws SmbException { int size = readUnsignedShort(); byte[] b = new byte[size]; read( b, 0, size ); try { return Encdec.dec_utf8( b, 0, size ); } catch( IOException ioe ) { throw new SmbException( "", ioe ); } } public final void writeBoolean( boolean v ) throws SmbException {
public final String readUTF() throws SmbException { int size = readUnsignedShort(); byte[] b = new byte[size]; read( b, 0, size ); try { return Encdec.dec_utf8( b, 0, size ); } catch( IOException ioe ) { throw new SmbException( "", ioe ); } } public final void writeBoolean( boolean v ) throws SmbException {
@Override public void setLastModified ( long time ) throws SmbException { if ( this.fileLocator.isRootOrShare() ) { throw new SmbException("Invalid operation for workgroups, servers, or shares"); } try { setPathInformation(0, 0L, time, 0L); } catch ( CIFSException e ) { throw SmbException.wrap(e); } }
FileEntry[] doNetShareEnum() throws SmbException { SmbComTransaction req = new NetShareEnum(); SmbComTransactionResponse resp = new NetShareEnumResponse(); send(req, resp); if (resp.status != SmbException.ERROR_SUCCESS) throw new SmbException(resp.status, true); return resp.results; } void doNetServerEnum(ArrayList list,
static FileEntry[] doMsrpcShareEnum ( CIFSContext ctx, SmbResourceLocator loc, Address address ) throws IOException { try ( DcerpcHandle handle = DcerpcHandle.getHandle("ncacn_np:" + getRPCTarget(ctx, loc, address) + "[\\PIPE\\srvsvc]", ctx) ) { MsrpcShareEnum rpc = new MsrpcShareEnum(loc.getServer()); handle.sendrecv(rpc); if ( rpc.retval != 0 ) { throw new SmbException(rpc.retval, true); } return rpc.getEntries(); } }
static FileEntry[] doNetShareEnum ( SmbTreeHandleImpl th ) throws CIFSException { SmbComTransaction req = new NetShareEnum(th.getConfig()); SmbComTransactionResponse resp = new NetShareEnumResponse(th.getConfig()); th.send(req, resp); if ( resp.getStatus() != WinError.ERROR_SUCCESS ) throw new SmbException(resp.getStatus(), true); return resp.getResults(); }