[jcifs] Calling NetServerEnum2 with no domain parameter

Chris Bearchell Chris-Bearchell at softwareimaging.com
Fri Nov 13 02:31:37 MST 2009

Hi Mike,

Thanks for the quick response. I've attached a patch which corrects the problem I was seeing. Essentially, if we are making a NetServerEnum2 request and the domain is absent (null or zero length) the alternate parameter descriptor is used.


-----Original Message-----
From: Michael B Allen [mailto:ioplex at gmail.com] 
Sent: 12 November 2009 17:33
To: Chris Bearchell
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] Calling NetServerEnum2 with no domain parameter

On Thu, Nov 12, 2009 at 8:26 AM, Chris Bearchell
<chris-bearchell at softwareimaging.com> wrote:
> Hi,
> I have an application, running on a phone, from which I would like to enumerate
> available domains/workgroups. I've been trying the following:
> SmbFile root = new SmbFile("smb://", NtlmPasswordAuthentication.ANONYMOUS);
> SmbFile[] domains = root.listFiles();
> The problem I was seeing was that the server responds with error 2320 (The
> computer is not active in this domain). Digging deeper with Wireshark I noticed
> that when calling the Windows API NetServerEnum() I see the following
> NetServerEnum2 request:
> Microsoft Windows Lanman Remote API Protocol
>  Function Code: NetServerEnum2 (104)
>  Parameter Descriptor: WrLehDO
>  Return Descriptor: B16BBDz
>  Detail Level: 1
>  Receive Buffer Length: 4200
>  Server Type: 0x80000000
>  Enumeration Domain (Null pointer)
> However, from the phone I see the following request
> Microsoft Windows Lanman Remote API Protocol
>  Function Code: NetServerEnum2 (104)
>  Parameter Descriptor: WrLehDz
>  Return Descriptor: B16BBDz
>  Detail Level: 1
>  Receive Buffer Length: 16384
>  Server Type: 0x80000000
>  Enumeration Domain (Null pointer)
> The obvious difference was the parameter descriptor, which put me on to the
> following from the Microsoft Open Specifications Developer Center:
> http://msdn.microsoft.com/en-us/library/cc240217%28PROT.10%29.aspx
> 'ParamDesc (variable): MUST be set to "WrLehDO" if the Domain parameter is not
> specified, or set to "WrLehDz".'
> Looking at NetServerEnum2.java, "WrLehDz" is always specified for a
> NetServerEnum2 request regardless of the domain parameter. I would like to
> contribute a fix for this issue. I am new to jCIFS and this list and am not sure
> on how I can proceed. Could someone on the list advise?

Hi Chris,

Nice diagnosis and very complete. That certainly sounds like a bug.

However, one problem is that I don't think I have a very good NetBIOS
setup anymore so if you can test the fix and post a patch or just
explain what you did to get it to work I will apply it anyway provided
that it does not obviously break anything at my end.

Otherwise I have also added it to the TODO for further investigation.


Michael B Allen
Java Active Directory Integration

Software Imaging: At the Forefront of Innovation in Printing and Imaging Software.
Providing Solutions for the Printer Industry and Mobile Phone Market.

Software Imaging Limited is a limited company registered in England and Wales.
Registered Office: 9400 Garsington Road, Oxford Business Park, Oxford, OX4 2HN, UK.
Registered No: 01755090

This message is strictly private and contains confidential information intended 
only for the use of the person named above. If you have received this e-mail in 
error and are not the intended recipient you must not disclose, copy or distribute 
it to anyone else. Please immediately advise the sender and delete this email and 
all attachments.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: NetServerEnum2.patch
Type: application/octet-stream
Size: 1570 bytes
Desc: NetServerEnum2.patch
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20091113/151a310b/attachment.obj>

More information about the jCIFS mailing list