+Mon Apr 19 20:23:10 EDT 2004
+jcifs-0.8.3 released / File Corruption with HotSpot
+
+A serious bug was discovered in the HotSpot VM on Linux that can cause an
+offset field to be encoded incorrectly resulting in file corruption. A bug
+report has been submitted and the code in question has been modified to
+avoid the problem. If you are using the <tt>-server</tt> option on Linux
+you must upgrade to this version of jCIFS. Big thanks to Richard Heap for
+diagnosing and fixing this very elusive issue.
+
Sun Mar 14 18:54:14 EST 2004
jcifs-0.8.2 released
+Mon Apr 19 20:23:10 EDT 2004
+jcifs-0.8.3 released / File Corruption with HotSpot
+
+A serious bug was discovered in the HotSpot VM on Linux that can cause file
+corruption. It has been fixed.
+
Sun Mar 14 18:54:14 EST 2004
jcifs-0.8.2 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.8.2.jar" basedir="build"/>
+ <jar jarfile="jcifs-0.8.3.jar" basedir="build"/>
</target>
<target name="tgz">
- <copy todir="dist_tmp/jcifs_0.8.2">
+ <copy todir="dist_tmp/jcifs_0.8.3">
<fileset dir="." excludes="ant,**/.*,build,jcifs.prp,**/*.tgz,**/*.zip"/>
</copy>
- <tar tarfile="jcifs-0.8.2.tar" basedir="dist_tmp"/>
- <gzip src="jcifs-0.8.2.tar" zipfile="jcifs-0.8.2.tgz"/>
- <delete file="jcifs-0.8.2.tar"/>
+ <tar tarfile="jcifs-0.8.3.tar" basedir="dist_tmp"/>
+ <gzip src="jcifs-0.8.3.tar" zipfile="jcifs-0.8.3.tgz"/>
+ <delete file="jcifs-0.8.3.tar"/>
<delete dir="dist_tmp"/>
</target>
<target name="zip">
- <copy todir="dist_tmp/jcifs_0.8.2">
+ <copy todir="dist_tmp/jcifs_0.8.3">
<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.8.2.zip" basedir="dist_tmp"/>
+ <zip zipfile="jcifs-0.8.3.zip" basedir="dist_tmp"/>
<delete dir="dist_tmp"/>
</target>
byte[] buf = new byte[4096];
int n;
while(( n = in.read( buf )) != -1 ) {
- System.out.write( buf, 0, n );
+ System.out.print( " " + n );
}
} else {
System.out.println( "stream waz null" );
$RUN Get ${URL_SHARE}${FILE1}
$RUN GetType ${URL_SHARE}
$RUN GrowWrite ${URL_WRITE_DIR}GrowWrite.txt
-$RUN GetURL ${URL_WRITE_DIR}Append.txt
-$RUN HttpURL ${URL_WRITE_DIR}Append.txt
+$RUN GetURL ${URL_WRITE_DIR}GrowWrite.txt
+$RUN HttpURL ${URL_WRITE_DIR} GrowWrite.txt
$RUN Interleave ${URL_WRITE_DIR} 3
$RUN IsDir ${URL_SHARE}${SRC_DIR}/
$RUN Length ${URL_SHARE}${FILE1}
dstIndex += writeHeaderWireFormat( dst, dstIndex );
dstIndex += writeAndXWireFormat( dst, dstIndex );
length = dstIndex - start;
+//Log.printHexDump( System.err, Thread.currentThread().getName() + ": writeWireFormat", dst, 0, Math.min( dstIndex, 63 ));
return length;
}
dst[start + ANDX_OFFSET_OFFSET + 1] = (byte)0x00;
// andx not used; return
+//Log.printHexDump( System.err, Thread.currentThread().getName() + ": writeAndXWireFormat1", dst, 0, Math.min( dstIndex, 63 ));
return dstIndex - start;
}
dstIndex += andx.byteCount;
}
+//Log.printHexDump( System.err, Thread.currentThread().getName() + ": writeAndXWireFormat1", dst, 0, Math.min( dstIndex, 63 ));
return dstIndex - start;
}
int readAndXWireFormat( InputStream in,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00
};
+
static void writeInt2( long val, byte[] dst, int dstIndex ) {
- dst[dstIndex++] = (byte)((int)(val >>> 0) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 8) & 0xFF);
+ dst[dstIndex] = (byte)(val);
+ dst[++dstIndex] = (byte)(val >> 8);
}
static void writeInt4( long val, byte[] dst, int dstIndex ) {
- dst[dstIndex++] = (byte)((int)(val >>> 0) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 8) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 16) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 24) & 0xFF);
+ dst[dstIndex] = (byte)(val);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >> 8);
}
static int readInt2( byte[] src, int srcIndex ) {
return ( src[srcIndex] & 0xFF ) +
return (readInt4( src, srcIndex ) & 0xFFFFFFFFL) +
((long)(readInt4( src, srcIndex + 4 )) << 32);
}
- static void writeLong( long val, byte[] dst, int dstIndex ) {
- dst[dstIndex++] = (byte)((int)(val >>> 0) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 8) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 16) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 24) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 32) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 40) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 48) & 0xFF);
- dst[dstIndex++] = (byte)((int)(val >>> 56) & 0xFF);
+ static void writeInt8( long val, byte[] dst, int dstIndex ) {
+ dst[dstIndex] = (byte)(val);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >>= 8);
+ dst[++dstIndex] = (byte)(val >> 8);
}
static long readTime( byte[] src, int srcIndex ) {
int low = readInt4( src, srcIndex );
int hi = readInt4( src, srcIndex + 4 );
- long t = ((long)hi << 32 ) | ( (long)low & 0xFFFFFFFFL );
+ long t = ((long)hi << 32L ) | (low & 0xFFFFFFFFL);
t = ( t / 10000L - MILLISECONDS_BETWEEN_1970_AND_1601 );
/*
}
static void writeTime( long t, byte[] dst, int dstIndex ) {
-/*
if( t != 0L ) {
+/*
synchronized( TZ ) {
if( TZ.inDaylightTime( new Date() )) {
// in DST
}
}
}
-
+*/
t = (t + MILLISECONDS_BETWEEN_1970_AND_1601) * 10000L;
}
-*/
- writeLong( t, dst, dstIndex );
+ writeInt8( t, dst, dstIndex );
}
static long readUTime( byte[] buffer, int bufferIndex ) {
return readInt4( buffer, bufferIndex ) * 1000L;
dstIndex += 4;
writeInt4( desiredAccess, dst, dstIndex );
dstIndex += 4;
- writeLong( allocationSize, dst, dstIndex );
+ writeInt8( allocationSize, dst, dstIndex );
dstIndex += 8;
writeInt4( extFileAttributes, dst, dstIndex );
dstIndex += 4;
writeInt2( fid, dst, dstIndex );
dstIndex += 2;
- writeInt4( offset & 0xFFFFFFFFL, dst, dstIndex );
+ writeInt4( offset, dst, dstIndex );
dstIndex += 4;
writeInt2( maxCount, dst, dstIndex );
dstIndex += 2;
dstIndex += 4;
writeInt2( remaining, dst, dstIndex );
dstIndex += 2;
- writeInt4(( offset >> 32 ) & 0xFFFFFFFFL, dst, dstIndex );
+ writeInt4( offset >> 32, dst, dstIndex );
dstIndex += 4;
return dstIndex - start;
writeInt2( fid, dst, dstIndex );
dstIndex += 2;
- writeInt4( offset & 0xFFFFFFFFL, dst, dstIndex );
+ writeInt4( offset, dst, dstIndex );
dstIndex += 4;
for( int i = 0; i < 4; i++ ) {
dst[dstIndex++] = (byte)0x00;
dstIndex += 2;
writeInt2( dataOffset, dst, dstIndex );
dstIndex += 2;
- writeInt4(( offset >> 32 ) & 0xFFFFFFFFL, dst, dstIndex );
+ writeInt4( offset >> 32, dst, dstIndex );
dstIndex += 4;
return dstIndex - start;
}
out.write(snd_buf, 0, length);
out.flush();
+//Log.printHexDump( System.err, Thread.currentThread().getName() + ": " + request.toString(), snd_buf, 0, Math.min( length, 63 ));
Log.printMessageData( "smb sent", request );
ServerMessageBlock smb = request;
int start = dstIndex;
writeTime( createTime, dst, dstIndex ); dstIndex += 8;
- writeLong( 0L, dst, dstIndex ); dstIndex += 8;
+ writeInt8( 0L, dst, dstIndex ); dstIndex += 8;
writeTime( lastWriteTime, dst, dstIndex ); dstIndex += 8;
- writeLong( 0L, dst, dstIndex ); dstIndex += 8;
+ writeInt8( 0L, dst, dstIndex ); dstIndex += 8;
/* Samba 2.2.7 needs ATTR_NORMAL
*/
writeInt2( 0x80 | attributes, dst, dstIndex ); dstIndex += 2;
/* 6 zeros observed with NT */
- writeLong( 0L, dst, dstIndex ); dstIndex += 6;
+ writeInt8( 0L, dst, dstIndex ); dstIndex += 6;
/* Also observed 4 byte alignment but we stick
* with the default for jCIFS which is 2 */
public static void printHexDump( String desc, byte[] src ) {
printHexDump( desc, src, 0, src.length );
}
+ public static void printHexDump( PrintStream ps, String desc, byte[] src, int srcIndex, int length ) {
+ ps.println( desc );
+ printHexDump( ps, src, srcIndex, length );
+ }
public static void printHexDump( PrintStream ps, byte[] src, int srcIndex, int length ) {
int s = length % 16;
int r = ( s == 0 ) ? length / 16 : length / 16 + 1;