1 19 20 package jcifs.smb; 21 22 import java.io.UnsupportedEncodingException ; 23 24 class NetServerEnum2 extends SmbComTransaction { 25 26 static final int SV_TYPE_ALL = 0xFFFFFFFF; 27 static final int SV_TYPE_DOMAIN_ENUM = 0x80000000; 28 29 static final String [] DESCR = { 30 "WrLehDz\u0000B16BBDz\u0000", 31 "WrLehDzz\u0000B16BBDz\u0000" 32 }; 33 34 String domain, lastName = null; 35 int serverTypes; 36 37 NetServerEnum2( String domain, int serverTypes ) { 38 this.domain = domain; 39 this.serverTypes = serverTypes; 40 command = SMB_COM_TRANSACTION; 41 subCommand = NET_SERVER_ENUM2; name = "\\PIPE\\LANMAN"; 43 44 maxParameterCount = 8; 45 maxDataCount = 16384; 47 maxSetupCount = (byte)0x00; 48 setupCount = 0; 49 timeout = 5000; 50 } 51 52 void reset( int key, String lastName ) { 53 super.reset(); 54 this.lastName = lastName; 55 } 56 57 int writeSetupWireFormat( byte[] dst, int dstIndex ) { 58 return 0; 59 } 60 int writeParametersWireFormat( byte[] dst, int dstIndex ) { 61 int start = dstIndex; 62 byte[] descr; 63 int which = subCommand == NET_SERVER_ENUM2 ? 0 : 1; 64 65 try { 66 descr = DESCR[which].getBytes( "ASCII" ); 67 } catch( UnsupportedEncodingException uee ) { 68 return 0; 69 } 70 71 writeInt2( subCommand & 0xFF, dst, dstIndex ); 72 dstIndex += 2; 73 System.arraycopy( descr, 0, dst, dstIndex, descr.length ); 74 dstIndex += descr.length; 75 writeInt2( 0x0001, dst, dstIndex ); 76 dstIndex += 2; 77 writeInt2( maxDataCount, dst, dstIndex ); 78 dstIndex += 2; 79 writeInt4( serverTypes, dst, dstIndex ); 80 dstIndex += 4; 81 dstIndex += writeString( domain.toUpperCase(), dst, dstIndex, false ); 82 if( which == 1 ) { 83 dstIndex += writeString( lastName.toUpperCase(), dst, dstIndex, false ); 84 } 85 86 return dstIndex - start; 87 } 88 int writeDataWireFormat( byte[] dst, int dstIndex ) { 89 return 0; 90 } 91 int readSetupWireFormat( byte[] buffer, int bufferIndex, int len ) { 92 return 0; 93 } 94 int readParametersWireFormat( byte[] buffer, int bufferIndex, int len ) { 95 return 0; 96 } 97 int readDataWireFormat( byte[] buffer, int bufferIndex, int len ) { 98 return 0; 99 } 100 public String toString() { 101 return new String ( "NetServerEnum2[" + super.toString() + 102 ",name=" + name + 103 ",serverTypes=" + (serverTypes == SV_TYPE_ALL ? 104 "SV_TYPE_ALL" : "SV_TYPE_DOMAIN_ENUM" ) + 105 "]" ); 106 } 107 } 108 | Popular Tags |