diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-12-20 03:22:51 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-12-20 03:22:51 +0000 |
commit | abb9a2de72073a8a6f332b60d74af9eb6c3d6f25 (patch) | |
tree | d7814a9822c7c0481e227a5620db122d595264c2 /source3/smbwrapper | |
parent | 7bf9d8ce4bb7e96a4c72f674e21d015b1ef1481e (diff) | |
download | samba-abb9a2de72073a8a6f332b60d74af9eb6c3d6f25.tar.gz |
implemented a much nicer name_status() interface. It now returns a
list of structures rather than the dodgy parsing code we had before
this also gets smbw working correctly with no initial workgroup (using
name_status_find on __MSBROWSE__ returns)
(This used to be commit f2be88a8738a39ca5c98936edb7537cd701348a1)
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r-- | source3/smbwrapper/smbw.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 65a70c91783..91009af1c58 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -261,6 +261,7 @@ static char *smbw_find_workgroup(void) char *p; struct in_addr *ip_list = NULL; int count = 0; + int i; /* first off see if an existing workgroup name exists */ p = smbw_getshared("WORKGROUP"); @@ -273,12 +274,21 @@ static char *smbw_find_workgroup(void) if (!name_resolve_bcast(MSBROWSE, 1, &ip_list, &count)) { DEBUG(1,("No workgroups found!")); return p; - } - free((char *)ip_list); + for (i=0;i<count;i++) { + static fstring name; + if (name_status_find(0x1d, ip_list[i], name)) { + slprintf(server, sizeof(server), "%s#1D", name); + if (smbw_server(server, "IPC$")) { + free(ip_list); + return name; + } + } + } + + free(ip_list); - DEBUG(0,("Need to do node status code")); return p; } |