1 19 20 package com.knowgate.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 = 4096; 46 maxSetupCount = (byte)0x00; 47 setupCount = 0; 48 timeout = 5000; 49 } 50 51 void reset( int key, String lastName ) { 52 super.reset(); 53 this.lastName = lastName; 54 } 55 56 int writeSetupWireFormat( byte[] dst, int dstIndex ) { 57 return 0; 58 } 59 int writeParametersWireFormat( byte[] dst, int dstIndex ) { 60 int start = dstIndex; 61 byte[] descr; 62 int which = subCommand == NET_SERVER_ENUM2 ? 0 : 1; 63 64 try { 65 descr = DESCR[which].getBytes( "ASCII" ); 66 } catch( UnsupportedEncodingException uee ) { 67 return 0; 68 } 69 70 writeInt2( subCommand & 0xFF, dst, dstIndex ); 71 dstIndex += 2; 72 System.arraycopy( descr, 0, dst, dstIndex, descr.length ); 73 dstIndex += descr.length; 74 writeInt2( 0x0001, dst, dstIndex ); 75 dstIndex += 2; 76 writeInt2( maxDataCount, dst, dstIndex ); 77 dstIndex += 2; 78 writeInt4( serverTypes, dst, dstIndex ); 79 dstIndex += 4; 80 dstIndex += writeString( domain.toUpperCase(), dst, dstIndex, false ); 81 if( which == 1 ) { 82 dstIndex += writeString( lastName.toUpperCase(), dst, dstIndex, false ); 83 } 84 85 return dstIndex - start; 86 } 87 int writeDataWireFormat( byte[] dst, int dstIndex ) { 88 return 0; 89 } 90 int readSetupWireFormat( byte[] buffer, int bufferIndex, int len ) { 91 return 0; 92 } 93 int readParametersWireFormat( byte[] buffer, int bufferIndex, int len ) { 94 return 0; 95 } 96 int readDataWireFormat( byte[] buffer, int bufferIndex, int len ) { 97 return 0; 98 } 99 public String toString() { 100 return new String ( "NetServerEnum2[" + super.toString() + 101 ",name=" + name + 102 ",serverTypes=" + (serverTypes == SV_TYPE_ALL ? 103 "SV_TYPE_ALL" : "SV_TYPE_DOMAIN_ENUM" ) + 104 "]" ); 105 } 106 } 107 | Popular Tags |