SmbComTreeConnectAndXpublic class SmbComTreeConnectAndX extends AndXServerMessageBlock
Fields Summary |
---|
private static final boolean | DISABLE_PLAIN_TEXT_PASSWORDS | private SmbSession | session | private boolean | disconnectTid | private String | service | private byte[] | password | private int | passwordLength | String | path | private static byte[] | batchLimits |
Constructors Summary |
---|
SmbComTreeConnectAndX(SmbSession session, String path, String service, ServerMessageBlock andx)
String s;
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.CheckDirectory" )) != null ) {
batchLimits[0] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.CreateDirectory" )) != null ) {
batchLimits[2] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.Delete" )) != null ) {
batchLimits[3] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.DeleteDirectory" )) != null ) {
batchLimits[4] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.OpenAndX" )) != null ) {
batchLimits[5] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.Rename" )) != null ) {
batchLimits[6] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.Transaction" )) != null ) {
batchLimits[7] = Byte.parseByte( s );
}
if(( s = Config.getProperty( "jcifs.smb.client.TreeConnectAndX.QueryInformation" )) != null ) {
batchLimits[8] = Byte.parseByte( s );
}
super( andx );
this.session = session;
this.path = path;
this.service = service;
command = SMB_COM_TREE_CONNECT_ANDX;
|
Methods Summary |
---|
int | getBatchLimit(byte command)
int c = (int)( command & 0xFF );
// why isn't this just return batchLimits[c]?
switch( c ) {
case SMB_COM_CHECK_DIRECTORY:
return batchLimits[0];
case SMB_COM_CREATE_DIRECTORY:
return batchLimits[2];
case SMB_COM_DELETE:
return batchLimits[3];
case SMB_COM_DELETE_DIRECTORY:
return batchLimits[4];
case SMB_COM_OPEN_ANDX:
return batchLimits[5];
case SMB_COM_RENAME:
return batchLimits[6];
case SMB_COM_TRANSACTION:
return batchLimits[7];
case SMB_COM_QUERY_INFORMATION:
return batchLimits[8];
}
return 0;
| int | readBytesWireFormat(byte[] buffer, int bufferIndex)
return 0;
| int | readParameterWordsWireFormat(byte[] buffer, int bufferIndex)
return 0;
| public java.lang.String | toString()
String result = new String( "SmbComTreeConnectAndX[" +
super.toString() +
",disconnectTid=" + disconnectTid +
",passwordLength=" + passwordLength +
",password=" + Hexdump.toHexString( password, passwordLength, 0 ) +
",path=" + path +
",service=" + service + "]" );
return result;
| int | writeBytesWireFormat(byte[] dst, int dstIndex)
int start = dstIndex;
if( session.transport.server.security == SECURITY_SHARE &&
( session.auth.hashesExternal ||
session.auth.password.length() > 0 )) {
System.arraycopy( password, 0, dst, dstIndex, passwordLength );
dstIndex += passwordLength;
} else {
// no password in tree connect
dst[dstIndex++] = (byte)0x00;
}
dstIndex += writeString( path, dst, dstIndex );
try {
System.arraycopy( service.getBytes( "ASCII" ), 0, dst, dstIndex, service.length() );
} catch( UnsupportedEncodingException uee ) {
return 0;
}
dstIndex += service.length();
dst[dstIndex++] = (byte)'\0";
return dstIndex - start;
| int | writeParameterWordsWireFormat(byte[] dst, int dstIndex)
if( session.transport.server.security == SECURITY_SHARE &&
( session.auth.hashesExternal ||
session.auth.password.length() > 0 )) {
if( session.transport.server.encryptedPasswords ) {
// encrypted
password = session.auth.getAnsiHash( session.transport.server.encryptionKey );
passwordLength = password.length;
} else if( DISABLE_PLAIN_TEXT_PASSWORDS ) {
throw new RuntimeException( "Plain text passwords are disabled" );
} else {
// plain text
password = new byte[(session.auth.password.length() + 1) * 2];
passwordLength = writeString( session.auth.password, password, 0 );
}
} else {
// no password in tree connect
passwordLength = 1;
}
dst[dstIndex++] = disconnectTid ? (byte)0x01 : (byte)0x00;
dst[dstIndex++] = (byte)0x00;
writeInt2( passwordLength, dst, dstIndex );
return 4;
|
|