[jcifs] Re: Infinite loop in server enumeration

Michael B Allen mba2000 at ioplex.com
Fri Jul 2 02:10:57 GMT 2004


Eric Glass said:
> Mike,
>
> The NetServerEnum stuff appears to be getting caught in an infinite
> loop (for me anyways); it enumerates over the same list of servers and
> eventually gets an out of memory error.

Found it. NetServerEnum3 is actually just recycled NetServerEnum2. To
facilitate this evil optimization I added a reset() method to
SmbComTransaction and SmbComTransactionResponse. The idea is after sending
NetServerEnum2 I just set the command explicitly to NET_SERVER_EMUM3 and
call reset() to reset counters and initial state and such. I was resetting
the request object but forgot to reset the *response* object. The result
was the parameter and data counters indicated all data was read and that
the response could be decoded. Of course only the first secondary response
was read so it decoded the NetServerEnum2 response all over again. This
didn't happen before because the transaction buffer size used to be
hardcoded at 4096 so we'd never see secondary transactions. After flipping
it to 65535 in the last release it made it possible for secondary
transactions and thus this error.

Incedentally I'm curious to know why your RAP was not effected by this. Do
you not use SmbComTransaction?

Also, I noticed some incorrect values in your RAPs. In particular
ByteCount is much larger than it should be. I think TotalDataCount and
DataCount might also be incorrect.

I'll release this and the NtlmHttpURLConnection fix asap.

Thanks,
Mike


More information about the jcifs mailing list