+Tue Dec 9 18:13:25 EST 2003
+jcifs-0.7.16 released
+
+If NT SMBs are not negotiated jCIFS will now use SMB_COM_WRITE as opposed
+to SMB_COM_WRITE_ANDX. This was done to support NetWare 6 which apparently
+does not implement this ANDX command.
+
Thu Oct 23 01:18:29 EDT 2003
jcifs-0.7.15 released
-Thu Oct 23 01:18:29 EDT 2003
+Tue Dec 9 18:13:25 EST 2003
+jcifs-0.7.16 released
+
+An issue regarding writing to NetWare 6 servers has been resolved.
jcifs-0.7.15 released
<target name="jar" depends="smb">
<copy file="src/jcifs/util/mime.map" tofile="build/jcifs/util/mime.map" overwrite="yes"/>
<copy file="src/jcifs/http/ne.css" tofile="build/jcifs/http/ne.css" overwrite="yes"/>
- <jar jarfile="jcifs-0.7.15.jar" basedir="build"/>
+ <jar jarfile="jcifs-0.7.16.jar" basedir="build"/>
</target>
<target name="tgz">
- <copy todir="dist_tmp/jcifs_0.7.15">
+ <copy todir="dist_tmp/jcifs_0.7.16">
<fileset dir="." excludes="ant,**/.*,build,jcifs.prp,**/*.tgz,**/*.zip"/>
</copy>
- <tar tarfile="jcifs-0.7.15.tar" basedir="dist_tmp"/>
- <gzip src="jcifs-0.7.15.tar" zipfile="jcifs-0.7.15.tgz"/>
- <delete file="jcifs-0.7.15.tar"/>
+ <tar tarfile="jcifs-0.7.16.tar" basedir="dist_tmp"/>
+ <gzip src="jcifs-0.7.16.tar" zipfile="jcifs-0.7.16.tgz"/>
+ <delete file="jcifs-0.7.16.tar"/>
<delete dir="dist_tmp"/>
</target>
<target name="zip">
- <copy todir="dist_tmp/jcifs_0.7.15">
+ <copy todir="dist_tmp/jcifs_0.7.16">
<fileset dir="." excludes="ant,**/.*,build,jcifs.prp,**/*.tgz,**/*.zip"/>
</copy>
<fixcrlf srcdir="dist_tmp" cr="add" tab="remove" tablength="4" excludes="**/*.jar,**/*.exe"/>
- <zip zipfile="jcifs-0.7.15.zip" basedir="dist_tmp"/>
+ <zip zipfile="jcifs-0.7.16.zip" basedir="dist_tmp"/>
<delete dir="dist_tmp"/>
</target>
static final byte SMB_COM_DELETE = (byte)0x06;
static final byte SMB_COM_RENAME = (byte)0x07;
static final byte SMB_COM_QUERY_INFORMATION = (byte)0x08;
+ static final byte SMB_COM_WRITE = (byte)0x0B;
static final byte SMB_COM_CHECK_DIRECTORY = (byte)0x10;
static final byte SMB_COM_TRANSACTION = (byte)0x25;
static final byte SMB_COM_TRANSACTION_SECONDARY = (byte)0x26;
--- /dev/null
+/* jcifs smb client library in Java
+ * Copyright (C) 2003 "Michael B. Allen" <jcifs at samba dot org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package jcifs.smb;
+
+import jcifs.Config;
+import java.io.IOException;
+import java.io.InputStream;
+
+class SmbComWrite extends ServerMessageBlock {
+
+ int fid,
+ count,
+ offset,
+ remaining,
+ off;
+ byte[] b;
+
+ SmbComWrite() {
+ super();
+ command = SMB_COM_WRITE;
+ }
+ SmbComWrite( int fid, int offset, int remaining, byte[] b, int off, int len ) {
+ this.fid = fid;
+ this.count = len;
+ this.offset = offset;
+ this.remaining = remaining;
+ this.b = b;
+ this.off = off;
+ command = SMB_COM_WRITE;
+ }
+
+ void setParam( int fid, long offset, int remaining,
+ byte[] b, int off, int len ) {
+ this.fid = fid;
+ this.offset = (int)(offset & 0xFFFFFFFFL);
+ this.remaining = remaining;
+ this.b = b;
+ this.off = off;
+ count = len;
+ }
+ int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
+ int start = dstIndex;
+
+ writeInt2( fid, dst, dstIndex );
+ dstIndex += 2;
+ writeInt2( count, dst, dstIndex );
+ dstIndex += 2;
+ writeInt4( offset, dst, dstIndex );
+ dstIndex += 4;
+ writeInt2( remaining, dst, dstIndex );
+ dstIndex += 2;
+
+ return dstIndex - start;
+ }
+ int writeBytesWireFormat( byte[] dst, int dstIndex ) {
+ int start = dstIndex;
+
+ dst[dstIndex++] = (byte)0x01; /* BufferFormat */
+ writeInt2( count, dst, dstIndex ); /* DataLength? */
+ dstIndex += 2;
+ System.arraycopy( b, off, dst, dstIndex, count );
+ dstIndex += count;
+
+ return dstIndex - start;
+ }
+ int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
+ return 0;
+ }
+ int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
+ return 0;
+ }
+ int readBytesDirectWireFormat( InputStream in, int byteCount ) throws IOException {
+ return 0;
+ }
+ public String toString() {
+ return new String( "SmbComWrite[" +
+ super.toString() +
+ ",fid=" + fid +
+ ",count=" + count +
+ ",offset=" + offset +
+ ",remaining=" + remaining + "]" );
+ }
+}
--- /dev/null
+/* jcifs smb client library in Java\r
+ * Copyright (C) 2003 "Michael B. Allen" <jcifs at samba dot org>\r
+ * \r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ */\r
+\r
+package jcifs.smb;\r
+\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+\r
+class SmbComWriteResponse extends ServerMessageBlock {\r
+\r
+ long count;\r
+\r
+ SmbComWriteResponse() {\r
+ }\r
+\r
+ int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {\r
+ return 0;\r
+ }\r
+ int writeBytesWireFormat( byte[] dst, int dstIndex ) {\r
+ return 0;\r
+ }\r
+ int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {\r
+ count = readInt2( buffer, bufferIndex ) & 0xFFFFL;\r
+ return 8;\r
+ }\r
+ int readBytesWireFormat( byte[] buffer, int bufferIndex ) {\r
+ return 0;\r
+ }\r
+ int readBytesDirectWireFormat( InputStream in, int byteCount ) throws IOException {\r
+ return 0;\r
+ }\r
+ public String toString() {\r
+ return new String( "SmbComWriteResponse[" +\r
+ super.toString() +\r
+ ",count=" + count + "]" );\r
+ }\r
+}\r
boolean ready = true;
SmbFile dest;
SmbException e = null;
- SmbComWriteAndX req = new SmbComWriteAndX();
- SmbComWriteAndXResponse resp = new SmbComWriteAndXResponse();
+ boolean useNTSmbs;
+ SmbComWriteAndX reqx;
+ SmbComWrite req;
+ ServerMessageBlock resp;
- WriterThread() {
+ WriterThread() throws SmbException {
super( "JCIFS-WriterThread" );
+ useNTSmbs = tree.session.transport.hasCapability( ServerMessageBlock.CAP_NT_SMBS );
+ if( useNTSmbs ) {
+ reqx = new SmbComWriteAndX();
+ resp = new SmbComWriteAndXResponse();
+ } else {
+ req = new SmbComWrite();
+ resp = new SmbComWriteResponse();
+ }
}
synchronized void write( byte[] b, int n, SmbFile dest, int off ) {
if( n == -1 ) {
return;
}
- req.setParam( dest.fid, off, n, b, 0, n );
- dest.send( req, resp );
+ if( useNTSmbs ) {
+ reqx.setParam( dest.fid, off, n, b, 0, n );
+ dest.send( reqx, resp );
+ } else {
+ req.setParam( dest.fid, off, n, b, 0, n );
+ dest.send( req, resp );
+ }
notify();
}
} catch( SmbException e ) {
req = new SmbComReadAndX();
resp = new SmbComReadAndXResponse();
- w = new WriterThread();
- w.setDaemon( true );
- w.start();
connect0();
dest.connect0();
+ w = new WriterThread();
+ w.setDaemon( true );
+ w.start();
+
bsize = Math.min( Math.min( tree.session.transport.rcv_buf_size - 70,
dest.tree.session.transport.server.maxBufferSize - 70 ),
Math.min( tree.session.transport.snd_buf_size - 70,
public class SmbFileOutputStream extends OutputStream {\r
\r
private SmbFile file;\r
- private boolean append;\r
+ private boolean append, useNTSmbs;\r
private int openFlags, writeSize;\r
private long fp;\r
private byte[] tmp = new byte[1];\r
+ private SmbComWriteAndX reqx;\r
+ private SmbComWriteAndXResponse rspx;\r
+ private SmbComWrite req;\r
+ private SmbComWriteResponse rsp;\r
\r
/**\r
* Creates an {@link java.io.OutputStream} for writing to a file\r
file.open( openFlags );\r
writeSize = Math.min( file.tree.session.transport.snd_buf_size - 70,\r
file.tree.session.transport.server.maxBufferSize - 70 );\r
+\r
+ useNTSmbs = file.tree.session.transport.hasCapability( ServerMessageBlock.CAP_NT_SMBS );\r
+ if( useNTSmbs ) {\r
+ reqx = new SmbComWriteAndX();\r
+ rspx = new SmbComWriteAndXResponse();\r
+ } else {\r
+ req = new SmbComWrite();\r
+ rsp = new SmbComWriteResponse(); \r
+ }\r
}\r
\r
/**\r
" fid=" + file.fid + ",off=" + off + ",len=" + len );\r
*/\r
int w;\r
- SmbComWriteAndXResponse rsp = new SmbComWriteAndXResponse();\r
do {\r
w = len > writeSize ? writeSize : len;\r
- file.send( new SmbComWriteAndX( file.fid, fp, len - w, b, off, w, null ), rsp );\r
- fp += rsp.count;\r
- len -= rsp.count;\r
- off += rsp.count;\r
+ if( useNTSmbs ) {\r
+ reqx.setParam( file.fid, fp, len - w, b, off, w );\r
+ file.send( reqx, rspx );\r
+ fp += rspx.count;\r
+ len -= rspx.count;\r
+ off += rspx.count;\r
+ } else {\r
+ req.setParam( file.fid, fp, len - w, b, off, w );\r
+ fp += rsp.count;\r
+ len -= rsp.count;\r
+ off += rsp.count;\r
+ file.send( req, rsp );\r
+ }\r
} while( len > 0 );\r
}\r
}\r
client.flags2 &= 0xFFFF ^ ServerMessageBlock.FLAGS2_UNICODE;
client.capabilities &= 0xFFFF ^ ServerMessageBlock.CAP_UNICODE;
}
- if( Config.getBoolean( "jcifs.smb.client.useNTSmbs", false ) == true ) {
- client.capabilities |= ServerMessageBlock.CAP_NT_SMBS;
+ if( Config.getBoolean( "jcifs.smb.client.useNTSmbs", true ) == false ) {
+ client.capabilities &= ~ServerMessageBlock.CAP_NT_SMBS;
}
useSigning = Config.getBoolean("jcifs.smb.client.signingPreferred", false);
if( useSigning ) {
}
if( service.equals( "A:" ) == false ) {
switch( request.command ) {
+ case ServerMessageBlock.SMB_COM_WRITE:
case ServerMessageBlock.SMB_COM_OPEN_ANDX:
case ServerMessageBlock.SMB_COM_NT_CREATE_ANDX:
case ServerMessageBlock.SMB_COM_READ_ANDX: