summaryrefslogtreecommitdiff
path: root/source3/namepacket.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-08-20 15:45:16 +0000
committerAndrew Tridgell <tridge@samba.org>1996-08-20 15:45:16 +0000
commit748d65a4ac898708dc7d2fd6f2bdee41489fee86 (patch)
treeb54a4d77d71beba6e6422c366ecb17f57c172614 /source3/namepacket.c
parent7f38abfbdb57b4ed33fa0aaacdfe7414d4c19a28 (diff)
downloadsamba-748d65a4ac898708dc7d2fd6f2bdee41489fee86.tar.gz
samba-748d65a4ac898708dc7d2fd6f2bdee41489fee86.tar.bz2
samba-748d65a4ac898708dc7d2fd6f2bdee41489fee86.zip
- fix a bug in NetServerEnum where counted and total were not counted
correctly if there were multiple instances of a name. This led to the infamous "not enough memory" error when browsing (but this isn't the only cause of that message) - fix a triple-chaining bug which affected OpenX following a TconX - fix a serious nmbd bug that meant nmdb would answer packets that it wasn't supposed to, causing havoc with browse lists. - never time out SELF packets. This is an interim fix until I find out why nmbd thought they should be timed out. (This used to be commit 2960c3908c2c3b01a1f2b77def60350018d298e1)
Diffstat (limited to 'source3/namepacket.c')
-rw-r--r--source3/namepacket.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source3/namepacket.c b/source3/namepacket.c
index 4be5a95952..02f4958520 100644
--- a/source3/namepacket.c
+++ b/source3/namepacket.c
@@ -162,7 +162,10 @@ void initiate_netbios_packet(uint16 *id,
p.timestamp = time(NULL);
p.packet_type = NMB_PACKET;
- if (!send_packet(&p)) *id = 0xffff;
+ if (!send_packet(&p)) {
+ DEBUG(3,("send_packet to %s %d failed\n",inet_ntoa(p.ip),p.port));
+ *id = 0xffff;
+ }
return;
}
@@ -296,6 +299,26 @@ void queue_packet(struct packet_struct *packet)
packet->prev = p;
}
+/****************************************************************************
+ determine if a packet is for us. Note that to have any chance of
+ being efficient we need to drop as many packets as possible at this
+ stage as subsequent processing is expensive.
+
+ We also must make absolutely sure we don't tread on another machines
+ property by answering a packet that is not for us.
+ ****************************************************************************/
+static BOOL listening(struct packet_struct *p,struct nmb_name *n)
+{
+ struct subnet_record *d;
+ struct name_record *n1;
+
+ d = find_subnet(p->ip);
+
+ n1 = find_name_search(&d,n,FIND_LOCAL|FIND_WINS|FIND_SELF,p->ip);
+
+ return (n1 != NULL);
+}
+
/****************************************************************************
process udp 138 datagrams
@@ -307,6 +330,11 @@ static void process_dgram(struct packet_struct *p)
int len;
struct dgram_packet *dgram = &p->packet.dgram;
+ /* if we aren't listening to the destination name then ignore the packet */
+ if (!listening(p,&dgram->dest_name))
+ return;
+
+
if (dgram->header.msg_type != 0x10 &&
dgram->header.msg_type != 0x11 &&
dgram->header.msg_type != 0x12) {