diff options
Diffstat (limited to 'source3/smbwrapper/smbw.c')
-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 65a70c9178..91009af1c5 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; } |