From d1f422c55d3b00a8438e3088e684ee6434784b14 Mon Sep 17 00:00:00 2001 From: Frederic Peters Date: Fri, 21 Jan 2005 17:26:07 +0000 Subject: adds samlp: prefix to statuscode qname if necessary --- lasso/xml/samlp_status_code.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lasso/xml/samlp_status_code.c b/lasso/xml/samlp_status_code.c index f2d8d9fb..1952f37b 100644 --- a/lasso/xml/samlp_status_code.c +++ b/lasso/xml/samlp_status_code.c @@ -47,6 +47,23 @@ static struct XmlSnippet schema_snippets[] = { { NULL, 0, 0} }; +static gboolean +init_from_query(LassoNode *node, char **query_fields) +{ + LassoSamlpStatusCode *code = LASSO_SAMLP_STATUS_CODE(node); + gboolean rc; + + rc = lasso_node_init_from_query_fields(node, query_fields); + if (code->Value && strchr(code->Value, ':') == NULL) { + char *s; /* if not a QName; add the samlp prefix */ + s = g_strdup_printf("samlp:%s", code->Value); + g_free(code->Value); + code->Value = s; + } + + return rc; +} + /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -63,6 +80,7 @@ class_init(LassoSamlpStatusCodeClass *klass) LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_query = init_from_query; lasso_node_class_set_nodename(nclass, "StatusCode"); lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX); lasso_node_class_add_snippets(nclass, schema_snippets); -- cgit