Skip to content

Commit

Permalink
dyndns: PTR record updates separately
Browse files Browse the repository at this point in the history
DNS server does not allow updates for different zones in one
single step. Those updates must be sent separately.

It is complicated and in some cases impossible to detect that
PTR updates does not fit into one zone because it often depends
on DNS server configuration.

With this patch PTR record updates are always sent separately.

Resolves: #6956

Reviewed-by: Dan Lavu <[email protected]>
Reviewed-by: Justin Stephenson <[email protected]>
(cherry picked from commit f0bba9d)
  • Loading branch information
thalman authored and pbrezina committed Oct 18, 2023
1 parent 793284a commit a48c744
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
5 changes: 5 additions & 0 deletions src/man/sssd-ad.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,11 @@ ad_gpo_map_deny = +my_pam_service
updated when updating the client's DNS records.
Applicable only when dyndns_update is true.
</para>
<para>
Note that <emphasis>dyndns_update_per_family</emphasis>
parameter does not apply for PTR record updates.
Those updates are always sent separately.
</para>
<para>
Default: True
</para>
Expand Down
5 changes: 5 additions & 0 deletions src/man/sssd-ipa.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@
PTR records automatically when forward records
are changed.
</para>
<para>
Note that <emphasis>dyndns_update_per_family</emphasis>
parameter does not apply for PTR record updates.
Those updates are always sent separately.
</para>
<para>
Default: False (disabled)
</para>
Expand Down
18 changes: 3 additions & 15 deletions src/providers/be_dyndns.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ nsupdate_msg_add_ptr(char *update_msg, struct sss_iface_addr *addresses,
}

updateipv4 = talloc_asprintf_append(updateipv4,
"update add %s %d in PTR %s.\n",
"update add %s %d in PTR %s.\nsend\n",
ptr, ttl, hostname);
break;
case AF_INET6:
Expand All @@ -415,7 +415,7 @@ nsupdate_msg_add_ptr(char *update_msg, struct sss_iface_addr *addresses,
}
}
updateipv6 = talloc_asprintf_append(updateipv6,
"update add %s %d in PTR %s.\n",
"update add %s %d in PTR %s.\nsend\n",
ptr, ttl, hostname);
break;
}
Expand All @@ -426,21 +426,9 @@ nsupdate_msg_add_ptr(char *update_msg, struct sss_iface_addr *addresses,
}
}

if (update_per_family && updateipv4[0] && updateipv6[0]) {
/* update per family and both families present */
return talloc_asprintf_append(update_msg,
"%s"
"send\n"
"%s"
"send\n",
updateipv4,
updateipv6);
}

return talloc_asprintf_append(update_msg,
"%s"
"%s"
"send\n",
"%s",
updateipv4,
updateipv6);
}
Expand Down
5 changes: 5 additions & 0 deletions src/tests/cmocka/test_dyndns.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,13 @@ void dyndns_test_create_ptr_msg(void **state)
assert_string_equal(msg,
"\nupdate delete 1.0.168.192.in-addr.arpa. in PTR\n"
"update add 1.0.168.192.in-addr.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 2.0.168.192.in-addr.arpa. in PTR\n"
"update add 2.0.168.192.in-addr.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 4.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. in PTR\n"
"update add 4.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 5.5.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. in PTR\n"
"update add 5.5.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. 1234 in PTR bran_stark.\n"
"send\n");
Expand All @@ -680,10 +682,13 @@ void dyndns_test_create_ptr_msg(void **state)
assert_string_equal(msg,
"\nupdate delete 1.0.168.192.in-addr.arpa. in PTR\n"
"update add 1.0.168.192.in-addr.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 2.0.168.192.in-addr.arpa. in PTR\n"
"update add 2.0.168.192.in-addr.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 4.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. in PTR\n"
"update add 4.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. 1234 in PTR bran_stark.\n"
"send\n"
"update delete 5.5.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. in PTR\n"
"update add 5.5.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.b.d.c.1.0.0.2.ip6.arpa. 1234 in PTR bran_stark.\n"
"send\n");
Expand Down

0 comments on commit a48c744

Please sign in to comment.