Hi!

The attached simple patch just makes the code more
defensive. We do not know the real
cause for the segfault and we do not
have a reproducer.

Michal
>From fffc09ee7de730df5700cac61fbf71d43de473a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzi...@redhat.com>
Date: Tue, 12 Jul 2016 12:11:18 +0200
Subject: [PATCH] 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.
---
 src/providers/ipa/ipa_dyndns.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c
index 7217c61..1d5d7a0 100644
--- a/src/providers/ipa/ipa_dyndns.c
+++ b/src/providers/ipa/ipa_dyndns.c
@@ -172,6 +172,24 @@ ipa_dyndns_update_send(struct ipa_options *ctx)
     }
     state->ipa_ctx->dyndns_ctx->last_refresh = time(NULL);
 
+    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 (strncmp(ctx->service->sdap->uri,
                 "ldap://";, 7) != 0) {
         DEBUG(SSSDBG_CRIT_FAILURE, "Unexpected format of LDAP URI.\n");
-- 
2.5.0

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to