diff options
author | Jeremy Allison <jra@samba.org> | 1997-12-16 09:20:34 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1997-12-16 09:20:34 +0000 |
commit | 16bf14adf1b78f7ec4d3d267d500258fdf399627 (patch) | |
tree | 5933e3edc94f51bce97bf9ebca498b373fdcdc2e /source3/nmbd/nmbd_packets.c | |
parent | 5d4345b66de2bbf9d60e78682d820adb30b52a79 (diff) | |
download | samba-16bf14adf1b78f7ec4d3d267d500258fdf399627.tar.gz samba-16bf14adf1b78f7ec4d3d267d500258fdf399627.tar.bz2 samba-16bf14adf1b78f7ec4d3d267d500258fdf399627.zip |
Added Lanman announce patch from Jacco de Leeuw <leeuw@wins.uva.nl>.
Also added code to stop old Samba servers that announce the workgroup
name as master browser name when they are a local master browser.
Jeremy.
(This used to be commit 3605da055737e2cc0fbfffe7772721943a5be8bd)
Diffstat (limited to 'source3/nmbd/nmbd_packets.c')
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 43249cc0a3..4fb0543967 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1024,6 +1024,56 @@ command code %d from %s IP %s to %s\n", } /**************************************************************************** + Dispatch a LanMan browse frame from port 138 to the correct processing function. +****************************************************************************/ + +void process_lanman_packet(struct packet_struct *p, char *buf,int len) +{ + struct dgram_packet *dgram = &p->packet.dgram; + int command = SVAL(buf,0); + struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p); + + /* Drop the packet if it's a different NetBIOS scope, or + the source is from one of our names. */ + + if (!strequal(dgram->dest_name.scope,scope )) + { + DEBUG(7,("process_lanman_packet: Discarding datagram from IP %s. Scope (%s) \ +mismatch with our scope (%s).\n", inet_ntoa(p->ip), dgram->dest_name.scope, scope)); + return; + } + + if (is_myname(dgram->source_name.name)) + { + DEBUG(0,("process_lanman_packet: Discarding datagram from IP %s. Source name \ +%s is one of our names !\n", inet_ntoa(p->ip), namestr(&dgram->source_name))); + return; + } + + switch (command) + { + case ANN_HostAnnouncement: + { + debug_browse_data(buf, len); + process_lm_host_announce(subrec, p, buf+1); + break; + } + case ANN_AnnouncementRequest: + { + process_lm_announce_request(subrec, p, buf+1); + break; + } + default: + { + DEBUG(0,("process_lanman_packet: On subnet %s ignoring browse packet \ +command code %d from %s IP %s to %s\n", + subrec->subnet_name, command, namestr(&dgram->source_name), + inet_ntoa(p->ip), namestr(&dgram->dest_name))); + } + } +} + +/**************************************************************************** Determine if a packet is for us on port 138. 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. @@ -1100,6 +1150,12 @@ static void process_dgram(struct packet_struct *p) return; } + /* Datagram packet received for the LAN Manager mailslot */ + if (strequal(smb_buf(buf),LANMAN_MAILSLOT)) { + process_lanman_packet(p,buf2,len); + return; + } + /* Datagram packet received for the domain logon mailslot */ if (strequal(smb_buf(buf),NET_LOGON_MAILSLOT)) { |