-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This patch should fix a segfault in failover code introduced by my
recent hostname expiration patch.

I didn't realize that when using SRV records, server->common == NULL is
legal as we don't have the server name resolved yet.

The first hunk in the patch is completely unrelated to the crash. But I
think it is correct, server->common == NULL should never mean that the
server is resolved. Should I split the hunk (at least for stable
branches sake) even if it is one-liner?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk10rCgACgkQHsardTLnvCV7AwCcD3S6hlJIMnF3xxxtkaON/2Gr
IkQAn0ZFtnsyH+YOBBuM7SmwmfAV+o0P
=V/Kz
-----END PGP SIGNATURE-----
From 5e92c68d48cf46c2d4a8e0967024d3b685ff9f8f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Mon, 7 Mar 2011 10:52:19 +0100
Subject: [PATCH] Prevent segfault in failover code

---
 src/providers/fail_over.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index a09a409..37ffe26 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -312,7 +312,7 @@ get_server_status(struct fo_server *server)
     time_t timeout;
 
     if (server->common == NULL)
-        return SERVER_NAME_RESOLVED;
+        return SERVER_NAME_NOT_RESOLVED;
 
     DEBUG(7, ("Status of server '%s' is '%s'\n", SERVER_NAME(server),
               str_server_status(server->common->server_status)));
@@ -353,7 +353,8 @@ get_port_status(struct fo_server *server)
             server->port_status = PORT_NEUTRAL;
             server->last_status_change.tv_sec = tv.tv_sec;
 
-            if (STATUS_DIFF(server->common, tv) > HOSTNAME_RESOLVE_TIMEOUT) {
+            if (server->common != NULL &&
+                STATUS_DIFF(server->common, tv) > HOSTNAME_RESOLVE_TIMEOUT) {
                 DEBUG(4, ("Reseting the server status of '%s'\n",
                           SERVER_NAME(server)));
                 fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED);
-- 
1.7.4

Attachment: 0001-Prevent-segfault-in-failover-code.patch.sig
Description: PGP signature

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

Reply via email to