diff options
author | Andrew Tridgell <tridge@samba.org> | 1996-06-06 11:43:09 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1996-06-06 11:43:09 +0000 |
commit | b9ae225b28f4707609e6436dad4be7ebdd7e181f (patch) | |
tree | de9b672d8fd9cbb0e79039f7ea543b4c4793a2d1 /source3/namedb.c | |
parent | f57b053db8b17041ef02588127a67f362af871b6 (diff) | |
download | samba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.tar.gz samba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.tar.xz samba-b9ae225b28f4707609e6436dad4be7ebdd7e181f.zip |
- added interface.c and removed all the references to myip, bcast_ip
and Netmask, instead replacing them with calls to routines in
interface.c
- got rid of old MAXINT define
- added code to ensure we only return one entry for each name in the ipc
enum routines
- added new_only option to add_netbios_entry() to prevent overwriting
of important names
- minor time handling fixup
(This used to be commit 7ed71b73ae745da099072eee36fc2700d1d91407)
Diffstat (limited to 'source3/namedb.c')
-rw-r--r-- | source3/namedb.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/source3/namedb.c b/source3/namedb.c index 402617ffbd..2e942587be 100644 --- a/source3/namedb.c +++ b/source3/namedb.c @@ -28,14 +28,15 @@ #include "includes.h" #include "smb.h" #include "loadparm.h" -#include "localnet.h" + +extern int ClientNMB; +extern int ClientDGRAM; extern int DEBUGLEVEL; extern time_t StartupTime; extern pstring myname; extern pstring scope; -extern struct in_addr bcast_ip; /* this is our browse master/backup cache database */ struct browse_cache_record *browserlist = NULL; @@ -305,7 +306,8 @@ void expire_browse_cache(time_t t) that it get created/added anyway. this allows us to force entries in lmhosts file to be added. **************************************************************************/ -struct work_record *find_workgroupstruct(struct domain_record *d, fstring name, BOOL add) +struct work_record *find_workgroupstruct(struct domain_record *d, + fstring name, BOOL add) { struct work_record *ret, *work; @@ -323,28 +325,31 @@ struct work_record *find_workgroupstruct(struct domain_record *d, fstring name, return NULL; } - for (ret = d->workgrouplist; ret; ret = ret->next) - { - if (!strcmp(ret->work_group,name)) - { - DEBUG(4, ("found\n")); - return(ret); - } + for (ret = d->workgrouplist; ret; ret = ret->next) { + if (!strcmp(ret->work_group,name)) { + DEBUG(4, ("found\n")); + return(ret); } - - DEBUG(4, ("not found: creating\n")); + } + + if (!add) { + DEBUG(4, ("not found\n")); + return NULL; + } + + DEBUG(4,("not found: creating\n")); if ((work = make_workgroup(name))) { if (lp_preferred_master() && strequal(lp_workgroup(), name) && - ip_equal(d->bcast_ip, bcast_ip)) + ismybcast(d->bcast_ip)) { DEBUG(3, ("preferred master startup for %s\n", work->work_group)); work->needelection = True; work->ElectionCriterion |= (1<<3); } - if (!ip_equal(bcast_ip, d->bcast_ip)) + if (!ismybcast(d->bcast_ip)) { work->needelection = False; } @@ -446,7 +451,8 @@ struct domain_record *add_domain_entry(struct in_addr source_ip, ip = *interpret_addr2("255.255.255.255"); - if (zero_ip(source_ip)) source_ip = bcast_ip; + if (zero_ip(source_ip)) + source_ip = *iface_bcast(source_ip); /* add the domain into our domain database */ if ((d = find_domain(source_ip)) || @@ -516,7 +522,8 @@ struct browse_cache_record *add_browser_entry(char *name, int type, char *wg, b->ip = ip; b->type = type; - if (newentry || ttl < b->sync_time) b->sync_time = ttl; + if (newentry || ttl < b->sync_time) + b->sync_time = ttl; if (newentry) { @@ -576,7 +583,7 @@ struct server_record *add_server_entry(struct domain_record *d, bzero((char *)s,sizeof(*s)); } - if (ip_equal(bcast_ip, d->bcast_ip) && + if (ismybcast(d->bcast_ip) && strequal(lp_workgroup(),work->work_group)) { servertype |= SV_TYPE_LOCAL_LIST_ONLY; |