-Sat Jan 28 13:46:42 EST 2012
-jcifs-1.3.18b
+Wed Oct 29 21:08:01 EDT 2014
+jcifs-1.3.18
+This release includes mostly minor fixes including:
+System.getProperties().clone() modified to prevent
+ConcurrentModificationException when loading classes.
A logical check has been added to prevent a NullPointerException.
+Reset tree if transport disconnected.
+DCERPC error message improved.
+
+Note: There are several other bugs that have been discussed on the
+mailing list that have not been fixed in this release.
Tue Oct 18 15:10:23 EDT 2011
jcifs-1.3.17
<project name="jcifs" default="usage" basedir=".">
- <property name="version" value="1.3.18b"/>
- <property name="reldate" value="Jan 28, 2012"/>
+ <property name="version" value="1.3.18"/>
+ <property name="reldate" value="Oct 29, 2014"/>
<target name="usage">
<echo>
-C:\tmp>ktpass /princ HTTP/www.foo.net@WIN.NET /ptype KRB5_NT_PRINCIPAL /desonly /pass asj7j112233hh4455 /mapuser test2
-Targeting domain controller: ts0.win.net
-Using legacy password setting method
-Successfully mapped HTTP/www.foo.net to test2.
-Key created.
+C:\tmp>ktpass /princ HTTP/www.foo.net@WIN.NET /ptype KRB5_NT_PRINCIPAL /desonly /pass asj7j112233hh4455 /mapuser test2\r
+Targeting domain controller: ts0.win.net\r
+Using legacy password setting method\r
+Successfully mapped HTTP/www.foo.net to test2.\r
+Key created.\r
Account test2 has been set for DES-only encryption.
\ No newline at end of file
--- /dev/null
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.lang.reflect.Method;
+import java.io.PrintStream;
+import java.io.InputStream;
+
+import jcifs.Config;
+
+/*
+This test was used to provoke the following exception:
+
+Exception in thread "main" .java.lang.ExceptionInInitializerError
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
+ at java.lang.reflect.Method.invoke(Method.java:592)
+ at ClassLoaderTest.main(ClassLoaderTest.java:46)
+Caused by: java.util.ConcurrentModificationException
+ at java.util.Hashtable$Enumerator.next(Hashtable.java:1020)
+ at java.util.Hashtable.putAll(Hashtable.java:469)
+ at jcifs.Config.load(Config.java:164)
+ at jcifs.Config.<clinit>(Config.java:70)
+
+caused by this line of code in the jcifs.Config static initializer:
+
+ prp.putAll( System.getProperties() );
+
+The fix is to simply clone() the system properties like:
+
+ prp.putAll( (java.util.Map)System.getProperties().clone() );
+
+At least this removes the error.
+*/
+
+public class ClassLoaderTest implements Runnable {
+
+ static final int MULT = 1;
+
+ public void run()
+ {
+ for (int i = 0; i < (ClassLoaderTest.MULT * 700); i++) {
+ System.setProperty("i" + i, "x");
+ System.err.print('.');
+ }
+ }
+
+ public static void main(String[] argv) throws Exception
+ {
+ if (argv.length < 1) {
+ System.err.println("usage: ClassLoaderTest <jcifsjarpath>");
+ System.exit(1);
+ }
+
+ ClassLoaderTest clt = new ClassLoaderTest();
+ (new Thread(clt)).start();
+
+ for (int j = 0; j < (ClassLoaderTest.MULT * 100); j++) {
+ URL url = new URL(argv[0]);
+ URLClassLoader ucl = URLClassLoader.newInstance(new URL[] {url});
+ Class c = ucl.loadClass("jcifs.Config");
+/*
+ Method m = c.getMethod("list", PrintStream.class);
+ m.invoke(null, new Object[] { System.err });
+*/
+ Method m = c.getMethod("load", InputStream.class);
+ m.invoke(null, new Object[] { null });
+ ucl = null;
+ System.err.print('+');
+ }
+
+ }
+}
--- /dev/null
+import jcifs.util.Base64;
+import jcifs.util.Hexdump;
+
+public class TestBase64 {
+
+ public void run(String str) throws Exception
+ {
+ Base64 b64 = new Base64();
+
+ byte[] bytes = b64.decode(str);
+
+ Hexdump.hexdump(System.out, bytes, 0, bytes.length);
+ }
+
+ public static void main(String[] argv) throws Exception {
+ if (argv.length < 1) {
+ System.err.println( "usage: TestBase64 <b64>" );
+ System.exit(1);
+ }
+ TestBase64 t = new TestBase64();
+ t.run(argv[0]);
+ }
+}
--- /dev/null
+#!/bin/sh
+
+JAVA_HOME=/usr/local/java5
+CLASSPATH=../build:.
+RUN="${JAVA_HOME}/bin/java -cp ${CLASSPATH}"
+
+$RUN ClassLoaderTest file:/home/miallen/p/jcifs/jcifs-1.3.18.jar
JAVA_HOME=/usr/local/java5
CLASSPATH=../build:.
-PROPERTIES=../../user2.prp
+PROPERTIES=../../bcarter.prp
RUN="${JAVA_HOME}/bin/java -cp ${CLASSPATH} -Djcifs.properties=${PROPERTIES}"
#SERVER=192.168.15.110
-SERVER=dc1.w.net
+SERVER=dc08.busico.local
SHARE=tmp
DIR=test
# Domain-based DFS
#SERVER=192.168.15.110
-#SERVER=w.net
+#SERVER=busico.local
#SHARE=root2
#DIR=test
set -x
-$RUN SidLookup dc1.w.net S-1-5-21-2779991279-2625083122-3494051191-1361
+$RUN SidLookup dc08.busico.local S-1-5-21-2779991279-2625083122-3494051191-1361
$RUN TestGetParent 'smb://'
$RUN TestGetParent ${URL_WRITE_DIR}
-$RUN TestListLoop 'smb://dc5.w.net/tmp/' 2
-$RUN TestCopy smb://fs1.w.net/tmp/xxx/ smb://dc5.w.net/tmp/deleteme/
+$RUN TestListLoop 'smb://dc08.busico.local/tmp/' 2
+$RUN TestCopy smb://dc08.busico.local/tmp/xxx/ smb://dc08.busico.local/tmp/deleteme/
$RUN ListFiles smb://
$RUN ListFiles smb://192.168.15.110/tmp/
$RUN ListACL ${URL_WRITE_DIR}
--- /dev/null
+diff --git a/jcifs/jcifs/smb/SmbFile.java b/jcifs/jcifs/smb/SmbFile.java
+index 22391e9..00a1da3 100644
+--- a/jcifs/jcifs/smb/SmbFile.java
++++ b/jcifs/jcifs/smb/SmbFile.java
+@@ -268,6 +268,7 @@ import java.util.Date;
+
+ public class SmbFile extends URLConnection implements SmbConstants {
+
++ static final String RFC_2396_DISTINGUISHING_PREFIX = "URL:";
+ static final int O_RDONLY = 0x01;
+ static final int O_WRONLY = 0x02;
+ static final int O_RDWR = 0x03;
+@@ -465,7 +466,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+ throws MalformedURLException, UnknownHostException {
+ this( context.isWorkgroup0() ?
+ new URL( null, "smb://" + name, Handler.SMB_HANDLER ) :
+- new URL( context.url, name, Handler.SMB_HANDLER ), context.auth );
++ new URL( context.url, RFC_2396_DISTINGUISHING_PREFIX+name, Handler.SMB_HANDLER ), context.auth );
+ }
+
+ /**
+@@ -483,7 +484,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+
+ public SmbFile( String context, String name ) throws MalformedURLException {
+ this( new URL( new URL( null, context, Handler.SMB_HANDLER ),
+- name, Handler.SMB_HANDLER ));
++ RFC_2396_DISTINGUISHING_PREFIX+name, Handler.SMB_HANDLER ));
+ }
+
+ /**
+@@ -536,7 +537,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+ */
+ public SmbFile( String context, String name, NtlmPasswordAuthentication auth )
+ throws MalformedURLException {
+- this( new URL( new URL( null, context, Handler.SMB_HANDLER ), name, Handler.SMB_HANDLER ), auth );
++ this( new URL( new URL( null, context, Handler.SMB_HANDLER ), RFC_2396_DISTINGUISHING_PREFIX+name, Handler.SMB_HANDLER ), auth );
+ }
+ /**
+ * Constructs an SmbFile representing a resource on an SMB network such
+@@ -559,7 +560,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+ */
+ public SmbFile( String context, String name, NtlmPasswordAuthentication auth, int shareAccess )
+ throws MalformedURLException {
+- this( new URL( new URL( null, context, Handler.SMB_HANDLER ), name, Handler.SMB_HANDLER ), auth );
++ this( new URL( new URL( null, context, Handler.SMB_HANDLER ), RFC_2396_DISTINGUISHING_PREFIX + name, Handler.SMB_HANDLER ), auth );
+ if ((shareAccess & ~(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)) != 0) {
+ throw new RuntimeException( "Illegal shareAccess parameter" );
+ }
+@@ -587,7 +588,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+ throws MalformedURLException, UnknownHostException {
+ this( context.isWorkgroup0() ?
+ new URL( null, "smb://" + name, Handler.SMB_HANDLER ) :
+- new URL( context.url, name, Handler.SMB_HANDLER ), context.auth );
++ new URL( context.url, RFC_2396_DISTINGUISHING_PREFIX + name, Handler.SMB_HANDLER ), context.auth );
+ if ((shareAccess & ~(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)) != 0) {
+ throw new RuntimeException( "Illegal shareAccess parameter" );
+ }
+@@ -621,7 +622,7 @@ public class SmbFile extends URLConnection implements SmbConstants {
+ throws MalformedURLException, UnknownHostException {
+ this( context.isWorkgroup0() ?
+ new URL( null, "smb://" + name + "/", Handler.SMB_HANDLER ) :
+- new URL( context.url, name + (( attributes & ATTR_DIRECTORY ) > 0 ? "/" : "" )));
++ new URL( context.url, RFC_2396_DISTINGUISHING_PREFIX +name + (( attributes & ATTR_DIRECTORY ) > 0 ? "/" : "" )));
+
+ /* why was this removed before? DFS? copyTo? Am I going around in circles? */
+ auth = context.auth;
prp.load( in );
}
try {
- prp.putAll( System.getProperties() );
+ prp.putAll( (java.util.Map)System.getProperties().clone() );
} catch( SecurityException se ) {
if( log.level > 1 )
log.println( "SecurityException: jcifs will ignore System properties" );
if (key.equals("endpoint")) {
endpoint = val.toString();
String lep = endpoint.toLowerCase();
- if (lep.toLowerCase().startsWith("\\pipe\\")) {
- String iface = (String)INTERFACES.get(lep.toLowerCase().substring(6));
+ if (lep.startsWith("\\pipe\\")) {
+ String iface = (String)INTERFACES.get(lep.substring(6));
if (iface != null) {
int c, p;
c = iface.indexOf(':');
addrEntry = new NbtAddress[rDataLength / 6];
end = srcIndex + rDataLength;
+/* Apparently readRDataWireFormat can return 0 if resultCode != 0 in
+which case this will look indefinitely. Putting this else clause around
+the loop might fix that. But I would need to see a capture to confirm.
+if (resultCode != 0) {
+ srcIndex += rDataLength;
+} else {
+*/
for( addrIndex = 0; srcIndex < end; addrIndex++ ) {
srcIndex += readRDataWireFormat( src, srcIndex );
}