[jcifs] Calling NetServerEnum2 with no domain parameter

Michael B Allen ioplex at gmail.com
Thu Nov 12 10:32:39 MST 2009


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.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jCIFS mailing list