1 18 19 package jcifs.smb; 20 21 import java.io.UnsupportedEncodingException ; 22 23 class SmbComSessionSetupAndXResponse extends AndXServerMessageBlock { 24 25 private String nativeOs = ""; 26 private String nativeLanMan = ""; 27 private String primaryDomain = ""; 28 29 boolean isLoggedInAsGuest; 30 31 SmbComSessionSetupAndXResponse( ServerMessageBlock andx ) { 32 super( andx ); 33 } 34 35 int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) { 36 return 0; 37 } 38 int writeBytesWireFormat( byte[] dst, int dstIndex ) { 39 return 0; 40 } 41 int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) { 42 isLoggedInAsGuest = ( buffer[bufferIndex] & 0x01 ) == 0x01 ? true : false; 43 return 2; 44 } 45 int readBytesWireFormat( byte[] buffer, int bufferIndex ) { 46 int start = bufferIndex; 47 48 nativeOs = readString( buffer, bufferIndex ); 49 bufferIndex += stringWireLength( nativeOs, bufferIndex ); 50 nativeLanMan = readString( buffer, bufferIndex ); 51 bufferIndex += stringWireLength( nativeLanMan, bufferIndex ); 52 53 if( useUnicode ) { 54 int len; 55 56 if((( bufferIndex - headerStart ) % 2 ) != 0 ) { 57 bufferIndex++; 58 } 59 60 len = 0; 61 while( buffer[bufferIndex + len] != (byte)0x00 ) { 62 len += 2; 63 if( len > 256 ) { 64 throw new RuntimeException ( "zero termination not found" ); 65 } 66 } 67 try { 68 primaryDomain = new String ( buffer, bufferIndex, len, "UnicodeLittle" ); 69 } catch( UnsupportedEncodingException uee ) { 70 if( log.level > 1 ) 71 uee.printStackTrace( log ); 72 } 73 bufferIndex += len; 74 } else { 75 primaryDomain = readString( buffer, bufferIndex ); 76 bufferIndex += stringWireLength( primaryDomain, bufferIndex ); 77 } 78 79 return bufferIndex - start; 80 } 81 public String toString() { 82 String result = new String ( "SmbComSessionSetupAndXResponse[" + 83 super.toString() + 84 ",isLoggedInAsGuest=" + isLoggedInAsGuest + 85 ",nativeOs=" + nativeOs + 86 ",nativeLanMan=" + nativeLanMan + 87 ",primaryDomain=" + primaryDomain + "]" ); 88 return result; 89 } 90 } 91 92 | Popular Tags |