From 1e447f8e9ab94a962275459a9f771938e466f7b9 Mon Sep 17 00:00:00 2001 From: Felix Schumacher Date: Tue, 23 Dec 2008 15:27:09 +0100 Subject: [PATCH] from jcifs-1.3.2.tgz Mon Dec 22 13:30:39 EST 2008 jcifs-1.3.2 Querying Samba DFS links directly could fail due to a slight difference in Samba v. Windows DFS referrals. This issue has been fixed. Querying Samba DFS roots or paths under DFS links were not affected. --- README.txt | 7 +++++++ build.xml | 4 ++-- src/jcifs/dcerpc/UUID.java | 14 ++++++++++++++ src/jcifs/smb/Dfs.java | 15 +++++++++++++++ src/jcifs/smb/NtlmPasswordAuthentication.java | 1 + src/jcifs/smb/SID.java | 2 +- 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index 52826a9..ea8c302 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,10 @@ +Mon Dec 22 13:30:39 EST 2008 +jcifs-1.3.2 + +Querying Samba DFS links directly could fail due to a slight difference +in Samba v. Windows DFS referrals. This issue has been fixed. Querying +Samba DFS roots or paths under DFS links were not affected. + Sat Nov 30 00:32:09 EST 2008 jcifs-1.3.1 diff --git a/build.xml b/build.xml index 1efcea8..af58471 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/jcifs/dcerpc/UUID.java b/src/jcifs/dcerpc/UUID.java index b36e566..8f07f3f 100644 --- a/src/jcifs/dcerpc/UUID.java +++ b/src/jcifs/dcerpc/UUID.java @@ -64,6 +64,20 @@ public class UUID extends rpc.uuid_t { private static byte B(int i) { return (byte)(i & 0xFF); } private static short S(int i) { return (short)(i & 0xFFFF); } + public UUID(rpc.uuid_t uuid) { + time_low = uuid.time_low; + time_mid = uuid.time_mid; + time_hi_and_version = uuid.time_hi_and_version; + clock_seq_hi_and_reserved = uuid.clock_seq_hi_and_reserved; + clock_seq_low = uuid.clock_seq_low; + node = new byte[6]; + node[0] = uuid.node[0]; + node[1] = uuid.node[1]; + node[2] = uuid.node[2]; + node[3] = uuid.node[3]; + node[4] = uuid.node[4]; + node[5] = uuid.node[5]; + } public UUID(String str) { char[] arr = str.toCharArray(); time_low = hex_to_bin(arr, 0, 8); diff --git a/src/jcifs/smb/Dfs.java b/src/jcifs/smb/Dfs.java index c9ff674..13d6895 100644 --- a/src/jcifs/smb/Dfs.java +++ b/src/jcifs/smb/Dfs.java @@ -248,6 +248,21 @@ public class Dfs { share = path.substring(s1 + 1, s2); key = path.substring(0, dr.pathConsumed).toLowerCase(); + + /* Samba has a tendency to return referral paths and pathConsumed values + * in such a way that there can be a slash at the end of the path. This + * causes problems matching keys in resolve() where an extra slash causes + * a mismatch. This strips trailing slashes from all keys to eliminate + * this problem. + */ + int ki = key.length(); + while (ki > 1 && key.charAt(ki - 1) == '\\') { + ki--; + } + if (ki < key.length()) { + key = key.substring(0, ki); + } + /* Subtract the server and share from the pathConsumed so that * it refects the part of the relative path consumed and not * the entire path. diff --git a/src/jcifs/smb/NtlmPasswordAuthentication.java b/src/jcifs/smb/NtlmPasswordAuthentication.java index 125f1c4..845407e 100644 --- a/src/jcifs/smb/NtlmPasswordAuthentication.java +++ b/src/jcifs/smb/NtlmPasswordAuthentication.java @@ -145,6 +145,7 @@ public final class NtlmPasswordAuthentication implements Principal, Serializable try { byte[] hash = new byte[16]; byte[] response = new byte[24]; +// The next 2-1/2 lines of this should be placed with nTOWFv1 in place of password MD4 md4 = new MD4(); md4.update(password.getBytes("UnicodeLittleUnmarked")); HMACT64 hmac = new HMACT64(md4.digest()); diff --git a/src/jcifs/smb/SID.java b/src/jcifs/smb/SID.java index cbb8020..c68875e 100644 --- a/src/jcifs/smb/SID.java +++ b/src/jcifs/smb/SID.java @@ -315,7 +315,7 @@ public class SID extends rpc.sid_t { } this.sub_authority[i] = rid; } - SID(rpc.sid_t sid, + public SID(rpc.sid_t sid, int type, String domainName, String acctName, -- 2.11.0