diff options
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ipa/ipa_common.h | 1 | ||||
-rw-r--r-- | src/providers/ipa/ipa_dyndns.c | 14 | ||||
-rw-r--r-- | src/providers/ipa/ipa_opts.h | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/providers/ipa/ipa_common.h b/src/providers/ipa/ipa_common.h index 01e14032..f077776b 100644 --- a/src/providers/ipa/ipa_common.h +++ b/src/providers/ipa/ipa_common.h @@ -38,6 +38,7 @@ enum ipa_basic_opt { IPA_BACKUP_SERVER, IPA_HOSTNAME, IPA_DYNDNS_UPDATE, + IPA_DYNDNS_TTL, IPA_DYNDNS_IFACE, IPA_HBAC_SEARCH_BASE, IPA_HOST_SEARCH_BASE, diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c index 66515e84..3f430a33 100644 --- a/src/providers/ipa/ipa_dyndns.c +++ b/src/providers/ipa/ipa_dyndns.c @@ -857,7 +857,7 @@ static int create_nsupdate_message(struct ipa_nsupdate_ctx *ctx, uint8_t remove_af, bool use_server_with_nsupdate) { - int ret, i; + int ret, i, ttl; char *servername = NULL; char *realm; char *realm_directive; @@ -935,6 +935,15 @@ static int create_nsupdate_message(struct ipa_nsupdate_ctx *ctx, goto done; } + /* Get the TTL details for the record(s) */ + + ttl = dp_opt_get_int(ctx->dyndns_ctx->ipa_ctx->basic, + IPA_DYNDNS_TTL); + /* Should not happen but just in case set the default */ + if (!ttl) { + ttl = 1200; + } + /* Remove existing entries as needed */ if (remove_af & IPA_DYNDNS_REMOVE_A) { ctx->update_msg = talloc_asprintf_append(ctx->update_msg, @@ -986,8 +995,9 @@ static int create_nsupdate_message(struct ipa_nsupdate_ctx *ctx, /* Format the record update */ ctx->update_msg = talloc_asprintf_append( ctx->update_msg, - "update add %s. 86400 in %s %s\n", + "update add %s. %d in %s %s\n", ctx->dyndns_ctx->hostname, + ttl, new_record->addr->ss_family == AF_INET ? "A" : "AAAA", ip_addr); if (ctx->update_msg == NULL) { diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h index ae75413a..01c32f46 100644 --- a/src/providers/ipa/ipa_opts.h +++ b/src/providers/ipa/ipa_opts.h @@ -35,6 +35,7 @@ struct dp_option ipa_basic_opts[] = { { "ipa_backup_server", DP_OPT_STRING, NULL_STRING, NULL_STRING }, { "ipa_hostname", DP_OPT_STRING, NULL_STRING, NULL_STRING }, { "ipa_dyndns_update", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }, + { "ipa_dyndns_ttl", DP_OPT_NUMBER, { .number = 1200}, NULL_NUMBER}, { "ipa_dyndns_iface", DP_OPT_STRING, NULL_STRING, NULL_STRING}, { "ipa_hbac_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING}, { "ipa_host_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING }, |