[jcifs] jcifs.smb.SmbException: A duplicate name exists on the
network
Josh
josh.nw at gmail.com
Thu May 22 18:32:12 GMT 2008
If I add an IP-hostname mapping to my HOSTS file:
10.0.10.98 client
and try to connect to an SmbNamedPipe using the URL:
smb://client/IPC$/foobar
I get the following exception:
Caused by: jcifs.smb.SmbException: A duplicate name exists on the network.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:522)
at jcifs.smb.SmbTransport.send(SmbTransport.java:636)
at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:280)
at jcifs.smb.SmbSession.send(SmbSession.java:233)
at jcifs.smb.SmbTree.treeConnect(SmbTree.java:154)
at jcifs.smb.SmbFile.doConnect(SmbFile.java:816)
at jcifs.smb.SmbFile.connect(SmbFile.java:854)
at jcifs.smb.SmbFile.connect0(SmbFile.java:793)
at jcifs.smb.SmbNamedPipe.connect0(SmbNamedPipe.java:203)
at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:73)
at jcifs.smb.SmbNamedPipe.getNamedPipeInputStream(SmbNamedPipe.java:166)
Interestingly, I can reproduce the error:
C:\>net use p: \\client\C$
System error 52 has occurred.
You were not connected because a duplicate name exists on the network.
Go to System in Control Panel to change the computer name and try again.
So jcifs is doing the right thing. But what does this error mean? Why
can't SMB handle hosts with multiple hostnames?
To work around this problem, I can always specify the SMB URL using an
IP address:
smb://10.0.10.98/IPC$/foobar
This works, however, jcifs always performs a NodeStatusRequest to resolve
the IP address back to a NetBIOS name, and uses that as the tconHostName:
SmbTransport.java:
321: tconHostName = address.getHostName();
However, "net use p: \\10.0.10.98\C$" doesn't do a NodeStatusRequest.
The Ethereal trace shows it uses the IP address as the tree connect
hostname:
ff 53 4d 42 75 00 .f)&.... .R.SMBu.
0040 00 00 00 18 07 c8 00 00 00 00 00 00 00 00 00 00 ........ ........
0050 00 00 00 00 ff fe 01 08 60 00 04 ff 00 52 00 08 ........ `....R..
0060 00 01 00 27 00 00 5c 00 5c 00 31 00 30 00 2e 00 ...'..\. \.1.0...
0070 30 00 2e 00 31 00 30 00 2e 00 39 00 38 00 5c 00 0...1.0. ..9.8.\.
0080 43 00 24 00 00 00 3f 3f 3f 3f 3f 00
Is jcifs performing a NodeStatusRequest intentionally, or is it just a
side-effect of calling getHostName() on a UniAddress constructed from
an IP address?
Thanks!
Josh
More information about the jcifs
mailing list