summaryrefslogtreecommitdiff
path: root/source3/namedbsubnet.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-08-24 01:41:46 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-08-24 01:41:46 +0000
commit9ad5a3fe36ac2b32bcb7a50c608ec586629f2125 (patch)
tree133871efd2c12d360a4ff585f9ab96f7db91c5ea /source3/namedbsubnet.c
parent8c41ad5614f4b3e6218cc7a3a21526122b202709 (diff)
downloadsamba-9ad5a3fe36ac2b32bcb7a50c608ec586629f2125.tar.gz
samba-9ad5a3fe36ac2b32bcb7a50c608ec586629f2125.tar.bz2
samba-9ad5a3fe36ac2b32bcb7a50c608ec586629f2125.zip
removed all of lukes recent changes. I need to do a p2 release but
can't test the multi group changes. I also found that some of lukes changes wiped out some recent bug fixes. Is your CVS tree ok luke? (This used to be commit 8b7fe224bce64803d55ae279fa61ef3ebbbb0241)
Diffstat (limited to 'source3/namedbsubnet.c')
-rw-r--r--source3/namedbsubnet.c151
1 files changed, 68 insertions, 83 deletions
diff --git a/source3/namedbsubnet.c b/source3/namedbsubnet.c
index 94decb7f0b..0bad79246a 100644
--- a/source3/namedbsubnet.c
+++ b/source3/namedbsubnet.c
@@ -26,9 +26,6 @@
04 jul 96: lkcl@pires.co.uk
created module namedbsubnet containing subnet database functions
- 30 July 96: David.Chappell@mail.trincoll.edu
- Expanded multiple workgroup domain master browser support.
-
*/
#include "includes.h"
@@ -93,16 +90,16 @@ struct subnet_record *find_subnet(struct in_addr bcast_ip)
for (d = subnetlist; d; d = d->next)
{
if (ip_equal(bcast_ip, wins_ip))
- {
+ {
if (ip_equal(bcast_ip, d->bcast_ip))
{
return d;
}
}
else if (same_net(bcast_ip, d->bcast_ip, d->mask_ip))
- {
- return(d);
- }
+ {
+ return(d);
+ }
}
return (NULL);
@@ -157,24 +154,24 @@ static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr
****************************************************************************/
void add_subnet_interfaces(void)
{
- struct interface *i;
-
- /* loop on all local interfaces */
- for (i = local_interfaces; i; i = i->next)
+ struct interface *i;
+
+ /* loop on all local interfaces */
+ for (i = local_interfaces; i; i = i->next)
+ {
+ /* add the interface into our subnet database */
+ if (!find_subnet(i->bcast))
+ {
+ make_subnet(i->bcast,i->nmask);
+ }
+ }
+
+ /* add the pseudo-ip interface for WINS: 255.255.255.255 */
+ if (lp_wins_support() || (*lp_wins_server()))
{
- /* add the interface into our subnet database */
- if (!find_subnet(i->bcast))
- {
- make_subnet(i->bcast,i->nmask);
- }
- }
-
- /* add the pseudo-ip interface for WINS: 255.255.255.255 */
- if (lp_wins_support() || (*lp_wins_server()))
- {
- struct in_addr wins_bcast = ipgrp;
- struct in_addr wins_nmask = ipzero;
- make_subnet(wins_bcast, wins_nmask);
+ struct in_addr wins_bcast = ipgrp;
+ struct in_addr wins_nmask = ipzero;
+ make_subnet(wins_bcast, wins_nmask);
}
}
@@ -191,7 +188,7 @@ void add_my_subnets(char *group)
if (*group == '*') return;
- /* the coding choice is up to you, andrew: i can see why you don't want
+ /* the coding choice is up to you, andrew: i can see why you don't want
global access to the local_interfaces structure: so it can't get
messed up! */
for (i = local_interfaces; i; i = i->next)
@@ -206,8 +203,8 @@ void add_my_subnets(char *group)
to the named a workgroup.
****************************************************************************/
struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
- struct in_addr mask_ip,
- char *name, BOOL add, BOOL lmhosts)
+ struct in_addr mask_ip,
+ char *name, BOOL add, BOOL lmhosts)
{
struct subnet_record *d;
@@ -225,41 +222,29 @@ struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
/* add the domain into our domain database */
if ((d = find_subnet(bcast_ip)) ||
(d = make_subnet(bcast_ip, mask_ip)))
- {
- struct work_record *work = find_workgroupstruct(d, name, add);
-
- if (!work) return NULL;
-
- if (conf_should_workgroup_member(work->token))
{
- /* add samba server name to workgroup list. don't add
- lmhosts server entries to local interfaces */
-
- pstring comment;
- char *my_name = conf_browsing_alias (work->token);
- char *my_comment = conf_browsing_alias_comment(work->token);
-
- my_name = my_name ? my_name : myname;
- my_comment = my_comment ? my_comment : lp_server_comment();
-
- StrnCpy(comment, my_comment, 43);
-
- add_server_entry(d,work,my_name,
- work->ServerType | SV_TYPE_LOCAL_LIST_ONLY,
- 0,comment,True);
-
+ struct work_record *w = find_workgroupstruct(d, name, add);
+
+ if (!w) return NULL;
+
+ /* add WORKGROUP(1e) and WORKGROUP(00) entries into name database
+ or register with WINS server, if it's our workgroup */
+ if (strequal(lp_workgroup(), name))
+ {
+ add_my_name_entry(d,name,0x1e,nb_type|NB_ACTIVE|NB_GROUP);
+ add_my_name_entry(d,name,0x0 ,nb_type|NB_ACTIVE|NB_GROUP);
+ }
+ /* add samba server name to workgroup list. don't add
+ lmhosts server entries to local interfaces */
+ if (strequal(lp_workgroup(), name))
+ {
+ add_server_entry(d,w,myname,w->ServerType,0,lp_serverstring(),True);
DEBUG(3,("Added server name entry %s at %s\n",
name,inet_ntoa(bcast_ip)));
-
- /* add WORKGROUP(1e) and WORKGROUP(00) entries into name database
- or register with WINS server, if it's our workgroup */
- add_my_name_entry(d,work->token,name,0x1e,nb_type|NB_ACTIVE|NB_GROUP);
- add_my_name_entry(d,work->token,name,0x0 ,nb_type|NB_ACTIVE|NB_GROUP);
- }
+ }
- return d;
- }
-
+ return d;
+ }
return NULL;
}
@@ -305,31 +290,31 @@ void write_browse_list(void)
{
struct work_record *work;
for (work = d->workgrouplist; work ; work = work->next)
- {
- struct server_record *s;
- for (s = work->serverlist; s ; s = s->next)
- {
- fstring tmp;
-
- /* don't list domains I don't have a master for */
- if ((s->serv.type & SV_TYPE_DOMAIN_ENUM) && !s->serv.comment[0])
- {
- continue;
- }
-
- /* output server details, plus what workgroup/domain
- they're in. without the domain information, the
- combined list of all servers in all workgroups gets
- sent to anyone asking about any workgroup! */
-
- sprintf(tmp, "\"%s\"", s->serv.name);
- fprintf(f, "%-25s ", tmp);
- fprintf(f, "%08x ", s->serv.type);
- sprintf(tmp, "\"%s\" ", s->serv.comment);
- fprintf(f, "%-30s", tmp);
- fprintf(f, "\"%s\"\n", work->work_group);
- }
- }
+ {
+ struct server_record *s;
+ for (s = work->serverlist; s ; s = s->next)
+ {
+ fstring tmp;
+
+ /* don't list domains I don't have a master for */
+ if ((s->serv.type & SV_TYPE_DOMAIN_ENUM) && !s->serv.comment[0])
+ {
+ continue;
+ }
+
+ /* output server details, plus what workgroup/domain
+ they're in. without the domain information, the
+ combined list of all servers in all workgroups gets
+ sent to anyone asking about any workgroup! */
+
+ sprintf(tmp, "\"%s\"", s->serv.name);
+ fprintf(f, "%-25s ", tmp);
+ fprintf(f, "%08x ", s->serv.type);
+ sprintf(tmp, "\"%s\" ", s->serv.comment);
+ fprintf(f, "%-30s", tmp);
+ fprintf(f, "\"%s\"\n", work->work_group);
+ }
+ }
}
fclose(f);