+Mon Dec 27 17:53:42 EST 2004
+jcifs-1.1.6 released
+
+If a variable length 8 bit encodings such as Big5 is used the NTCreateAndX
+command could fail. This bug has been fixed. If an
+SmbFile{Input,Output}Stream was closed, a subsequent operation could cause
+the file to be reopened. This behavior is now blocked such that operations
+performed on a stream after it has been closed will generate an
+IOException. Some transport layer synchronization has been adjusted. A
+getPrincipal method has been added to SmbFile that will return the
+NtlmPasswordAuthentication object used to create the file or pipe. The
+documentation has been updated regarding transparent NTLM authentication in
+Mozilla, the available method of SmbFileInputStream.
+
Thu Dec 16 21:57:23 EST 2004
jcifs-1.1.5 released
<project name="jcifs" default="usage" basedir=".">
- <property name="version" value="1.1.5"/>
- <property name="reldate" value="Dec 17, 2004"/>
+ <property name="version" value="1.1.6"/>
+ <property name="reldate" value="Dec 27, 2004"/>
<target name="usage">
<echo>
impersonationLevel;
private long allocationSize;
private byte securityFlags;
+ private int namelen_index;
SmbComNTCreateAndX( String name, int flags,
int shareAccess,
dst[dstIndex++] = (byte)0x00;
// name length without counting null termination
- writeInt2( ( useUnicode ? path.length() * 2 : path.length() ), dst, dstIndex );
+ namelen_index = dstIndex;
dstIndex += 2;
writeInt4( flags, dst, dstIndex );
dstIndex += 4;
return dstIndex - start;
}
int writeBytesWireFormat( byte[] dst, int dstIndex ) {
- return writeString( path, dst, dstIndex );
+ int n;
+ n = writeString( path, dst, dstIndex );
+ writeInt2( ( useUnicode ? path.length() * 2 : n ), dst, namelen_index );
+ return n;
}
int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
return 0;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.security.Principal;
import jcifs.Config;
import jcifs.util.LogStream;
import jcifs.UniAddress;
}
/**
+ * Returns the <tt>NtlmPasswordAuthentication</tt> object used as
+ * credentials with this file or pipe. This can be used to retrieve the
+ * username for example:
+ * <tt>
+ * String username = f.getPrincipal().getName();
+ * </tt>
+ * The <tt>Principal</tt> object returned will never be <tt>null</tt>
+ * however the username can be <tt>null</tt> indication anonymous
+ * credentials were used (e.g. some IPC$ services).
+ */
+
+ public Principal getPrincipal() {
+ return auth;
+ }
+
+/**
* Returns the last component of the target URL. This will
* effectively be the name of the file or directory represented by this
* <code>SmbFile</code> or in the case of URLs that only specify a server
public void close() throws IOException {
file.close();
+ tmp = null;
}
/**
}
long start = fp;
+ if( tmp == null ) {
+ throw new IOException( "Bad file descriptor" );
+ }
// ensure file is open
file.open( openFlags, SmbFile.ATTR_NORMAL, 0 );
return (int)(fp - start);
}
+/**
+ * This stream class is unbuffered. Therefore this method will always
+ * return 0 for streams connected to regular files. However, a
+ * stream created from a Named Pipe this method will query the server using a
+ * "peek named pipe" operation and return the number of available bytes
+ * on the server.
+ */
public int available() throws IOException {
SmbNamedPipe pipe;
TransPeekNamedPipe req;
public void close() throws IOException {
file.close();
+ tmp = null;
}
/**
return;
}
+ if( tmp == null ) {
+ throw new IOException( "Bad file descriptor" );
+ }
// ensure file is open
if( file.isOpen() == false ) {
if( file instanceof SmbNamedPipe ) {
response.isPrimary = true;
try {
+ synchronized( outLock ) {
+ mid = aquireMid();
+ }
request.txn_buf = BufferCache.getBuffer();
response.txn_buf = BufferCache.getBuffer();
synchronized( interimResponse ) {
try {
synchronized( outLock ) {
- mid = aquireMid();
request.mid = mid.mid;
responseTable.put( mid, interimResponse );
synchronized(snd_buf) {
int length = request.writeWireFormat(snd_buf, 4);
out.write(snd_buf, 4, length);
out.flush();
-
+
if( log.level > 3 ) {
log.println( request );
if( log.level > 5 ) {
}
}
}
-
+
interimResponse.wait( RESPONSE_TIMEOUT );
if( interimResponse.received == false ) {
}
} finally {
responseTable.remove( mid );
- synchronized( outLock ) {
- releaseMid( mid );
- }
}
}
synchronized( response ) {
try {
synchronized( outLock ) {
- mid = aquireMid();
request.mid = mid.mid;
responseTable.put( mid, response );
do {
} while( response.received && response.hasMoreElements() );
} finally {
responseTable.remove( mid );
- synchronized( outLock ) {
- releaseMid( mid );
- }
}
}
} catch( InterruptedException ie ) {
tryClose( true );
throw new SmbException( "An error occured sending the request.", ioe );
} finally {
+ synchronized( outLock ) {
+ releaseMid( mid );
+ }
BufferCache.releaseBuffer( request.txn_buf );
BufferCache.releaseBuffer( response.txn_buf );
}