From 7950c5e87082f4292780b0b1571c5111b291e39e Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Thu, 24 Jul 1997 20:39:30 +0000 Subject: nameserv.c: split add_domain_names() into three functions: add_domain_logon_names() - adds <1c> names on WINS and broadcast. add_domain_master_wins() - adds <1b> name only with WINS server add_domain_master_bcast() - adds <1b> names only by bcast. : made add_domain_names() add <1c> names, unconditionally, and add <1b> name with the WINS server if using a WINS server, or add <1b> name by broadcast if _not_ using a WINS server, but _not_ both. : removed the direct parameter from remove_name_entry() and add_my_name_entry(). nameelect.c: made become_domain_master(), on successful registration of the <1b> name with the WINS server, go ahead and register the <1b> names by broadcast. if the <1b> name is _not_ successfully registered with the WINS server, the broadcast registration of <1b> names will _not_ proceed. namedbsubnet.c: sorted out calls to add_my_name_entry() and remove_my_name() which no longer has a direct parameter. this is all added because... in order to fix a compatibility bug with 1.9.16p2->p11, jeremy had added a feature that got the <1b> broadcast registered names _directly_ into the nmbd netbios lists, undefended. the aim was to get round the aggressive netbios registration of <1b> names of 1.9.16p2->p11. however, because 1.9.16p2->p11 don't properly _provide_ netlogon services, it is better that an error message appears in 1.9.17 logs, and that administrators are made aware of the problems with 1.9.16p2->p11, and replace 1.9.16p2->p11 servers, rather than attempt to run 1.9.16 alonside 1.9.17. (these warning messages will need to be added...) in _addition_, they shouldn't _be_ getting two samba servers to provide domain logon / domain master services for the same workgroup in the same WINS scope! lkcl (This used to be commit 5a668ff7ba83433b5eaa9f7d03a42573ee26caf9) --- source3/include/proto.h | 21 ++-- source3/namedbsubnet.c | 4 +- source3/nameelect.c | 140 ++++++++++++------------ source3/nameserv.c | 286 +++++++++++++++++++++++++++++------------------- 4 files changed, 259 insertions(+), 192 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index bcd3a426dc..7b634d15f5 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -14,7 +14,7 @@ int interpret_character_set(char *str, int def); /*The following definitions come from charset.c */ -void charset_initialise(void); +void charset_initialise(); void codepage_initialise(int client_codepage); void add_char_string(char *s); @@ -51,6 +51,7 @@ char *smb_errstr(char *inbuf); /*The following definitions come from clitar.c */ +int strslashcmp(char *s1, char *s2); int padit(char *buf, int bufsize, int padsize); void cmd_block(void); void cmd_tarmode(void); @@ -77,7 +78,7 @@ BOOL dptr_fill(char *buf1,unsigned int key); BOOL dptr_zero(char *buf); void *dptr_fetch(char *buf,int *num); void *dptr_fetch_lanman2(char *params,int dptr_num); -BOOL dir_check_ftype(int cnum, int mode,struct stat *st,int dirtype); +BOOL dir_check_ftype(int cnum,int mode,struct stat *st,int dirtype); BOOL get_dir_entry(int cnum,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend); void *OpenDir(int cnum, char *name, BOOL use_veto); void CloseDir(void *p); @@ -493,8 +494,11 @@ struct response_record *queue_netbios_packet(struct subnet_record *d, /*The following definitions come from nameserv.c */ -void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct); -void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, BOOL direct); +void remove_name_entry(struct subnet_record *d, char *name,int type); +void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags); +void add_domain_logon_names(void); +void add_domain_master_bcast(void); +void add_domain_master_wins(void); void add_domain_names(time_t t); void add_my_names(void); void remove_my_names(); @@ -719,7 +723,7 @@ void close_cnum(int cnum, uint16 vuid); BOOL yield_connection(int cnum,char *name,int max_connections); BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear); void exit_server(char *reason); -void standard_sub(int cnum,char *s); +void standard_sub(int cnum,char *string); char *smb_fn_name(int type); int chain_reply(char *inbuf,char *outbuf,int size,int bufsize); int construct_reply(char *inbuf,char *outbuf,int size,int bufsize); @@ -737,9 +741,6 @@ BOOL smb_shm_unlock_hash_entry( unsigned int entry ); BOOL smb_shm_get_usage(int *bytes_free, int *bytes_used, int *bytes_overhead); -smb_shm_offset_t smb_shm_alloc(int size); -smb_shm_offset_t smb_shm_addr2offset(void *addr); -smb_shm_offset_t smb_shm_get_userdef_off(void); /*The following definitions come from smbencrypt.c */ @@ -898,7 +899,7 @@ BOOL strhaslower(char *s); int count_chars(char *s,char c); void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date); void close_low_fds(void); -int set_blocking(int fd, int set); +int set_blocking(int fd, BOOL set); int write_socket(int fd,char *buf,int len); int read_udp_socket(int fd,char *buf,int len); int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out); @@ -943,7 +944,7 @@ BOOL zero_ip(struct in_addr ip); void reset_globals_after_fork(); char *client_name(void); char *client_addr(void); -void standard_sub_basic(char *s); +void standard_sub_basic(char *string); BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask); int PutUniCode(char *dst,char *src); struct hostent *Get_Hostbyname(char *name); diff --git a/source3/namedbsubnet.c b/source3/namedbsubnet.c index e3a2ea6e68..5ddda0a282 100644 --- a/source3/namedbsubnet.c +++ b/source3/namedbsubnet.c @@ -214,8 +214,8 @@ void add_workgroup_to_subnet( struct subnet_record *d, char *group) */ if (strequal(myworkgroup, group)) { - add_my_name_entry(d,group,0x0 ,nb_type|NB_ACTIVE|NB_GROUP,False); - add_my_name_entry(d,group,0x1e,nb_type|NB_ACTIVE|NB_GROUP,False); + add_my_name_entry(d,group,0x0 ,nb_type|NB_ACTIVE|NB_GROUP); + add_my_name_entry(d,group,0x1e,nb_type|NB_ACTIVE|NB_GROUP); /* add samba server name to workgroup list. */ add_server_entry(d,w,myname,w->ServerType|SV_TYPE_LOCAL_LIST_ONLY,0, lp_serverstring(),True); diff --git a/source3/nameelect.c b/source3/nameelect.c index 2b4ebf091c..295fcd7333 100644 --- a/source3/nameelect.c +++ b/source3/nameelect.c @@ -349,7 +349,7 @@ void become_local_master(struct subnet_record *d, struct work_record *work) 0,lp_serverstring(),True); /* add special browser name */ - add_my_name_entry(d,MSBROWSE,0x01,nb_type|NB_ACTIVE|NB_GROUP,False); + add_my_name_entry(d,MSBROWSE,0x01,nb_type|NB_ACTIVE|NB_GROUP); /* DON'T do anything else after calling add_my_name_entry() */ break; @@ -365,7 +365,7 @@ void become_local_master(struct subnet_record *d, struct work_record *work) 0,myname,True); /* add master name */ - add_my_name_entry(d,work->work_group,0x1d,nb_type|NB_ACTIVE,False); + add_my_name_entry(d,work->work_group,0x1d,nb_type|NB_ACTIVE); /* DON'T do anything else after calling add_my_name_entry() */ break; @@ -444,74 +444,80 @@ on subnet %s\n", work->work_group, inet_ntoa(d->bcast_ip))); ******************************************************************/ void become_domain_master(struct subnet_record *d, struct work_record *work) { - /* domain type must be limited to domain enum + server type. it must - not have SV_TYPE_SERVER or anything else with SERVER in it, else - clients get confused and start thinking this entry is a server - not a workgroup - */ + /* domain type must be limited to domain enum + server type. it must + not have SV_TYPE_SERVER or anything else with SERVER in it, else + clients get confused and start thinking this entry is a server + not a workgroup + */ - if (!work || !d) return; - - if (!lp_domain_master()) - { - DEBUG(0,("Samba not configured as a domain master browser.\n")); - return; - } + if (!work || !d) return; - DEBUG(2,("Becoming domain master for %s %s (currently at stage %d)\n", + if (!lp_domain_master()) + { + DEBUG(0,("Samba not configured as a domain master browser.\n")); + return; + } + + DEBUG(2,("Becoming domain master for %s %s (currently at stage %d)\n", work->work_group,inet_ntoa(d->bcast_ip),work->dom_state)); - - switch (work->dom_state) - { - case DOMAIN_NONE: /* while we were nothing but a server... */ - { - DEBUG(3,("become_domain_master: go to first stage: register <1b> name\n")); - work->dom_state = DOMAIN_WAIT; - - /* Registering the DOMAIN<1b> name is very tricky. We need to - do this on all our subnets, but don't want to bradcast it - on locally connected subnets (WinNT doesn't do this). Also, - previous versions of Samba screw up royally when we do this. - We need to register it immediatly on our local subnet, but - also actually check with the WINS server if it exists. If the name - has already been claimed by someone else in the WINS server - then we need to back out all our local registrations and - fail. Thus we only directly enter the name on local subnets, - on the WINS subnet we actually check... - */ - /* XXXX the 0x1b is domain master browser name */ - if(d == wins_subnet) - add_my_name_entry(d, work->work_group,0x1b,nb_type|NB_ACTIVE,False); - else - add_my_name_entry(d, work->work_group,0x1b,nb_type|NB_ACTIVE,True); - /* DON'T do anything else after calling add_my_name_entry() */ - break; - } + switch (work->dom_state) + { + case DOMAIN_NONE: /* while we were nothing but a server... */ + { + DEBUG(3,("become_domain_master: go to first stage: register <1b> name\n")); + work->dom_state = DOMAIN_WAIT; + + /* Registering the DOMAIN<1b> name is very tricky. We need to + do this on all our subnets, but don't want to bradcast it + on locally connected subnets (WinNT doesn't do this). Also, + previous versions of Samba screw up royally when we do this. + We need to register it immediatly on our local subnet, but + also actually check with the WINS server if it exists. If the name + has already been claimed by someone else in the WINS server + then we need to back out all our local registrations and + fail. Thus we only directly enter the name on local subnets, + on the WINS subnet we actually check... + */ + /* XXXX the 0x1b is domain master browser name */ + add_my_name_entry(d, work->work_group,0x1b,nb_type|NB_ACTIVE); + + /* DON'T do anything else after calling add_my_name_entry() */ + break; + } - case DOMAIN_WAIT: - { - work->dom_state = DOMAIN_MST; /* ... become domain master */ - DEBUG(3,("become_domain_master: first stage - register as domain member\n")); - - /* update our server status */ - work->ServerType |= SV_TYPE_NT|SV_TYPE_DOMAIN_MASTER; - add_server_entry(d,work,myname,work->ServerType|SV_TYPE_LOCAL_LIST_ONLY, - 0, lp_serverstring(),True); + case DOMAIN_WAIT: + { + work->dom_state = DOMAIN_MST; /* ... become domain master */ + DEBUG(3,("become_domain_master: first stage - register as domain member\n")); - DEBUG(0,("Samba is now a domain master browser for workgroup %s on subnet %s\n", - work->work_group, inet_ntoa(d->bcast_ip))); + /* update our server status */ + work->ServerType |= SV_TYPE_NT|SV_TYPE_DOMAIN_MASTER; + add_server_entry(d,work,myname,work->ServerType|SV_TYPE_LOCAL_LIST_ONLY, + 0, lp_serverstring(),True); - break; - } + DEBUG(0,("Samba is now a domain master browser for workgroup %s on subnet %s\n", + work->work_group, inet_ntoa(d->bcast_ip))); - case DOMAIN_MST: - { - /* don't have to do anything: just report success */ - DEBUG(3,("domain second stage: there isn't one!\n")); - break; - } - } + if (d == wins_subnet) + { + /* ok! we successfully registered by unicast with the + WINS server. we now expect to become the domain + master on the local subnets. if this fails, it's + probably a 1.9.16p2 to 1.9.16p11 server's fault + */ + add_domain_master_bcast(); + } + break; + } + + case DOMAIN_MST: + { + /* don't have to do anything: just report success */ + DEBUG(3,("domain second stage: there isn't one!\n")); + break; + } + } } @@ -539,7 +545,7 @@ void become_logon_server(struct subnet_record *d, struct work_record *work) work->log_state = LOGON_WAIT; /* XXXX the 0x1c is apparently something to do with domain logons */ - add_my_name_entry(d, myworkgroup,0x1c,nb_type|NB_ACTIVE|NB_GROUP,False); + add_my_name_entry(d, myworkgroup,0x1c,nb_type|NB_ACTIVE|NB_GROUP); /* DON'T do anything else after calling add_my_name_entry() */ break; @@ -598,8 +604,8 @@ void unbecome_local_master(struct subnet_record *d, struct work_record *work, /* announce ourselves as no longer active as a master browser. */ announce_server(d, work, work->work_group, myname, 0, 0); - remove_name_entry(d,MSBROWSE ,0x01,False); - remove_name_entry(d,work->work_group,0x1d,False); + remove_name_entry(d,MSBROWSE ,0x01); + remove_name_entry(d,work->work_group,0x1d); } } @@ -635,7 +641,7 @@ void unbecome_domain_master(struct subnet_record *d, struct work_record *work, announce_server(d, work, work->work_group, myname, 0, 0); /* Remove the name entry without any NetBIOS traffic as that's how it was registered. */ - remove_name_entry(d,work->work_group,0x1b,True); + remove_name_entry(d,work->work_group,0x1b); } } } @@ -665,7 +671,7 @@ void unbecome_logon_server(struct subnet_record *d, struct work_record *work, /* announce ourselves as no longer active as a master browser. */ announce_server(d, work, work->work_group, myname, 0, 0); - remove_name_entry(d,work->work_group,0x1c,False); + remove_name_entry(d,work->work_group,0x1c); } } diff --git a/source3/nameserv.c b/source3/nameserv.c index f1b34482c8..abad9b28c2 100644 --- a/source3/nameserv.c +++ b/source3/nameserv.c @@ -51,12 +51,8 @@ extern uint16 nb_type; /* samba's NetBIOS type */ note: the name will _always_ be removed XXXX at present, the name is removed _even_ if a WINS server says keep it. - If direct is True then the name being removed must have been a direct name - add. This is done for special names such as DOMAIN<1b>. Just delete it - without any network release traffic. - ****************************************************************************/ -void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct) +void remove_name_entry(struct subnet_record *d, char *name,int type) { /* XXXX BUG: if samba is offering WINS support, it should still broadcast a de-registration packet to the local subnet before removing the @@ -101,7 +97,7 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct if (ip_equal(d->bcast_ip, wins_ip)) { - if (!lp_wins_support() && !direct) + if (!lp_wins_support()) { /* not a WINS server: we have to release them on the network */ queue_netbios_pkt_wins(ClientNMB,NMB_REL,NAME_RELEASE, @@ -111,7 +107,6 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct } else { - if(!direct) /* local interface: release them on the network */ queue_netbios_packet(d,ClientNMB,NMB_REL,NAME_RELEASE, name, type, 0, 0,0,NULL,NULL, @@ -122,16 +117,12 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct /**************************************************************************** add an entry to the name list - If the direct BOOL is set then no network traffic is done for the add - it - is just blasted into the subnet entry with a zero TTL - it will not - expire and has not been legitimately claimed. This is *only* done if - we are a WINS server or for a special name such as DOMAIN<1b>. big note: our name will _always_ be added (if there are no objections). it's just a matter of when this will be done (e.g after a time-out). ****************************************************************************/ -void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, BOOL direct) +void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags) { BOOL re_reg = False; struct nmb_name n; @@ -151,13 +142,13 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, if (ip_equal(d->bcast_ip, wins_ip)) { - if (lp_wins_support() || direct) + if (lp_wins_support()) { /* we are a WINS server. */ if(lp_wins_support()) + { DEBUG(4,("add_my_name_entry: samba as WINS server adding: ")); - else - DEBUG(4,("add_my_name_entry: direct name entry : adding: ")); + } /* this will call add_netbios_entry() */ name_register_work(d, name, type, nb_flags,0, ipzero, False); @@ -176,27 +167,153 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, } else { - if(direct) - { - /* Just enter the name to be the ip address of the subnet - via name_register_work to ensure all side effects are done. - */ - DEBUG(4,("add_my_name_entry: direct name entry : adding: ")); - /* this will call add_netbios_entry() */ - name_register_work(d, name, type, nb_flags,0, d->myip, False); - } - else - { - /* broadcast the packet, but it comes from ipzero */ - queue_netbios_packet(d,ClientNMB, + /* broadcast the packet, but it comes from ipzero */ + queue_netbios_packet(d,ClientNMB, re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER, name, type, nb_flags, GET_TTL(0),0,NULL,NULL, True, False, d->bcast_ip, ipzero); - } } } +/**************************************************************************** + add the internet group <1c> domain logon names by wins unicast and broadcast. + ****************************************************************************/ +void add_domain_logon_names(void) +{ + struct subnet_record *d; + + if (!lp_domain_logons()) return; + + for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d)) + { + struct work_record *work = find_workgroupstruct(d, myworkgroup, True); + + if (work && work->log_state == LOGON_NONE) + { + struct nmb_name n; + make_nmb_name(&n,myworkgroup,0x1c,scope); + + if (!find_name(d->namelist, &n, FIND_SELF)) + { + /* logon servers are group names. don't expect failure */ + + DEBUG(0,("%s attempting to become logon server for %s %s\n", + timestring(), myworkgroup, inet_ntoa(d->bcast_ip))); + + become_logon_server(d, work); + } + } + } +} + + +/**************************************************************************** + add the <1b> domain master names by broadcast. + ****************************************************************************/ +void add_domain_master_bcast(void) +{ + struct subnet_record *d; + + if (!lp_domain_master()) return; + + for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d)) + { + struct work_record *work = find_workgroupstruct(d, myworkgroup, True); + + if (work && work->dom_state == DOMAIN_NONE) + { + struct nmb_name n; + make_nmb_name(&n,myworkgroup,0x1b,scope); + + if (!find_name(d->namelist, &n, FIND_SELF)) + { + DEBUG(0,("%s add_domain_names: attempting to become domain \ +master browser on workgroup %s %s\n", + timestring(), myworkgroup, inet_ntoa(d->bcast_ip))); + + /* send out a query to establish whether there's a + domain controller on the local subnet. if not, + we can become a domain controller. it's only + polite that we check, before claiming the + NetBIOS name 0x1b. + */ + + DEBUG(0,("add_domain_names:querying subnet %s \ +for domain master on workgroup %s\n", + inet_ntoa(d->bcast_ip), myworkgroup)); + + queue_netbios_packet(d,ClientNMB,NMB_QUERY, + NAME_QUERY_DOMAIN, + myworkgroup, 0x1b, + 0, 0,0,NULL,NULL, + True, False, + d->bcast_ip, d->bcast_ip); + } + } + } +} + + +/**************************************************************************** + add the <1b> domain master name by wins unicast. + ****************************************************************************/ +void add_domain_master_wins(void) +{ + struct work_record *work; + + if (!lp_domain_master() || wins_subnet == NULL) return; + + work = find_workgroupstruct(wins_subnet, myworkgroup, True); + + if (work && work->dom_state == DOMAIN_NONE) + { + struct nmb_name n; + make_nmb_name(&n,myworkgroup,0x1b,scope); + + if (!find_name(wins_subnet->namelist, &n, FIND_SELF)) + { + DEBUG(0,("%s add_domain_names: attempting to become domain \ +master browser on workgroup %s %s\n", + timestring(), myworkgroup, inet_ntoa(wins_subnet->bcast_ip))); + + if (lp_wins_support()) + { + /* use the wins server's capabilities (indirectly). if + someone has already registered the domain<1b> + name with the WINS server, then the WINS + server's job is to _check_ that the owner still + wants it, before giving it away. + */ + + DEBUG(1,("%s initiate become domain master for %s\n", + timestring(), myworkgroup)); + + become_domain_master(wins_subnet, work); + } + else + { + /* send out a query to establish whether there's a + domain controller on the WINS subnet. if not, + we can become a domain controller. it's only + polite that we check, before claiming the + NetBIOS name 0x1b. + */ + + DEBUG(0,("add_domain_names:querying WINS \ +for domain master on workgroup %s\n", myworkgroup)); + + queue_netbios_pkt_wins(ClientNMB,NMB_QUERY, + NAME_QUERY_DOMAIN, + myworkgroup, 0x1b, + 0, 0,0,NULL,NULL, + False, True, ipzero, ipzero); + } + } + } +} + + /**************************************************************************** add the domain logon server and domain master browser names @@ -207,90 +324,33 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags, **************************************************************************/ void add_domain_names(time_t t) { - static time_t lastrun = 0; - struct subnet_record *d; - struct work_record *work; - struct nmb_name n; + static time_t lastrun = 0; - if (lastrun != 0 && t < lastrun + CHECK_TIME_ADD_DOM_NAMES * 60) return; - lastrun = t; + if (lastrun != 0 && t < lastrun + CHECK_TIME_ADD_DOM_NAMES * 60) return; + lastrun = t; - for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d)) - { - work = find_workgroupstruct(d, myworkgroup, False); - if (lp_domain_logons() && work && work->log_state == LOGON_NONE) - { - make_nmb_name(&n,myworkgroup,0x1c,scope); - if (!find_name(d->namelist, &n, FIND_SELF)) - { - /* logon servers are group names - we don't expect this to fail. */ - DEBUG(0,("%s attempting to become logon server for %s %s\n", - timestring(), myworkgroup, inet_ntoa(d->bcast_ip))); - become_logon_server(d, work); - } - } - } + /* do the "internet group" - <1c> names */ + add_domain_logon_names(); - for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d)) - { - work = find_workgroupstruct(d, myworkgroup, True); + /* do the domain master names */ + if (wins_subnet != NULL) + { + /* if the registration of the <1b> name is successful, then + add_domain_master_bcast() will be called. this will + result in domain logon services being gracefully provided, + as opposed to the aggressive nature of 1.9.16p2 to 1.9.16p11. - if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE) - { - make_nmb_name(&n,myworkgroup,0x1b,scope); - if (!find_name(d->namelist, &n, FIND_SELF)) - { - DEBUG(0,("%s add_domain_names: attempting to become domain master \ -browser on workgroup %s %s\n", - timestring(), myworkgroup, inet_ntoa(d->bcast_ip))); - - if(d == wins_subnet) - { - if (lp_wins_support()) - { - /* use the wins server's capabilities (indirectly). if - someone has already registered the domain<1b> name with - the WINS server, then the WINS server's job is to _check_ - that the owner still wants it, before giving it away. - */ - - DEBUG(1,("%s initiating becoming domain master for %s\n", - timestring(), myworkgroup)); - become_domain_master(d, work); - } - else - { - /* send out a query to establish whether there's a - domain controller on the WINS subnet. if not, - we can become a domain controller. - it's only polite that we check, before claiming the - NetBIOS name 0x1b. - */ - - DEBUG(0,("add_domain_names:querying WINS for domain master \ -on workgroup %s\n", myworkgroup)); - - queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN, - myworkgroup, 0x1b, - 0, 0,0,NULL,NULL, - False, True, ipzero, ipzero); - } - } - else - { - DEBUG(0,("add_domain_names:querying subnet %s for domain master \ -on workgroup %s\n", inet_ntoa(d->bcast_ip), myworkgroup)); - queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN, - myworkgroup, 0x1b, - 0, 0,0,NULL,NULL, - True, False, - d->bcast_ip, d->bcast_ip); - } - } - } - } -} + which, due to a bug in namelogon.c from 1.9.16p2 to 1.9.16p11 + cannot _provide_ domain master / domain logon services!!! + */ + add_domain_master_wins(); + } + else + { + add_domain_master_bcast(); + } +} /**************************************************************************** add the magic samba names, useful for finding samba servers @@ -308,9 +368,9 @@ void add_my_names(void) { BOOL wins = (lp_wins_support() && (d == wins_subnet)); - add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE,False); - add_my_name_entry(d, myname,0x03,nb_type|NB_ACTIVE,False); - add_my_name_entry(d, myname,0x00,nb_type|NB_ACTIVE,False); + add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE); + add_my_name_entry(d, myname,0x03,nb_type|NB_ACTIVE); + add_my_name_entry(d, myname,0x00,nb_type|NB_ACTIVE); /* these names are added permanently (ttl of zero) and will NOT be refreshed with the WINS server */ @@ -341,7 +401,7 @@ void remove_my_names() /* get all SELF names removed from the WINS server's database */ /* XXXX note: problem occurs if this removes the wrong one! */ - remove_name_entry(d,n->name.name, n->name.name_type,False); + remove_name_entry(d,n->name.name, n->name.name_type); } } } @@ -366,7 +426,7 @@ void refresh_my_names(time_t t) n->death_time != 0) { add_my_name_entry(d,n->name.name,n->name.name_type, - n->ip_flgs[0].nb_flags,False); + n->ip_flgs[0].nb_flags); /* they get a new lease on life :-) */ n->death_time += GET_TTL(0); n->refresh_time += GET_TTL(0); -- cgit