diff options
author | Michal Židek <mzidek@redhat.com> | 2016-07-12 12:11:18 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-07-13 12:01:39 +0200 |
commit | ae8c7c4010cb8fda478526771ef12d2bb8bfeffa (patch) | |
tree | 1dbd29b2b4c148a3d100cf78547db8c885cfe454 | |
parent | a77707fee46d9ffd9159780b58a797228889ad7f (diff) | |
download | sssd-ae8c7c4010cb8fda478526771ef12d2bb8bfeffa.tar.gz sssd-ae8c7c4010cb8fda478526771ef12d2bb8bfeffa.tar.xz sssd-ae8c7c4010cb8fda478526771ef12d2bb8bfeffa.zip |
dyndns: Add checks for NULL
Fixes:
https://fedorahosted.org/sssd/ticket/3076
We segfaulted in this area once. This patch
makes the code more defensive and adds
some DEBUG messages.
Normally the structures are filled in online
and/or resolve callbacks.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit b5f61f8963300c9ba011436f234e9e10224aff6d)
-rw-r--r-- | src/providers/ipa/ipa_dyndns.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c index e7026eb27..bd2612a1f 100644 --- a/src/providers/ipa/ipa_dyndns.c +++ b/src/providers/ipa/ipa_dyndns.c @@ -163,6 +163,26 @@ ipa_dyndns_update_send(struct ipa_options *ctx) } state->ipa_ctx = ctx; + /* The following three checks are here to prevent SEGFAULT + * from ticket #3076. */ + if (ctx->service == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, "service structure not initialized\n"); + ret = EINVAL; + goto done; + } + + if (ctx->service->sdap == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, "sdap structure not initialized\n"); + ret = EINVAL; + goto done; + } + + if (ctx->service->sdap->uri == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, "LDAP uri not set\n"); + ret = EINVAL; + goto done; + } + if (ctx->dyndns_ctx->last_refresh + 60 > time(NULL) || ctx->dyndns_ctx->timer_in_progress) { DEBUG(SSSDBG_FUNC_DATA, "Last periodic update ran recently or timer " |