DcerpcPipeHandlepublic class DcerpcPipeHandle extends DcerpcHandle
Fields Summary |
---|
SmbNamedPipe | pipe | SmbFileInputStream | in | SmbFileOutputStream | out | boolean | isStart |
Constructors Summary |
---|
public DcerpcPipeHandle(String url, NtlmPasswordAuthentication auth)
binding = DcerpcHandle.parseBinding(url);
url = "smb://" + binding.server + "/IPC$/" + binding.endpoint.substring(6);
String params = "", server, address;
server = (String)binding.getOption("server");
if (server != null)
params += "&server=" + server;
address = (String)binding.getOption("address");
if (server != null)
params += "&address=" + address;
if (params.length() > 0)
url += "?" + params.substring(1);
pipe = new SmbNamedPipe(url,
/* This 0x20000 bit is going to get chopped! */
(0x2019F << 16) | SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_DCE_TRANSACT,
auth);
|
Methods Summary |
---|
public void | close()
state = 0;
if (out != null)
out.close();
| protected void | doReceiveFragment(byte[] buf, boolean isDirect)
int off, flags, length;
if (buf.length < max_recv)
throw new IllegalArgumentException("buffer too small");
if (isStart && !isDirect) { // start of new frag, do trans
off = in.read(buf, 0, 1024);
} else {
off = in.readDirect(buf, 0, buf.length);
}
if (buf[0] != 5 && buf[1] != 0)
throw new IOException("Unexpected DCERPC PDU header");
flags = buf[3] & 0xFF;
// next read is start of new frag
isStart = (flags & DCERPC_LAST_FRAG) == DCERPC_LAST_FRAG;
length = Encdec.dec_uint16le(buf, 8);
if (length > max_recv)
throw new IOException("Unexpected fragment length: " + length);
while (off < length) {
off += in.readDirect(buf, off, length - off);
}
| protected void | doSendFragment(byte[] buf, int off, int length, boolean isDirect)
if (out != null && out.isOpen() == false)
throw new IOException("DCERPC pipe is no longer open");
if (in == null)
in = (SmbFileInputStream)pipe.getNamedPipeInputStream();
if (out == null)
out = (SmbFileOutputStream)pipe.getNamedPipeOutputStream();
if (isDirect) {
out.writeDirect( buf, off, length, 1 );
return;
}
out.write(buf, off, length);
|
|