Procedure for Finding Master Browser And Workgroup List

Michael B. Allen mballen at erols.com
Wed Mar 28 08:20:57 GMT 2001


On Wed, Mar 28, 2001 at 11:57:05AM +0900, Richard Sharpe wrote:
> At 09:26 PM 3/27/01 -0500, Allen, Michael B (RSCH) wrote:
> >How exactly should one go about extracting the list of workgroups for
> >the 'smb://' URL? For example right now I do:
> >
> >1) Broadcast for MSBROWSE name
> >2) Reverse Lookup on IP Address of response to extact called name
> >3) Connect to IPC$ through CalledName<20> but if that fails connect
> >to *SMBSERVER<20>
> >4) Issue NetServerEnum2 with serverTypes = 0x80000000
> 
> I do it slightly differenly ... Check out smbc_opendir in libsmbclient.c in
> the Samba head branch. I might need to tweak my approach a bit, though.

Ok, I figured it out. The RAP doc says if serverType is
SV_TYPE_DOMAIN_ENUM then "pszDomain must be NULL". This is false. The
domain must *not* be NULL. The wierd thing is that if it is NULL it will
work once. If you then do a 'net view' from another windows machine it
will refresh it on the server and then again querying with a NULL domain
will work once and then the second time it will fail. Very strange. This
is NT BTW.

Since smbc_opendir uses the workgroup parameter libsmbclient doesn't have
this problem. But I thought it would be nice not to require that so I
just use the OEMDomainName returned from negotiation. What's my domain
you ask? Uhh, it's the same as *your* domain. Yeah, that's the ticket :~)

Mike

-- 
signature pending




More information about the samba-technical mailing list