Blame SOURCES/bz1070916-pcmk-pe_gracefully_handle_bad_values_for_xml_attr_transition_magic.patch

7100e8
commit 5882024877d6c22f0663160a3f7278a421f31819
7100e8
Author: Andrew Beekhof <andrew@beekhof.net>
7100e8
Date:   Wed Aug 7 09:03:43 2013 +1000
7100e8
7100e8
    Fix: PE: Gracefully handle bad values for XML_ATTR_TRANSITION_MAGIC
7100e8
    
7100e8
    (cherry picked from commit 164ca366c14c914794f9230acd7646426641e6b2)
7100e8
7100e8
diff --git a/lib/common/utils.c b/lib/common/utils.c
7100e8
index 4e18039..7543464 100644
7100e8
--- a/lib/common/utils.c
7100e8
+++ b/lib/common/utils.c
7100e8
@@ -885,15 +885,13 @@ decode_transition_magic(const char *magic, char **uuid, int *transition_id, int
7100e8
     key = calloc(1, strlen(magic) + 1);
7100e8
     res = sscanf(magic, "%d:%d;%s", op_status, op_rc, key);
7100e8
     if (res != 3) {
7100e8
-        crm_crit("Only found %d items in: %s", res, magic);
7100e8
-        result = FALSE;
7100e8
-        goto bail;
7100e8
+        crm_warn("Only found %d items in: '%s'", res, magic);
7100e8
+        free(key);
7100e8
+        return FALSE;
7100e8
     }
7100e8
 
7100e8
-    CRM_CHECK(decode_transition_key(key, uuid, transition_id, action_id, target_rc), result = FALSE;
7100e8
-              goto bail;);
7100e8
+    CRM_CHECK(decode_transition_key(key, uuid, transition_id, action_id, target_rc), result = FALSE);
7100e8
 
7100e8
-  bail:
7100e8
     free(key);
7100e8
     return result;
7100e8
 }
7100e8
diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
7100e8
index e9997a2..1e827e0 100644
7100e8
--- a/lib/pengine/utils.c
7100e8
+++ b/lib/pengine/utils.c
7100e8
@@ -1332,11 +1332,12 @@ sort_op_by_callid(gconstpointer a, gconstpointer b)
7100e8
         const char *b_magic = crm_element_value_const(xml_b, XML_ATTR_TRANSITION_MAGIC);
7100e8
 
7100e8
         CRM_CHECK(a_magic != NULL && b_magic != NULL, sort_return(0, "No magic"));
7100e8
-        CRM_CHECK(decode_transition_magic(a_magic, &a_uuid, &a_id, &dummy, &dummy, &dummy, &dummy),
7100e8
-                  sort_return(0, "bad magic a"));
7100e8
-        CRM_CHECK(decode_transition_magic(b_magic, &b_uuid, &b_id, &dummy, &dummy, &dummy, &dummy),
7100e8
-                  sort_return(0, "bad magic b"));
7100e8
-
7100e8
+        if(!decode_transition_magic(a_magic, &a_uuid, &a_id, &dummy, &dummy, &dummy, &dummy)) {
7100e8
+            sort_return(0, "bad magic a");
7100e8
+        }
7100e8
+        if(!decode_transition_magic(b_magic, &b_uuid, &b_id, &dummy, &dummy, &dummy, &dummy)) {
7100e8
+            sort_return(0, "bad magic b");
7100e8
+        }
7100e8
         /* try and determin the relative age of the operation...
7100e8
          * some pending operations (ie. a start) may have been supuerceeded
7100e8
          *   by a subsequent stop