Blame SOURCES/0002-Assert-on-missing-id.patch

39524d
From 1fbf95be686300f265aa13ac45636fbabb6a1d1e Mon Sep 17 00:00:00 2001
39524d
From: Simo Sorce <simo@redhat.com>
39524d
Date: Thu, 31 Jul 2014 13:42:10 -0400
39524d
Subject: [PATCH 2/3] Assert on missing id
39524d
39524d
In this function id is required, so just assert if it is missing.
39524d
This also silences a warning about "reference" being used unintialized
39524d
if "id" is null.
39524d
39524d
License: MIT
39524d
Signed-off-by: Simo Sorce <simo@redhat.com>
39524d
---
39524d
 lasso/xml/tools.c | 12 ++++++------
39524d
 1 file changed, 6 insertions(+), 6 deletions(-)
39524d
39524d
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
39524d
index fd3defbe1f0559c6cbb1ef17bbdd020170d485f5..09f7da8541b15e0a60e370111968f38b4f93f366 100644
39524d
--- a/lasso/xml/tools.c
39524d
+++ b/lasso/xml/tools.c
39524d
@@ -2525,6 +2525,8 @@ lasso_xmlnode_add_saml2_signature_template(xmlNode *node, LassoSignatureContext
39524d
 	xmlNode *existing_signature = NULL, *signature = NULL, *reference, *key_info;
39524d
 	char *uri;
39524d
 
39524d
+	g_assert(id);
39524d
+
39524d
 	if (! lasso_validate_signature_context(context) || ! node)
39524d
 		return;
39524d
 
39524d
@@ -2555,12 +2557,10 @@ lasso_xmlnode_add_saml2_signature_template(xmlNode *node, LassoSignatureContext
39524d
 	 * other cases, set snippet->offset to 0 and use xmlSecTmpSignatureAddReference from another
39524d
 	 * node get_xmlNode virtual method to add the needed reference.
39524d
 	 */
39524d
-	if (id) {
39524d
-		uri = g_strdup_printf("#%s", id);
39524d
-		reference = xmlSecTmplSignatureAddReference(signature,
39524d
-				xmlSecTransformSha1Id, NULL, (xmlChar*)uri, NULL);
39524d
-		lasso_release(uri);
39524d
-	}
39524d
+	uri = g_strdup_printf("#%s", id);
39524d
+	reference = xmlSecTmplSignatureAddReference(signature,
39524d
+			xmlSecTransformSha1Id, NULL, (xmlChar*)uri, NULL);
39524d
+	lasso_release(uri);
39524d
 
39524d
 	/* add enveloped transform */
39524d
 	xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId);
39524d
-- 
39524d
1.9.3
39524d