dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0087-DYNDNS-remove-zone-command.patch

6cf099
From 17f136d85a5ce0e2a6fa71d32eb2b048853b4800 Mon Sep 17 00:00:00 2001
6cf099
From: Pavel Reichl <preichl@redhat.com>
6cf099
Date: Thu, 23 Jul 2015 05:30:34 -0400
6cf099
Subject: [PATCH 87/90] DYNDNS: remove zone command
6cf099
6cf099
Remove zone command from message to nsupsate. This command is generally
6cf099
used to hint nsupdate. In correctly configured environment such
6cf099
information should be obtained via DNS.
6cf099
6cf099
If DNS does not provide necessary information we give other hints.
6cf099
6cf099
For more details see:
6cf099
https://fedorahosted.org/sssd/wiki/DesignDocs/DDNSMessagesUpdate
6cf099
6cf099
Resolves:
6cf099
https://fedorahosted.org/sssd/ticket/2495
6cf099
6cf099
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
6cf099
(cherry picked from commit 4f2a07c422fa357ef6651bca8c48b8005280fa1d)
6cf099
---
6cf099
 src/providers/ad/ad_dyndns.c     |  1 -
6cf099
 src/providers/dp_dyndns.c        | 12 +-----------
6cf099
 src/providers/dp_dyndns.h        |  2 +-
6cf099
 src/providers/ipa/ipa_dyndns.c   | 16 ----------------
6cf099
 src/providers/ldap/sdap_dyndns.c | 13 +------------
6cf099
 src/providers/ldap/sdap_dyndns.h |  1 -
6cf099
 6 files changed, 3 insertions(+), 42 deletions(-)
6cf099
6cf099
diff --git a/src/providers/ad/ad_dyndns.c b/src/providers/ad/ad_dyndns.c
6cf099
index aac7d8b0a170e07cba0cd150a6f19c538948d657..5f8638128b966f0981c85a44e50e3201c73d561e 100644
6cf099
--- a/src/providers/ad/ad_dyndns.c
6cf099
+++ b/src/providers/ad/ad_dyndns.c
6cf099
@@ -233,7 +233,6 @@ ad_dyndns_update_send(struct ad_options *ctx)
6cf099
                                                        DP_OPT_DYNDNS_IFACE),
6cf099
                                      dp_opt_get_string(ctx->basic,
6cf099
                                                        AD_HOSTNAME),
6cf099
-                                     NULL,
6cf099
                                      dp_opt_get_string(ctx->basic,
6cf099
                                                        AD_KRB5_REALM),
6cf099
                                      state->servername,
6cf099
diff --git a/src/providers/dp_dyndns.c b/src/providers/dp_dyndns.c
6cf099
index 3171e6909e5f92a98cd506278e6e8c3418b979fe..ae3f913ee392a6513f75aab497e7f2d784784748 100644
6cf099
--- a/src/providers/dp_dyndns.c
6cf099
+++ b/src/providers/dp_dyndns.c
6cf099
@@ -436,7 +436,7 @@ fail:
6cf099
 
6cf099
 errno_t
6cf099
 be_nsupdate_create_fwd_msg(TALLOC_CTX *mem_ctx, const char *realm,
6cf099
-                           const char *zone, const char *servername,
6cf099
+                           const char *servername,
6cf099
                            const char *hostname, const unsigned int ttl,
6cf099
                            uint8_t remove_af, struct sss_iface_addr *addresses,
6cf099
                            char **_update_msg)
6cf099
@@ -459,16 +459,6 @@ be_nsupdate_create_fwd_msg(TALLOC_CTX *mem_ctx, const char *realm,
6cf099
         goto done;
6cf099
     }
6cf099
 
6cf099
-    if (zone) {
6cf099
-        DEBUG(SSSDBG_FUNC_DATA,
6cf099
-              "Setting the zone explicitly to [%s].\n", zone);
6cf099
-        update_msg = talloc_asprintf_append(update_msg, "zone %s.\n", zone);
6cf099
-        if (update_msg == NULL) {
6cf099
-            ret = ENOMEM;
6cf099
-            goto done;
6cf099
-        }
6cf099
-    }
6cf099
-
6cf099
     update_msg = nsupdate_msg_add_fwd(update_msg, addresses, hostname,
6cf099
                                       ttl, remove_af);
6cf099
     if (update_msg == NULL) {
6cf099
diff --git a/src/providers/dp_dyndns.h b/src/providers/dp_dyndns.h
6cf099
index 3cc8d122646590365a3fb6dafa6a0f699b620ad9..9f72331b6fd68e17e9eb91505a13fc839d3f54e1 100644
6cf099
--- a/src/providers/dp_dyndns.h
6cf099
+++ b/src/providers/dp_dyndns.h
6cf099
@@ -89,7 +89,7 @@ sss_iface_addr_list_as_str_list(TALLOC_CTX *mem_ctx,
6cf099
 
6cf099
 errno_t
6cf099
 be_nsupdate_create_fwd_msg(TALLOC_CTX *mem_ctx, const char *realm,
6cf099
-                           const char *zone, const char *servername,
6cf099
+                           const char *servername,
6cf099
                            const char *hostname, const unsigned int ttl,
6cf099
                            uint8_t remove_af, struct sss_iface_addr *addresses,
6cf099
                            char **_update_msg);
6cf099
diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c
6cf099
index 83009ff2a08cb8e4ae2b7a1e89039539b23b6d79..e7026eb275798f0ed21fb8490295b6e6d419d8ee 100644
6cf099
--- a/src/providers/ipa/ipa_dyndns.c
6cf099
+++ b/src/providers/ipa/ipa_dyndns.c
6cf099
@@ -153,9 +153,7 @@ ipa_dyndns_update_send(struct ipa_options *ctx)
6cf099
     struct ipa_dyndns_update_state *state;
6cf099
     struct tevent_req *req, *subreq;
6cf099
     struct sdap_id_ctx *sdap_ctx = ctx->id_ctx->sdap_id_ctx;
6cf099
-    char *dns_zone;
6cf099
     const char *servername;
6cf099
-    int i;
6cf099
 
6cf099
     DEBUG(SSSDBG_TRACE_FUNC, "Performing update\n");
6cf099
 
6cf099
@@ -175,19 +173,6 @@ ipa_dyndns_update_send(struct ipa_options *ctx)
6cf099
     }
6cf099
     state->ipa_ctx->dyndns_ctx->last_refresh = time(NULL);
6cf099
 
6cf099
-    dns_zone = dp_opt_get_string(ctx->basic, IPA_DOMAIN);
6cf099
-    if (!dns_zone) {
6cf099
-        ret = EIO;
6cf099
-        goto done;
6cf099
-    }
6cf099
-
6cf099
-    /* The DNS zone for IPA is the lower-case
6cf099
-     * version of the IPA domain
6cf099
-     */
6cf099
-    for (i = 0; dns_zone[i] != '\0'; i++) {
6cf099
-        dns_zone[i] = tolower(dns_zone[i]);
6cf099
-    }
6cf099
-
6cf099
     if (strncmp(ctx->service->sdap->uri,
6cf099
                 "ldap://", 7) != 0) {
6cf099
         DEBUG(SSSDBG_CRIT_FAILURE, "Unexpected format of LDAP URI.\n");
6cf099
@@ -209,7 +194,6 @@ ipa_dyndns_update_send(struct ipa_options *ctx)
6cf099
                                                        DP_OPT_DYNDNS_IFACE),
6cf099
                                      dp_opt_get_string(ctx->basic,
6cf099
                                                        IPA_HOSTNAME),
6cf099
-                                     dns_zone,
6cf099
                                      dp_opt_get_string(ctx->basic,
6cf099
                                                        IPA_KRB5_REALM),
6cf099
                                      servername,
6cf099
diff --git a/src/providers/ldap/sdap_dyndns.c b/src/providers/ldap/sdap_dyndns.c
6cf099
index 0f0e63ee2259d017c3e94afca5f3148f4fc2ce04..f0e3dd855005d00ea19cb5dc283375f58b0d2cca 100644
6cf099
--- a/src/providers/ldap/sdap_dyndns.c
6cf099
+++ b/src/providers/ldap/sdap_dyndns.c
6cf099
@@ -47,7 +47,6 @@ struct sdap_dyndns_update_state {
6cf099
     struct dp_option *opts;
6cf099
 
6cf099
     const char *hostname;
6cf099
-    const char *dns_zone;
6cf099
     const char *realm;
6cf099
     const char *servername;
6cf099
     int ttl;
6cf099
@@ -61,7 +60,6 @@ struct sdap_dyndns_update_state {
6cf099
     enum be_nsupdate_auth auth_type;
6cf099
     bool use_server_with_nsupdate;
6cf099
     char *update_msg;
6cf099
-    size_t pass_num;
6cf099
 };
6cf099
 
6cf099
 static void sdap_dyndns_update_addrs_done(struct tevent_req *subreq);
6cf099
@@ -82,7 +80,6 @@ sdap_dyndns_update_send(TALLOC_CTX *mem_ctx,
6cf099
                         enum be_nsupdate_auth auth_type,
6cf099
                         const char *ifname,
6cf099
                         const char *hostname,
6cf099
-                        const char *dns_zone,
6cf099
                         const char *realm,
6cf099
                         const char *servername,
6cf099
                         const int ttl,
6cf099
@@ -101,7 +98,6 @@ sdap_dyndns_update_send(TALLOC_CTX *mem_ctx,
6cf099
     state->check_diff = check_diff;
6cf099
     state->update_ptr = dp_opt_get_bool(opts, DP_OPT_DYNDNS_UPDATE_PTR);
6cf099
     state->hostname = hostname;
6cf099
-    state->dns_zone = dns_zone;
6cf099
     state->realm = realm;
6cf099
     state->servername = servername;
6cf099
     state->use_server_with_nsupdate = false;
6cf099
@@ -110,7 +106,6 @@ sdap_dyndns_update_send(TALLOC_CTX *mem_ctx,
6cf099
     state->ev = ev;
6cf099
     state->opts = opts;
6cf099
     state->auth_type = auth_type;
6cf099
-    state->pass_num = 0;
6cf099
 
6cf099
     /* fallback servername is overriden by user option */
6cf099
     conf_servername = dp_opt_get_string(opts, DP_OPT_DYNDNS_SERVER);
6cf099
@@ -317,7 +312,6 @@ sdap_dyndns_update_step(struct tevent_req *req)
6cf099
     struct sdap_dyndns_update_state *state;
6cf099
     const char *servername;
6cf099
     struct tevent_req *subreq;
6cf099
-    const char *dns_zone = NULL;
6cf099
 
6cf099
     state = tevent_req_data(req, struct sdap_dyndns_update_state);
6cf099
 
6cf099
@@ -327,11 +321,7 @@ sdap_dyndns_update_step(struct tevent_req *req)
6cf099
         servername = state->servername;
6cf099
     }
6cf099
 
6cf099
-    if (state->pass_num > 0) {
6cf099
-        dns_zone = state->dns_zone;
6cf099
-    }
6cf099
-
6cf099
-    ret = be_nsupdate_create_fwd_msg(state, state->realm, dns_zone,
6cf099
+    ret = be_nsupdate_create_fwd_msg(state, state->realm,
6cf099
                                      servername, state->hostname,
6cf099
                                      state->ttl, state->remove_af,
6cf099
                                      state->addresses,
6cf099
@@ -340,7 +330,6 @@ sdap_dyndns_update_step(struct tevent_req *req)
6cf099
         DEBUG(SSSDBG_OP_FAILURE, "Can't get addresses for DNS update\n");
6cf099
         return ret;
6cf099
     }
6cf099
-    state->pass_num++;
6cf099
 
6cf099
     /* Fork a child process to perform the DNS update */
6cf099
     subreq = be_nsupdate_send(state, state->ev, state->auth_type,
6cf099
diff --git a/src/providers/ldap/sdap_dyndns.h b/src/providers/ldap/sdap_dyndns.h
6cf099
index 7aaff5d2c69fbda55fff5208c97b953b970c55cc..a9481b7941be6af0f172afce5f4d54f57ef85e48 100644
6cf099
--- a/src/providers/ldap/sdap_dyndns.h
6cf099
+++ b/src/providers/ldap/sdap_dyndns.h
6cf099
@@ -39,7 +39,6 @@ sdap_dyndns_update_send(TALLOC_CTX *mem_ctx,
6cf099
                         enum be_nsupdate_auth auth_type,
6cf099
                         const char *ifname,
6cf099
                         const char *hostname,
6cf099
-                        const char *dns_zone,
6cf099
                         const char *realm,
6cf099
                         const char *servername,
6cf099
                         const int ttl,
6cf099
-- 
6cf099
2.4.3
6cf099