summaryrefslogtreecommitdiffstats
path: root/src/providers/dp_dyndns.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-04-16 14:19:15 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-05-03 20:25:46 +0200
commite45b81abe0aafa8a04bd64ac31a2fac63ce675b7 (patch)
tree332b0acdc2ec094331025f08b259d9b9b8d81262 /src/providers/dp_dyndns.c
parent38ebc764eeb7693e0c4f0894d6687e54fbba871b (diff)
downloadsssd-e45b81abe0aafa8a04bd64ac31a2fac63ce675b7.tar.gz
sssd-e45b81abe0aafa8a04bd64ac31a2fac63ce675b7.tar.xz
sssd-e45b81abe0aafa8a04bd64ac31a2fac63ce675b7.zip
dyndns: new option dyndns_force_tcp
https://fedorahosted.org/sssd/ticket/1831 Adds a new option that can be used to force nsupdate to only use TCP to communicate with the DNS server.
Diffstat (limited to 'src/providers/dp_dyndns.c')
-rw-r--r--src/providers/dp_dyndns.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/providers/dp_dyndns.c b/src/providers/dp_dyndns.c
index 79701c629..36cce4582 100644
--- a/src/providers/dp_dyndns.c
+++ b/src/providers/dp_dyndns.c
@@ -935,7 +935,8 @@ static void be_nsupdate_done(struct tevent_req *subreq);
struct tevent_req *be_nsupdate_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
- char *nsupdate_msg)
+ char *nsupdate_msg,
+ bool force_tcp)
{
int pipefd_to_child[2];
pid_t child_pid;
@@ -943,7 +944,7 @@ struct tevent_req *be_nsupdate_send(TALLOC_CTX *mem_ctx,
struct tevent_req *req = NULL;
struct tevent_req *subreq = NULL;
struct be_nsupdate_state *state;
- char *args[3];
+ char *args[4];
req = tevent_req_create(mem_ctx, &state, struct be_nsupdate_state);
if (req == NULL) {
@@ -962,14 +963,24 @@ struct tevent_req *be_nsupdate_send(TALLOC_CTX *mem_ctx,
child_pid = fork();
if (child_pid == 0) { /* child */
+ memset(args, 0, 4 * sizeof(char *));
+
args[0] = talloc_strdup(state, NSUPDATE_PATH);
args[1] = talloc_strdup(state, "-g");
- args[2] = NULL;
if (args[0] == NULL || args[1] == NULL) {
ret = ENOMEM;
goto done;
}
+ if (force_tcp) {
+ DEBUG(SSSDBG_FUNC_DATA, ("TCP is set to on\n"));
+ args[2] = talloc_strdup(state, "-v");
+ if (args[2] == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
close(pipefd_to_child[1]);
ret = dup2(pipefd_to_child[0], STDIN_FILENO);
if (ret == -1) {
@@ -1117,6 +1128,7 @@ static struct dp_option default_dyndns_opts[] = {
{ "dyndns_iface", DP_OPT_STRING, NULL_STRING, NULL_STRING },
{ "dyndns_ttl", DP_OPT_NUMBER, { .number = 1200 }, NULL_NUMBER },
{ "dyndns_update_ptr", DP_OPT_BOOL, BOOL_TRUE, BOOL_FALSE },
+ { "dyndns_force_tcp", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
DP_OPTION_TERMINATOR
};