examples: add bind9 patches for TSIG-GSS support
[abartlet/samba.git/.git] / examples / bind9-patches / 0003-don-t-compress-TSIG-names.patch
1 From ec22ed6c9797dbdcd820e352167bef8500ca00c6 Mon Sep 17 00:00:00 2001
2 From: Andrew Tridgell <tridge@samba.org>
3 Date: Wed, 17 Feb 2010 12:20:35 +1100
4 Subject: [PATCH 3/5] don't compress TSIG names
5
6 windows DNS servers will refuse TSIG-GSS requests with compressed
7 names
8 ---
9  bin/nsupdate/nsupdate.c |    4 ++++
10  lib/dns/message.c       |    2 ++
11  lib/dns/tsig.c          |    3 +++
12  3 files changed, 9 insertions(+), 0 deletions(-)
13
14 diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
15 index 6cf4cf4..f7ce6db 100644
16 --- a/bin/nsupdate/nsupdate.c
17 +++ b/bin/nsupdate/nsupdate.c
18 @@ -1985,6 +1985,10 @@ send_update(dns_name_t *zonename, isc_sockaddr_t *master,
19                 fprintf(stderr, "Sending update to %s\n", addrbuf);
20         }
21
22 +       /* windows doesn't like the tsig name to be compressed */
23 +       if (updatemsg->tsigname)
24 +               updatemsg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
25 +
26         result = dns_request_createvia3(requestmgr, updatemsg, srcaddr,
27                                         master, options, tsigkey, timeout,
28                                         udp_timeout, udp_retries, global_task,
29 diff --git a/lib/dns/message.c b/lib/dns/message.c
30 index ae4965f..cb4528f 100644
31 --- a/lib/dns/message.c
32 +++ b/lib/dns/message.c
33 @@ -1531,6 +1531,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
34                 } else if (rdtype == dns_rdatatype_tsig && msg->tsig == NULL) {
35                         msg->tsig = rdataset;
36                         msg->tsigname = name;
37 +                       /* TSIG names should not be compressed */
38 +                       msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
39                         rdataset = NULL;
40                         free_rdataset = ISC_FALSE;
41                         free_name = ISC_FALSE;
42 diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c
43 index 74a7af3..3223942 100644
44 --- a/lib/dns/tsig.c
45 +++ b/lib/dns/tsig.c
46 @@ -889,6 +889,9 @@ dns_tsig_sign(dns_message_t *msg) {
47         msg->tsig = dataset;
48         msg->tsigname = owner;
49
50 +       /* windows does not like the tsig name being compressed */
51 +       msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
52 +
53         return (ISC_R_SUCCESS);
54
55   cleanup_rdatalist:
56 --
57 1.6.3.3
58