From: Felix Schumacher Date: Thu, 6 Nov 2008 12:14:14 +0000 (+0100) Subject: jcifs-1.2.25 from tgz X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8498a5e280b0e27dada8838f6fb5dc0a678aa49a;p=jcifs_without_docs.git jcifs-1.2.25 from tgz Sun Oct 19 23:25:45 EDT 2008 jcifs-1.2.25 The DcerpcHandle code to increase the stub size if alloc_hint was reater than stub.length was not being engaged properly which would result in an ArrayIndexOutOfBoundsException if the DCERPC response was larger han 0xffff. This has been fixed. Disabled decoding of NativeFileSystem field b/c it seems the iSeries implementation sends this field in ASCII even though Unicode is indicated. Fortunately the field is of no interest to anyone so we can simply omit decoding it. Added check in copyTo to prevent a possible thread lockup when server is disconnected during a copy. Force SMB_COM_TREE_CONNECT_ANDX service to always be what was passed to the constructor (default is '?????'). IBM iSeries apparently does not like explicitly specifying 'A:' which can occur on reconnect after an soTimeout. --- diff --git a/README.txt b/README.txt index f54421d..217f899 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,24 @@ +Sun Oct 19 23:25:45 EDT 2008 +jcifs-1.2.25 + +The DcerpcHandle code to increase the stub size if alloc_hint was greater +than stub.length was not being engaged properly which would result in +an ArrayIndexOutOfBoundsException if the DCERPC response was larger than +0xffff. This has been fixed. + +Disabled decoding of NativeFileSystem field b/c it seems the iSeries +implementation sends this field in ASCII even though Unicode is +indicated. Fortunately the field is of no interest to anyone so we can +simply omit decoding it. + +Added check in copyTo to prevent a possible thread lockup when server +is disconnected during a copy. + +Force SMB_COM_TREE_CONNECT_ANDX service to always be what was passed to +the constructor (default is '?????'). IBM iSeries apparently does not +like explicitly specifying 'A:' which can occur on reconnect after +an soTimeout. + Wed Jul 23 13:35:20 EDT 2008 jcifs-1.2.24 diff --git a/build.xml b/build.xml index 05c1c52..3cbd385 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/jcifs/dcerpc/DcerpcHandle.java b/src/jcifs/dcerpc/DcerpcHandle.java index 7786a82..e8ac0c5 100644 --- a/src/jcifs/dcerpc/DcerpcHandle.java +++ b/src/jcifs/dcerpc/DcerpcHandle.java @@ -203,7 +203,7 @@ public abstract class DcerpcHandle implements DcerpcConstants { off += stub_frag_len; } - buf.reset(); + buf = new NdrBuffer(stub, 0); msg.decode(buf); } finally { jcifs.smb.BufferCache.releaseBuffer(stub); diff --git a/src/jcifs/netbios/NameServiceClient.java b/src/jcifs/netbios/NameServiceClient.java index c250986..80f6ab9 100644 --- a/src/jcifs/netbios/NameServiceClient.java +++ b/src/jcifs/netbios/NameServiceClient.java @@ -258,16 +258,17 @@ class NameServiceClient implements Runnable { responseTable.remove( nid ); } - if (NbtAddress.isWINS( request.addr ) == false) - break; - - /* Message was sent to WINS but - * failed to receive response. - * Try a different WINS server. - */ - if (request.addr == NbtAddress.getWINSAddress()) - NbtAddress.switchWINS(); - request.addr = NbtAddress.getWINSAddress(); + synchronized (LOCK) { + if (NbtAddress.isWINS( request.addr ) == false) + break; + /* Message was sent to WINS but + * failed to receive response. + * Try a different WINS server. + */ + if (request.addr == NbtAddress.getWINSAddress()) + NbtAddress.switchWINS(); + request.addr = NbtAddress.getWINSAddress(); + } } } } diff --git a/src/jcifs/netbios/NameServicePacket.java b/src/jcifs/netbios/NameServicePacket.java index 38b7d47..3107efa 100644 --- a/src/jcifs/netbios/NameServicePacket.java +++ b/src/jcifs/netbios/NameServicePacket.java @@ -251,6 +251,7 @@ abstract class NameServicePacket { break; default: opCodeString = Integer.toString( opCode ); + break; } switch( resultCode ) { case FMT_ERR: @@ -273,14 +274,18 @@ abstract class NameServicePacket { break; default: resultCodeString = "0x" + Hexdump.toHexString( resultCode, 1 ); + break; } switch( questionType ) { case NB: questionTypeString = "NB"; + break; case NBSTAT: questionTypeString = "NBSTAT"; + break; default: questionTypeString = "0x" + Hexdump.toHexString( questionType, 4 ); + break; } switch( recordType ) { case A: @@ -294,10 +299,13 @@ abstract class NameServicePacket { break; case NB: recordTypeString = "NB"; + break; case NBSTAT: recordTypeString = "NBSTAT"; + break; default: recordTypeString = "0x" + Hexdump.toHexString( recordType, 4 ); + break; } return new String( diff --git a/src/jcifs/smb/SmbComTreeConnectAndXResponse.java b/src/jcifs/smb/SmbComTreeConnectAndXResponse.java index 8116089..0ca6f7d 100644 --- a/src/jcifs/smb/SmbComTreeConnectAndXResponse.java +++ b/src/jcifs/smb/SmbComTreeConnectAndXResponse.java @@ -54,10 +54,13 @@ class SmbComTreeConnectAndXResponse extends AndXServerMessageBlock { } bufferIndex += len + 1; // win98 observed not returning nativeFileSystem +/* Problems here with iSeries returning ASCII even though useUnicode = true + * Fortunately we don't really need nativeFileSystem for anything. if( byteCount > bufferIndex - start ) { nativeFileSystem = readString( buffer, bufferIndex ); bufferIndex += stringWireLength( nativeFileSystem, bufferIndex ); } +*/ return bufferIndex - start; } diff --git a/src/jcifs/smb/SmbFile.java b/src/jcifs/smb/SmbFile.java index 2244e24..11df2b7 100644 --- a/src/jcifs/smb/SmbFile.java +++ b/src/jcifs/smb/SmbFile.java @@ -2162,6 +2162,9 @@ if (this instanceof SmbNamedPipe) { send( req, resp ); synchronized( w ) { + if( w.e != null ) { + throw w.e; + } while( !w.ready ) { try { w.wait(); diff --git a/src/jcifs/smb/SmbTree.java b/src/jcifs/smb/SmbTree.java index 951bdcf..7ecabb5 100644 --- a/src/jcifs/smb/SmbTree.java +++ b/src/jcifs/smb/SmbTree.java @@ -32,6 +32,7 @@ class SmbTree { String share; String service = "?????"; + String service0; SmbSession session; boolean treeConnected, inDfs, inDomainDfs; int tree_num; @@ -42,6 +43,7 @@ class SmbTree { if( service != null && service.startsWith( "??" ) == false ) { this.service = service; } + this.service0 = this.service; } boolean matches( String share, String service ) { @@ -140,6 +142,11 @@ synchronized(transport) { unc = "\\\\" + session.transport.tconHostName + '\\' + share; + /* IBM iSeries doesn't like specifying a service. Always reset + * the service to whatever was determined in the constructor. + */ + service = service0; + /* * Tree Connect And X Request / Response */