1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

'The mother of all checkins' :-). Jeremy Allison (jallison@whistle.com)

Wed May  7 1997: Update for 1.9.17alpha1 release - 'browsefix release'
designed to make browsing across subnets work.

byteorder.h:	Updated copyright to 1997.
charcnv.c:      Updated copyright to 1997.
charset.c 	Updated copyright to 1997.
charset.h	Updated copyright to 1997.
client.c	Updated copyright to 1997.
clientutil.c	Updated copyright to 1997.
dir.c		Updated copyright to 1997.
fault.c		Updated copyright to 1997.
includes.h	Updated copyright to 1997.
interface.c	Updated copyright to 1997.
ipc.c		Updated copyright to 1997.
kanji.c		Updated copyright to 1997.
kanji.h		Updated copyright to 1997.
loadparm.c	Updated copyright to 1997.
locking.c	Updated copyright to 1997.
mangle.c	Updated copyright to 1997.
message.c	Updated copyright to 1997.
nameannounce.c

	Made use of WINS subnet explicit.
Added reset_announce_timer() so announcement
can be made immediately when we become a master.
Expanded code to do sync with dmb.

namebrowse.c

	Removed redundent checks for AM_MASTER in
sync code. Made use of WINS subnet explicit.

namedbname.c	Made use of WINS subnet explicit.
namedbresp.c	Made use of WINS subnet explicit.
namedbserver.c	Made use of WINS subnet explicit.

namedbsubnet.c

	Explicitly add workgroup to WINS subnet
when we become a dmb. Made use of WINS subnet explicit.

namedbwork.c

	Made use of WINS subnet explicit. Removed
redundent check_work_servertype() function.

nameelect.c

	Explicitly add workgroup to WINS subnet
when we become a master browser. Made use of WINS subnet explicit.

namelogon.c	Updated copyright to 1997.
namepacket.c	Updated copyright to 1997.
namequery.c	Updated copyright to 1997.

nameresp.c

	Made use of WINS subnet explicit. Made nmbd fail if
configured as master browser and one exists already.

nameserv.c

	Made use of WINS subnet explicit. Remove redundent
logon server and domain master code.

nameserv.h	Add emumerate subnet macros.
nameservreply.c	Made use of WINS subnet explicit.
nameservresp.c	Updated copyright to 1997.

namework.c

	Made use of WINS subnet explicit. Updated code to
add sync browser entries to add subnet parameter.

nmbd.c

	Added sanity check for misconfigured nmbd.

nmblib.c	Updated copyright to 1997.
nmblookup.c	Updated copyright to 1997.
nmbsync.c

	Removed redundent AM_ANY_MASTER check.

params.c	Updated copyright to 1997.
password.c	Updated copyright to 1997.
pipes.c		Updated copyright to 1997.
predict.c	Updated copyright to 1997.
printing.c	Updated copyright to 1997.

proto.h

	Changed protos for new nmbd code.

quotas.c	Updated copyright to 1997.
replace.c	Updated copyright to 1997.
reply.c		Updated copyright to 1997.
server.c	Updated copyright to 1997.
shmem.c		Updated copyright to 1997.
smb.h		Updated copyright to 1997.
smbencrypt.c	Updated copyright to 1997.
smbpasswd.c	Updated copyright to 1997.
smbrun.c	Updated copyright to 1997.
status.c	Updated copyright to 1997.
system.c	Updated copyright to 1997.
testparm.c	Updated copyright to 1997.
testprns.c	Updated copyright to 1997.
time.c		Updated copyright to 1997.
trans2.c	Updated copyright to 1997.
trans2.h	Updated copyright to 1997.
uid.c		Updated copyright to 1997.
username.c	Updated copyright to 1997.
util.c		Updated copyright to 1997.
version.h

	Changed to 1.9.17alpha1.
This commit is contained in:
Samba Release Account -
parent 285769003a
commit cf23a155a1
64 changed files with 390 additions and 361 deletions

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -4,7 +4,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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
@ -75,8 +75,6 @@
#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"
@ -160,6 +158,8 @@ struct name_record
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
{
@ -173,6 +173,7 @@ 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 */
@ -413,3 +414,15 @@ struct packet_struct
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))

View File

@ -295,12 +295,14 @@ int reply_sendend(char *inbuf,char *outbuf);
/*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,
@ -318,7 +320,9 @@ void announce_remote(time_t t);
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 */
@ -460,7 +464,7 @@ BOOL name_query(int fd,char *name,int name_type,
/*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,

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -1 +1 @@
#define VERSION "1.9.16p12alpha"
#define VERSION "1.9.17alpha1"

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -3,7 +3,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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
@ -47,7 +47,7 @@ extern int workgroup_count;
extern struct in_addr wins_ip;
extern pstring scope;
/****************************************************************************
send a announce request to the local net
@ -119,12 +119,13 @@ void do_announce_request(char *info, char *to_name, int announce_type,
**************************************************************************/
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)
{
@ -189,7 +190,7 @@ void do_announce_host(int command,
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)
@ -228,7 +229,7 @@ void announce_server(struct subnet_record *d, struct work_record *work,
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,
@ -305,12 +306,10 @@ void announce_host(time_t t)
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;
@ -362,6 +361,19 @@ void announce_host(time_t t)
}
}
/* 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.
@ -373,16 +385,26 @@ void announce_host(time_t t)
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;
}
last = t;
if(wins_subnet == 0)
{
DEBUG(10,("announce_master: no wins subnet, ignoring.\n"));
return;
}
for (d = subnetlist; d; d = d->next)
announce_timer_last = t;
for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_EXCLUDING_WINS(d))
{
struct work_record *work;
for (work = d->workgrouplist; work; work = work->next)
@ -398,69 +420,95 @@ void announce_master(time_t t)
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. */
for (d = subnetlist; d; d = d->next)
/* Try and find our workgroup on the WINS subnet */
work = find_workgroupstruct(wins_subnet, lp_workgroup(), False);
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()));
/* XXXX i'm not sure we should be using the domain controller
option for this purpose.
*/
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)));
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);
}
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);
}
}
}
}

View File

@ -2,7 +2,7 @@
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
@ -95,7 +95,8 @@ void expire_browse_cache(time_t t)
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;
@ -137,7 +138,8 @@ struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
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;
@ -164,20 +166,14 @@ find a server responsible for a workgroup, and sync browse lists
**************************************************************************/
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))) {
@ -187,29 +183,23 @@ workgroup for a browse cache entry workgroup %s, server %s\n",
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;
}

View File

@ -2,7 +2,7 @@
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
@ -187,7 +187,7 @@ struct name_record *find_name_search(struct subnet_record **d,
if (!(search & FIND_WINS)) return NULL;
/* find WINS subnet record. */
*d = find_subnet(wins_ip);
*d = wins_subnet;
if (*d == NULL) return NULL;
@ -203,12 +203,14 @@ struct name_record *find_name_search(struct subnet_record **d,
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,"/");
@ -224,29 +226,28 @@ void dump_names(void)
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 :-) */
@ -264,7 +265,7 @@ void dump_names(void)
fprintf(f, "\n");
}
}
}
fclose(f);
unlink(fname);
@ -282,7 +283,7 @@ void dump_names(void)
****************************************************************************/
void load_netbios_names(void)
{
struct subnet_record *d = find_subnet(wins_ip);
struct subnet_record *d = wins_subnet;
fstring fname;
FILE *f;
@ -414,6 +415,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
{
struct name_record *n;
struct name_record *n2=NULL;
struct subnet_record *found_subnet = 0;
int search = 0;
BOOL self = source == SELF;
@ -447,12 +449,13 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
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)
@ -469,7 +472,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
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);
}
@ -485,7 +488,7 @@ void expire_names(time_t t)
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)
{
@ -522,9 +525,9 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
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)));
@ -543,7 +546,7 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
/* 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;
}
@ -551,6 +554,6 @@ struct name_record *dns_name_search(struct nmb_name *question, int Time)
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);
}

View File

@ -2,7 +2,7 @@
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
@ -144,7 +144,7 @@ struct response_record *find_response_record(struct subnet_record **d,
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)
{

View File

@ -2,7 +2,7 @@
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
@ -208,7 +208,7 @@ void expire_servers(time_t t)
{
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;

View File

@ -2,7 +2,7 @@
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
@ -50,6 +50,10 @@ extern struct interface *local_interfaces;
/* 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. */
@ -81,32 +85,19 @@ static void add_subnet(struct subnet_record *d)
/****************************************************************************
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);
@ -125,8 +116,8 @@ struct subnet_record *find_req_subnet(struct in_addr ip, BOOL bcast)
/* 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;
}
/****************************************************************************
@ -137,13 +128,13 @@ struct subnet_record *find_subnet_all(struct in_addr bcast_ip)
{
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));
@ -159,7 +150,8 @@ static struct subnet_record *make_subnet(struct in_addr bcast_ip, struct in_addr
d->mask_ip = mask_ip;
d->workgrouplist = NULL;
add_subnet(d);
if(add)
add_subnet(d);
return d;
}
@ -179,7 +171,7 @@ void add_subnet_interfaces(void)
/* 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);
}
}
@ -188,14 +180,14 @@ void add_subnet_interfaces(void)
{
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)
{
@ -212,6 +204,18 @@ 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));
}
@ -240,7 +244,7 @@ static struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
/* 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);
@ -304,7 +308,7 @@ void write_browse_list(time_t t)
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)

View File

@ -2,7 +2,7 @@
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
@ -97,7 +97,7 @@ static struct work_record *make_workgroup(char *name)
/* 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)
@ -175,16 +175,6 @@ struct work_record *find_workgroupstruct(struct subnet_record *d,
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"));
@ -223,7 +213,7 @@ void dump_workgroups(void)
{
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)
{
@ -248,42 +238,3 @@ void dump_workgroups(void)
}
}
}
/****************************************************************************
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;
}

View File

@ -2,7 +2,7 @@
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
@ -67,14 +67,10 @@ void check_master_browser(time_t t)
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))
@ -365,7 +361,27 @@ void become_local_master(struct subnet_record *d, struct work_record *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:
@ -642,17 +658,10 @@ void run_elections(time_t t)
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)
@ -777,7 +786,7 @@ BOOL check_elections(void)
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)

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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
@ -62,7 +62,7 @@ static void dead_netbios_entry(struct subnet_record *d,
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,
@ -162,18 +162,11 @@ static void dead_netbios_entry(struct subnet_record *d,
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);
@ -182,6 +175,11 @@ static void dead_netbios_entry(struct subnet_record *d,
become_domain_master(d,work);
}
}
else
{
DEBUG(0, ("ERROR: nmbd configured as domain master and one already exitsts !!!\n"));
exit(1);
}
break;
}
@ -206,7 +204,7 @@ void expire_netbios_response_entries(time_t t)
{
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;
@ -249,7 +247,7 @@ void expire_netbios_response_entries(time_t t)
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,
@ -283,7 +281,7 @@ struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
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);

View File

@ -2,7 +2,7 @@
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
@ -85,7 +85,7 @@ void remove_name_entry(struct subnet_record *d, char *name,int type)
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);
}
@ -142,7 +142,7 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags)
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);
@ -171,15 +171,15 @@ void add_domain_names(time_t t)
{
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);
@ -191,52 +191,52 @@ void add_domain_names(time_t t)
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);
}
}
}
}
}
@ -252,9 +252,9 @@ void add_my_names(void)
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);
@ -268,15 +268,6 @@ void add_my_names(void)
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);
}
}
}
@ -288,7 +279,7 @@ void remove_my_names()
{
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;
@ -314,7 +305,7 @@ void refresh_my_names(time_t t)
{
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;
@ -347,7 +338,7 @@ void refresh_my_names(time_t t)
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;

View File

@ -2,7 +2,7 @@
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
@ -433,7 +433,7 @@ void reply_name_status(struct packet_struct *p)
/* 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)
{
@ -520,7 +520,7 @@ void reply_name_query(struct packet_struct *p)
}
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)));

View File

@ -2,7 +2,7 @@
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
@ -320,7 +320,7 @@ static void response_name_status_check(struct in_addr ip,
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

View File

@ -2,7 +2,7 @@
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
@ -96,7 +96,7 @@ void tell_become_backup(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)
@ -263,6 +263,7 @@ static void process_localnet_announce(struct packet_struct *p,uint16 command,cha
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)
@ -270,15 +271,18 @@ static void process_localnet_announce(struct packet_struct *p,uint16 command,cha
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;
@ -287,9 +291,9 @@ static void process_master_announce(struct packet_struct *p,char *buf)
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;
}
@ -299,12 +303,12 @@ static void process_master_announce(struct packet_struct *p,char *buf)
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);
}
}
}
@ -434,7 +438,7 @@ static void send_backup_list(char *work_name, struct nmb_name *src_name,
#if 0
for (d = subnetlist; d; d = d->next)
for (d = FIRST_SUBNET; d; d = NEXT_SUBNET_INCLUDING_WINS(d))
{
struct work_record *work;
@ -573,7 +577,7 @@ static void process_reset_browser(struct packet_struct *p,char *buf)
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)
@ -594,7 +598,7 @@ static void process_reset_browser(struct packet_struct *p,char *buf)
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));

View File

@ -2,7 +2,7 @@
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
@ -206,6 +206,13 @@ BOOL reload_services(BOOL test)
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);
}
@ -546,6 +553,7 @@ static void usage(char *pname)
if (strequal(lp_workgroup(),"*")) {
DEBUG(0,("ERROR: a workgroup name of * is no longer supported\n"));
exit(1);
}
add_my_subnets(lp_workgroup());

View File

@ -2,7 +2,7 @@
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
@ -140,7 +140,13 @@ void sync_browse_lists(struct subnet_record *d, struct work_record *work,
{
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();

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -3,7 +3,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -3,7 +3,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
/*
* 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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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

View File

@ -2,7 +2,7 @@
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