|
|
b2d430 |
From b0330a760d838b30c88d6f02f0148b84093761c3 Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
|
|
|
b2d430 |
Date: Tue, 12 Jul 2016 12:11:18 +0200
|
|
|
b2d430 |
Subject: [PATCH 19/19] dyndns: Add checks for NULL
|
|
|
b2d430 |
MIME-Version: 1.0
|
|
|
b2d430 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b2d430 |
Content-Transfer-Encoding: 8bit
|
|
|
b2d430 |
|
|
|
b2d430 |
Fixes:
|
|
|
b2d430 |
https://fedorahosted.org/sssd/ticket/3076
|
|
|
b2d430 |
|
|
|
b2d430 |
We segfaulted in this area once. This patch
|
|
|
b2d430 |
makes the code more defensive and adds
|
|
|
b2d430 |
some DEBUG messages.
|
|
|
b2d430 |
|
|
|
b2d430 |
Normally the structures are filled in online
|
|
|
b2d430 |
and/or resolve callbacks.
|
|
|
b2d430 |
|
|
|
b2d430 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/providers/ipa/ipa_dyndns.c | 20 ++++++++++++++++++++
|
|
|
b2d430 |
1 file changed, 20 insertions(+)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c
|
|
|
b2d430 |
index 7217c61452e7ead2949a9f7d57b2f2fc58953af1..dc910770c771d4b7a7ee62d25be7c48e16c988a7 100644
|
|
|
b2d430 |
--- a/src/providers/ipa/ipa_dyndns.c
|
|
|
b2d430 |
+++ b/src/providers/ipa/ipa_dyndns.c
|
|
|
b2d430 |
@@ -162,6 +162,26 @@ ipa_dyndns_update_send(struct ipa_options *ctx)
|
|
|
b2d430 |
}
|
|
|
b2d430 |
state->ipa_ctx = ctx;
|
|
|
b2d430 |
|
|
|
b2d430 |
+ /* The following three checks are here to prevent SEGFAULT
|
|
|
b2d430 |
+ * from ticket #3076. */
|
|
|
b2d430 |
+ if (ctx->service == NULL) {
|
|
|
b2d430 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "service structure not initialized\n");
|
|
|
b2d430 |
+ ret = EINVAL;
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ if (ctx->service->sdap == NULL) {
|
|
|
b2d430 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "sdap structure not initialized\n");
|
|
|
b2d430 |
+ ret = EINVAL;
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
+ if (ctx->service->sdap->uri == NULL) {
|
|
|
b2d430 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "LDAP uri not set\n");
|
|
|
b2d430 |
+ ret = EINVAL;
|
|
|
b2d430 |
+ goto done;
|
|
|
b2d430 |
+ }
|
|
|
b2d430 |
+
|
|
|
b2d430 |
if (ctx->dyndns_ctx->last_refresh + 60 > time(NULL) ||
|
|
|
b2d430 |
ctx->dyndns_ctx->timer_in_progress) {
|
|
|
b2d430 |
DEBUG(SSSDBG_FUNC_DATA, "Last periodic update ran recently or timer "
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|