Unix SMB/Netbios implementation.
Version 1.9.
SMB client
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB client
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB Byte handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Character set handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Machine customisation and include handling
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
- Copyright (C) Andrew Tridgell 1992-1994
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios header - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define AM_BACKUP(work) (work->ServerType & SV_TYPE_BACKUP_BROWSER)
#define AM_DOMMST(work) (work->ServerType & SV_TYPE_DOMAIN_MASTER)
#define AM_DOMMEM(work) (work->ServerType & SV_TYPE_DOMAIN_MEMBER)
-#define AM_ANY_MASTER(work) (check_work_servertype(work->work_group, \
-SV_TYPE_MASTER_BROWSER|SV_TYPE_DOMAIN_MASTER))
/* microsoft browser NetBIOS name */
#define MSBROWSE "\001\002__MSBROWSE__\002"
time_t refresh_time; /* time record should be refreshed */
};
+struct subnet_record;
+
/* browse and backup server cache for synchronising browse list */
struct browse_cache_record
{
time_t sync_time;
BOOL synced;
BOOL local;
+ struct subnet_record *subnet;
};
/* this is used to hold the list of servers in my domain, and is */
SV_TYPE_PRINTQ_SERVER | SV_TYPE_SERVER_NT | \
SV_TYPE_NT )
+/* Macro's to enumerate subnets either with or without
+ the WINS subnet. */
+
+extern struct subnet_record *subnetlist;
+extern struct subnet_record *wins_subnet;
+
+#define FIRST_SUBNET subnetlist
+#define NEXT_SUBNET_EXCLUDING_WINS(x) ((x)->next)
+#define NEXT_SUBNET_INCLUDING_WINS(x) ( ((x) == wins_subnet) ? 0 : \
+ (((x)->next == 0) ? wins_subnet : \
+ (x)->next))
+
/*The following definitions come from nameannounce.c */
+void reset_announce_timer();
void announce_request(struct work_record *work, struct in_addr ip);
void do_announce_request(char *info, char *to_name, int announce_type,
int from,
int to, struct in_addr dest_ip);
void sync_server(enum state_type state, char *serv_name, char *work_name,
int name_type,
+ struct subnet_record *d,
struct in_addr ip);
void do_announce_host(int command,
char *from_name, int from_type, struct in_addr from_ip,
void expire_browse_cache(time_t t);
struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
- time_t ttl, struct in_addr ip, BOOL local);
+ time_t ttl,
+ struct subnet_record *d,
+ struct in_addr ip, BOOL local);
void do_browser_lists(time_t t);
/*The following definitions come from nameconf.c */
/*The following definitions come from nameresp.c */
void expire_netbios_response_entries(time_t t);
-struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
+struct response_record *queue_netbios_pkt_wins(
int fd,int quest_type,enum state_type state,
char *name,int name_type,int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB transaction2 handling
- Copyright (C) Jeremy Allison 1994
+ Copyright (C) Jeremy Allison 1994-1997
Extensively modified by Andrew Tridgell, 1995
-#define VERSION "1.9.16p12alpha"
+#define VERSION "1.9.17alpha1"
Unix SMB/Netbios implementation.
Version 1.9.
Character set conversion Extensions
- Copyright (C) Andrew Tridgell 1992-1994
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Character set handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Critical Fault handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
multiple interface handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
- Copyright (C) Andrew Tridgell 1992-1994
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
replacement routines for broken systems
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Samba system utilities
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
time handling functions
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Username handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Samba utility functions
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
name query routines
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios library routines
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
Modified by Jeremy Allison 1995.
This program is free software; you can redistribute it and/or modify
Unix SMB/Netbios implementation.
Version 1.9.
Locking functions
- Copyright (C) Andrew Tridgell 1992-1996
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Shared memory functions
- Copyright (C) Erik Devriendt 1996
+ Copyright (C) Erik Devriendt 1996-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
extern struct in_addr wins_ip;
-
+extern pstring scope;
/****************************************************************************
send a announce request to the local net
**************************************************************************/
void sync_server(enum state_type state, char *serv_name, char *work_name,
int name_type,
+ struct subnet_record *d,
struct in_addr ip)
{
/* with a domain master we can get the whole list (not local only list) */
BOOL local_only = (state != NAME_STATUS_DOM_SRV_CHK);
- add_browser_entry(serv_name, name_type, work_name, 0, ip, local_only);
+ add_browser_entry(serv_name, name_type, work_name, 0, d, ip, local_only);
if (state == NAME_STATUS_DOM_SRV_CHK)
{
void remove_my_servers(void)
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
if (!lp_wins_support() && *lp_wins_server())
{
/* look up the domain master with the WINS server */
- queue_netbios_pkt_wins(d,ClientNMB,NMB_QUERY,
+ queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,
NAME_QUERY_ANNOUNCE_HOST,
work->work_group,0x1b,0,ttl*1000,
server_type,name,comment,
my_name = *myname ? myname : "NoName";
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
- if (ip_equal(d->bcast_ip, wins_ip)) continue;
-
for (work = d->workgrouplist; work; work = work->next)
{
uint32 stype = work->ServerType;
}
}
+/* Announce timer. Moved into global static so it can be reset
+ when a machine becomes a master browser. */
+static time_t announce_timer_last=0;
+
+/****************************************************************************
+ Reset the announce_timer so that a master browser announce will be done
+ immediately.
+ ****************************************************************************/
+
+void reset_announce_timer()
+{
+ announce_timer_last = 0;
+}
/****************************************************************************
announce myself as a master to all other domain master browsers.
void announce_master(time_t t)
{
struct subnet_record *d;
- static time_t last=0;
+ struct work_record *work;
BOOL am_master = False; /* are we a master of some sort? :-) */
- if (!last) last = t;
- if (t-last < CHECK_TIME_MST_ANNOUNCE * 60)
- return;
+ if (!announce_timer_last) announce_timer_last = t;
+ if (t-announce_timer_last < CHECK_TIME_MST_ANNOUNCE * 60)
+ {
+ DEBUG(10,("announce_master: t (%d) - last(%d) < %d\n",
+ t, announce_timer_last, CHECK_TIME_MST_ANNOUNCE * 60 ));
+ return;
+ }
+
+ if(wins_subnet == 0)
+ {
+ DEBUG(10,("announce_master: no wins subnet, ignoring.\n"));
+ return;
+ }
- last = t;
+ announce_timer_last = t;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
if (!am_master) return; /* only proceed if we are a master browser */
- /* Note that we don't do this if we are domain master browser. */
+ /* Note that we don't do this if we are domain master browser
+ and that we *only* do this on the WINS subnet. */
+
+ /* Try and find our workgroup on the WINS subnet */
+ work = find_workgroupstruct(wins_subnet, lp_workgroup(), False);
- for (d = subnetlist; d; d = d->next)
+ if (work)
{
- /* Try and find our workgroup on this subnet */
- struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
+ char *name;
+ int type;
- if (work)
+ if (*lp_domain_controller())
{
- char *name;
- int type;
-
- if (*lp_domain_controller())
- {
- /* the domain controller option is used to manually specify
- the domain master browser to sync with
- */
-
- /* XXXX i'm not sure we should be using the domain controller
- option for this purpose.
- */
-
- name = lp_domain_controller();
- type = 0x20;
- }
- else
- {
- /* assume that the domain master browser we want to sync
- with is our own domain.
- */
- name = work->work_group;
- type = 0x1b;
- }
-
- /* check the existence of a dmb for this workgroup, and if
- one exists at the specified ip, sync with it and announce
- ourselves as a master browser to it
+ /* the domain controller option is used to manually specify
+ the domain master browser to sync with
*/
- if (!lp_wins_support() && *lp_wins_server() &&
- ip_equal(d->bcast_ip, wins_ip))
- {
- DEBUG(4, ("Local Announce: find %s<%02x> from WINS server %s\n",
- name, type, lp_wins_server()));
-
- queue_netbios_pkt_wins(d,ClientNMB,
- NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
- name, type, 0,0,0,
- work->work_group,NULL,
- False, False, ipzero, ipzero);
- }
- else
- {
- DEBUG(4, ("Local Announce: find %s<%02x> on %s\n",
- name, type, inet_ntoa(d->bcast_ip)));
-
- queue_netbios_packet(d,ClientNMB,
- NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
- name, type, 0,0,0,
- work->work_group,NULL,
- True, False, d->bcast_ip, d->bcast_ip);
- }
- }
+ /* XXXX i'm not sure we should be using the domain controller
+ option for this purpose.
+ */
+
+ name = lp_domain_controller();
+ type = 0x20;
+ }
+ else
+ {
+ /* assume that the domain master browser we want to sync
+ with is our own domain.
+ */
+ name = work->work_group;
+ type = 0x1b;
+ }
+
+ /* check the existence of a dmb for this workgroup, and if
+ one exists at the specified ip, sync with it and announce
+ ourselves as a master browser to it
+ */
+
+ if (!lp_wins_support() && *lp_wins_server() )
+ {
+ DEBUG(4, ("Local Announce: find %s<%02x> from WINS server %s\n",
+ name, type, lp_wins_server()));
+
+ queue_netbios_pkt_wins(ClientNMB,
+ NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
+ name, type, 0,0,0,
+ work->work_group,NULL,
+ False, False, ipzero, ipzero);
+ }
+ else if(lp_wins_support())
+ {
+ /* We are the WINS server - query ourselves for the dmb name. */
+
+ struct nmb_name netb_name;
+ struct subnet_record *d = 0;
+ struct name_record *nr = 0;
+
+ make_nmb_name(&netb_name, name, type, scope);
+
+ if ((nr = find_name_search(&d, &netb_name, FIND_WINS, ipzero)) == 0)
+ {
+ DEBUG(0, ("announce_master: unable to find domain master browser for workgroup %s \
+in our own WINS database.\n", work->work_group));
+ return;
+ }
+
+ /* Check that this isn't one of our addresses (ie. we are not domain master
+ ourselves) */
+ if(ismyip(nr->ip_flgs[0].ip))
+ {
+ DEBUG(4, ("announce_master: domain master ip found (%s) for workgroup %s \
+is one of our interfaces.\n", work->work_group, inet_ntoa(nr->ip_flgs[0].ip) ));
+ return;
+ }
+
+ /* Issue a NAME_STATUS_DOM_SRV_CHK immediately - short circuit the
+ NAME_QUERY_DOM_SRV_CHK which is done only if we are talking to a
+ remote WINS server. */
+
+ DEBUG(4, ("announce_master: doing name status for %s<%02x> to domain master ip %s \
+for workgroup %s\n", name, type, inet_ntoa(nr->ip_flgs[0].ip), work->work_group ));
+
+ queue_netbios_packet(wins_subnet, ClientNMB,
+ NMB_QUERY,NAME_STATUS_DOM_SRV_CHK,
+ name, type, 0,0,0,
+ work->work_group,NULL,
+ False, False, nr->ip_flgs[0].ip, nr->ip_flgs[0].ip);
+ }
+
}
}
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
add a browser entry
****************************************************************************/
struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
- time_t ttl, struct in_addr ip, BOOL local)
+ time_t ttl, struct subnet_record *d,
+ struct in_addr ip, BOOL local)
{
BOOL newentry=False;
b->ip = ip;
b->type = type;
b->local = local; /* local server list sync or complete sync required */
-
+ b->subnet = d;
+
if (newentry || ttl < b->sync_time)
b->sync_time = ttl;
**************************************************************************/
static void start_sync_browse_entry(struct browse_cache_record *b)
{
- struct subnet_record *d;
+ struct subnet_record *d = b->subnet;
struct work_record *work;
- /* Look for the workgroup first on the local subnet. If this
- fails try WINS - we may need to sync with the domain master,
- or we may be the domain master and need to sync with subnet
- masters.
- */
-
- if (!(d = find_subnet_all(b->ip))) {
- DEBUG(0, ("start_sync_browse_entry: failed to get a \
-subnet for a browse cache entry workgroup %s, server %s\n",
- b->group, b->name));
- return;
+ /* Check panic conditions - these should not be true. */
+ if(b->subnet != wins_subnet) {
+ DEBUG(0,
+ ("start_sync_browse_entry: ERROR sync requested on non-WINS subnet.\n"));
+ return;
}
if (!(work = find_workgroupstruct(d, b->group, False))) {
return;
}
- /* only sync if we are a subnet master or domain master - but
- we sync if we are a master for this workgroup on *any*
- of our interfaces. */
- if (AM_MASTER(work) || AM_DOMMST(work) || AM_ANY_MASTER(work)) {
-
- DEBUG(4, ("start_sync_browse_entry: Initiating %s sync with %s<0x20>, \
+ DEBUG(4, ("start_sync_browse_entry: Initiating %s sync with %s<0x20>, \
workgroup %s\n",
- b->local ? "local" : "remote", b->name, b->group));
+ b->local ? "local" : "remote", b->name, b->group));
- /* first check whether the server we intend to sync with exists. if it
- doesn't, the server must have died. o dear. */
+ /* first check whether the server we intend to sync with exists. if it
+ doesn't, the server must have died. o dear. */
- /* see response_netbios_packet() or expire_netbios_response_entries() */
- /* We cheat here by using the my_comment field of the response_record
- struct as the workgroup name we are going to do the sync for.
- This is because the reply packet doesn't include the workgroup, but
- we need it when the reply comes back.
- */
- queue_netbios_packet(d,ClientNMB,NMB_QUERY,
- b->local?NAME_QUERY_SYNC_LOCAL:NAME_QUERY_SYNC_REMOTE,
- b->name,0x20,0,0,0,NULL,b->group,
- False,False,b->ip,b->ip);
- }
+ /* see response_netbios_packet() or expire_netbios_response_entries() */
+ /* We cheat here by using the my_comment field of the response_record
+ struct as the workgroup name we are going to do the sync for.
+ This is because the reply packet doesn't include the workgroup, but
+ we need it when the reply comes back.
+ */
+ queue_netbios_packet(d,ClientNMB,NMB_QUERY,
+ b->local?NAME_QUERY_SYNC_LOCAL:NAME_QUERY_SYNC_REMOTE,
+ b->name,0x20,0,0,0,NULL,b->group,
+ False,False,b->ip,b->ip);
b->synced = True;
}
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (!(search & FIND_WINS)) return NULL;
/* find WINS subnet record. */
- *d = find_subnet(wins_ip);
+ *d = wins_subnet;
if (*d == NULL) return NULL;
void dump_names(void)
{
struct name_record *n;
- struct subnet_record *d;
fstring fname, fnamenew;
time_t t = time(NULL);
FILE *f;
-
+
+ if(lp_wins_support() == False || wins_subnet == 0)
+ return;
+
strcpy(fname,lp_lockdir());
trim_string(fname,NULL,"/");
strcat(fname,"/");
return;
}
- DEBUG(4,("Dump of local name table:\n"));
+ DEBUG(4,("Dump of WINS name table:\n"));
- for (d = subnetlist; d; d = d->next)
- for (n = d->namelist; n; n = n->next)
- {
- int i;
+ for (n = wins_subnet->namelist; n; n = n->next)
+ {
+ int i;
- DEBUG(4,("%15s ", inet_ntoa(d->bcast_ip)));
- DEBUG(4,("%15s ", inet_ntoa(d->mask_ip)));
- DEBUG(4,("%-19s TTL=%ld ",
+ DEBUG(4,("%15s ", inet_ntoa(wins_subnet->bcast_ip)));
+ DEBUG(4,("%15s ", inet_ntoa(wins_subnet->mask_ip)));
+ DEBUG(4,("%-19s TTL=%ld ",
namestr(&n->name),
n->death_time?n->death_time-t:0));
- for (i = 0; i < n->num_ips; i++)
- {
- DEBUG(4,("%15s NB=%2x source=%d",
- inet_ntoa(n->ip_flgs[i].ip),
+ for (i = 0; i < n->num_ips; i++)
+ {
+ DEBUG(4,("%15s NB=%2x source=%d",
+ inet_ntoa(n->ip_flgs[i].ip),
n->ip_flgs[i].nb_flags,n->source));
- }
- DEBUG(4,("\n"));
+ }
+ DEBUG(4,("\n"));
- if (f && ip_equal(d->bcast_ip, wins_ip) && n->source == REGISTER)
+ if (f && n->source == REGISTER)
{
/* XXXX i have little imagination as to how to output nb_flags as
anything other than as a hexadecimal number :-) */
fprintf(f, "\n");
}
- }
+ }
fclose(f);
unlink(fname);
****************************************************************************/
void load_netbios_names(void)
{
- struct subnet_record *d = find_subnet(wins_ip);
+ struct subnet_record *d = wins_subnet;
fstring fname;
FILE *f;
{
struct name_record *n;
struct name_record *n2=NULL;
+ struct subnet_record *found_subnet = 0;
int search = 0;
BOOL self = source == SELF;
make_nmb_name(&n->name,name,type,scope);
- if ((n2 = find_name_search(&d, &n->name, search, new_only?ipzero:ip)))
+ if ((n2 = find_name_search(&found_subnet, &n->name, search, new_only?ipzero:ip)))
{
free(n->ip_flgs);
free(n);
if (new_only || (n2->source==SELF && source!=SELF)) return n2;
n = n2;
+ d = found_subnet;
}
if (ttl)
DEBUG(3,("Added netbios name %s at %s ttl=%d nb_flags=%2x to interface %s\n",
namestr(&n->name),inet_ntoa(ip),ttl,nb_flags,
- ip_equal(d->bcast_ip, wins_ip) ? "WINS" : inet_ntoa(d->bcast_ip)));
+ ip_equal(d->bcast_ip, wins_ip) ? "WINS" : (char *)inet_ntoa(d->bcast_ip)));
return(n);
}
struct subnet_record *d;
/* expire old names */
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
for (n = d->namelist; n; n = next)
{
char *r;
BOOL dns_type = (name_type == 0x20 || name_type == 0);
struct in_addr dns_ip;
- struct subnet_record *d = find_subnet(wins_ip);
- if (d == NULL) return NULL;
+ if (wins_subnet == NULL)
+ return NULL;
DEBUG(3,("Search for %s - ", namestr(question)));
/* no luck with DNS. We could possibly recurse here XXXX */
DEBUG(3,("not found. no recursion.\n"));
/* add the fail to WINS cache of names. give it 1 hour in the cache */
- add_netbios_entry(d,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip,
+ add_netbios_entry(wins_subnet,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip,
True, True);
return NULL;
}
DEBUG(3,("found with DNS: %s\n", inet_ntoa(dns_ip)));
/* add it to our WINS cache of names. give it 2 hours in the cache */
- return add_netbios_entry(d,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip,
+ return add_netbios_entry(wins_subnet,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip,
True,True);
}
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios library routines
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (!d) return NULL;
- for ((*d) = subnetlist; (*d); (*d) = (*d)->next)
+ for ((*d) = FIRST_SUBNET; (*d); (*d) = NEXT_SUBNET_INCLUDING_WINS(*d))
{
for (n = (*d)->responselist; n; n = n->next)
{
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
struct subnet_record *d;
- for (d = subnetlist ; d ; d = d->next)
+ for (d = FIRST_SUBNET; d ; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *work;
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* this is our domain/workgroup/server database */
struct subnet_record *subnetlist = NULL;
+/* WINS subnet - keep this separate so enumeration code doesn't
+ run onto it by mistake. */
+struct subnet_record *wins_subnet = 0;
+
extern uint16 nb_type; /* samba's NetBIOS name type */
/* Forward references. */
/****************************************************************************
- find a subnet in the subnetlist
+ find a subnet in the subnetlist - not including WINS.
**************************************************************************/
struct subnet_record *find_subnet(struct in_addr bcast_ip)
{
struct subnet_record *d;
/* search through subnet list for broadcast/netmask that matches
- the source ip address. a subnet 255.255.255.255 represents the
- WINS list. */
+ the source ip address. */
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
- 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))
- {
- if (!ip_equal(d->bcast_ip, wins_ip))
- {
- return d;
- }
- }
+ if (same_net(bcast_ip, d->bcast_ip, d->mask_ip))
+ return d;
}
return (NULL);
/* identify the subnet the broadcast request came from */
return find_subnet(*iface_bcast(ip));
}
- /* find the subnet under the pseudo-ip of 255.255.255.255 */
- return find_subnet(wins_ip);
+ /* Return the subnet with the pseudo-ip of 255.255.255.255 */
+ return wins_subnet;
}
/****************************************************************************
{
struct subnet_record *d = find_subnet(bcast_ip);
if(!d)
- return find_subnet( wins_ip);
+ return wins_subnet;
}
/****************************************************************************
create a domain entry
****************************************************************************/
-static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr mask_ip)
+static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr mask_ip, BOOL add)
{
struct subnet_record *d;
d = (struct subnet_record *)malloc(sizeof(*d));
d->mask_ip = mask_ip;
d->workgrouplist = NULL;
- add_subnet(d);
+ if(add)
+ add_subnet(d);
return d;
}
/* add the interface into our subnet database */
if (!find_subnet(i->bcast))
{
- make_subnet(i->bcast,i->nmask);
+ make_subnet(i->bcast,i->nmask, True);
}
}
{
struct in_addr wins_bcast = wins_ip;
struct in_addr wins_nmask = ipzero;
- make_subnet(wins_bcast, wins_nmask);
+ wins_subnet = make_subnet(wins_bcast, wins_nmask, False);
}
}
/****************************************************************************
- add the default workgroup into my domain
+ add the default workgroup into the subnet lists.
**************************************************************************/
void add_my_subnets(char *group)
{
{
add_subnet_entry(i->bcast,i->nmask,group, True, False);
}
+
+ /* If we are setup as a domain master browser, and are using
+ WINS, then we must add the workgroup to the WINS subnet. This
+ is used as a place to keep collated server lists. */
+
+ if(lp_domain_master() && (lp_wins_support() || lp_wins_server()))
+ if(find_workgroupstruct(wins_subnet, group, True) == 0)
+ DEBUG(0, ("add_my_subnets: Failed to add workgroup %s to \
+WINS subnet.\n", group));
+ else
+ DEBUG(3,("add_my_subnets: Added workgroup %s to WINS subnet.\n",
+ group));
}
/* Note that we never add into the WINS subnet as add_subnet_entry
is only called to add our local interfaces. */
if ((d = find_subnet(bcast_ip)) ||
- (d = make_subnet(bcast_ip, mask_ip)))
+ (d = make_subnet(bcast_ip, mask_ip, True)))
{
struct work_record *w = find_workgroupstruct(d, name, add);
return;
}
- for (d = subnetlist; d ; d = d->next)
+ for (d = FIRST_SUBNET; d ; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work ; work = work->next)
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* make sure all token representations of workgroups are unique */
- for (d = subnetlist; d && t == -1; d = d->next)
+ for (d = FIRST_SUBNET; d && t == -1; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *w;
for (w = d->workgrouplist; w && t == -1; w = w->next)
DEBUG(4, ("workgroup search for %s: ", name));
- if (strequal(name, "*"))
- {
- DEBUG(2,("add any workgroups: initiating browser search on %s\n",
- inet_ntoa(d->bcast_ip)));
- queue_netbios_pkt_wins(d,ClientNMB,NMB_QUERY, NAME_QUERY_FIND_MST,
- MSBROWSE,0x1,0,0,0,NULL,NULL,
- True,False, d->bcast_ip, d->bcast_ip);
- return NULL;
- }
-
for (ret = d->workgrouplist; ret; ret = ret->next) {
if (!strcmp(ret->work_group,name)) {
DEBUG(4, ("found\n"));
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
if (d->workgrouplist)
{
}
}
}
-
-/****************************************************************************
- check to see if a ServerType bit is set in any workgroup on any interface
- except WINS. Used to determine if a nmbd is a master browser or domain
- master browser in a particular workgroup on any subnet.
- **************************************************************************/
-int check_work_servertype(const char *work_name, int type_mask)
-{
- struct subnet_record *d;
-
- for (d = subnetlist; d; d = d->next)
- {
- if(ip_equal(d->bcast_ip, wins_ip))
- {
- /* WINS ip */
- DEBUG(10,("check_work_servertype: ignoring WINS subnet\n"));
- continue;
- }
- if (d->workgrouplist)
- {
- struct work_record *work;
-
- for (work = d->workgrouplist; work; work = work->next)
- {
- if(strequal(work->work_group, (char *)work_name) &&
- (type_mask & work->ServerType) != 0)
- {
- DEBUG(10, ("check_work_servertype: Workgroup %s has \
-ServerType %x - match for type_mask %x\n", work_name, work->ServerType,
- type_mask));
- return 1;
- }
- }
- }
- }
- DEBUG(10, ("check_work_servertype: Workgroup %s has no match for \
-type mask %x\n", work_name, type_mask));
- return 0;
-}
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
dump_workgroups();
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
- /* don't do election stuff on the WINS subnet */
- if (ip_equal(d->bcast_ip,wins_ip))
- continue;
-
for (work = d->workgrouplist; work; work = work->next)
{
if (strequal(work->work_group, lp_workgroup()) && !AM_MASTER(work))
/* XXXX OOPS! add_server_entry will always add one entry - our own. */
announce_request(work, d->bcast_ip);
}
+
+ /* If we have WINS support or are a WINS server we must add
+ the workgroup we just became master browser for to the
+ WINS subnet. This is needed so we have somewhere to save
+ server lists when we do browser synchronization. */
+ if(wins_subnet != 0)
+ {
+ if(find_workgroupstruct(wins_subnet, work->work_group, True) == 0)
+ DEBUG(0, ("become_local_master: \
+Failed to add workgroup %s to WINS subnet.\n",
+ work->work_group));
+ else
+ DEBUG(3, ("become_local_master: Added workgroup %s to WINS subnet.\n",
+ work->work_group));
+
+ /* Reset the announce master timer so that we do an announce as soon as possible
+ now we are a master. */
+ reset_announce_timer();
+ }
break;
+
}
case MST_BROWSER:
lastime = t;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
- if(ip_equal(d->bcast_ip, wins_ip))
- {
- /* WINS ip */
- DEBUG(10,("run_elections: ignoring WINS subnet\n"));
- continue;
- }
-
for (work = d->workgrouplist; work; work = work->next)
{
if (work->RunningElection)
struct subnet_record *d;
BOOL run_any_election = False;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios library routines
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if ((!NAME_GROUP(n->nb_flags)))
{
- struct subnet_record *d1 = find_subnet(wins_ip);
+ struct subnet_record *d1 = wins_subnet;
if (d1)
{
/* remove the name that had been registered with us,
case NAME_QUERY_DOMAIN:
{
- /* if no response received, there is no domain controller on
- this local subnet. it's ok for us to register
+ /* if no response was received, there is no domain controller for
+ this DOMAIN registered within WINS. it's ok for us to register
+ the DOMAIN<1b> name.
*/
- if (!n->bcast)
- {
- DEBUG(0,("NAME_QUERY_DOMAIN incorrectly used - contact samba-bugs!\n"));
- /* XXXX whoops. someone's using this to unicast a packet. this state
- should only be used for broadcast checks
- */
- break;
- }
if (n->num_msgs == 0)
{
struct work_record *work = find_workgroupstruct(d,n->name.name,False);
become_domain_master(d,work);
}
}
+ else
+ {
+ DEBUG(0, ("ERROR: nmbd configured as domain master and one already exitsts !!!\n"));
+ exit(1);
+ }
break;
}
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct response_record *n, *nextn;
name server instead, if it exists. if wins is false, and there has been no
WINS server specified, the packet will NOT be sent.
****************************************************************************/
-struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
+struct response_record *queue_netbios_pkt_wins(
int fd,int quest_type,enum state_type state,
char *name,int name_type,int nb_flags, time_t ttl,
int server_type, char *my_name, char *my_comment,
if (zero_ip(send_ip)) return NULL;
- return queue_netbios_packet(d,fd, quest_type, state,
+ return queue_netbios_packet(wins_subnet,fd, quest_type, state,
name, name_type, nb_flags, ttl,
server_type,my_name,my_comment,
bcast, recurse, send_ip, reply_to_ip);
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (!lp_wins_support())
{
/* not a WINS server: we have to release them on the network */
- queue_netbios_pkt_wins(d,ClientNMB,NMB_REL,NAME_RELEASE,
+ queue_netbios_pkt_wins(ClientNMB,NMB_REL,NAME_RELEASE,
name, type, 0, 0,0,NULL,NULL,
False, True, ipzero, ipzero);
}
else
{
/* a time-to-live allows us to refresh this name with the WINS server. */
- queue_netbios_pkt_wins(d,ClientNMB,
+ queue_netbios_pkt_wins(ClientNMB,
re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER,
name, type, nb_flags, GET_TTL(0),0,NULL,NULL,
False, True, ipzero, ipzero);
{
static time_t lastrun = 0;
struct subnet_record *d;
+ struct work_record *work;
+ struct nmb_name n;
if (lastrun != 0 && t < lastrun + CHECK_TIME_ADD_DOM_NAMES * 60) return;
lastrun = t;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
- struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
- struct nmb_name n;
-
+ work = find_workgroupstruct(d, lp_workgroup(), False);
if (lp_domain_logons() && work && work->log_state == LOGON_NONE)
{
make_nmb_name(&n,lp_workgroup(),0x1c,scope);
become_logon_server(d, work);
}
}
+ }
- if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
+ if(wins_subnet != 0)
+ work = find_workgroupstruct(wins_subnet, lp_workgroup(), False);
+
+ if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
{
DEBUG(0,("add_domain_names:Checking for domain master on workgroup %s\n", lp_workgroup()));
make_nmb_name(&n,lp_workgroup(),0x1b,scope);
- if (!find_name(d->namelist, &n, FIND_SELF))
+ if (!find_name(wins_subnet->namelist, &n, FIND_SELF))
{
- DEBUG(0,("add_domain_names: attempting to become domain master browser on workgroup %s, bcast %s\n",
- lp_workgroup(), inet_ntoa(d->bcast_ip)));
+ DEBUG(0,("add_domain_names: attempting to become domain master browser on workgroup %s\n",
+ lp_workgroup()));
- if (ip_equal(d->bcast_ip,wins_ip))
+ if (lp_wins_support())
{
- if (lp_wins_support())
- {
- /* use the wins server's capabilities (indirectly). if
- someone has already register 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.
- */
+ /* 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 logon server for %s %s\n",
- timestring(), lp_workgroup(), inet_ntoa(d->bcast_ip)));
- become_domain_master(d, work);
- }
+ DEBUG(1,("%s initiating becoming domain master for %s\n",
+ timestring(), lp_workgroup()));
+ become_domain_master(wins_subnet, work);
}
else
{
/* send out a query to establish whether there's a
- domain controller on the local subnet. if not,
- we can become a domain controller on that subnet.
+ 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 for domain master on workgroup %s\n", lp_workgroup()));
+ DEBUG(0,("add_domain_names:querying WINS for domain master on workgroup %s\n", lp_workgroup()));
- queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN,
+ queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN,
lp_workgroup(), 0x1b,
0, 0,0,NULL,NULL,
- True, True, d->bcast_ip, d->bcast_ip);
+ False, False, ipzero, ipzero);
}
}
}
- }
}
there would be yet _another_ for-loop, this time on the transport type
*/
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
- BOOL wins = lp_wins_support() && ip_equal(d->bcast_ip,wins_ip);
+ BOOL wins = (lp_wins_support() && (d == wins_subnet));
struct work_record *work = find_workgroupstruct(d, lp_workgroup(), False);
add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE);
add_netbios_entry(d,"*",0x20,nb_type|NB_ACTIVE,0,SELF,d->myip,False,wins);
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() && work && work->log_state == LOGON_NONE)
- {
- become_logon_server(d, work);
- }
- if (lp_domain_master() && work && work->dom_state == DOMAIN_NONE)
- {
- become_domain_master(d, work);
- }
}
}
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct name_record *n, *next;
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct name_record *n;
void query_refresh_names(time_t t)
{
struct name_record *n;
- struct subnet_record *d = find_subnet(wins_ip);
+ struct subnet_record *d = wins_subnet;
static time_t lasttime = 0;
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* end of this name list: add wins names too? */
struct subnet_record *w_d;
- if (!(w_d = find_subnet(wins_ip))) break;
+ if (!(w_d = wins_subnet)) break;
if (w_d != d)
{
}
else
{
- if (!(d = find_subnet(wins_ip)))
+ if (!(d = wins_subnet))
{
DEBUG(3,("name query: wins search %s not known\n",
inet_ntoa(p->ip)));
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
workgroup name to sync with. See
response_server_check() */
sync_server(n->state,serv_name,
- n->my_name,name.name_type, n->send_ip);
+ n->my_name,name.name_type, d, n->send_ip);
}
}
else
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1996
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
tell_become_backup();
#endif
+#if 0 /* JRA TEST - I Think this code should not be here */
/* get the local_only browse list from the local master and add it
to ours. */
if (command == ANN_LocalMasterAnnouncement)
add_browser_entry(serv_name,dgram->dest_name.name_type,
work->work_group,30,p->ip,True);
}
+#endif /* END JRA TEST */
}
/*******************************************************************
process a master announcement frame
+ Domain master browsers recieve these from local masters. The Domain
+ master should then issue a sync with the local master, asking for
+ that machines local server list.
******************************************************************/
static void process_master_announce(struct packet_struct *p,char *buf)
{
struct dgram_packet *dgram = &p->packet.dgram;
- struct subnet_record *d = find_subnet_all(p->ip); /* Explicitly include WINS */
char *name = buf;
struct work_record *work;
name[15] = 0;
if (same_context(dgram)) return;
- if (!d)
+ if (!wins_subnet)
{
- DEBUG(3,("process_master_announce: Cannot find interface\n"));
+ DEBUG(3,("process_master_announce: No wins subnet !\n"));
return;
}
return;
}
- for (work = d->workgrouplist; work; work = work->next)
+ for (work = wins_subnet->workgrouplist; work; work = work->next)
{
- if (AM_MASTER(work) || AM_DOMMST(work) || AM_ANY_MASTER(work))
+ if (AM_MASTER(work) || AM_DOMMST(work))
{
/* merge browse lists with them */
- add_browser_entry(name,0x1d, work->work_group,30,p->ip,True);
+ add_browser_entry(name,0x1d, work->work_group,30,wins_subnet,p->ip,True);
}
}
}
#if 0
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *work;
if (state & 0x1)
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
if (state & 0x2)
{
struct subnet_record *d;
- for (d = subnetlist; d; d = d->next)
+ for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *work;
for (work=d->workgrouplist;work;work=remove_workgroup(d,work,True));
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
load_interfaces();
add_subnet_interfaces();
+ /* Do a sanity check for a misconfigured nmbd */
+ if(lp_wins_support() && *lp_wins_server()) {
+ DEBUG(0,("ERROR: both 'wins support = true' and 'wins server = <server>' \
+cannot be set in the smb.conf file. nmbd aborting.\n"));
+ exit(10);
+ }
+
return(ret);
}
if (strequal(lp_workgroup(),"*")) {
DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
+ exit(1);
}
add_my_subnets(lp_workgroup());
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines to synchronise browse lists
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
- if (!d || !work || !AM_ANY_MASTER(work)) return;
+ if (!d || !work ) return;
+
+ if(d != wins_subnet) {
+ DEBUG(0,
+ ("sync_browse_lists: ERROR sync requested on non-WINS subnet.\n"));
+ return;
+ }
pid = getpid();
uid = getuid();
Unix SMB/Netbios implementation.
Version 1.9.
Parameter loading functions
- Copyright (C) Karl Auer 1993,1994
+ Copyright (C) Karl Auer 1993,1997
Largely re-written by Andrew Tridgell, September 1994
Unix SMB/Netbios implementation.
Version 1.9.
Parameter loading utlities
- Copyright (C) Karl Auer 1993,1994
+ Copyright (C) Karl Auer 1993,1994,1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
printing routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Directory handling routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Inter-process communication and named pipe handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Name mangling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB messaging
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Password and authentication handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Pipe SMB reply routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
file read prediction routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
support for quotas
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Main SMB reply routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Main SMB server routines
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
external program running routine
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB transaction2 handling
- Copyright (C) Jeremy Allison 1994
+ Copyright (C) Jeremy Allison 1994-1997
Extensively modified by Andrew Tridgell, 1995
Unix SMB/Netbios implementation.
Version 1.9.
uid/user handling
- Copyright (C) Andrew Tridgell 1992-1995
+ Copyright (C) Andrew Tridgell 1992-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT client - used to lookup netbios names
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
* Unix SMB/Netbios implementation. Version 1.9. smbpasswd module. Copyright
- * (C) Jeremy Allison 1995.
+ * (C) Jeremy Allison 1995-1997.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
Unix SMB/Netbios implementation.
Version 1.9.
status reporting
- Copyright (C) Andrew Tridgell 1994-1995
+ Copyright (C) Andrew Tridgell 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Test validity of smb.conf
- Copyright (C) Karl Auer 1993, 1994
+ Copyright (C) Karl Auer 1993, 1994-1997
Extensively modified by Andrew Tridgell, 1995
Unix SMB/Netbios implementation.
Version 1.9.
test printer setup
- Copyright (C) Karl Auer 1993, 1994
+ Copyright (C) Karl Auer 1993, 1994-1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by