mirror of
https://github.com/samba-team/samba.git
synced 2024-12-29 11:21:54 +03:00
0f1f0ceb95
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 used to be commit cf23a155a1
)
165 lines
4.4 KiB
C
165 lines
4.4 KiB
C
/*
|
|
Unix SMB/Netbios implementation.
|
|
Version 1.9.
|
|
NBT netbios library routines
|
|
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
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
Module name: namedbresp.c
|
|
|
|
*/
|
|
|
|
#include "includes.h"
|
|
|
|
extern int ClientNMB;
|
|
extern int ClientDGRAM;
|
|
|
|
extern struct subnet_record *subnetlist;
|
|
|
|
extern int DEBUGLEVEL;
|
|
|
|
extern pstring scope;
|
|
extern pstring myname;
|
|
extern struct in_addr ipzero;
|
|
|
|
int num_response_packets = 0;
|
|
|
|
/***************************************************************************
|
|
add an expected response record into the list
|
|
**************************************************************************/
|
|
void add_response_record(struct subnet_record *d,
|
|
struct response_record *n)
|
|
{
|
|
struct response_record *n2;
|
|
|
|
if (!d) return;
|
|
|
|
num_response_packets++; /* count of total number of packets still around */
|
|
|
|
DEBUG(4,("adding response record id:%d num_records:%d\n",
|
|
n->response_id, num_response_packets));
|
|
|
|
if (!d->responselist)
|
|
{
|
|
d->responselist = n;
|
|
n->prev = NULL;
|
|
n->next = NULL;
|
|
return;
|
|
}
|
|
|
|
for (n2 = d->responselist; n2->next; n2 = n2->next) ;
|
|
|
|
n2->next = n;
|
|
n->next = NULL;
|
|
n->prev = n2;
|
|
}
|
|
|
|
|
|
/***************************************************************************
|
|
remove an expected response record from the list
|
|
**************************************************************************/
|
|
void remove_response_record(struct subnet_record *d,
|
|
struct response_record *n)
|
|
{
|
|
if (!d) return;
|
|
|
|
if (n->prev) n->prev->next = n->next;
|
|
if (n->next) n->next->prev = n->prev;
|
|
|
|
if (d->responselist == n) d->responselist = n->next;
|
|
|
|
free(n);
|
|
|
|
num_response_packets--; /* count of total number of packets still around */
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
create a name query response record
|
|
**************************************************************************/
|
|
struct response_record *make_response_queue_record(enum state_type state,
|
|
int id,uint16 fd,
|
|
int quest_type, char *name,int type, int nb_flags, time_t ttl,
|
|
int server_type, char *my_name, char *my_comment,
|
|
BOOL bcast,BOOL recurse,
|
|
struct in_addr send_ip, struct in_addr reply_to_ip)
|
|
{
|
|
struct response_record *n;
|
|
|
|
if (!name || !name[0]) return NULL;
|
|
|
|
if (!(n = (struct response_record *)malloc(sizeof(*n))))
|
|
return(NULL);
|
|
|
|
n->response_id = id;
|
|
n->state = state;
|
|
n->fd = fd;
|
|
n->quest_type = quest_type;
|
|
make_nmb_name(&n->name, name, type, scope);
|
|
n->nb_flags = nb_flags;
|
|
n->ttl = ttl;
|
|
n->server_type = server_type;
|
|
n->bcast = bcast;
|
|
n->recurse = recurse;
|
|
n->send_ip = send_ip;
|
|
n->reply_to_ip = reply_to_ip;
|
|
if(my_name)
|
|
StrnCpy(n->my_name, my_name, sizeof(n->my_name)-1);
|
|
else
|
|
*n->my_name = 0;
|
|
if(my_comment)
|
|
StrnCpy(n->my_comment, my_comment, sizeof(n->my_comment)-1);
|
|
else
|
|
*n->my_comment = 0;
|
|
n->repeat_interval = 1; /* XXXX should be in ms */
|
|
n->repeat_count = 3; /* 3 retries */
|
|
n->repeat_time = time(NULL) + n->repeat_interval; /* initial retry time */
|
|
|
|
n->num_msgs = 0;
|
|
|
|
return n;
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
find a response in a subnet's name query response list.
|
|
**************************************************************************/
|
|
struct response_record *find_response_record(struct subnet_record **d,
|
|
uint16 id)
|
|
{
|
|
struct response_record *n;
|
|
|
|
if (!d) return NULL;
|
|
|
|
for ((*d) = FIRST_SUBNET; (*d); (*d) = NEXT_SUBNET_INCLUDING_WINS(*d))
|
|
{
|
|
for (n = (*d)->responselist; n; n = n->next)
|
|
{
|
|
if (n->response_id == id) {
|
|
DEBUG(4, ("found response record on %s: %d\n",
|
|
inet_ntoa((*d)->bcast_ip), id));
|
|
return n;
|
|
}
|
|
}
|
|
}
|
|
|
|
*d = NULL;
|
|
|
|
return NULL;
|
|
}
|
|
|
|
|