diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-03-15 18:38:27 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-03-15 18:38:27 +0000 |
commit | a2bb924496d41ea8bfa0216548f2f9bd074b294e (patch) | |
tree | 4582fee18c8edc7e8fc32c4e57457b237dd8fc21 | |
parent | e1eb836430256fc917d22a9e14cf2b76a3f0864d (diff) | |
download | samba-a2bb924496d41ea8bfa0216548f2f9bd074b294e.tar.gz samba-a2bb924496d41ea8bfa0216548f2f9bd074b294e.tar.bz2 samba-a2bb924496d41ea8bfa0216548f2f9bd074b294e.zip |
become_domain_master(), become_local_master() and become_logon_server()
weren't being called properly from name_register_work().
lkcl
(This used to be commit 9987724cb8e7bcc25c6fb50dc8e645efc1499fa5)
-rw-r--r-- | source3/nameelect.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/source3/nameelect.c b/source3/nameelect.c index 9254e44712..ec569b532e 100644 --- a/source3/nameelect.c +++ b/source3/nameelect.c @@ -61,8 +61,8 @@ void check_master_browser(time_t t) struct subnet_record *d; if (!lastrun) lastrun = t; - if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) - return; + if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) return; + lastrun = t; dump_workgroups(); @@ -231,43 +231,45 @@ void name_unregister_work(struct subnet_record *d, char *name, int name_type) void name_register_work(struct subnet_record *d, char *name, int name_type, int nb_flags, time_t ttl, struct in_addr ip, BOOL bcast) { - enum name_source source = (ismyip(ip) || ip_equal(ip, ipzero)) ? - SELF : REGISTER; + enum name_source source = (ismyip(ip) || ip_equal(ip, ipzero)) ? + SELF : REGISTER; - if (source == SELF) - { - struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False); + if (source == SELF) + { + struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False); - add_netbios_entry(d,name,name_type,nb_flags,ttl,source,ip,True,!bcast); + add_netbios_entry(d,name,name_type,nb_flags,ttl,source,ip,True,!bcast); - if (work) - { - if (work->mst_state != MST_POTENTIAL) - { - /* samba is working towards local master browser-ness. - initiate the next stage. - */ - become_local_master(d, work); - return; - } - if (work->dom_state != DOMAIN_NONE) - { - /* samba is working towards domain master browser-ness. - initiate the next stage. - */ - become_domain_master(d, work); - return; - } - if (work->log_state != LOGON_NONE) - { - /* samba is working towards domain master browser-ness. - initiate the next stage. - */ - become_logon_server(d, work); - return; - } - } - } + if (work) + { + int add_type_local = False; + int add_type_domain = False; + int add_type_logon = False; + + /* work out what to become, from the name type being added */ + + if (ms_browser_name(name, name_type)) + { + add_type_local ||= True; + } + if (strequal(name, lp_workgroup()) == 0 && name_type == 0x1d) + { + add_type_local ||= True; + } + if (strequal(name, lp_workgroup()) == 0 && name_type == 0x1b) + { + add_type_domain ||= True; + } + if (strequal(name, lp_workgroup()) == 0 && name_type == 0x1c) + { + add_type_logon ||= True; + } + + if (add_type_local ) become_local_master (d, work); + if (add_type_domain) become_domain_master(d, work); + if (add_type_logon ) become_logon_server (d, work); + } + } } |