From b581d0324098f12a5bcb1941e698339a84e44a93 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sun, 9 Mar 1997 14:58:22 +0000 Subject: 1) updated ipc.c NetUserGetInfo - load \\%L\%U instead of \\%L\HOMES because the share must be browseable by a w95 client 2) send_mailslot_reply - unique or group datagram argument added. 3) netlogon.c - rewrote response packet to do the right thing for w95. 4) server.c reply_nt1() - added OEMDomainstring to the end. 5) (deep breath) reworked the nmbd-browsing code a little bit. i discovered two months ago that becoming a primary domain controller (and domain master browser) is done independently of becoming a backup domain controller (logon server) is done independently of becoming a local master browser. therefore, three sets of state-machines (instead of just one) are in place - each of which is responsible for taking samba through the required stages to become: a logon server; a domain master browser; and a local master browser. each of these three things can occur independently on each interface, _including_ the wins pseudo-interface. the only slight caveat is that the wins pseudo-interface, by virtue of _not_ being a broadcast interface, does _not_ register as a local master browser with the wins server, as this doesn't make sense. lkcl (This used to be commit 88c6a00c3c1b430307f512986185b5ed7aea7181) --- source3/nameserv.c | 61 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 10 deletions(-) (limited to 'source3/nameserv.c') diff --git a/source3/nameserv.c b/source3/nameserv.c index 7353251940..7f1c0fadee 100644 --- a/source3/nameserv.c +++ b/source3/nameserv.c @@ -155,6 +155,51 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags) } +/**************************************************************************** + add the domain logon server and domain master browser names + + this code was written so that several samba servers can co-operate in + sharing the task of (one server) being a domain master, and of being + domain logon servers. + + **************************************************************************/ +void add_domain_names(time_t t) +{ + static time_t lastrun = 0; + struct subnet_record *d; + + if (lastrun != 0 && t < lastrun + CHECK_TIME_ADD_DOM_NAMES * 60) return; + lastrun = t; + + for (d = subnetlist; d; d = d->next) + { + struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False); + struct nmb_name n; + + if (lp_domain_logons() && work && work->log_state == LOGON_NONE) + { + make_nmb_name(&n,lp_workgroup(),0x1c,scope); + if (!find_name(d->namelist, &n, FIND_SELF)) + { + DEBUG(0,("%s attempting to become logon server for %s %s\n", + timestring(), lp_workgroup(), inet_ntoa(d->bcast_ip))); + become_logon_server(d, work); + } + } + if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE) + { + make_nmb_name(&n,lp_workgroup(),0x1b,scope); + if (!find_name(d->namelist, &n, FIND_SELF)) + { + DEBUG(1,("%s attempting to become logon server for %s %s\n", + timestring(), lp_workgroup(), inet_ntoa(d->bcast_ip))); + become_domain_master(d, work); + } + } + } +} + + /**************************************************************************** add the magic samba names, useful for finding samba servers **************************************************************************/ @@ -170,6 +215,7 @@ void add_my_names(void) for (d = subnetlist; d; d = d->next) { BOOL wins = lp_wins_support() && ip_equal(d->bcast_ip,ipgrp); + struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False); add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE); add_my_name_entry(d, myname,0x03,nb_type|NB_ACTIVE); @@ -183,18 +229,13 @@ void add_my_names(void) add_netbios_entry(d,"__SAMBA__",0x20,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins); add_netbios_entry(d,"__SAMBA__",0x00,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins); - if (lp_domain_logons()) { - /* XXXX the 0x1c is apparently something to do with domain logons */ - add_my_name_entry(d, lp_workgroup(),0x1c,nb_type|NB_ACTIVE|NB_GROUP); + if (lp_domain_logons() && work && work->log_state == LOGON_NONE) + { + become_logon_server(d, work); } - } - if (lp_domain_master() && (d = find_subnet(ipgrp))) - { - struct work_record *work = find_workgroupstruct(d, lp_workgroup(), True); - if (work && work->state == MST_NONE) + if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE) { - work->state = MST_DOMAIN_NONE; - become_master(d, work); + become_domain_master(d, work); } } } -- cgit