summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-01-29 02:03:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:13 -0500
commit22923f7d2d20afb758f48a371160473a2a900750 (patch)
tree091173a49d2ff16e7466135528f7b895d4e0e7b0 /source3/nmbd
parente612109aced3284033fc2e9170bbc290d8b5d6c6 (diff)
downloadsamba-22923f7d2d20afb758f48a371160473a2a900750.tar.gz
samba-22923f7d2d20afb758f48a371160473a2a900750.tar.bz2
samba-22923f7d2d20afb758f48a371160473a2a900750.zip
r5076: Ensure that WINS negative name query responses and WACK packets
use the correct RR type of 0xA instead of reflecting back what the query RR type was (0x20). See rfc1002 sections 4.2.14 and 4.2.16. Jeremy. (This used to be commit ab8c9240044f1ef3d5c6ac4850c8ec615c2e32fd)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_packets.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 8a111eb957..70ea087426 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -864,6 +864,7 @@ void reply_netbios_packet(struct packet_struct *orig_packet,
struct res_rec answers;
struct nmb_packet *orig_nmb = &orig_packet->packet.nmb;
BOOL loopback_this_packet = False;
+ BOOL use_null_rr_type = False;
const char *packet_type = "unknown";
/* Check if we are sending to or from ourselves. */
@@ -906,6 +907,7 @@ void reply_netbios_packet(struct packet_struct *orig_packet,
packet_type = "nmb_wack";
nmb->header.nm_flags.recursion_desired = False;
nmb->header.nm_flags.recursion_available = False;
+ use_null_rr_type = True;
break;
case WINS_REG:
packet_type = "wins_reg";
@@ -916,6 +918,9 @@ void reply_netbios_packet(struct packet_struct *orig_packet,
packet_type = "wins_query";
nmb->header.nm_flags.recursion_desired = True;
nmb->header.nm_flags.recursion_available = True;
+ if (rcode) {
+ use_null_rr_type = True;
+ }
break;
default:
DEBUG(0,("reply_netbios_packet: Unknown packet type: %s %s to ip %s\n",
@@ -947,7 +952,11 @@ for id %hu\n", packet_type, nmb_namestr(&orig_nmb->question.question_name),
memset((char*)nmb->answers,'\0',sizeof(*nmb->answers));
nmb->answers->rr_name = orig_nmb->question.question_name;
- nmb->answers->rr_type = orig_nmb->question.question_type;
+ if (use_null_rr_type) {
+ nmb->answers->rr_type = RR_TYPE_NULL;
+ } else {
+ nmb->answers->rr_type = orig_nmb->question.question_type;
+ }
nmb->answers->rr_class = orig_nmb->question.question_class;
nmb->answers->ttl = ttl;