s4 dns: TKEY record needs to remember incoming algorithm
authorKai Blin <kai@samba.org>
Wed, 5 Sep 2012 06:27:28 +0000 (08:27 +0200)
committerKai Blin <kai@samba.org>
Wed, 5 Sep 2012 17:02:17 +0000 (19:02 +0200)
Samba3 (and older windows versions) use gss.microsoft.com, win7 (and the RFC) use gss-tsig

source4/dns_server/dns_query.c
source4/dns_server/dns_server.h

index 00feec0a83d3d6d175d0e2f11b7efe05707ce8cc..3c919ee0a973c6fe63487ec120941c184028132b 100644 (file)
@@ -322,6 +322,7 @@ static WERROR handle_question(struct dns_server *dns,
 
 static NTSTATUS create_tkey(struct dns_server *dns,
                            const char* name,
+                           const char* algorithm,
                            struct dns_server_tkey **tkey)
 {
        NTSTATUS status;
@@ -338,6 +339,11 @@ static NTSTATUS create_tkey(struct dns_server *dns,
                return NT_STATUS_NO_MEMORY;
        }
 
+       k->algorithm = talloc_strdup(k, algorithm);
+       if (k->algorithm == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
        status = samba_server_gensec_start(k,
                                           dns->task->event_ctx,
                                           dns->task->msg_ctx,
@@ -442,7 +448,8 @@ static WERROR handle_tkey(struct dns_server *dns,
        ret_tkey->rr_class = DNS_QCLASS_ANY;
        ret_tkey->length = UINT16_MAX;
 
-       ret_tkey->rdata.tkey_record.algorithm = talloc_strdup(ret_tkey, ret_tkey->name);
+       ret_tkey->rdata.tkey_record.algorithm = talloc_strdup(ret_tkey,
+                       in_tkey->rdata.tkey_record.algorithm);
        if (ret_tkey->rdata.tkey_record.algorithm  == NULL) {
                return WERR_NOMEM;
        }
@@ -473,6 +480,7 @@ static WERROR handle_tkey(struct dns_server *dns,
 
                if (tkey == NULL) {
                        status  = create_tkey(dns, in->questions[0].name,
+                                             in_tkey->rdata.tkey_record.algorithm,
                                              &tkey);
                        if (!NT_STATUS_IS_OK(status)) {
                                ret_tkey->rdata.tkey_record.error = DNS_RCODE_BADKEY;
index 74a1ded6f2b98fabf143f21f33da56b88cd94266..994e7bfbbc1c7fcba8c60b898e1a09adb4f207ec 100644 (file)
@@ -36,6 +36,7 @@ struct dns_server_zone {
 struct dns_server_tkey {
        const char *name;
        enum dns_tkey_mode mode;
+       const char *algorithm;
        struct auth_session_info *session_info;
        struct gensec_security *gensec;
        bool complete;