summaryrefslogtreecommitdiffstats
path: root/src/providers
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
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')
-rw-r--r--src/providers/dp_dyndns.c18
-rw-r--r--src/providers/dp_dyndns.h4
-rw-r--r--src/providers/ipa/ipa_opts.h1
-rw-r--r--src/providers/ldap/sdap_dyndns.c8
4 files changed, 25 insertions, 6 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
};
diff --git a/src/providers/dp_dyndns.h b/src/providers/dp_dyndns.h
index 8fdbe487b..a1e31e450 100644
--- a/src/providers/dp_dyndns.h
+++ b/src/providers/dp_dyndns.h
@@ -47,6 +47,7 @@ enum dp_dyndns_opts {
DP_OPT_DYNDNS_IFACE,
DP_OPT_DYNDNS_TTL,
DP_OPT_DYNDNS_UPDATE_PTR,
+ DP_OPT_DYNDNS_FORCE_TCP,
DP_OPT_DYNDNS /* attrs counter */
};
@@ -103,7 +104,8 @@ be_nsupdate_create_ptr_msg(TALLOC_CTX *mem_ctx, const char *realm,
*/
struct tevent_req *be_nsupdate_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
- char *nsupdate_msg);
+ char *nsupdate_msg,
+ bool force_tcp);
errno_t be_nsupdate_recv(struct tevent_req *req, int *child_status);
struct tevent_req * nsupdate_get_addrs_send(TALLOC_CTX *mem_ctx,
diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h
index bfb09e36c..97dd6ea9f 100644
--- a/src/providers/ipa/ipa_opts.h
+++ b/src/providers/ipa/ipa_opts.h
@@ -57,6 +57,7 @@ struct dp_option ipa_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_FALSE, BOOL_FALSE },
+ { "dyndns_force_tcp", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
DP_OPTION_TERMINATOR
};
diff --git a/src/providers/ldap/sdap_dyndns.c b/src/providers/ldap/sdap_dyndns.c
index ccaec8e09..1c400f65a 100644
--- a/src/providers/ldap/sdap_dyndns.c
+++ b/src/providers/ldap/sdap_dyndns.c
@@ -323,7 +323,9 @@ sdap_dyndns_update_step(struct tevent_req *req)
}
/* Fork a child process to perform the DNS update */
- subreq = be_nsupdate_send(state, state->ev, state->update_msg);
+ subreq = be_nsupdate_send(state, state->ev, state->update_msg,
+ dp_opt_get_bool(state->opts,
+ DP_OPT_DYNDNS_FORCE_TCP));
if (subreq == NULL) {
return EIO;
}
@@ -405,7 +407,9 @@ sdap_dyndns_update_ptr_step(struct tevent_req *req)
/* Fork a child process to perform the DNS update */
subreq = be_nsupdate_send(state, state->ev,
- state->update_msg);
+ state->update_msg,
+ dp_opt_get_bool(state->opts,
+ DP_OPT_DYNDNS_FORCE_TCP));
if (subreq == NULL) {
return EIO;
}