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