[jcifs] Unmapped NetServerEnum2Response code
Del Merritt
del at alum.mit.edu
Thu Mar 11 15:57:00 MST 2010
On 03/11/2010 05:36 PM, Michael B Allen wrote:
> On Thu, Mar 11, 2010 at 4:40 PM, Del Merritt <del at alum.mit.edu> wrote:
>
>> I'm using JCIFS 1.3.14*. I have code that does this:
>>
>> public class NetServerEnum2Ext extends SmbFile
>> {
>> myMethod() {
>> int Flags = 0x00000200;
>> NetServerEnum2 req = new NetServerEnum2(host, Flags);
>> NetServerEnum2Response resp = new NetServerEnum2Response();
>> send(req, resp);
>> // Check status
>> if(resp.status != SmbException.ERROR_SUCCESS && resp.status !=
>> SmbException.ERROR_MORE_DATA)
>> throw new SmbException(resp.status, true);
>> ...
>> }
>> }
>>
>> Usually it works fine. Sometimes it will throw because it doesn't recognize
>> the response status. The value I see in the response status is "2". The
>> same host, flags, and authentication info (not shown for brevity) are used
>> both when it works and when it doesn't.
>>
>> jcifs.smb.SmbException is not figuring out a text translation. Where should
>> I look to see what the status means?
>>
> Hi Del,
>
> I don't even know where to begin to decipher what you're doing here.
> The "2" could be a status code or it could be garbage.
>
> Note that the Net* calls are RAP calls which are totally obsolete and
> will not work in most environments.
Would you define "obsolete"? I am not trying to be obtuse; instead, I
am trying to put together an application that will play well in a
sandbox that includes XP, Vista, and 7 systems, along with a couple of
Linux systems running samba and CUPS. At least one - and arguably two -
of those OSs are considered obsolete. For the moment I am willing to
constrain the discovery mechanism to be running in a "typical"
domain-based environment.
> In fact, that is probably the
> problem you're having. I think this particular RAP call would only
> work with a NetBIOS "master browser". There is a special lookup for
> that (see the NbtAddress class) but again, not all environments will
> have a master browser and if they do it's not going to have a good
> consistent list of servers.
I'm still puzzling as to why it "works" most of the time. What I
haven't done is log the host that is responding to my request(s);
perhaps multiple master browsers are responding, and one is not
responding well. Hmm.
Thanks for the tip to use the NbtAddress class; I may be back with some
more questions on that.
> Getting a proper list of servers on the
> subnet is a rather difficult think to do actually.
>
Understood. I'm happy to try to do it the Right Way. I also want it to
work in legacy networks.
Thanks,
-Del
More information about the jCIFS
mailing list