+Thu Feb 11 15:10:26 EST 2010
+jcifs-1.3.14
+
+A lock has been added to DcerpcHandle to ensure that the NT_CREATE_ANDX
+and DCERPC bind are performed together as some pipes will return 'All
+pipe instances are busy' errors if the client tries to open the same
+pipe concurrently.
+
+JCIFS will no longer do a NetBIOS Node Status to determine the server
+hostname as it seems some servers no longer respond to it which causes
+a long delay on connect.
+
+Tue Jan 5 13:19:39 EDT 2010
jcifs-1.3.13
Locking throughout the transport layer has been rewritten. This should
<project name="jcifs" default="usage" basedir=".">
- <property name="version" value="1.3.13"/>
- <property name="reldate" value="Jan 5, 2010"/>
+ <property name="version" value="1.3.14"/>
+ <property name="reldate" value="Feb 10, 2010"/>
<target name="usage">
<echo>
PROPERTIES=../../user2.prp
RUN="${JAVA_HOME}/bin/java -cp ${CLASSPATH} -Djcifs.properties=${PROPERTIES}"
-#SERVER=192.168.2.110
+SERVER=192.168.2.110
#SERVER=dc1.w.net
-#SHARE=tmp
-#DIR=test
+SHARE=tmp
+DIR=test
# Domain-based DFS
#SERVER=192.168.2.110
-SERVER=w.net
-SHARE=root2
-DIR=test
+#SERVER=w.net
+#SHARE=root2
+#DIR=test
# smb://fs4.w.net/DFSStandaloneRoot/DFSStandaloneLink/test/
# smb://dc1.w.net/root2/link2/test/
Object getOption(String key) {
if (key.equals("endpoint"))
return endpoint;
- return options.get(key);
+ if (options != null)
+ return options.get(key);
+ return null;
}
public String toString() {
}
public void bind() throws DcerpcException, IOException {
+synchronized (this) {
try {
state = 1;
DcerpcMessage bind = new DcerpcBind(binding, this);
state = 0;
throw ioe;
}
+}
}
public void sendrecv(DcerpcMessage msg) throws DcerpcException, IOException {
byte[] stub, frag;
throws UnknownHostException, MalformedURLException, DcerpcException {
binding = DcerpcHandle.parseBinding(url);
url = "smb://" + binding.server + "/IPC$/" + binding.endpoint.substring(6);
+
+ String params = "", server, address;
+ server = (String)binding.getOption("server");
+ if (server != null)
+ params += "&server=" + server;
+ address = (String)binding.getOption("address");
+ if (server != null)
+ params += "&address=" + address;
+ if (params.length() > 0)
+ url += "?" + params.substring(1);
+
pipe = new SmbNamedPipe(url,
/* This 0x20000 bit is going to get chopped! */
(0x2019F << 16) | SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_DCE_TRANSACT,
}
}
public void close() throws IOException {
+ state = 0;
if (out != null)
out.close();
}
*/
public String getHostName() {
- try {
- checkData();
- } catch( UnknownHostException uhe ) {
+ /* 2010 - We no longer try a Node Status to get the
+ * hostname because apparently some servers do not respond
+ * anymore. I think everyone post Windows 98 will accept
+ * an IP address as the tconHostName which is the principal
+ * use of this method.
+ */
+ if (hostName == UNKNOWN_NAME) {
return getHostAddress();
}
return hostName.name;
import jcifs.ntlmssp.*;
import jcifs.util.LogStream;
import jcifs.util.Hexdump;
+import jcifs.util.Encdec;
/**
For initiating NTLM authentication (including NTLMv2). If you want to add NTLMv2 authentication support to something this is what you want to use. See the code for details. Note that JCIFS does not implement the acceptor side of NTLM authentication.
boolean isEstablished = false;
byte[] serverChallenge = null;
byte[] signingKey = null;
+ String netbiosName = null;
int state = 1;
LogStream log;
{
return signingKey;
}
+ public String getNetbiosName()
+ {
+ return netbiosName;
+ }
+
+ private String getNtlmsspListItem(byte[] type2token, int id0)
+ {
+ int ri = 58;
+
+ for ( ;; ) {
+ int id = Encdec.dec_uint16le(type2token, ri);
+ int len = Encdec.dec_uint16le(type2token, ri + 2);
+ ri += 4;
+ if (id == 0 || (ri + len) > type2token.length) {
+ break;
+ } else if (id == id0) {
+ try {
+ return new String(type2token, ri, len, SmbConstants.UNI_ENCODING);
+ } catch (java.io.UnsupportedEncodingException uee) {
+ break;
+ }
+ }
+ ri += len;
+ }
+ return null;
+ }
public byte[] initSecContext(byte[] token, int offset, int len) throws SmbException {
switch (state) {
case 1:
serverChallenge = msg2.getChallenge();
ntlmsspFlags &= msg2.getFlags();
+// netbiosName = getNtlmsspListItem(token, 0x0001);
+
Type3Message msg3 = new Type3Message(msg2,
auth.getPassword(),
auth.getDomain(),
private SmbSession session;
private boolean disconnectTid = false;
- private String path, service;
+ private String service;
private byte[] password;
private int passwordLength;
+ String path;
/* batchLimits indecies
*
addresses[0] = UniAddress.getByName( server );
return getNextAddress();
}
+ String address = queryLookup(query, "address");
+ if (address != null && address.length() > 0) {
+ byte[] ip = java.net.InetAddress.getByName(address).getAddress();
+ addresses = new UniAddress[1];
+ addresses[0] = new UniAddress(java.net.InetAddress.getByAddress(host, ip));
+ return getNextAddress();
+ }
}
if (host.length() == 0) {
SmbTransport transport = null;
NtlmPasswordAuthentication auth;
long expiration;
+ String netbiosName = null;
SmbSession( UniAddress address, int port,
InetAddress localAddr, int localPort,
if( response != null && response.received ) {
return;
}
+
+ if (request instanceof SmbComTreeConnectAndX) {
+ SmbComTreeConnectAndX tcax = (SmbComTreeConnectAndX)request;
+ if (netbiosName != null && tcax.path.endsWith("\\IPC$")) {
+ /* Some pipes may require that the hostname in the tree connect
+ * be the netbios name. So if we have the netbios server name
+ * from the NTLMSSP type 2 message, and the share is IPC$, we
+ * assert that the tree connect path uses the netbios hostname.
+ */
+ tcax.path = "\\\\" + netbiosName + "\\IPC$";
+ }
+ }
+
request.uid = uid;
request.auth = auth;
try {
if (nctx.isEstablished()) {
+ netbiosName = nctx.getNetbiosName();
+
connectionState = 2;
state = 0;
return;
connectionState = 3; // disconnecting
+ netbiosName = null;
+
for( Enumeration e = trees.elements(); e.hasMoreElements(); ) {
SmbTree t = (SmbTree)e.nextElement();
t.treeDisconnect( inError );
*/
session.transport.connect();
-
+
unc = "\\\\" + session.transport.tconHostName + '\\' + share;
/* IBM iSeries doesn't like specifying a service. Always reset