removed extra parentheses after return statements;

This commit is contained in:
Frédéric Péters 2004-09-01 09:59:53 +00:00
parent 16fb06a9ab
commit 2bde0c2ddb
46 changed files with 412 additions and 420 deletions

View File

@ -51,14 +51,6 @@ Coding Style
message(G_LOG_LEVEL_MESSAGE, "Ok"); message(G_LOG_LEVEL_MESSAGE, "Ok");
} }
- Use round brackets ``()`` for ``return``.
Examples:
BAD:
``return 0;``
GOOD:
``return(0);``
- Check for memory leaks. - Check for memory leaks.
I recommend valgrind (http://valgrind.kde.org) utility with options: I recommend valgrind (http://valgrind.kde.org) utility with options:
--leak-check=yes --leak-check=yes

View File

@ -43,7 +43,7 @@ lasso_artifact_split_samlArt(gchar *b64_samlArt,
/* decode samlArt */ /* decode samlArt */
i = xmlSecBase64Decode((const xmlChar *)b64_samlArt, samlArt, 42+1); i = xmlSecBase64Decode((const xmlChar *)b64_samlArt, samlArt, 42+1);
if (i < 0 || i > 42) { if (i < 0 || i > 42) {
return(-1); return -1;
} }
/* extract ByteCode, IdentityProviderSuccinctID and AssertionHandle */ /* extract ByteCode, IdentityProviderSuccinctID and AssertionHandle */
for(j=0; j<42; j++) { for(j=0; j<42; j++) {
@ -59,7 +59,7 @@ lasso_artifact_split_samlArt(gchar *b64_samlArt,
} }
sprintf(byteCode, "%d", byte_code); sprintf(byteCode, "%d", byte_code);
return(0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -93,7 +93,7 @@ lasso_artifact_get_assertionHandle(LassoArtifact *artifact,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (assertionHandle); return assertionHandle;
} }
/** /**
@ -132,13 +132,13 @@ lasso_artifact_get_byteCode(LassoArtifact *artifact,
"ByteCode", NULL, &tmp_err); "ByteCode", NULL, &tmp_err);
if (byteCode == NULL) { if (byteCode == NULL) {
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
return (-1); return -1;
} }
ret = (gint)g_strtod(byteCode, NULL); ret = (gint)g_strtod(byteCode, NULL);
xmlFree(byteCode); xmlFree(byteCode);
return (ret); return ret;
} }
xmlChar* xmlChar*
@ -168,7 +168,7 @@ lasso_artifact_get_b64IdentityProviderSuccinctID(LassoArtifact *artifact,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return(b64_identityProviderSuccinctID); return b64_identityProviderSuccinctID;
} }
xmlChar* xmlChar*
@ -197,7 +197,7 @@ lasso_artifact_get_relayState(LassoArtifact *artifact,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (relayState); return relayState;
} }
xmlChar* xmlChar*
@ -226,7 +226,7 @@ lasso_artifact_get_samlArt(LassoArtifact *artifact,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (samlArt); return samlArt;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -299,7 +299,7 @@ lasso_artifact_new(gchar *samlArt,
class->new_child(artifact, "RelayState", relayState, FALSE); class->new_child(artifact, "RelayState", relayState, FALSE);
} }
return (artifact); return artifact;
} }
LassoNode* LassoNode*
@ -344,7 +344,7 @@ lasso_artifact_new_from_query(const xmlChar *query)
g_free(b64_samlArt); g_free(b64_samlArt);
g_free(relayState); g_free(relayState);
return (artifact); return artifact;
} }
LassoNode* LassoNode*
@ -373,5 +373,5 @@ lasso_artifact_new_from_lares(const xmlChar *lares,
g_free(identityProviderSuccinctID); g_free(identityProviderSuccinctID);
g_free(assertionHandle); g_free(assertionHandle);
return (artifact); return artifact;
} }

View File

@ -40,7 +40,7 @@ lasso_authn_request_get_protocolProfile(gchar *query)
if (protocolProfile == NULL) if (protocolProfile == NULL)
protocolProfile = (gchar *)lassoLibProtocolProfileBrwsArt; protocolProfile = (gchar *)lassoLibProtocolProfileBrwsArt;
return (protocolProfile); return protocolProfile;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -188,7 +188,7 @@ lasso_authn_request_new(const xmlChar *providerID,
lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request), lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request),
providerID); providerID);
return (request); return request;
} }
LassoNode* LassoNode*
@ -215,7 +215,7 @@ lasso_authn_request_new_from_export(gchar *buffer,
gd = lasso_query_to_dict(buffer); gd = lasso_query_to_dict(buffer);
if (gd == NULL) { if (gd == NULL) {
g_object_unref(request); g_object_unref(request);
return(NULL); return NULL;
} }
/* RequestID */ /* RequestID */
@ -226,7 +226,7 @@ lasso_authn_request_new_from_export(gchar *buffer,
else { else {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
/* MajorVersion */ /* MajorVersion */
@ -256,7 +256,7 @@ lasso_authn_request_new_from_export(gchar *buffer,
else { else {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
/* ProviderID */ /* ProviderID */
@ -266,7 +266,7 @@ lasso_authn_request_new_from_export(gchar *buffer,
else { else {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
/* NameIDPolicy */ /* NameIDPolicy */
@ -377,5 +377,5 @@ lasso_authn_request_new_from_export(gchar *buffer,
break; break;
} }
return (request); return request;
} }

View File

@ -41,7 +41,7 @@ LassoNode *lasso_authn_request_envelope_get_authnRequest(LassoAuthnRequestEnvelo
{ {
g_return_val_if_fail(LASSO_IS_AUTHN_REQUEST_ENVELOPE(request), NULL); g_return_val_if_fail(LASSO_IS_AUTHN_REQUEST_ENVELOPE(request), NULL);
return(lasso_node_get_child(LASSO_NODE(request), "AuthnRequest", NULL, NULL)); return lasso_node_get_child(LASSO_NODE(request), "AuthnRequest", NULL, NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -101,7 +101,7 @@ lasso_authn_request_envelope_new(LassoAuthnRequest *authnRequest,
lasso_lib_authn_request_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_REQUEST_ENVELOPE(request), lasso_lib_authn_request_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_REQUEST_ENVELOPE(request),
assertionConsumerServiceURL); assertionConsumerServiceURL);
return(request); return request;
} }
LassoNode* LassoNode*
@ -132,5 +132,5 @@ lasso_authn_request_envelope_new_from_export(gchar *buffer,
break; break;
} }
return(request); return request;
} }

View File

@ -66,15 +66,15 @@ lasso_authn_response_get_status(LassoAuthnResponse *response) {
if (err != NULL) { if (err != NULL) {
message(G_LOG_LEVEL_WARNING, err->message); message(G_LOG_LEVEL_WARNING, err->message);
g_error_free(err); g_error_free(err);
return (NULL); return NULL;
} }
else { else {
return (value); return value;
} }
} }
else { else {
message(G_LOG_LEVEL_WARNING, "No StatusCode element found in AuthnResponse.\n"); message(G_LOG_LEVEL_WARNING, "No StatusCode element found in AuthnResponse.\n");
return (NULL); return NULL;
} }
} }
@ -161,7 +161,7 @@ lasso_authn_response_new(char *providerID,
/* Status Code */ /* Status Code */
lasso_authn_response_set_status(LASSO_AUTHN_RESPONSE(response), lassoSamlStatusCodeSuccess); lasso_authn_response_set_status(LASSO_AUTHN_RESPONSE(response), lassoSamlStatusCodeSuccess);
return(response); return response;
} }
LassoNode* LassoNode*
@ -190,5 +190,5 @@ lasso_authn_response_new_from_export(gchar *buffer,
break; break;
} }
return (response); return response;
} }

View File

@ -39,14 +39,14 @@ xmlChar *lasso_authn_response_envelope_get_assertionConsumerServiceURL(LassoAuth
{ {
g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL); g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL);
return(lasso_node_get_child_content(LASSO_NODE(response), "AssertionConsumerServiceURL", NULL, NULL)); return lasso_node_get_child_content(LASSO_NODE(response), "AssertionConsumerServiceURL", NULL, NULL);
} }
LassoNode* lasso_authn_response_envelope_get_authnResponse(LassoAuthnResponseEnvelope *response) LassoNode* lasso_authn_response_envelope_get_authnResponse(LassoAuthnResponseEnvelope *response)
{ {
g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL); g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL);
return(lasso_node_get_child(LASSO_NODE(response), "AuthnResponse", NULL, NULL)); return lasso_node_get_child(LASSO_NODE(response), "AuthnResponse", NULL, NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -102,7 +102,7 @@ lasso_authn_response_envelope_new(LassoAuthnResponse *authnResponse,
lasso_lib_authn_response_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_RESPONSE_ENVELOPE(response), lasso_lib_authn_response_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_RESPONSE_ENVELOPE(response),
assertionConsumerServiceURL); assertionConsumerServiceURL);
return(response); return response;
} }
static LassoNode * static LassoNode *
@ -126,7 +126,7 @@ lasso_authn_response_envelope_new_from_soap(gchar *buffer)
class->set_xmlNode(LASSO_NODE(response), xmlNode_response); class->set_xmlNode(LASSO_NODE(response), xmlNode_response);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(response); return response;
} }
LassoNode* LassoNode*
@ -151,9 +151,9 @@ lasso_authn_response_envelope_new_from_export(gchar *buffer,
break; break;
default: default:
message(G_LOG_LEVEL_CRITICAL, "Invalid export type\n"); message(G_LOG_LEVEL_CRITICAL, "Invalid export type\n");
return(NULL); return NULL;
break; break;
} }
return(response); return response;
} }

View File

@ -100,5 +100,5 @@ lasso_assertion_new(const xmlChar *issuer,
requestID); requestID);
} }
return (assertion); return assertion;
} }

View File

@ -102,7 +102,7 @@ lasso_authentication_statement_new(const xmlChar *authenticationMethod
else { else {
message(G_LOG_LEVEL_CRITICAL, "Failed to create the authentication statement, both name identifiers are NULL\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to create the authentication statement, both name identifiers are NULL\n");
lasso_node_destroy(statement); lasso_node_destroy(statement);
return (NULL); return NULL;
} }
} }
else { else {
@ -145,5 +145,5 @@ lasso_authentication_statement_new(const xmlChar *authenticationMethod
lasso_node_destroy(subject); lasso_node_destroy(subject);
lasso_node_destroy(subject_confirmation); lasso_node_destroy(subject_confirmation);
return (statement); return statement;
} }

View File

@ -52,7 +52,7 @@ lasso_federation_copy(LassoFederation *federation)
copy->remote_nameIdentifier = lasso_node_copy(federation->remote_nameIdentifier); copy->remote_nameIdentifier = lasso_node_copy(federation->remote_nameIdentifier);
} }
return(copy); return copy;
} }
void void
@ -105,17 +105,17 @@ lasso_federation_dump(LassoFederation *federation)
dump = lasso_node_export(federation_node); dump = lasso_node_export(federation_node);
lasso_node_destroy(federation_node); lasso_node_destroy(federation_node);
return(dump); return dump;
} }
LassoNode * LassoNode *
lasso_federation_get_local_nameIdentifier(LassoFederation *federation) lasso_federation_get_local_nameIdentifier(LassoFederation *federation)
{ {
if (federation->local_nameIdentifier != NULL) { if (federation->local_nameIdentifier != NULL) {
return (lasso_node_copy(federation->local_nameIdentifier)); return lasso_node_copy(federation->local_nameIdentifier);
} }
else { else {
return (NULL); return NULL;
} }
} }
@ -123,10 +123,10 @@ LassoNode *
lasso_federation_get_remote_nameIdentifier(LassoFederation *federation) lasso_federation_get_remote_nameIdentifier(LassoFederation *federation)
{ {
if (federation->remote_nameIdentifier != NULL) { if (federation->remote_nameIdentifier != NULL) {
return(lasso_node_copy(federation->remote_nameIdentifier)); return lasso_node_copy(federation->remote_nameIdentifier);
} }
else { else {
return (NULL); return NULL;
} }
} }
@ -172,7 +172,7 @@ lasso_federation_verify_nameIdentifier(LassoFederation *federation,
NULL); NULL);
if(xmlStrEqual(federation_content, nameIdentifier_content)) { if(xmlStrEqual(federation_content, nameIdentifier_content)) {
xmlFree(federation_content); xmlFree(federation_content);
return(TRUE); return TRUE;
} }
xmlFree(federation_content); xmlFree(federation_content);
} }
@ -181,13 +181,13 @@ lasso_federation_verify_nameIdentifier(LassoFederation *federation,
NULL); NULL);
if(xmlStrEqual(federation_content, nameIdentifier_content)) { if(xmlStrEqual(federation_content, nameIdentifier_content)) {
xmlFree(federation_content); xmlFree(federation_content);
return(TRUE); return TRUE;
} }
xmlFree(federation_content); xmlFree(federation_content);
} }
xmlFree(nameIdentifier_content); xmlFree(nameIdentifier_content);
return(FALSE); return FALSE;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -282,7 +282,7 @@ lasso_federation_new(gchar *remote_providerID)
federation->remote_providerID = g_strdup(remote_providerID); federation->remote_providerID = g_strdup(remote_providerID);
return(federation); return federation;
} }
LassoFederation* LassoFederation*
@ -294,5 +294,5 @@ lasso_federation_new_from_dump(gchar *dump)
federation = LASSO_FEDERATION(g_object_new(LASSO_TYPE_FEDERATION, NULL)); federation = LASSO_FEDERATION(g_object_new(LASSO_TYPE_FEDERATION, NULL));
return(federation); return federation;
} }

View File

@ -118,7 +118,7 @@ lasso_federation_termination_notification_new(const xmlChar *providerID,
LASSO_SAML_NAME_IDENTIFIER(identifier)); LASSO_SAML_NAME_IDENTIFIER(identifier));
lasso_node_destroy(identifier); lasso_node_destroy(identifier);
return (request); return request;
} }
LassoNode * LassoNode *
@ -133,7 +133,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
gd = lasso_query_to_dict(query); gd = lasso_query_to_dict(query);
if (gd == NULL) { if (gd == NULL) {
g_object_unref(notification); g_object_unref(notification);
return(NULL); return NULL;
} }
/* RequestID */ /* RequestID */
@ -141,7 +141,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str);
@ -159,7 +159,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str);
@ -168,7 +168,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str);
@ -177,7 +177,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_lib_federation_termination_notification_set_providerID(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(notification), str); lasso_lib_federation_termination_notification_set_providerID(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(notification), str);
@ -186,21 +186,21 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
identifier = lasso_saml_name_identifier_new(str); identifier = lasso_saml_name_identifier_new(str);
str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0); str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0);
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str); lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str);
str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0); str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0);
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(notification); g_object_unref(notification);
return (NULL); return NULL;
} }
lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str); lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str);
@ -209,7 +209,7 @@ lasso_federation_termination_notification_new_from_query(const gchar *query)
lasso_node_destroy(identifier); lasso_node_destroy(identifier);
return(notification); return notification;
} }
LassoNode * LassoNode *
@ -234,7 +234,7 @@ lasso_federation_termination_notification_new_from_soap(const gchar *buffer)
class->set_xmlNode(LASSO_NODE(notification), xmlNode_notification); class->set_xmlNode(LASSO_NODE(notification), xmlNode_notification);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(notification); return notification;
} }
@ -254,8 +254,8 @@ lasso_federation_termination_notification_new_from_export(const gchar *b
notification = lasso_federation_termination_notification_new_from_soap(buffer); notification = lasso_federation_termination_notification_new_from_soap(buffer);
break; break;
default: default:
return(NULL); return NULL;
} }
return(notification); return notification;
} }

View File

@ -141,7 +141,7 @@ lasso_logout_request_new(gchar *providerID,
LASSO_SAML_NAME_IDENTIFIER(identifier)); LASSO_SAML_NAME_IDENTIFIER(identifier));
lasso_node_destroy(identifier); lasso_node_destroy(identifier);
return(request); return request;
} }
static LassoNode * static LassoNode *
@ -156,7 +156,7 @@ lasso_logout_request_new_from_query(gchar *query)
gd = lasso_query_to_dict(query); gd = lasso_query_to_dict(query);
if (gd == NULL) { if (gd == NULL) {
g_object_unref(request); g_object_unref(request);
return(NULL); return NULL;
} }
/* RequestID */ /* RequestID */
@ -164,7 +164,7 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), str);
@ -174,7 +174,7 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
/* MinorVersion */ /* MinorVersion */
@ -182,7 +182,7 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str);
@ -191,7 +191,7 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), str);
@ -200,7 +200,7 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_lib_logout_request_set_providerID(LASSO_LIB_LOGOUT_REQUEST(request), str); lasso_lib_logout_request_set_providerID(LASSO_LIB_LOGOUT_REQUEST(request), str);
@ -209,21 +209,21 @@ lasso_logout_request_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
identifier = lasso_saml_name_identifier_new(str); identifier = lasso_saml_name_identifier_new(str);
str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0); str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0);
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str); lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str);
str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0); str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0);
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(request); g_object_unref(request);
return (NULL); return NULL;
} }
lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str); lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str);
lasso_lib_logout_request_set_nameIdentifier(LASSO_LIB_LOGOUT_REQUEST(request), LASSO_SAML_NAME_IDENTIFIER(identifier)); lasso_lib_logout_request_set_nameIdentifier(LASSO_LIB_LOGOUT_REQUEST(request), LASSO_SAML_NAME_IDENTIFIER(identifier));
@ -246,7 +246,7 @@ lasso_logout_request_new_from_query(gchar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(request); return request;
} }
static LassoNode * static LassoNode *
@ -271,7 +271,7 @@ lasso_logout_request_new_from_soap(gchar *buffer)
class->set_xmlNode(LASSO_NODE(request), xmlNode_request); class->set_xmlNode(LASSO_NODE(request), xmlNode_request);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(request); return request;
} }
static LassoNode * static LassoNode *
@ -291,7 +291,7 @@ lasso_logout_request_new_from_xml(gchar *buffer)
class->set_xmlNode(LASSO_NODE(request), xmlNode_request); class->set_xmlNode(LASSO_NODE(request), xmlNode_request);
lasso_node_destroy(lassoNode_request); lasso_node_destroy(lassoNode_request);
return(request); return request;
} }
@ -318,5 +318,5 @@ lasso_logout_request_new_from_export(gchar *buffer,
break; break;
} }
return(request); return request;
} }

View File

@ -44,15 +44,15 @@ lasso_logout_response_get_status_code_value(LassoLogoutResponse *response)
if (err != NULL) { if (err != NULL) {
message(G_LOG_LEVEL_WARNING, err->message); message(G_LOG_LEVEL_WARNING, err->message);
g_error_free(err); g_error_free(err);
return (NULL); return NULL;
} }
else { else {
return (value); return value;
} }
} }
else { else {
message(G_LOG_LEVEL_WARNING, "No StatusCode element found in Response.\n"); message(G_LOG_LEVEL_WARNING, "No StatusCode element found in Response.\n");
return (NULL); return NULL;
} }
} }
@ -163,7 +163,7 @@ lasso_logout_response_new(gchar *providerID,
lasso_node_destroy(ssc); lasso_node_destroy(ssc);
lasso_node_destroy(ss); lasso_node_destroy(ss);
return (response); return response;
} }
LassoNode * LassoNode *
@ -174,7 +174,7 @@ lasso_logout_response_new_from_dump(gchar *buffer)
response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL));
lasso_node_import(response, buffer); lasso_node_import(response, buffer);
return (response); return response;
} }
LassoNode * LassoNode *
@ -189,7 +189,7 @@ lasso_logout_response_new_from_query(gchar *query)
gd = lasso_query_to_dict(query); gd = lasso_query_to_dict(query);
if (gd == NULL) { if (gd == NULL) {
g_object_unref(response); g_object_unref(response);
return(NULL); return NULL;
} }
/* ResponseID */ /* ResponseID */
@ -197,7 +197,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str);
@ -206,7 +206,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str);
@ -219,7 +219,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str);
@ -228,7 +228,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str);
@ -237,7 +237,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str);
@ -246,7 +246,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), str); lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), str);
@ -255,7 +255,7 @@ lasso_logout_response_new_from_query(gchar *query)
if (str == NULL) { if (str == NULL) {
g_datalist_clear(&gd); g_datalist_clear(&gd);
g_object_unref(response); g_object_unref(response);
return (NULL); return NULL;
} }
ss = lasso_samlp_status_new(); ss = lasso_samlp_status_new();
ssc = lasso_samlp_status_code_new(); ssc = lasso_samlp_status_code_new();
@ -276,7 +276,7 @@ lasso_logout_response_new_from_query(gchar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(response); return response;
} }
LassoNode * LassoNode *
@ -292,14 +292,14 @@ lasso_logout_response_new_from_soap(gchar *buffer)
envelope = lasso_node_new_from_dump(buffer); envelope = lasso_node_new_from_dump(buffer);
if(envelope == NULL) { if(envelope == NULL) {
message(G_LOG_LEVEL_WARNING, "Error while parsing the soap msg\n"); message(G_LOG_LEVEL_WARNING, "Error while parsing the soap msg\n");
return(NULL); return NULL;
} }
lassoNode_response = lasso_node_get_child(envelope, "LogoutResponse", lassoNode_response = lasso_node_get_child(envelope, "LogoutResponse",
NULL, NULL); NULL, NULL);
if(lassoNode_response == NULL) { if(lassoNode_response == NULL) {
message(G_LOG_LEVEL_WARNING, "LogoutResponse node not found\n"); message(G_LOG_LEVEL_WARNING, "LogoutResponse node not found\n");
return(NULL); return NULL;
} }
class = LASSO_NODE_GET_CLASS(lassoNode_response); class = LASSO_NODE_GET_CLASS(lassoNode_response);
xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1);
@ -309,7 +309,7 @@ lasso_logout_response_new_from_soap(gchar *buffer)
class->set_xmlNode(LASSO_NODE(response), xmlNode_response); class->set_xmlNode(LASSO_NODE(response), xmlNode_response);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(response); return response;
} }
static LassoNode * static LassoNode *
@ -329,7 +329,7 @@ lasso_logout_response_new_from_xml(gchar *buffer)
class->set_xmlNode(LASSO_NODE(response), xmlNode_response); class->set_xmlNode(LASSO_NODE(response), xmlNode_response);
lasso_node_destroy(lassoNode_response); lasso_node_destroy(lassoNode_response);
return(response); return response;
} }
LassoNode* LassoNode*
@ -352,8 +352,8 @@ lasso_logout_response_new_from_export(gchar *buffer,
break; break;
default: default:
message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); message(G_LOG_LEVEL_WARNING, "Invalid export type\n");
return(NULL); return NULL;
} }
return(response); return response;
} }

View File

@ -114,7 +114,7 @@ lasso_name_identifier_mapping_request_new(const xmlChar *providerID,
LASSO_SAML_NAME_IDENTIFIER(identifier)); LASSO_SAML_NAME_IDENTIFIER(identifier));
lasso_node_destroy(identifier); lasso_node_destroy(identifier);
return (request); return request;
} }
LassoNode * LassoNode *
@ -167,7 +167,7 @@ lasso_name_identifier_mapping_request_new_from_query(const gchar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(request); return request;
} }
LassoNode * LassoNode *
@ -192,5 +192,5 @@ lasso_name_identifier_mapping_request_new_from_soap(const gchar *buffer)
class->set_xmlNode(LASSO_NODE(request), xmlNode_request); class->set_xmlNode(LASSO_NODE(request), xmlNode_request);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(request); return request;
} }

View File

@ -121,7 +121,7 @@ lasso_name_identifier_mapping_response_new(const xmlChar *providerID,
lasso_node_destroy(ssc); lasso_node_destroy(ssc);
lasso_node_destroy(ss); lasso_node_destroy(ss);
return (response); return response;
} }
LassoNode * LassoNode *
@ -132,7 +132,7 @@ lasso_name_identifier_mapping_response_new_from_dump(const gchar *buffer)
response = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL)); response = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL));
lasso_node_import(response, buffer); lasso_node_import(response, buffer);
return (response); return response;
} }
/* build a NameIdentifierMappingResponse from a query form NameIdentifierMappingResponse */ /* build a NameIdentifierMappingResponse from a query form NameIdentifierMappingResponse */
@ -177,7 +177,7 @@ lasso_name_identifier_mapping_response_new_from_query(const gchar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(response); return response;
} }
/* build a NameIdentifierMappingRespose from a soap form NameIdentifierMappingRequest */ /* build a NameIdentifierMappingRespose from a soap form NameIdentifierMappingRequest */
@ -195,7 +195,7 @@ lasso_name_identifier_mapping_response_new_from_request_soap(const gchar *buff
request); request);
lasso_node_destroy(request); lasso_node_destroy(request);
return(response); return response;
} }
LassoNode * LassoNode *
@ -220,7 +220,7 @@ lasso_name_identifier_mapping_response_new_from_soap(const gchar *buffer)
class->set_xmlNode(LASSO_NODE(response), xmlNode_response); class->set_xmlNode(LASSO_NODE(response), xmlNode_response);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(response); return response;
} }
/* build a NameIdentifierMappingResponse from a query form NameIdentifierMappingRequest */ /* build a NameIdentifierMappingResponse from a query form NameIdentifierMappingRequest */
@ -238,5 +238,5 @@ lasso_name_identifier_mapping_response_new_from_request_query(const gchar *que
request); request);
lasso_node_destroy(request); lasso_node_destroy(request);
return(response); return response;
} }

View File

@ -49,7 +49,7 @@ lasso_provider_copy(LassoProvider *provider)
copy->public_key = g_strdup(provider->public_key); copy->public_key = g_strdup(provider->public_key);
copy->ca_certificate = g_strdup(provider->ca_certificate); copy->ca_certificate = g_strdup(provider->ca_certificate);
return(copy); return copy;
} }
void void
@ -87,7 +87,7 @@ lasso_provider_dump(LassoProvider *provider)
lasso_node_destroy(provider_node); lasso_node_destroy(provider_node);
return(provider_dump); return provider_dump;
} }
gchar * gchar *
@ -135,7 +135,7 @@ lasso_provider_get_metadata_value(LassoProvider *provider,
} }
if (descriptor == NULL) { if (descriptor == NULL) {
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
return (NULL); return NULL;
} }
content = lasso_node_get_child_content(descriptor, name, NULL, &tmp_err); content = lasso_node_get_child_content(descriptor, name, NULL, &tmp_err);
@ -148,7 +148,7 @@ lasso_provider_get_metadata_value(LassoProvider *provider,
xmlFree(content); xmlFree(content);
} }
return (result); return result;
} }
gchar * gchar *
@ -174,7 +174,7 @@ lasso_provider_get_assertionConsumerServiceURL(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -199,7 +199,7 @@ lasso_provider_get_authnRequestsSigned(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -225,7 +225,7 @@ lasso_provider_get_federationTerminationNotificationProtocolProfile(LassoProvide
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -251,7 +251,7 @@ lasso_provider_get_federationTerminationServiceReturnURL(LassoProvider *pro
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -277,7 +277,7 @@ lasso_provider_get_federationTerminationServiceURL(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -303,7 +303,7 @@ lasso_provider_get_nameIdentifierMappingProtocolProfile(LassoProvider *prov
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -318,7 +318,7 @@ lasso_provider_get_providerID(LassoProvider *provider)
if (descriptor == NULL) { if (descriptor == NULL) {
message(G_LOG_LEVEL_CRITICAL, err->message); message(G_LOG_LEVEL_CRITICAL, err->message);
g_error_free(err); g_error_free(err);
return (NULL); return NULL;
} }
value = lasso_node_get_attr_value(descriptor, "providerID", &err); value = lasso_node_get_attr_value(descriptor, "providerID", &err);
@ -330,7 +330,7 @@ lasso_provider_get_providerID(LassoProvider *provider)
g_error_free(err); g_error_free(err);
} }
return (value); return value;
} }
gchar * gchar *
@ -356,7 +356,7 @@ lasso_provider_get_registerNameIdentifierProtocolProfile(LassoProvider *pro
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -382,7 +382,7 @@ lasso_provider_get_registerNameIdentifierServiceURL(LassoProvider *provider
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -407,7 +407,7 @@ lasso_provider_get_singleSignOnProtocolProfile(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -432,7 +432,7 @@ lasso_provider_get_singleSignOnServiceURL(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -458,7 +458,7 @@ lasso_provider_get_singleLogoutProtocolProfile(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -484,7 +484,7 @@ lasso_provider_get_singleLogoutServiceURL(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -510,7 +510,7 @@ lasso_provider_get_singleLogoutServiceReturnURL(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
gchar * gchar *
@ -536,7 +536,7 @@ lasso_provider_get_soapEndpoint(LassoProvider *provider,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (value); return value;
} }
void void
@ -565,12 +565,12 @@ static gchar *lasso_provider_get_direct_child_content(LassoProvider *provider,
node = lasso_node_get_child(LASSO_NODE(provider), name, NULL, NULL); node = lasso_node_get_child(LASSO_NODE(provider), name, NULL, NULL);
if(node == NULL) { if(node == NULL) {
return(NULL); return NULL;
} }
content = lasso_node_get_content(node, NULL); content = lasso_node_get_content(node, NULL);
lasso_node_destroy(node); lasso_node_destroy(node);
return(content); return content;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -665,7 +665,7 @@ lasso_provider_new(gchar *metadata,
provider->ca_certificate = g_strdup(ca_certificate); provider->ca_certificate = g_strdup(ca_certificate);
} }
return(provider); return provider;
} }
@ -677,7 +677,7 @@ lasso_provider_new_from_metadata_node(LassoNode *metadata_node)
provider = LASSO_PROVIDER(g_object_new(LASSO_TYPE_PROVIDER, NULL)); provider = LASSO_PROVIDER(g_object_new(LASSO_TYPE_PROVIDER, NULL));
provider->metadata = lasso_node_copy(metadata_node); provider->metadata = lasso_node_copy(metadata_node);
return(provider); return provider;
} }
LassoProvider* LassoProvider*
@ -702,5 +702,5 @@ lasso_provider_new_metadata_filename(gchar *metadata_filename)
"Failed to build LassoProvider: invalid metadata file.\n"); "Failed to build LassoProvider: invalid metadata file.\n");
} }
return(provider); return provider;
} }

View File

@ -152,7 +152,7 @@ lasso_register_name_identifier_request_new(const xmlChar *providerID,
LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER(oldidentifier)); LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER(oldidentifier));
lasso_node_destroy(oldidentifier); lasso_node_destroy(oldidentifier);
return (request); return request;
} }
static LassoNode * static LassoNode *
@ -229,7 +229,7 @@ lasso_register_name_identifier_request_new_from_query(const xmlChar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(request); return request;
} }
static LassoNode * static LassoNode *
@ -254,7 +254,7 @@ lasso_register_name_identifier_request_new_from_soap(const xmlChar *buffer)
class->set_xmlNode(LASSO_NODE(request), xmlNode_request); class->set_xmlNode(LASSO_NODE(request), xmlNode_request);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(request); return request;
} }
LassoNode* LassoNode*
@ -277,5 +277,5 @@ lasso_register_name_identifier_request_new_from_export(gchar *buff
request = NULL; request = NULL;
} }
return(request); return request;
} }

View File

@ -79,7 +79,7 @@ lasso_register_name_identifier_response_new_from_query(gchar *query)
g_datalist_clear(&gd); g_datalist_clear(&gd);
return(response); return response;
} }
static LassoNode* static LassoNode*
@ -104,7 +104,7 @@ lasso_register_name_identifier_response_new_from_soap(gchar *buffer)
class->set_xmlNode(LASSO_NODE(response), xmlNode_response); class->set_xmlNode(LASSO_NODE(response), xmlNode_response);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(response); return response;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -205,7 +205,7 @@ lasso_register_name_identifier_response_new(gchar *providerID,
lasso_node_destroy(ssc); lasso_node_destroy(ssc);
lasso_node_destroy(ss); lasso_node_destroy(ss);
return (response); return response;
} }
LassoNode* LassoNode*
@ -222,14 +222,14 @@ lasso_register_name_identifier_response_new_from_request_export(gchar
if(request){ if(request){
message(G_LOG_LEVEL_WARNING, "Error while building RegisterNameIdentifierRequest\n"); message(G_LOG_LEVEL_WARNING, "Error while building RegisterNameIdentifierRequest\n");
return(NULL); return NULL;
} }
response = lasso_register_name_identifier_response_new(providerID, response = lasso_register_name_identifier_response_new(providerID,
statusCodeValue, statusCodeValue,
request); request);
return(response); return response;
} }
LassoNode* LassoNode*
@ -249,8 +249,8 @@ lasso_register_name_identifier_response_new_from_export(gchar *buf
break; break;
default: default:
message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); message(G_LOG_LEVEL_WARNING, "Invalid export type\n");
return(NULL); return NULL;
} }
return(response); return response;
} }

View File

@ -108,7 +108,7 @@ lasso_request_new(const xmlChar *assertionArtifact)
lasso_samlp_request_set_assertionArtifact(LASSO_SAMLP_REQUEST(request), lasso_samlp_request_set_assertionArtifact(LASSO_SAMLP_REQUEST(request),
assertionArtifact); assertionArtifact);
return (request); return request;
} }
LassoNode* LassoNode*
@ -141,5 +141,5 @@ lasso_request_new_from_export(gchar *buffer,
break; break;
} }
return (request); return request;
} }

View File

@ -106,7 +106,7 @@ lasso_response_new()
lasso_node_destroy(status_code); lasso_node_destroy(status_code);
lasso_node_destroy(status); lasso_node_destroy(status);
return (response); return response;
} }
LassoNode* LassoNode*
@ -139,5 +139,5 @@ lasso_response_new_from_export(gchar *buffer,
break; break;
} }
return (response); return response;
} }

View File

@ -157,7 +157,7 @@ lasso_defederation_build_notification_msg(LassoDefederation *defederation)
xmlFree(query); xmlFree(query);
} }
return(ret); return ret;
} }
/** /**
@ -346,7 +346,7 @@ lasso_defederation_init_notification(LassoDefederation *defederation,
xmlFree(format); xmlFree(format);
lasso_node_destroy(nameIdentifier); lasso_node_destroy(nameIdentifier);
return(ret); return ret;
} }
/** /**
@ -422,7 +422,7 @@ lasso_defederation_process_notification_msg(LassoDefederation *defederation,
done: done:
return(ret); return ret;
} }
/** /**
@ -564,7 +564,7 @@ lasso_defederation_validate_notification(LassoDefederation *defederation)
lasso_node_destroy(nameIdentifier); lasso_node_destroy(nameIdentifier);
} }
return(ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -677,5 +677,5 @@ lasso_defederation_new(LassoServer *server,
"provider_type", provider_type, "provider_type", provider_type,
NULL); NULL);
return(defederation); return defederation;
} }

View File

@ -104,7 +104,7 @@ lasso_identity_add_federation(LassoIdentity *identity,
identity->is_dirty = TRUE; identity->is_dirty = TRUE;
return(0); return 0;
} }
LassoIdentity* LassoIdentity*
@ -114,7 +114,7 @@ lasso_identity_copy(LassoIdentity *identity)
guint i; guint i;
if (identity == NULL) { if (identity == NULL) {
return(NULL); return NULL;
} }
copy = LASSO_IDENTITY(g_object_new(LASSO_TYPE_IDENTITY, NULL)); copy = LASSO_IDENTITY(g_object_new(LASSO_TYPE_IDENTITY, NULL));
@ -131,7 +131,7 @@ lasso_identity_copy(LassoIdentity *identity)
(gpointer)copy->federations); (gpointer)copy->federations);
copy->is_dirty = identity->is_dirty; copy->is_dirty = identity->is_dirty;
return(copy); return copy;
} }
void void
@ -171,7 +171,7 @@ lasso_identity_dump(LassoIdentity *identity)
lasso_node_destroy(identity_node); lasso_node_destroy(identity_node);
return(dump); return dump;
} }
LassoFederation* LassoFederation*
@ -187,10 +187,10 @@ lasso_identity_get_federation(LassoIdentity *identity,
remote_providerID); remote_providerID);
if (federation == NULL) { if (federation == NULL) {
debug("No Federation found with remote ProviderID = %s\n", remote_providerID); debug("No Federation found with remote ProviderID = %s\n", remote_providerID);
return (NULL); return NULL;
} }
return(lasso_federation_copy(federation)); return lasso_federation_copy(federation);
} }
gchar* gchar*
@ -201,12 +201,12 @@ lasso_identity_get_next_federation_remote_providerID(LassoIdentity *identity)
g_return_val_if_fail(identity!=NULL, NULL); g_return_val_if_fail(identity!=NULL, NULL);
if (identity->providerIDs->len == 0) { if (identity->providerIDs->len == 0) {
return(NULL); return NULL;
} }
remote_providerID = g_strdup(g_ptr_array_index(identity->providerIDs, 0)); remote_providerID = g_strdup(g_ptr_array_index(identity->providerIDs, 0));
return(remote_providerID); return remote_providerID;
} }
gint gint
@ -240,7 +240,7 @@ lasso_identity_remove_federation(LassoIdentity *identity,
identity->is_dirty = TRUE; identity->is_dirty = TRUE;
return(0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -342,7 +342,7 @@ lasso_identity_new()
identity = LASSO_IDENTITY(g_object_new(LASSO_TYPE_IDENTITY, NULL)); identity = LASSO_IDENTITY(g_object_new(LASSO_TYPE_IDENTITY, NULL));
return(identity); return identity;
} }
LassoIdentity* LassoIdentity*
@ -370,7 +370,7 @@ lasso_identity_new_from_dump(gchar *dump)
identity_node = lasso_node_new_from_dump(dump); identity_node = lasso_node_new_from_dump(dump);
if (identity_node == NULL) { if (identity_node == NULL) {
message(G_LOG_LEVEL_WARNING, "Can't create a identity from dump\n"); message(G_LOG_LEVEL_WARNING, "Can't create a identity from dump\n");
return (NULL); return NULL;
} }
/* federations */ /* federations */
@ -475,5 +475,5 @@ lasso_identity_new_from_dump(gchar *dump)
lasso_node_destroy(identity_node); lasso_node_destroy(identity_node);
return (identity); return identity;
} }

View File

@ -46,12 +46,12 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp)
NULL); NULL);
if (assertionConsumerServiceURL == NULL) { if (assertionConsumerServiceURL == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n"); message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n");
return(-1); return -1;
} }
if (profile->request == NULL) { if (profile->request == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AuthnRequest not found\n"); message(G_LOG_LEVEL_CRITICAL, "AuthnRequest not found\n");
return(-1); return -1;
} }
lecp->authnRequestEnvelope = lasso_authn_request_envelope_new(LASSO_AUTHN_REQUEST(profile->request), lecp->authnRequestEnvelope = lasso_authn_request_envelope_new(LASSO_AUTHN_REQUEST(profile->request),
@ -59,16 +59,16 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp)
assertionConsumerServiceURL); assertionConsumerServiceURL);
if (lecp->authnRequestEnvelope == NULL) { if (lecp->authnRequestEnvelope == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while building AuthnRequestEnvelope\n"); message(G_LOG_LEVEL_CRITICAL, "Error while building AuthnRequestEnvelope\n");
return(-1); return -1;
} }
profile->msg_body = lasso_node_export(lecp->authnRequestEnvelope); profile->msg_body = lasso_node_export(lecp->authnRequestEnvelope);
if (profile->msg_body == NULL) { if (profile->msg_body == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while exporting the AuthnRequestEnvelope to POST msg\n"); message(G_LOG_LEVEL_CRITICAL, "Error while exporting the AuthnRequestEnvelope to POST msg\n");
return(-1); return -1;
} }
return(0); return 0;
} }
gint gint
@ -91,10 +91,10 @@ lasso_lecp_build_authn_request_msg(LassoLecp *lecp,
profile->msg_body = lasso_node_export_to_soap(profile->request); profile->msg_body = lasso_node_export_to_soap(profile->request);
if (profile->msg_body == NULL) { if (profile->msg_body == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while building the AuthnRequest SOAP message\n"); message(G_LOG_LEVEL_CRITICAL, "Error while building the AuthnRequest SOAP message\n");
return(-1); return -1;
} }
return(0); return 0;
} }
gint gint
@ -108,15 +108,15 @@ lasso_lecp_build_authn_response_msg(LassoLecp *lecp)
profile->msg_url = g_strdup(lecp->assertionConsumerServiceURL); profile->msg_url = g_strdup(lecp->assertionConsumerServiceURL);
if (profile->msg_url == NULL) { if (profile->msg_url == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n"); message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n");
return(-1); return -1;
} }
profile->msg_body = lasso_node_export_to_base64(profile->response); profile->msg_body = lasso_node_export_to_base64(profile->response);
if (profile->msg_body == NULL) { if (profile->msg_body == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AuthnResponse Base64 msg not found\n"); message(G_LOG_LEVEL_CRITICAL, "AuthnResponse Base64 msg not found\n");
return(-1); return -1;
} }
return(0); return 0;
} }
gint gint
@ -135,7 +135,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp,
if (LASSO_IS_AUTHN_RESPONSE(profile->response) == FALSE) { if (LASSO_IS_AUTHN_RESPONSE(profile->response) == FALSE) {
message(G_LOG_LEVEL_CRITICAL, "AuthnResponse not found\n"); message(G_LOG_LEVEL_CRITICAL, "AuthnResponse not found\n");
return(-1); return -1;
} }
provider = lasso_server_get_provider_ref(profile->server, provider = lasso_server_get_provider_ref(profile->server,
@ -143,7 +143,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp,
NULL); NULL);
if (provider == NULL) { if (provider == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Provider %s not found\n", profile->remote_providerID); message(G_LOG_LEVEL_CRITICAL, "Provider %s not found\n", profile->remote_providerID);
return(-1); return -1;
} }
/* build lib:AuthnResponse */ /* build lib:AuthnResponse */
@ -157,7 +157,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp,
NULL); NULL);
if (assertionConsumerServiceURL == NULL) { if (assertionConsumerServiceURL == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n"); message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n");
return(-1); return -1;
} }
xmlFree(LASSO_PROFILE(lecp)->msg_body); xmlFree(LASSO_PROFILE(lecp)->msg_body);
@ -170,10 +170,10 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp,
if (LASSO_PROFILE(lecp)->msg_body == NULL) { if (LASSO_PROFILE(lecp)->msg_body == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while exporting the AuthnResponseEnvelope to SOAP msg\n"); message(G_LOG_LEVEL_CRITICAL, "Error while exporting the AuthnResponseEnvelope to SOAP msg\n");
return(-1); return -1;
} }
return(0); return 0;
} }
gint gint
@ -188,7 +188,7 @@ lasso_lecp_init_authn_request(LassoLecp *lecp)
a signature template */ a signature template */
res = lasso_login_init_authn_request(LASSO_LOGIN(lecp), lassoHttpMethodPost); res = lasso_login_init_authn_request(LASSO_LOGIN(lecp), lassoHttpMethodPost);
return(res); return res;
} }
gint gint
@ -203,10 +203,10 @@ lasso_lecp_init_from_authn_request_msg(LassoLecp *lecp,
if (authn_request_method != lassoHttpMethodSoap) { if (authn_request_method != lassoHttpMethodSoap) {
message(G_LOG_LEVEL_CRITICAL, "Invalid authentication request method\n"); message(G_LOG_LEVEL_CRITICAL, "Invalid authentication request method\n");
return(-1); return -1;
} }
res = lasso_login_init_from_authn_request_msg(LASSO_LOGIN(lecp), authn_request_msg, authn_request_method); res = lasso_login_init_from_authn_request_msg(LASSO_LOGIN(lecp), authn_request_msg, authn_request_method);
return(res); return res;
} }
gint gint
@ -219,16 +219,16 @@ lasso_lecp_process_authn_request_envelope_msg(LassoLecp *lecp,
lecp->authnRequestEnvelope = lasso_authn_request_envelope_new_from_export(request_msg, lassoNodeExportTypeXml); lecp->authnRequestEnvelope = lasso_authn_request_envelope_new_from_export(request_msg, lassoNodeExportTypeXml);
if (lecp->authnRequestEnvelope == NULL) { if (lecp->authnRequestEnvelope == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while building the authentication request envelope\n"); message(G_LOG_LEVEL_CRITICAL, "Error while building the authentication request envelope\n");
return(-1); return -1;
} }
LASSO_PROFILE(lecp)->request = lasso_authn_request_envelope_get_authnRequest(LASSO_AUTHN_REQUEST_ENVELOPE(lecp->authnRequestEnvelope)); LASSO_PROFILE(lecp)->request = lasso_authn_request_envelope_get_authnRequest(LASSO_AUTHN_REQUEST_ENVELOPE(lecp->authnRequestEnvelope));
if (LASSO_PROFILE(lecp)->request == NULL) { if (LASSO_PROFILE(lecp)->request == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AuthnRequest not found\n"); message(G_LOG_LEVEL_CRITICAL, "AuthnRequest not found\n");
return(-1); return -1;
} }
return(0); return 0;
} }
gint gint
@ -245,23 +245,23 @@ lasso_lecp_process_authn_response_envelope_msg(LassoLecp *lecp,
lecp->authnResponseEnvelope = lasso_authn_response_envelope_new_from_export(response_msg, lassoNodeExportTypeSoap); lecp->authnResponseEnvelope = lasso_authn_response_envelope_new_from_export(response_msg, lassoNodeExportTypeSoap);
if (lecp->authnResponseEnvelope == NULL) { if (lecp->authnResponseEnvelope == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Error while building AuthnResponseEnvelope\n"); message(G_LOG_LEVEL_CRITICAL, "Error while building AuthnResponseEnvelope\n");
return(-1); return -1;
} }
profile->response = lasso_authn_response_envelope_get_authnResponse(LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->authnResponseEnvelope)); profile->response = lasso_authn_response_envelope_get_authnResponse(LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->authnResponseEnvelope));
if (profile->response == NULL) { if (profile->response == NULL) {
message(G_LOG_LEVEL_CRITICAL, "AuthnResponse not found\n"); message(G_LOG_LEVEL_CRITICAL, "AuthnResponse not found\n");
return(-1); return -1;
} }
lecp->assertionConsumerServiceURL = lasso_authn_response_envelope_get_assertionConsumerServiceURL( lecp->assertionConsumerServiceURL = lasso_authn_response_envelope_get_assertionConsumerServiceURL(
LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->authnResponseEnvelope)); LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->authnResponseEnvelope));
if (lecp->assertionConsumerServiceURL == NULL){ if (lecp->assertionConsumerServiceURL == NULL){
message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n"); message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found\n");
return(-1); return -1;
} }
return(0); return 0;
} }
void void
@ -341,5 +341,5 @@ lasso_lecp_new(LassoServer *server)
} }
return(lecp); return lecp;
} }

View File

@ -83,7 +83,7 @@ lasso_login_add_response_assertion(LassoLogin *login,
message(G_LOG_LEVEL_CRITICAL, err->message); message(G_LOG_LEVEL_CRITICAL, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return(ret); return ret;
} }
assertion = lasso_assertion_new(LASSO_PROFILE(login)->server->providerID, assertion = lasso_assertion_new(LASSO_PROFILE(login)->server->providerID,
requestID); requestID);
@ -125,7 +125,7 @@ lasso_login_add_response_assertion(LassoLogin *login,
lasso_node_destroy(as); lasso_node_destroy(as);
lasso_node_destroy(assertion); lasso_node_destroy(assertion);
return (ret); return ret;
} }
static gint static gint
@ -210,7 +210,7 @@ lasso_login_process_federation(LassoLogin *login)
xmlFree(nameIDPolicy); xmlFree(nameIDPolicy);
xmlFree(consent); xmlFree(consent);
return (ret); return ret;
} }
static gint static gint
@ -297,7 +297,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) {
lasso_node_destroy(status); lasso_node_destroy(status);
lasso_node_destroy(assertion); lasso_node_destroy(assertion);
return (ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -398,7 +398,7 @@ lasso_login_accept_sso(LassoLogin *login)
lasso_node_destroy(idp_ni_copy); lasso_node_destroy(idp_ni_copy);
lasso_node_destroy(assertion); lasso_node_destroy(assertion);
return (ret); return ret;
} }
/** /**
@ -436,13 +436,13 @@ lasso_login_build_artifact_msg(LassoLogin *login,
if (http_method != lassoHttpMethodRedirect && http_method != lassoHttpMethodPost) { if (http_method != lassoHttpMethodRedirect && http_method != lassoHttpMethodPost) {
message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT or POST\n."); message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT or POST\n.");
return (-2); return -2;
} }
/* ProtocolProfile must be BrwsArt */ /* ProtocolProfile must be BrwsArt */
if (login->protocolProfile != lassoLoginProtocolProfileBrwsArt) { if (login->protocolProfile != lassoLoginProtocolProfileBrwsArt) {
message(G_LOG_LEVEL_CRITICAL, "Failed to build artifact message, an AuthnResponse is required by ProtocolProfile.\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to build artifact message, an AuthnResponse is required by ProtocolProfile.\n");
return (-3); return -3;
} }
if (authentication_result == 0) { if (authentication_result == 0) {
@ -513,7 +513,7 @@ lasso_login_build_artifact_msg(LassoLogin *login,
xmlFree(b64_samlArt); xmlFree(b64_samlArt);
xmlFree(relayState); xmlFree(relayState);
return (0); return 0;
} }
/** /**
@ -553,7 +553,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login,
if (remote_provider == NULL) { if (remote_provider == NULL) {
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
/* check if authnRequest must be signed */ /* check if authnRequest must be signed */
@ -634,7 +634,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login,
xmlFree(url); xmlFree(url);
xmlFree(request_protocolProfile); xmlFree(request_protocolProfile);
return (ret); return ret;
} }
/** /**
@ -664,7 +664,7 @@ lasso_login_build_authn_response_msg(LassoLogin *login,
/* ProtocolProfile must be BrwsPost */ /* ProtocolProfile must be BrwsPost */
if (login->protocolProfile != lassoLoginProtocolProfileBrwsPost) { if (login->protocolProfile != lassoLoginProtocolProfileBrwsPost) {
message(G_LOG_LEVEL_CRITICAL, "Failed to build AuthnResponse message, an Artifact is required by ProtocolProfile.\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to build AuthnResponse message, an Artifact is required by ProtocolProfile.\n");
return (-1); return -1;
} }
if (authentication_result == 0) { if (authentication_result == 0) {
@ -695,7 +695,7 @@ lasso_login_build_authn_response_msg(LassoLogin *login,
lassoProviderTypeSp, lassoProviderTypeSp,
NULL); NULL);
return (0); return 0;
} }
gint gint
@ -725,13 +725,13 @@ lasso_login_build_request_msg(LassoLogin *login)
if (err != NULL) { if (err != NULL) {
goto done; goto done;
} }
return (0); return 0;
done: done:
message(G_LOG_LEVEL_CRITICAL, err->message); message(G_LOG_LEVEL_CRITICAL, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
void void
@ -766,7 +766,7 @@ lasso_login_dump(LassoLogin *login)
dump = lasso_node_export(node); dump = lasso_node_export(node);
lasso_node_destroy(node); lasso_node_destroy(node);
return (dump); return dump;
} }
gint gint
@ -776,7 +776,7 @@ lasso_login_init_authn_request(LassoLogin *login,
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
if (http_method != lassoHttpMethodRedirect && http_method != lassoHttpMethodPost) { if (http_method != lassoHttpMethodRedirect && http_method != lassoHttpMethodPost) {
message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it must be REDIRECT or POST\n."); message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it must be REDIRECT or POST\n.");
return (LASSO_PARAM_ERROR_INVALID_VALUE); return LASSO_PARAM_ERROR_INVALID_VALUE;
} }
login->http_method = http_method; login->http_method = http_method;
@ -793,12 +793,12 @@ lasso_login_init_authn_request(LassoLogin *login,
} }
if (LASSO_PROFILE(login)->request == NULL) { if (LASSO_PROFILE(login)->request == NULL) {
return (-2); return -2;
} }
LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest; LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest;
return (0); return 0;
} }
gint gint
@ -821,7 +821,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
authn_request_http_method != lassoHttpMethodPost && \ authn_request_http_method != lassoHttpMethodPost && \
authn_request_http_method != lassoHttpMethodSoap) { authn_request_http_method != lassoHttpMethodSoap) {
message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT, POST or SOAP (LECP)\n."); message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT, POST or SOAP (LECP)\n.");
return (-2); return -2;
} }
server = LASSO_PROFILE(login)->server; server = LASSO_PROFILE(login)->server;
@ -849,7 +849,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
/* verify ASSO_PROFILE(login)-request is an AuthnRequest object */ /* verify ASSO_PROFILE(login)-request is an AuthnRequest object */
if ( LASSO_IS_AUTHN_REQUEST(LASSO_PROFILE(login)->request) == FALSE ) { if ( LASSO_IS_AUTHN_REQUEST(LASSO_PROFILE(login)->request) == FALSE ) {
message(G_LOG_LEVEL_CRITICAL, "Message is not an AuthnRequest\n"); message(G_LOG_LEVEL_CRITICAL, "Message is not an AuthnRequest\n");
return(-1); return -1;
} }
LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest; LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest;
@ -901,14 +901,14 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
message(G_LOG_LEVEL_CRITICAL, err->message); message(G_LOG_LEVEL_CRITICAL, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
} }
else { else {
message(G_LOG_LEVEL_CRITICAL, err->message); message(G_LOG_LEVEL_CRITICAL, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
/* verify request signature */ /* verify request signature */
@ -944,10 +944,10 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
lassoLibStatusCodeUnsignedAuthnRequest); lassoLibStatusCodeUnsignedAuthnRequest);
break; break;
} }
return (-3); return -3;
} }
} }
return (0); return 0;
} }
gint gint
@ -966,7 +966,7 @@ lasso_login_init_request(LassoLogin *login,
if (response_http_method != lassoHttpMethodRedirect && \ if (response_http_method != lassoHttpMethodRedirect && \
response_http_method != lassoHttpMethodPost) { response_http_method != lassoHttpMethodPost) {
message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT or POST\n."); message(G_LOG_LEVEL_CRITICAL, "Invalid HTTP method, it could be REDIRECT or POST\n.");
return (-1); return -1;
} }
/* rebuild response (artifact) */ /* rebuild response (artifact) */
@ -1011,7 +1011,7 @@ lasso_login_init_request(LassoLogin *login,
g_clear_error(&err); g_clear_error(&err);
} }
return (ret); return ret;
} }
gboolean gboolean
@ -1051,7 +1051,7 @@ lasso_login_must_authenticate(LassoLogin *login)
lassoLibStatusCodeNoPassive); lassoLibStatusCodeNoPassive);
} }
return (must_authenticate); return must_authenticate;
} }
gint gint
@ -1085,7 +1085,7 @@ lasso_login_process_authn_response_msg(LassoLogin *login,
ret2 = lasso_login_process_response_status_and_assertion(login); ret2 = lasso_login_process_response_status_and_assertion(login);
return (ret2 == 0 ? ret1 : ret2); return ret2 == 0 ? ret1 : ret2;
} }
gint gint
@ -1103,7 +1103,7 @@ lasso_login_process_request_msg(LassoLogin *login,
lassoNodeExportTypeSoap); lassoNodeExportTypeSoap);
if (LASSO_PROFILE(login)->request == NULL) { if (LASSO_PROFILE(login)->request == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to rebuild samlp:Request with request message.\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to rebuild samlp:Request with request message.\n");
return (LASSO_ERROR_UNDEFINED); return LASSO_ERROR_UNDEFINED;
} }
LASSO_PROFILE(login)->request_type = lassoMessageTypeRequest; LASSO_PROFILE(login)->request_type = lassoMessageTypeRequest;
@ -1117,7 +1117,7 @@ lasso_login_process_request_msg(LassoLogin *login,
g_error_free(err); g_error_free(err);
} }
return (ret); return ret;
} }
gint gint
@ -1132,11 +1132,11 @@ lasso_login_process_response_msg(LassoLogin *login,
lassoNodeExportTypeSoap); lassoNodeExportTypeSoap);
if (LASSO_PROFILE(login)->response == NULL) { if (LASSO_PROFILE(login)->response == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to rebuild samlp:Response with response message.\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to rebuild samlp:Response with response message.\n");
return (LASSO_ERROR_UNDEFINED); return LASSO_ERROR_UNDEFINED;
} }
LASSO_PROFILE(login)->response_type = lassoMessageTypeResponse; LASSO_PROFILE(login)->response_type = lassoMessageTypeResponse;
return (lasso_login_process_response_status_and_assertion(login)); return lasso_login_process_response_status_and_assertion(login);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1234,7 +1234,7 @@ lasso_login_new(LassoServer *server)
"server", lasso_server_copy(server), "server", lasso_server_copy(server),
NULL)); NULL));
return (login); return login;
} }
LassoLogin* LassoLogin*
@ -1334,5 +1334,5 @@ lasso_login_new_from_dump(LassoServer *server,
lasso_node_destroy(node_dump); lasso_node_destroy(node_dump);
return (login); return login;
} }

View File

@ -93,7 +93,7 @@ lasso_logout_dump(LassoLogout *logout)
dump = lasso_node_export(node); dump = lasso_node_export(node);
lasso_node_destroy(node); lasso_node_destroy(node);
return(dump); return dump;
} }
/** /**
@ -209,7 +209,7 @@ lasso_logout_build_request_msg(LassoLogout *logout)
xmlFree(query); xmlFree(query);
} }
return(ret); return ret;
} }
/** /**
@ -310,7 +310,7 @@ lasso_logout_build_response_msg(LassoLogout *logout)
xmlFree(query); xmlFree(query);
} }
return(ret); return ret;
} }
/** /**
@ -355,7 +355,7 @@ lasso_logout_get_next_providerID(LassoLogout *logout)
provider_id = lasso_session_get_next_providerID(profile->session); provider_id = lasso_session_get_next_providerID(profile->session);
} }
return(provider_id); return provider_id;
} }
/** /**
@ -541,7 +541,7 @@ lasso_logout_init_request(LassoLogout *logout,
xmlFree(singleLogoutProtocolProfile); xmlFree(singleLogoutProtocolProfile);
} }
return(ret); return ret;
} }
/** /**
@ -645,7 +645,7 @@ gint lasso_logout_process_request_msg(LassoLogout *logout,
xmlFree(remote_providerID); xmlFree(remote_providerID);
} }
return(ret); return ret;
} }
/** /**
@ -778,7 +778,7 @@ lasso_logout_process_response_msg(LassoLogout *logout,
done: done:
return(ret); return ret;
} }
/** /**
@ -800,7 +800,7 @@ gint lasso_logout_reset_session_index(LassoLogout *logout)
lasso_session_reset_index_providerID(profile->session); lasso_session_reset_index_providerID(profile->session);
return(0); return 0;
} }
/** /**
@ -994,7 +994,7 @@ lasso_logout_validate_request(LassoLogout *logout)
done: done:
return(ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1105,7 +1105,7 @@ lasso_logout_new(LassoServer *server,
"provider_type", provider_type, "provider_type", provider_type,
NULL); NULL);
return(logout); return logout;
} }
LassoLogout* LassoLogout*
@ -1194,5 +1194,5 @@ lasso_logout_new_from_dump(LassoServer *server,
/* Initial logout remote provider id */ /* Initial logout remote provider id */
logout->initial_remote_providerID = lasso_node_get_child_content(node_dump, "InitialRemoteProviderID", lassoLassoHRef, NULL); logout->initial_remote_providerID = lasso_node_get_child_content(node_dump, "InitialRemoteProviderID", lassoLassoHRef, NULL);
return(logout); return logout;
} }

View File

@ -36,7 +36,7 @@ lasso_name_identifier_mapping_dump(LassoNameIdentifierMapping *mapping)
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), NULL); g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), NULL);
return(dump); return dump;
} }
gint gint
@ -58,7 +58,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
NULL); NULL);
if(provider == NULL) { if(provider == NULL) {
message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID); message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2); return -2;
} }
protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider, protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider,
@ -68,7 +68,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
message(G_LOG_LEVEL_ERROR, err->message); message(G_LOG_LEVEL_ERROR, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
@ -88,7 +88,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
profile->msg_body = NULL; profile->msg_body = NULL;
} }
return(0); return 0;
} }
gint gint
@ -109,7 +109,7 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
NULL); NULL);
if(provider == NULL) { if(provider == NULL) {
message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID); message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2); return -2;
} }
protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider, protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider,
@ -119,7 +119,7 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
message(G_LOG_LEVEL_ERROR, err->message); message(G_LOG_LEVEL_ERROR, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return(ret); return ret;
} }
if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
@ -138,7 +138,7 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
profile->msg_body = NULL; profile->msg_body = NULL;
} }
return(0); return 0;
} }
gint gint
@ -162,7 +162,7 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID); federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if(federation == NULL) { if(federation == NULL) {
message(G_LOG_LEVEL_ERROR, "error, federation not found\n"); message(G_LOG_LEVEL_ERROR, "error, federation not found\n");
return(-3); return -3;
} }
/* get the name identifier (!!! depend on the provider type : SP or IDP !!!)*/ /* get the name identifier (!!! depend on the provider type : SP or IDP !!!)*/
@ -183,13 +183,13 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
break; break;
default: default:
message(G_LOG_LEVEL_ERROR, "Unknown provider type\n"); message(G_LOG_LEVEL_ERROR, "Unknown provider type\n");
return(-4); return -4;
} }
lasso_federation_destroy(federation); lasso_federation_destroy(federation);
if(nameIdentifier == NULL) { if(nameIdentifier == NULL) {
message(G_LOG_LEVEL_ERROR, "Name identifier not found\n"); message(G_LOG_LEVEL_ERROR, "Name identifier not found\n");
return(-5); return -5;
} }
/* build the request */ /* build the request */
@ -203,7 +203,7 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
g_return_val_if_fail(profile->request != NULL, -6); g_return_val_if_fail(profile->request != NULL, -6);
return(0); return 0;
} }
gint gint
@ -237,7 +237,7 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
break; break;
default: default:
message(G_LOG_LEVEL_ERROR, "Unknown request method\n"); message(G_LOG_LEVEL_ERROR, "Unknown request method\n");
return(-3); return -3;
} }
/* set the remote provider id from the request */ /* set the remote provider id from the request */
@ -258,7 +258,7 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL, NULL); nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL, NULL);
if(nameIdentifier == NULL) { if(nameIdentifier == NULL) {
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-5); return -5;
} }
remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID",
@ -269,17 +269,17 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
if(federation == NULL) { if(federation == NULL) {
message(G_LOG_LEVEL_WARNING, "No federation for %s\n", remote_providerID); message(G_LOG_LEVEL_WARNING, "No federation for %s\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-6); return -6;
} }
if(lasso_federation_verify_nameIdentifier(federation, nameIdentifier) == FALSE){ if(lasso_federation_verify_nameIdentifier(federation, nameIdentifier) == FALSE){
message(G_LOG_LEVEL_WARNING, "No name identifier for %s\n", remote_providerID); message(G_LOG_LEVEL_WARNING, "No name identifier for %s\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-7); return -7;
} }
lasso_federation_destroy(federation); lasso_federation_destroy(federation);
return(0); return 0;
} }
gint gint
@ -304,23 +304,23 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m
profile->response = lasso_name_identifier_mapping_response_new_from_soap(response_msg); profile->response = lasso_name_identifier_mapping_response_new_from_soap(response_msg);
default: default:
message(G_LOG_LEVEL_ERROR, "Unknown response method\n"); message(G_LOG_LEVEL_ERROR, "Unknown response method\n");
return(-3); return -3;
} }
statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL, NULL); statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL, NULL);
statusCodeValue = lasso_node_get_attr_value(statusCode, "Value", &err); statusCodeValue = lasso_node_get_attr_value(statusCode, "Value", &err);
if (err == NULL) { if (err == NULL) {
if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)) { if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)) {
return(-4); return -4;
} }
} }
else { else {
message(G_LOG_LEVEL_ERROR, err->message); message(G_LOG_LEVEL_ERROR, err->message);
ret = err->code; ret = err->code;
g_error_free(err); g_error_free(err);
return (ret); return ret;
} }
return(0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -376,5 +376,5 @@ lasso_name_identifier_mapping_new(LassoServer *server,
"identity", lasso_identity_copy(identity), "identity", lasso_identity_copy(identity),
"provider_type", provider_type, "provider_type", provider_type,
NULL); NULL);
return(mapping); return mapping;
} }

View File

@ -48,7 +48,7 @@ lasso_name_registration_dump(LassoNameRegistration *name_registration)
dump = NULL; dump = NULL;
return(dump); return dump;
} }
/** /**
@ -140,7 +140,7 @@ lasso_name_registration_build_request_msg(LassoNameRegistration *name_registrati
done: done:
return(ret); return ret;
} }
gint gint
@ -159,7 +159,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
NULL); NULL);
if (provider == NULL) { if (provider == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Provider not found (ProviderID = %s)\n", profile->remote_providerID); message(G_LOG_LEVEL_CRITICAL, "Provider not found (ProviderID = %s)\n", profile->remote_providerID);
return(-2); return -2;
} }
protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider, protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider,
@ -167,7 +167,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
NULL); NULL);
if (protocolProfile == NULL) { if (protocolProfile == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Register name identifier protocol profile not found\n"); message(G_LOG_LEVEL_CRITICAL, "Register name identifier protocol profile not found\n");
return(-3); return -3;
} }
if (xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \ if (xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
@ -183,7 +183,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
debug("building a http get response message\n"); debug("building a http get response message\n");
} }
return(0); return 0;
} }
void void
@ -321,7 +321,7 @@ lasso_name_registration_init_request(LassoNameRegistration *name_registration,
done: done:
return(ret); return ret;
} }
gint lasso_name_registration_process_request_msg(LassoNameRegistration *name_registration, gint lasso_name_registration_process_request_msg(LassoNameRegistration *name_registration,
@ -369,7 +369,7 @@ gint lasso_name_registration_process_request_msg(LassoNameRegistration *name_reg
done : done :
return(ret); return ret;
} }
gint gint
@ -445,7 +445,7 @@ lasso_name_registration_validate_request(LassoNameRegistration *name_registratio
done: done:
return(ret); return ret;
} }
gint gint
@ -497,7 +497,7 @@ lasso_name_registration_process_response_msg(LassoNameRegistration *name_registr
done: done:
return(ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -568,5 +568,5 @@ lasso_name_registration_new(LassoServer *server,
"provider_type", provider_type, "provider_type", provider_type,
NULL); NULL);
return(name_registration); return name_registration;
} }

View File

@ -54,13 +54,13 @@ lasso_profile_get_request_type_from_soap_msg(gchar *soap)
soap_node = lasso_node_new_from_dump(soap); soap_node = lasso_node_new_from_dump(soap);
if (soap_node == NULL) { if (soap_node == NULL) {
message(G_LOG_LEVEL_WARNING, "Error while build node from soap msg\n"); message(G_LOG_LEVEL_WARNING, "Error while build node from soap msg\n");
return(-1); return -1;
} }
body_node = lasso_node_get_child(soap_node, "Body", NULL, NULL); body_node = lasso_node_get_child(soap_node, "Body", NULL, NULL);
if(body_node == NULL) { if(body_node == NULL) {
message(G_LOG_LEVEL_WARNING, "Body node not found\n"); message(G_LOG_LEVEL_WARNING, "Body node not found\n");
return(-2); return -2;
} }
children = lasso_node_get_children(body_node); children = lasso_node_get_children(body_node);
@ -92,7 +92,7 @@ lasso_profile_get_request_type_from_soap_msg(gchar *soap)
xmlFree(name); xmlFree(name);
} }
return(type); return type;
} }
@ -165,7 +165,7 @@ lasso_profile_dump(LassoProfile *ctx,
dump = lasso_node_export(node); dump = lasso_node_export(node);
lasso_node_destroy(node); lasso_node_destroy(node);
return (dump); return dump;
} }
LassoIdentity* LassoIdentity*
@ -176,11 +176,11 @@ lasso_profile_get_identity(LassoProfile *ctx)
if (ctx->identity != NULL) { if (ctx->identity != NULL) {
/* return identity copy only if identity isn't empty */ /* return identity copy only if identity isn't empty */
if (ctx->identity->providerIDs->len > 0) { if (ctx->identity->providerIDs->len > 0) {
return (lasso_identity_copy(ctx->identity)); return lasso_identity_copy(ctx->identity);
} }
} }
return (NULL); return NULL;
} }
LassoSession* LassoSession*
@ -191,21 +191,21 @@ lasso_profile_get_session(LassoProfile *ctx)
if (ctx->session != NULL) { if (ctx->session != NULL) {
/* return session copy only if session isn't empty */ /* return session copy only if session isn't empty */
if (ctx->session->providerIDs->len > 0) { if (ctx->session->providerIDs->len > 0) {
return (lasso_session_copy(ctx->session)); return lasso_session_copy(ctx->session);
} }
} }
return (NULL); return NULL;
} }
gboolean gboolean
lasso_profile_is_identity_dirty(LassoProfile *ctx) lasso_profile_is_identity_dirty(LassoProfile *ctx)
{ {
if (ctx->identity != NULL) { if (ctx->identity != NULL) {
return (ctx->identity->is_dirty); return ctx->identity->is_dirty;
} }
else { else {
return (FALSE); return FALSE;
} }
} }
@ -213,10 +213,10 @@ gboolean
lasso_profile_is_session_dirty(LassoProfile *ctx) lasso_profile_is_session_dirty(LassoProfile *ctx)
{ {
if (ctx->session != NULL) { if (ctx->session != NULL) {
return (ctx->session->is_dirty); return ctx->session->is_dirty;
} }
else { else {
return (FALSE); return FALSE;
} }
} }
@ -227,7 +227,7 @@ lasso_profile_set_remote_providerID(LassoProfile *ctx,
g_free(ctx->remote_providerID); g_free(ctx->remote_providerID);
ctx->remote_providerID = g_strdup(providerID); ctx->remote_providerID = g_strdup(providerID);
return (1); return 1;
} }
void void
@ -260,7 +260,7 @@ lasso_profile_set_identity(LassoProfile *ctx,
ctx->identity = lasso_identity_copy(identity); ctx->identity = lasso_identity_copy(identity);
ctx->identity->is_dirty = FALSE; ctx->identity->is_dirty = FALSE;
return(0); return 0;
} }
gint gint
@ -270,11 +270,11 @@ lasso_profile_set_identity_from_dump(LassoProfile *ctx,
ctx->identity = lasso_identity_new_from_dump((gchar *)dump); ctx->identity = lasso_identity_new_from_dump((gchar *)dump);
if (ctx->identity == NULL) { if (ctx->identity == NULL) {
message(G_LOG_LEVEL_WARNING, "Failed to create the identity from the identity dump\n"); message(G_LOG_LEVEL_WARNING, "Failed to create the identity from the identity dump\n");
return(-1); return -1;
} }
ctx->identity->is_dirty = FALSE; ctx->identity->is_dirty = FALSE;
return(0); return 0;
} }
gint gint
@ -286,7 +286,7 @@ lasso_profile_set_session(LassoProfile *ctx,
ctx->session = lasso_session_copy(session); ctx->session = lasso_session_copy(session);
ctx->session->is_dirty = FALSE; ctx->session->is_dirty = FALSE;
return(0); return 0;
} }
gint gint
@ -296,11 +296,11 @@ lasso_profile_set_session_from_dump(LassoProfile *ctx,
ctx->session = lasso_session_new_from_dump((gchar *)dump); ctx->session = lasso_session_new_from_dump((gchar *)dump);
if (ctx->session == NULL) { if (ctx->session == NULL) {
message(G_LOG_LEVEL_WARNING, "Failed to create the session from the session dump\n"); message(G_LOG_LEVEL_WARNING, "Failed to create the session from the session dump\n");
return(-1); return -1;
} }
ctx->session->is_dirty = FALSE; ctx->session->is_dirty = FALSE;
return(0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -519,5 +519,5 @@ lasso_profile_new(LassoServer *server,
"session", lasso_session_copy(session), "session", lasso_session_copy(session),
NULL)); NULL));
return (ctx); return ctx;
} }

View File

@ -58,7 +58,7 @@ lasso_server_add_lasso_provider(LassoServer *server,
g_ptr_array_add(server->providers, provider); g_ptr_array_add(server->providers, provider);
return (0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -82,10 +82,10 @@ lasso_server_add_provider(LassoServer *server,
} }
else { else {
message(G_LOG_LEVEL_CRITICAL, "Failed to add new provider.\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to add new provider.\n");
return (LASSO_SERVER_ERROR_ADD_PROVIDER_FAILED); return LASSO_SERVER_ERROR_ADD_PROVIDER_FAILED;
} }
return (0); return 0;
} }
LassoServer* LassoServer*
@ -114,7 +114,7 @@ lasso_server_copy(LassoServer *server)
copy->certificate = g_strdup(server->certificate); copy->certificate = g_strdup(server->certificate);
copy->signature_method = server->signature_method; copy->signature_method = server->signature_method;
return(copy); return copy;
} }
void void
@ -196,7 +196,7 @@ lasso_server_dump(LassoServer *server)
dump = lasso_node_export(server_node); dump = lasso_node_export(server_node);
lasso_node_destroy(server_node); lasso_node_destroy(server_node);
return(dump); return dump;
} }
LassoProvider* LassoProvider*
@ -217,13 +217,13 @@ lasso_server_get_provider(LassoServer *server,
provider = lasso_server_get_provider_ref(server, providerID, &tmp_err); provider = lasso_server_get_provider_ref(server, providerID, &tmp_err);
if (provider != NULL) { if (provider != NULL) {
return (lasso_provider_copy(provider)); return lasso_provider_copy(provider);
} }
else { else {
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (NULL); return NULL;
} }
LassoProvider* LassoProvider*
@ -276,7 +276,7 @@ lasso_server_get_provider_ref(LassoServer *server,
/* print error msg here so that caller just check err->code */ /* print error msg here so that caller just check err->code */
message(G_LOG_LEVEL_CRITICAL, err[0]->message); message(G_LOG_LEVEL_CRITICAL, err[0]->message);
return(NULL); return NULL;
} }
gchar * gchar *
@ -313,7 +313,7 @@ lasso_server_get_providerID_from_hash(LassoServer *server,
message(G_LOG_LEVEL_CRITICAL, message(G_LOG_LEVEL_CRITICAL,
"Failed to get a providerID corresponding to the hash.\n") "Failed to get a providerID corresponding to the hash.\n")
return(NULL); return NULL;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -435,7 +435,7 @@ lasso_server_new(gchar *metadata,
message(G_LOG_LEVEL_WARNING, err->message); message(G_LOG_LEVEL_WARNING, err->message);
g_error_free(err); g_error_free(err);
lasso_node_destroy(md_node); lasso_node_destroy(md_node);
return (NULL); return NULL;
} }
} }
@ -455,7 +455,7 @@ lasso_server_new(gchar *metadata,
LASSO_PROVIDER(server)->public_key = g_strdup(public_key); LASSO_PROVIDER(server)->public_key = g_strdup(public_key);
LASSO_PROVIDER(server)->ca_certificate = NULL; LASSO_PROVIDER(server)->ca_certificate = NULL;
return(server); return server;
} }
LassoServer * LassoServer *
@ -473,13 +473,13 @@ lasso_server_new_from_dump(gchar *dump)
server_node = lasso_node_new_from_dump(dump); server_node = lasso_node_new_from_dump(dump);
if (server_node == NULL) { if (server_node == NULL) {
message(G_LOG_LEVEL_WARNING, "Error while loading server dump\n"); message(G_LOG_LEVEL_WARNING, "Error while loading server dump\n");
return(NULL); return NULL;
} }
server_class = LASSO_NODE_GET_CLASS(server_node); server_class = LASSO_NODE_GET_CLASS(server_node);
if (strcmp(server_class->get_name(server_node), LASSO_SERVER_NODE) != 0) { if (strcmp(server_class->get_name(server_node), LASSO_SERVER_NODE) != 0) {
message(G_LOG_LEVEL_WARNING, "XML is not a server dump\n"); message(G_LOG_LEVEL_WARNING, "XML is not a server dump\n");
lasso_node_destroy(server_node); lasso_node_destroy(server_node);
return(NULL); return NULL;
} }
/* providerID */ /* providerID */
@ -558,5 +558,5 @@ lasso_server_new_from_dump(gchar *dump)
lasso_node_destroy(server_node); lasso_node_destroy(server_node);
return(server); return server;
} }

View File

@ -118,7 +118,7 @@ lasso_session_add_assertion(LassoSession *session,
session->is_dirty = TRUE; session->is_dirty = TRUE;
return(0); return 0;
} }
LassoSession* LassoSession*
@ -128,7 +128,7 @@ lasso_session_copy(LassoSession *session)
guint i; guint i;
if (session == NULL) { if (session == NULL) {
return(NULL); return NULL;
} }
copy = LASSO_SESSION(g_object_new(LASSO_TYPE_SESSION, NULL)); copy = LASSO_SESSION(g_object_new(LASSO_TYPE_SESSION, NULL));
@ -145,7 +145,7 @@ lasso_session_copy(LassoSession *session)
(gpointer)copy->assertions); (gpointer)copy->assertions);
copy->is_dirty = session->is_dirty; copy->is_dirty = session->is_dirty;
return(copy); return copy;
} }
void void
@ -187,7 +187,7 @@ lasso_session_dump(LassoSession *session)
lasso_node_destroy(session_node); lasso_node_destroy(session_node);
return(dump); return dump;
} }
LassoNode* LassoNode*
@ -205,7 +205,7 @@ lasso_session_get_assertion(LassoSession *session,
return NULL; return NULL;
} }
return(lasso_node_copy(assertion)); return lasso_node_copy(assertion);
} }
gchar* gchar*
@ -235,7 +235,7 @@ lasso_session_get_authentication_method(LassoSession *session,
done: done:
lasso_node_destroy(as); lasso_node_destroy(as);
lasso_node_destroy(assertion); lasso_node_destroy(assertion);
return (authentication_method); return authentication_method;
} }
gchar* gchar*
@ -246,15 +246,15 @@ lasso_session_get_first_providerID(LassoSession *session)
g_return_val_if_fail(session != NULL, NULL); g_return_val_if_fail(session != NULL, NULL);
if(session->providerIDs->len == 0) { if(session->providerIDs->len == 0) {
return(NULL); return NULL;
} }
providerID = g_ptr_array_index(session->providerIDs, 0); providerID = g_ptr_array_index(session->providerIDs, 0);
if (providerID == NULL) { if (providerID == NULL) {
return(NULL); return NULL;
} }
return(g_strdup(providerID)); return g_strdup(providerID);
} }
gchar* gchar*
@ -265,15 +265,15 @@ lasso_session_get_next_providerID(LassoSession *session)
g_return_val_if_fail(session!=NULL, NULL); g_return_val_if_fail(session!=NULL, NULL);
if(session->providerIDs->len == 0) { if(session->providerIDs->len == 0) {
return(NULL); return NULL;
} }
if (session->index_providerID < 0) { if (session->index_providerID < 0) {
return(NULL); return NULL;
} }
if (session->index_providerID>=session->providerIDs->len) { if (session->index_providerID>=session->providerIDs->len) {
return (NULL); return NULL;
} }
/* get the next provider id and increments the index */ /* get the next provider id and increments the index */
@ -282,7 +282,7 @@ lasso_session_get_next_providerID(LassoSession *session)
session->index_providerID++; session->index_providerID++;
//printf("return provider id %s\n", providerID); //printf("return provider id %s\n", providerID);
return(providerID); return providerID;
} }
gint gint
@ -317,7 +317,7 @@ lasso_session_remove_assertion(LassoSession *session,
session->is_dirty = TRUE; session->is_dirty = TRUE;
return(0); return 0;
} }
gint gint
@ -329,7 +329,7 @@ lasso_session_reset_index_providerID(LassoSession *session)
session->index_providerID = 0; session->index_providerID = 0;
} }
return(0); return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -432,7 +432,7 @@ lasso_session_new()
session = LASSO_SESSION(g_object_new(LASSO_TYPE_SESSION, NULL)); session = LASSO_SESSION(g_object_new(LASSO_TYPE_SESSION, NULL));
return(session); return session;
} }
LassoSession* LassoSession*
@ -453,7 +453,7 @@ lasso_session_new_from_dump(gchar *dump)
session_node = lasso_node_new_from_dump(dump); session_node = lasso_node_new_from_dump(dump);
if (session_node == NULL) { if (session_node == NULL) {
message(G_LOG_LEVEL_WARNING, "Can't create a session from dump\n"); message(G_LOG_LEVEL_WARNING, "Can't create a session from dump\n");
return (NULL); return NULL;
} }
/* get assertions */ /* get assertions */
@ -500,5 +500,5 @@ lasso_session_new_from_dump(gchar *dump)
lasso_node_destroy(assertions_node); lasso_node_destroy(assertions_node);
lasso_node_destroy(session_node); lasso_node_destroy(session_node);
return (session); return session;
} }

View File

@ -78,13 +78,13 @@ int lasso_init()
/* Init xmlsec library */ /* Init xmlsec library */
if(xmlSecInit() < 0) { if(xmlSecInit() < 0) {
message(G_LOG_LEVEL_CRITICAL, "XMLSec initialization failed.\n"); message(G_LOG_LEVEL_CRITICAL, "XMLSec initialization failed.\n");
return(-1); return -1;
} }
/* Check loaded library version */ /* Check loaded library version */
if(xmlSecCheckVersion() != 1) { if(xmlSecCheckVersion() != 1) {
message(G_LOG_LEVEL_CRITICAL, "Loaded xmlsec library version is not compatible.\n"); message(G_LOG_LEVEL_CRITICAL, "Loaded xmlsec library version is not compatible.\n");
return(-1); return -1;
} }
/* Load default crypto engine if we are supporting dynamic /* Load default crypto engine if we are supporting dynamic
@ -104,13 +104,13 @@ int lasso_init()
/* Init crypto library */ /* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) { if(xmlSecCryptoAppInit(NULL) < 0) {
message(G_LOG_LEVEL_CRITICAL, "Crypto initialization failed.\n"); message(G_LOG_LEVEL_CRITICAL, "Crypto initialization failed.\n");
return(-1); return -1;
} }
/* Init xmlsec-crypto library */ /* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) { if(xmlSecCryptoInit() < 0) {
message(G_LOG_LEVEL_CRITICAL, "xmlsec-crypto initialization failed.\n"); message(G_LOG_LEVEL_CRITICAL, "xmlsec-crypto initialization failed.\n");
return(-1); return -1;
} }
return 0; return 0;
} }
@ -141,7 +141,7 @@ int lasso_shutdown()
xmlCleanupParser(); xmlCleanupParser();
/* this is to debug memory for regression tests */ /* this is to debug memory for regression tests */
xmlMemoryDump(); xmlMemoryDump();
return (0); return 0;
} }
/** /**
@ -163,7 +163,7 @@ lasso_check_version_ext(int major, int minor, int subminor, lassoCheckVersionMod
if (major != LASSO_VERSION_MAJOR) { if (major != LASSO_VERSION_MAJOR) {
g_message("expected major version=%d;real major version=%d", g_message("expected major version=%d;real major version=%d",
LASSO_VERSION_MAJOR, major); LASSO_VERSION_MAJOR, major);
return (0); return 0;
} }
switch (mode) { switch (mode) {
@ -172,7 +172,7 @@ lasso_check_version_ext(int major, int minor, int subminor, lassoCheckVersionMod
g_message("mode=exact;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d", g_message("mode=exact;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
LASSO_VERSION_MINOR, minor, LASSO_VERSION_MINOR, minor,
LASSO_VERSION_SUBMINOR, subminor); LASSO_VERSION_SUBMINOR, subminor);
return (0); return 0;
} }
break; break;
case lassoCheckVersionABICompatible: case lassoCheckVersionABICompatible:
@ -181,10 +181,10 @@ lasso_check_version_ext(int major, int minor, int subminor, lassoCheckVersionMod
g_message("mode=abi compatible;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d", g_message("mode=abi compatible;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
LASSO_VERSION_MINOR, minor, LASSO_VERSION_MINOR, minor,
LASSO_VERSION_SUBMINOR, subminor); LASSO_VERSION_SUBMINOR, subminor);
return (0); return 0;
} }
break; break;
} }
return (1); return 1;
} }

View File

@ -83,6 +83,6 @@ lasso_strerror(int error_code)
default: default:
sprintf(msg, "Undefined error code %d.", error_code); sprintf(msg, "Undefined error code %d.", error_code);
return(strdup(msg)); return strdup(msg);
} }
} }

View File

@ -164,5 +164,5 @@ lasso_lib_assertion_new(gboolean use_xsitype)
"use_xsitype", use_xsitype, "use_xsitype", use_xsitype,
NULL)); NULL));
return (node); return node;
} }

View File

@ -183,5 +183,5 @@ lasso_lib_authentication_statement_new(gboolean use_xsitype)
"use_xsitype", use_xsitype, "use_xsitype", use_xsitype,
NULL)); NULL));
return (node); return node;
} }

View File

@ -83,5 +83,5 @@ lasso_lib_idp_provided_name_identifier_new(const xmlChar *content)
NULL)); NULL));
xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node), xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node),
content); content);
return (node); return node;
} }

View File

@ -84,5 +84,5 @@ LassoNode* lasso_lib_old_provided_name_identifier_new(const xmlChar *content) {
xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node), xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node),
content); content);
return(node); return node;
} }

View File

@ -84,5 +84,5 @@ LassoNode* lasso_lib_sp_provided_name_identifier_new(const xmlChar *content) {
xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node), xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node),
content); content);
return(node); return node;
} }

View File

@ -154,5 +154,5 @@ lasso_lib_subject_new(gboolean use_xsitype)
"use_xsitype", use_xsitype, "use_xsitype", use_xsitype,
NULL)); NULL));
return (node); return node;
} }

View File

@ -273,7 +273,7 @@ lasso_saml_assertion_set_signature(LassoSamlAssertion *node,
ret = class->add_signature(LASSO_NODE (node), sign_method, ret = class->add_signature(LASSO_NODE (node), sign_method,
private_key_file, certificate_file); private_key_file, certificate_file);
return (ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -92,5 +92,5 @@ LassoNode* lasso_saml_condition_abstract_new(const xmlChar *name)
if (name && *name) if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name); LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node); return node;
} }

View File

@ -126,5 +126,5 @@ LassoNode* lasso_saml_name_identifier_new(const xmlChar *content)
node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_NAME_IDENTIFIER, NULL)); node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_NAME_IDENTIFIER, NULL));
xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node), xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node),
content); content);
return (node); return node;
} }

View File

@ -92,5 +92,5 @@ LassoNode* lasso_saml_statement_abstract_new(const xmlChar *name)
if (name && *name) if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name); LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node); return node;
} }

View File

@ -115,5 +115,5 @@ LassoNode* lasso_saml_subject_statement_abstract_new(const xmlChar *name)
if (name && *name) if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name); LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node); return node;
} }

View File

@ -139,7 +139,7 @@ lasso_samlp_request_abstract_set_signature(LassoSamlpRequestAbstract *node,
ret = class->add_signature(LASSO_NODE (node), sign_method, ret = class->add_signature(LASSO_NODE (node), sign_method,
private_key_file, certificate_file); private_key_file, certificate_file);
return (ret); return ret;
} }
gint gint
@ -155,7 +155,7 @@ lasso_samlp_request_abstract_set_signature_tmpl(LassoSamlpRequestAbstract *node,
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return(class->add_signature_tmpl(LASSO_NODE (node), sign_type, sign_method, reference_id)); return class->add_signature_tmpl(LASSO_NODE (node), sign_type, sign_method, reference_id);
} }
gint gint

View File

@ -152,7 +152,7 @@ lasso_samlp_response_abstract_set_signature(LassoSamlpResponseAbstract *node,
ret = class->add_signature(LASSO_NODE (node), sign_method, ret = class->add_signature(LASSO_NODE (node), sign_method,
private_key_file, certificate_file); private_key_file, certificate_file);
return (ret); return ret;
} }
gint gint
@ -167,7 +167,7 @@ lasso_samlp_response_abstract_set_signature_tmpl(LassoSamlpResponseAbstract *nod
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return(class->add_signature_tmpl(LASSO_NODE (node), sign_type, sign_method, NULL)); return class->add_signature_tmpl(LASSO_NODE (node), sign_type, sign_method, NULL);
} }
gint gint

View File

@ -56,7 +56,7 @@ lasso_build_random_sequence(guint8 size)
} }
seq[size] = '\0'; seq[size] = '\0';
return (seq); return seq;
} }
/** /**
@ -101,7 +101,7 @@ lasso_build_unique_id(guint8 size)
/* g_free(id); */ /* g_free(id); */
/* return (enc_id); */ /* return (enc_id); */
return (id); return id;
} }
/** /**
@ -123,9 +123,9 @@ lasso_doc_get_node_content(xmlDocPtr doc, const xmlChar *name)
node = xmlSecFindNode(xmlDocGetRootElement(doc), name, xmlSecDSigNs); node = xmlSecFindNode(xmlDocGetRootElement(doc), name, xmlSecDSigNs);
if (node != NULL) if (node != NULL)
/* val returned must be xmlFree() */ /* val returned must be xmlFree() */
return (xmlNodeGetContent(node)); return xmlNodeGetContent(node);
else else
return (NULL); return NULL;
} }
/** /**
@ -141,10 +141,10 @@ xmlChar*
lasso_g_ptr_array_index(GPtrArray *a, guint i) lasso_g_ptr_array_index(GPtrArray *a, guint i)
{ {
if (a != NULL) { if (a != NULL) {
return (g_ptr_array_index(a, i)); return g_ptr_array_index(a, i);
} }
else { else {
return (NULL); return NULL;
} }
} }
@ -166,7 +166,7 @@ lasso_get_current_time()
tm = localtime(&(time_val.tv_sec)); tm = localtime(&(time_val.tv_sec));
strftime((char *)ret, 21, "%Y-%m-%dT%H:%M:%SZ", tm); strftime((char *)ret, 21, "%Y-%m-%dT%H:%M:%SZ", tm);
return (ret); return ret;
} }
/** /**
@ -195,7 +195,7 @@ lasso_query_get_value(const gchar *query,
g_ptr_array_add(array, g_strdup(g_ptr_array_index(tmp_array, i))); g_ptr_array_add(array, g_strdup(g_ptr_array_index(tmp_array, i)));
} }
g_datalist_clear(&gd); g_datalist_clear(&gd);
return (array); return array;
} }
static void static void
@ -272,7 +272,7 @@ lasso_query_to_dict(const gchar *query)
} }
g_strfreev(sa1); g_strfreev(sa1);
return (gd); return gd;
} }
/** /**
@ -307,7 +307,7 @@ lasso_query_verify_signature(const gchar *query,
/* split query, signature (must be last param) */ /* split query, signature (must be last param) */
str_split = g_strsplit(query, "&Signature=", 0); str_split = g_strsplit(query, "&Signature=", 0);
if (str_split[1] == NULL) if (str_split[1] == NULL)
return (2); return 2;
/* re-create doc to verify (signed + enrypted) */ /* re-create doc to verify (signed + enrypted) */
doc = lasso_str_sign(str_split[0], doc = lasso_str_sign(str_split[0],
lassoSignatureMethodRsaSha1, lassoSignatureMethodRsaSha1,
@ -368,7 +368,7 @@ lasso_query_verify_signature(const gchar *query,
if(doc != NULL) { if(doc != NULL) {
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
return (ret); return ret;
} }
/** /**
@ -386,10 +386,10 @@ lasso_sha1(xmlChar *str)
if (str != NULL) { if (str != NULL) {
md = xmlMalloc(20); md = xmlMalloc(20);
return(SHA1(str, strlen(str), md)); return SHA1(str, strlen(str), md);
} }
return (NULL); return NULL;
} }
/** /**
@ -404,7 +404,7 @@ xmlChar *
lasso_str_escape(xmlChar *str) lasso_str_escape(xmlChar *str)
{ {
/* value returned must be xmlFree() */ /* value returned must be xmlFree() */
return (xmlURIEscapeStr((const xmlChar *)str, NULL)); return xmlURIEscapeStr((const xmlChar *)str, NULL);
} }
xmlChar * xmlChar *
@ -427,7 +427,7 @@ lasso_str_hash(xmlChar *str,
xmlFree(b64_digest); xmlFree(b64_digest);
xmlFreeDoc(doc); xmlFreeDoc(doc);
/* value returned must be xmlFree() */ /* value returned must be xmlFree() */
return (digest); return digest;
} }
/** /**
@ -536,7 +536,7 @@ lasso_str_sign(xmlChar *str,
/* xmlDocDump(stdout, doc); */ /* xmlDocDump(stdout, doc); */
xmlSecDSigCtxDestroy(dsigCtx); xmlSecDSigCtxDestroy(dsigCtx);
/* doc must be freed be caller */ /* doc must be freed be caller */
return (doc); return doc;
done: done:
/* cleanup */ /* cleanup */
@ -547,7 +547,7 @@ lasso_str_sign(xmlChar *str,
if (doc != NULL) { if (doc != NULL) {
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
return (NULL); return NULL;
} }
/** /**
@ -565,5 +565,5 @@ lasso_str_unescape(xmlChar *str)
ret = g_malloc(strlen(str) * 2); /* XXX why *2? strlen(str) should be enough */ ret = g_malloc(strlen(str) * 2); /* XXX why *2? strlen(str) should be enough */
xmlURIUnescapeString((const char *)str, 0, ret); xmlURIUnescapeString((const char *)str, 0, ret);
return (ret); return ret;
} }

View File

@ -67,7 +67,7 @@ lasso_node_copy(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->copy(node)); return class->copy(node);
} }
/** /**
@ -89,7 +89,7 @@ lasso_node_dump(LassoNode *node,
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->dump(node, encoding, format)); return class->dump(node, encoding, format);
} }
/** /**
@ -122,7 +122,7 @@ lasso_node_export(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->export(node)); return class->export(node);
} }
/** /**
@ -140,7 +140,7 @@ lasso_node_export_to_base64(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->export_to_base64(node)); return class->export_to_base64(node);
} }
/** /**
@ -163,7 +163,7 @@ lasso_node_export_to_query(LassoNode *node,
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->export_to_query(node, sign_method, private_key_file)); return class->export_to_query(node, sign_method, private_key_file);
} }
/** /**
@ -181,7 +181,7 @@ lasso_node_export_to_soap(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->export_to_soap(node)); return class->export_to_soap(node);
} }
/** /**
@ -215,7 +215,7 @@ lasso_node_get_attr(LassoNode *node,
/* don't check @name here, it's checked in impl method */ /* don't check @name here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_attr(node, name, err)); return class->get_attr(node, name, err);
} }
/** /**
@ -250,7 +250,7 @@ lasso_node_get_attr_value(LassoNode *node,
/* don't check @name here, it's checked in impl method */ /* don't check @name here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_attr_value(node, name, err)); return class->get_attr_value(node, name, err);
} }
/** /**
@ -268,7 +268,7 @@ lasso_node_get_attrs(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_attrs(node)); return class->get_attrs(node);
} }
/** /**
@ -304,7 +304,7 @@ lasso_node_get_child(LassoNode *node,
/* don't check @name here, it's checked in impl method */ /* don't check @name here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_child(node, name, href, err)); return class->get_child(node, name, href, err);
} }
/** /**
@ -341,7 +341,7 @@ lasso_node_get_child_content(LassoNode *node,
/* don't check @name here, it's checked in impl method */ /* don't check @name here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_child_content(node, name, href, err)); return class->get_child_content(node, name, href, err);
} }
/** /**
@ -359,7 +359,7 @@ lasso_node_get_children(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_children(node)); return class->get_children(node);
} }
/** /**
@ -394,7 +394,7 @@ lasso_node_get_content(LassoNode *node,
} }
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_content(node, err)); return class->get_content(node, err);
} }
/** /**
@ -412,7 +412,7 @@ lasso_node_get_name(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_name(node)); return class->get_name(node);
} }
/** /**
@ -492,7 +492,7 @@ lasso_node_verify_signature(LassoNode *node,
/* don't check @public_key_file here, it's checked in impl method */ /* don't check @public_key_file here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->verify_signature(node, public_key_file)); return class->verify_signature(node, public_key_file);
} }
/** /**
@ -516,7 +516,7 @@ lasso_node_verify_x509_signature(LassoNode *node,
/* don't check @certificate_file here, it's checked in impl method */ /* don't check @certificate_file here, it's checked in impl method */
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->verify_x509_signature(node, ca_certificate_file)); return class->verify_x509_signature(node, ca_certificate_file);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -565,7 +565,7 @@ lasso_node_add_signature_tmpl(LassoNode *node,
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->add_signature_tmpl(node, sign_type, sign_method, reference_id)); return class->add_signature_tmpl(node, sign_type, sign_method, reference_id);
} }
static gchar * static gchar *
@ -575,7 +575,7 @@ lasso_node_build_query(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->build_query(node)); return class->build_query(node);
} }
static xmlNodePtr static xmlNodePtr
@ -585,7 +585,7 @@ lasso_node_get_xmlNode(LassoNode *node)
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->get_xmlNode(node)); return class->get_xmlNode(node);
} }
/** /**
@ -635,7 +635,7 @@ lasso_node_serialize(LassoNode *node,
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
class = LASSO_NODE_GET_CLASS(node); class = LASSO_NODE_GET_CLASS(node);
return (class->serialize(node, gd)); return class->serialize(node, gd);
} }
static void static void
@ -714,7 +714,7 @@ lasso_node_impl_copy(LassoNode *node)
copy = LASSO_NODE(g_object_new(G_OBJECT_TYPE(node), NULL)); copy = LASSO_NODE(g_object_new(G_OBJECT_TYPE(node), NULL));
lasso_node_set_xmlNode(copy, xmlCopyNode(node->private->node, 1)); lasso_node_set_xmlNode(copy, xmlCopyNode(node->private->node, 1));
return (copy); return copy;
} }
static void static void
@ -739,12 +739,12 @@ lasso_node_impl_dump(LassoNode *node,
if (encoding != NULL) { if (encoding != NULL) {
handler = xmlFindCharEncodingHandler(encoding); handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) { if (handler == NULL) {
return (NULL); return NULL;
} }
} }
buf = xmlAllocOutputBuffer(handler); buf = xmlAllocOutputBuffer(handler);
if (buf == NULL) { if (buf == NULL) {
return (NULL); return NULL;
} }
xmlNodeDumpOutput(buf, NULL, node->private->node, xmlNodeDumpOutput(buf, NULL, node->private->node,
0, format, encoding); 0, format, encoding);
@ -757,14 +757,14 @@ lasso_node_impl_dump(LassoNode *node,
} }
xmlOutputBufferClose(buf); xmlOutputBufferClose(buf);
return (ret); return ret;
} }
static gchar * static gchar *
lasso_node_impl_export(LassoNode *node) lasso_node_impl_export(LassoNode *node)
{ {
/* using lasso_node_impl_dump because dump method can be overrided */ /* using lasso_node_impl_dump because dump method can be overrided */
return (lasso_node_impl_dump(node, "utf-8", 0)); return lasso_node_impl_dump(node, "utf-8", 0);
} }
static gchar * static gchar *
@ -778,7 +778,7 @@ lasso_node_impl_export_to_base64(LassoNode *node)
g_free(buffer); g_free(buffer);
buffer = NULL; buffer = NULL;
return (ret); return ret;
} }
static gchar * static gchar *
@ -826,7 +826,7 @@ lasso_node_impl_export_to_query(LassoNode *node,
} }
else { else {
g_string_free(query, TRUE); g_string_free(query, TRUE);
return (NULL); return NULL;
} }
/* add signature in query */ /* add signature in query */
@ -838,7 +838,7 @@ lasso_node_impl_export_to_query(LassoNode *node,
ret = g_strdup(query->str); ret = g_strdup(query->str);
g_string_free(query, TRUE); g_string_free(query, TRUE);
return (ret); return ret;
} }
static gchar * static gchar *
@ -868,7 +868,7 @@ lasso_node_impl_export_to_soap(LassoNode *node)
lasso_node_destroy(body); lasso_node_destroy(body);
lasso_node_destroy(envelope); lasso_node_destroy(envelope);
return(buffer); return buffer;
} }
static LassoAttr* static LassoAttr*
@ -888,7 +888,7 @@ lasso_node_impl_get_attr(LassoNode *node,
prop = node->private->node->properties; prop = node->private->node->properties;
while (prop != NULL) { while (prop != NULL) {
if (xmlStrEqual(prop->name, name)) { if (xmlStrEqual(prop->name, name)) {
return (prop); return prop;
} }
prop = prop->next; prop = prop->next;
} }
@ -898,7 +898,7 @@ lasso_node_impl_get_attr(LassoNode *node,
LASSO_XML_ERROR_ATTR_NOT_FOUND, LASSO_XML_ERROR_ATTR_NOT_FOUND,
lasso_strerror(LASSO_XML_ERROR_ATTR_NOT_FOUND), lasso_strerror(LASSO_XML_ERROR_ATTR_NOT_FOUND),
name, node->private->node->name); name, node->private->node->name);
return (NULL); return NULL;
} }
static xmlChar * static xmlChar *
@ -923,7 +923,7 @@ lasso_node_impl_get_attr_value(LassoNode *node,
name, node->private->node->name); name, node->private->node->name);
} }
return (value); return value;
} }
static GPtrArray * static GPtrArray *
@ -943,7 +943,7 @@ lasso_node_impl_get_attrs(LassoNode *node)
prop = prop->next; prop = prop->next;
} }
return (attributes); return attributes;
} }
static LassoNode * static LassoNode *
@ -1014,14 +1014,14 @@ lasso_node_impl_get_child(LassoNode *node,
child = xmlSecFindNode(node->private->node, name, lassoLassoHRef); child = xmlSecFindNode(node->private->node, name, lassoLassoHRef);
} }
if (child != NULL) { if (child != NULL) {
return (lasso_node_new_from_xmlNode(child)); return lasso_node_new_from_xmlNode(child);
} }
else { else {
g_set_error(err, g_quark_from_string("Lasso"), g_set_error(err, g_quark_from_string("Lasso"),
LASSO_XML_ERROR_NODE_NOT_FOUND, LASSO_XML_ERROR_NODE_NOT_FOUND,
lasso_strerror(LASSO_XML_ERROR_NODE_NOT_FOUND), lasso_strerror(LASSO_XML_ERROR_NODE_NOT_FOUND),
name, node->private->node->name); name, node->private->node->name);
return (NULL); return NULL;
} }
} }
@ -1055,7 +1055,7 @@ lasso_node_impl_get_child_content(LassoNode *node,
g_propagate_error (err, tmp_err); g_propagate_error (err, tmp_err);
} }
return (content); return content;
} }
static GPtrArray * static GPtrArray *
@ -1075,7 +1075,7 @@ lasso_node_impl_get_children(LassoNode *node)
cur = cur->next; cur = cur->next;
} }
return (children); return children;
} }
static xmlChar * static xmlChar *
@ -1092,7 +1092,7 @@ lasso_node_impl_get_content(LassoNode *node,
node->private->node->name); node->private->node->name);
} }
return (content); return content;
} }
static xmlChar * static xmlChar *
@ -1100,7 +1100,7 @@ lasso_node_impl_get_name(LassoNode *node)
{ {
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
return (xmlStrdup(node->private->node->name)); return xmlStrdup(node->private->node->name);
} }
static void static void
@ -1234,7 +1234,7 @@ lasso_node_impl_verify_signature(LassoNode *node,
xmlSecDSigCtxDestroy(dsigCtx); xmlSecDSigCtxDestroy(dsigCtx);
} }
/* FIXME xmlFreeDoc(doc); */ /* FIXME xmlFreeDoc(doc); */
return (ret); return ret;
} }
static gint static gint
@ -1342,7 +1342,7 @@ lasso_node_impl_verify_x509_signature(LassoNode *node,
xmlSecKeysMngrDestroy(mngr); xmlSecKeysMngrDestroy(mngr);
} }
/* FIXME xmlFreeDoc(doc); */ /* FIXME xmlFreeDoc(doc); */
return (ret); return ret;
} }
/*** private methods **********************************************************/ /*** private methods **********************************************************/
@ -1400,7 +1400,7 @@ lasso_node_impl_add_signature(LassoNode *node,
ret = lasso_node_sign_signature_tmpl(node, private_key_file, certificate_file); ret = lasso_node_sign_signature_tmpl(node, private_key_file, certificate_file);
} }
return (ret); return ret;
} }
static gint static gint
@ -1434,7 +1434,7 @@ lasso_node_impl_add_signature_tmpl(LassoNode *node,
if (signature == NULL) { if (signature == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to create signature template\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to create signature template\n");
return (LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED); return LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED;
} }
/* uri = xmlMalloc(strlen(reference_uri)+1+1); */ /* uri = xmlMalloc(strlen(reference_uri)+1+1); */
@ -1454,14 +1454,14 @@ lasso_node_impl_add_signature_tmpl(LassoNode *node,
if (reference == NULL) { if (reference == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to add reference to signature template\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to add reference to signature template\n");
xmlFreeNode(signature); xmlFreeNode(signature);
return (LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED); return LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED;
} }
/* add enveloped transform */ /* add enveloped transform */
if (xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId) == NULL) { if (xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId) == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to add enveloped transform to reference\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to add enveloped transform to reference\n");
xmlFreeNode(signature); xmlFreeNode(signature);
return (LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED); return LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED;
} }
/* add <dsig:KeyInfo/> */ /* add <dsig:KeyInfo/> */
@ -1469,7 +1469,7 @@ lasso_node_impl_add_signature_tmpl(LassoNode *node,
if (key_info == NULL) { if (key_info == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to add key info\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to add key info\n");
xmlFreeNode(signature); xmlFreeNode(signature);
return (LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED); return LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED;
} }
/* add <dsig:X509Data/> */ /* add <dsig:X509Data/> */
@ -1477,7 +1477,7 @@ lasso_node_impl_add_signature_tmpl(LassoNode *node,
if (xmlSecTmplKeyInfoAddX509Data(key_info) == NULL) { if (xmlSecTmplKeyInfoAddX509Data(key_info) == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to add X509Data node\n"); message(G_LOG_LEVEL_CRITICAL, "Failed to add X509Data node\n");
xmlFreeNode(signature); xmlFreeNode(signature);
return (LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED); return LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED;
} }
} }
@ -1489,7 +1489,7 @@ lasso_node_impl_add_signature_tmpl(LassoNode *node,
/* xmlUnlinkNode(lasso_node_get_xmlNode(node)); */ /* xmlUnlinkNode(lasso_node_get_xmlNode(node)); */
/* xmlFreeDoc(doc); */ /* xmlFreeDoc(doc); */
return (0); return 0;
} }
static void static void
@ -1558,7 +1558,7 @@ lasso_node_impl_build_query(LassoNode *node)
ret = g_strdup(query->str); ret = g_strdup(query->str);
g_string_free(query, TRUE); g_string_free(query, TRUE);
return (ret); return ret;
} }
static xmlNodePtr static xmlNodePtr
@ -1566,7 +1566,7 @@ lasso_node_impl_get_xmlNode(LassoNode *node)
{ {
g_return_val_if_fail (LASSO_IS_NODE(node), NULL); g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
return (node->private->node); return node->private->node;
} }
static void static void
@ -1699,7 +1699,7 @@ lasso_node_impl_serialize(LassoNode *node,
g_ptr_array_free(children, TRUE); g_ptr_array_free(children, TRUE);
} }
return (gd); return gd;
} }
static void static void
@ -1786,7 +1786,7 @@ lasso_node_impl_sign_signature_tmpl(LassoNode *node,
if (dsig_ctx == NULL) { if (dsig_ctx == NULL) {
message(G_LOG_LEVEL_CRITICAL, message(G_LOG_LEVEL_CRITICAL,
lasso_strerror(LASSO_DS_ERROR_CONTEXT_CREATION_FAILED)); lasso_strerror(LASSO_DS_ERROR_CONTEXT_CREATION_FAILED));
return(LASSO_DS_ERROR_CONTEXT_CREATION_FAILED); return LASSO_DS_ERROR_CONTEXT_CREATION_FAILED;
} }
/* load private key, assuming that there is not password */ /* load private key, assuming that there is not password */
@ -1827,7 +1827,7 @@ lasso_node_impl_sign_signature_tmpl(LassoNode *node,
/* xmlUnlinkNode(lasso_node_get_xmlNode(node)); */ /* xmlUnlinkNode(lasso_node_get_xmlNode(node)); */
/* xmlFreeDoc(doc); */ /* xmlFreeDoc(doc); */
return (ret); return ret;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1963,7 +1963,7 @@ GType lasso_node_get_type() {
LassoNode* LassoNode*
lasso_node_new() lasso_node_new()
{ {
return (LASSO_NODE(g_object_new(LASSO_TYPE_NODE, NULL))); return LASSO_NODE(g_object_new(LASSO_TYPE_NODE, NULL));
} }
/** /**
@ -1992,7 +1992,7 @@ lasso_node_new_from_dump(const gchar *buffer)
/* free doc */ /* free doc */
xmlFreeDoc(doc); xmlFreeDoc(doc);
return (node); return node;
} }
/** /**
@ -2014,5 +2014,5 @@ lasso_node_new_from_xmlNode(xmlNodePtr node)
lasso_node_set_xmlNode(lasso_node, node); lasso_node_set_xmlNode(lasso_node, node);
lasso_node->private->node_is_weak_ref = TRUE; lasso_node->private->node_is_weak_ref = TRUE;
return (lasso_node); return lasso_node;
} }