Assert on missing id

In this function id is required, so just assert if it is missing.
This also silences a warning about "reference" being used unintialized
if "id" is null.

License: MIT
Signed-off-by: Simo Sorce <simo@redhat.com>
This commit is contained in:
Simo Sorce 2014-07-31 13:42:10 -04:00 committed by Benjamin Dauvergne
parent 23d961fe71
commit 3bd2c479a0
1 changed files with 6 additions and 6 deletions

View File

@ -2525,6 +2525,8 @@ lasso_xmlnode_add_saml2_signature_template(xmlNode *node, LassoSignatureContext
xmlNode *existing_signature = NULL, *signature = NULL, *reference, *key_info;
char *uri;
g_assert(id);
if (! lasso_validate_signature_context(context) || ! node)
return;
@ -2555,12 +2557,10 @@ lasso_xmlnode_add_saml2_signature_template(xmlNode *node, LassoSignatureContext
* other cases, set snippet->offset to 0 and use xmlSecTmpSignatureAddReference from another
* node get_xmlNode virtual method to add the needed reference.
*/
if (id) {
uri = g_strdup_printf("#%s", id);
reference = xmlSecTmplSignatureAddReference(signature,
xmlSecTransformSha1Id, NULL, (xmlChar*)uri, NULL);
lasso_release(uri);
}
uri = g_strdup_printf("#%s", id);
reference = xmlSecTmplSignatureAddReference(signature,
xmlSecTransformSha1Id, NULL, (xmlChar*)uri, NULL);
lasso_release(uri);
/* add enveloped transform */
xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId);