From 520345214fc6b8536c93e41039f63c52c96c6dec Mon Sep 17 00:00:00 2001 From: Valery Febvre Date: Sat, 24 Jul 2004 00:17:57 +0000 Subject: [PATCH] Replaced old debug() calls by the 2 new functions debug() and message() --- lasso/Attic/protocols/authn_response.c | 5 +- lasso/Attic/protocols/logout_response.c | 12 ++-- lasso/id-ff/federation_termination.c | 59 +++++++++--------- lasso/id-ff/lecp.c | 34 +++++------ lasso/id-ff/login.c | 80 +++++++++++++------------ lasso/id-ff/logout.c | 74 +++++++++++------------ lasso/id-ff/name_identifier_mapping.c | 38 ++++++------ lasso/id-ff/profile_context.c | 12 ++-- lasso/id-ff/register_name_identifier.c | 68 ++++++++++----------- lasso/id-ff/server.c | 4 +- lasso/id-ff/user.c | 14 ++--- lasso/xml/debug.c | 10 ++-- lasso/xml/debug.h | 2 +- lasso/xml/errors.c | 2 +- lasso/xml/errors.h | 2 +- lasso/xml/xml.c | 24 ++++---- 16 files changed, 223 insertions(+), 217 deletions(-) diff --git a/lasso/Attic/protocols/authn_response.c b/lasso/Attic/protocols/authn_response.c index e9f1deb8..c56091c8 100644 --- a/lasso/Attic/protocols/authn_response.c +++ b/lasso/Attic/protocols/authn_response.c @@ -25,6 +25,7 @@ #include #include +#include #include static void @@ -62,7 +63,7 @@ lasso_authn_response_get_status(LassoAuthnResponse *response) { value = lasso_node_get_attr_value(status_code, "Value", &err); lasso_node_destroy(status_code); if (err != NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); g_error_free(err); return (NULL); } @@ -71,7 +72,7 @@ lasso_authn_response_get_status(LassoAuthnResponse *response) { } } else { - debug(ERROR, "No StatusCode element found in AuthnResponse.\n"); + message(G_LOG_LEVEL_ERROR, "No StatusCode element found in AuthnResponse.\n"); return (NULL); } } diff --git a/lasso/Attic/protocols/logout_response.c b/lasso/Attic/protocols/logout_response.c index 6f2a2fc2..ddcfbd6c 100644 --- a/lasso/Attic/protocols/logout_response.c +++ b/lasso/Attic/protocols/logout_response.c @@ -41,7 +41,7 @@ lasso_logout_response_get_status_code_value(LassoLogoutResponse *response) value = lasso_node_get_attr_value(status_code, "Value", &err); lasso_node_destroy(status_code); if (err != NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); g_error_free(err); return (NULL); } @@ -50,7 +50,7 @@ lasso_logout_response_get_status_code_value(LassoLogoutResponse *response) } } else { - debug(ERROR, "No StatusCode element found in Response.\n"); + message(G_LOG_LEVEL_ERROR, "No StatusCode element found in Response.\n"); return (NULL); } } @@ -234,7 +234,7 @@ lasso_logout_response_new_from_request_export(gchar *buffer, request = lasso_logout_request_new_from_export(buffer, export_type); break; default: - debug(ERROR, "Unkown export type\n"); + message(G_LOG_LEVEL_ERROR, "Unkown export type\n"); return(NULL); } @@ -257,13 +257,13 @@ lasso_logout_response_new_from_soap(gchar *buffer) envelope = lasso_node_new_from_dump(buffer); if(envelope==NULL){ - debug(ERROR, "Error while parsing the soap msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while parsing the soap msg\n"); return(NULL); } lassoNode_response = lasso_node_get_child(envelope, "LogoutResponse", NULL); if(lassoNode_response==NULL){ - debug(ERROR, "LogoutResponse node not found\n"); + message(G_LOG_LEVEL_ERROR, "LogoutResponse node not found\n"); return(NULL); } class = LASSO_NODE_GET_CLASS(lassoNode_response); @@ -293,7 +293,7 @@ lasso_logout_response_new_from_export(gchar *buffer, response = lasso_logout_response_new_from_soap(buffer); break; default: - debug(ERROR, "Unknown export type\n"); + message(G_LOG_LEVEL_ERROR, "Unknown export type\n"); return(NULL); } diff --git a/lasso/id-ff/federation_termination.c b/lasso/id-ff/federation_termination.c index 24acb1ef..6984a013 100644 --- a/lasso/id-ff/federation_termination.c +++ b/lasso/id-ff/federation_termination.c @@ -42,14 +42,14 @@ lasso_federation_termination_build_notification_msg(LassoFederationTermination * provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider %s not found\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID); return(-2); } /* get the prototocol profile of the federation termination notification */ protocolProfile = lasso_provider_get_federationTerminationNotificationProtocolProfile(provider); if(protocolProfile==NULL){ - debug(ERROR, "Federation termination notification protocol profile not found\n"); + message(G_LOG_LEVEL_ERROR, "Federation termination notification protocol profile not found\n"); return(-3); } @@ -57,7 +57,7 @@ lasso_federation_termination_build_notification_msg(LassoFederationTermination * profileContext->request_type = lassoHttpMethodSoap; profileContext->msg_url = lasso_provider_get_federationTerminationServiceURL(provider); if(profileContext->msg_url==NULL){ - debug(ERROR, "Federation Termination Notification url not found\n"); + message(G_LOG_LEVEL_ERROR, "Federation Termination Notification url not found\n"); return(-4); } profileContext->msg_body = lasso_node_export_to_soap(profileContext->request); @@ -70,7 +70,7 @@ lasso_federation_termination_build_notification_msg(LassoFederationTermination * profileContext->msg_body = NULL; } else{ - debug(ERROR, "Unknown protocol profile\n"); + message(G_LOG_LEVEL_ERROR, "Unknown protocol profile\n"); return(-5); } @@ -107,24 +107,24 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed profileContext = LASSO_PROFILE_CONTEXT(defederation); - if(remote_providerID==NULL){ - debug(INFO, "No remote provider id, get the remote provider id of the first identity\n"); + if (remote_providerID == NULL) { + message(G_LOG_LEVEL_INFO, "No remote provider id, get the remote provider id of the first identity\n"); profileContext->remote_providerID = lasso_user_get_next_identity_remote_providerID(profileContext->user); } - else{ - debug(INFO, "A remote provider id for defederation notification : %s\n", remote_providerID); + else { + message(G_LOG_LEVEL_INFO, "A remote provider id for defederation notification : %s\n", remote_providerID); profileContext->remote_providerID = g_strdup(remote_providerID); } - if(profileContext->remote_providerID==NULL){ - debug(ERROR, "No provider id for init notification\n"); + if (profileContext->remote_providerID == NULL) { + message(G_LOG_LEVEL_ERROR, "No provider Id for init notification\n"); return(-2); } /* get identity */ identity = lasso_user_get_identity(profileContext->user, profileContext->remote_providerID); - if(identity==NULL){ - debug(ERROR, "Identity not found for %s\n", profileContext->remote_providerID); + if (identity == NULL) { + message(G_LOG_LEVEL_ERROR, "Identity not found for %s\n", profileContext->remote_providerID); return(-2); } @@ -142,11 +142,11 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed nameIdentifier = LASSO_NODE(lasso_identity_get_local_nameIdentifier(identity)); break; default: - debug(ERROR, "Unknown provider type\n"); + message(G_LOG_LEVEL_ERROR, "Unknown provider type\n"); } if(!nameIdentifier){ - debug(ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID); return(-3); } @@ -159,7 +159,7 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed nameQualifier, format); if(profileContext->request==NULL){ - debug(ERROR, "Error while creating the notification\n"); + message(G_LOG_LEVEL_ERROR, "Error while creating the notification\n"); return(-6); } @@ -181,22 +181,22 @@ lasso_federation_termination_process_notification_msg(LassoFederationTermination switch(request_method){ case lassoHttpMethodSoap: - debug(DEBUG, "Process a federation termination notification soap msg\n"); + message(G_LOG_LEVEL_DEBUG, "Process a federation termination notification soap msg\n"); profileContext->request = lasso_federation_termination_notification_new_from_export(request_msg, lassoNodeExportTypeSoap); break; case lassoHttpMethodRedirect: - debug(DEBUG, "Process a federation termination notification query msg\n"); + message(G_LOG_LEVEL_DEBUG, "Process a federation termination notification query msg\n"); profileContext->request = lasso_federation_termination_notification_new_from_export(request_msg, lassoNodeExportTypeQuery); break; case lassoHttpMethodGet: - debug(WARNING, "Implement the get federation termination notification method\n"); + message(G_LOG_LEVEL_WARNING, "Implement the get federation termination notification method\n"); break; default: - debug(ERROR, "Unknown request method (%d)\n", request_method); + message(G_LOG_LEVEL_ERROR, "Unknown request method (%d)\n", request_method); return(-1); } if(profileContext->request==NULL){ - debug(ERROR, "Error While building the request from msg\n"); + message(G_LOG_LEVEL_ERROR, "Error While building the request from msg\n"); return(-1); } @@ -205,31 +205,32 @@ lasso_federation_termination_process_notification_msg(LassoFederationTermination profileContext->remote_providerID = remote_providerID; nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL); - if(nameIdentifier==NULL){ - debug(ERROR, "Name identifier not found\n"); + if (nameIdentifier == NULL) { + message(G_LOG_LEVEL_ERROR, "Name identifier not found\n"); return(-2); } /* Verify federation */ - if(profileContext->user==NULL){ - debug(ERROR, "User environ not found\n"); + if (profileContext->user == NULL){ + message(G_LOG_LEVEL_ERROR, "User environ not found\n"); return(-3); } identity = lasso_user_get_identity(profileContext->user, remote_providerID); - if(identity==NULL){ - debug(WARNING, "No identity for %s\n", remote_providerID); + if (identity == NULL) { + message(G_LOG_LEVEL_WARNING, "No identity for %s\n", remote_providerID); return(-4); } - if(lasso_identity_verify_nameIdentifier(identity, nameIdentifier)==FALSE){ - debug(WARNING, "No name identifier for %s\n", remote_providerID); + if (lasso_identity_verify_nameIdentifier(identity, nameIdentifier) == FALSE) { + message(G_LOG_LEVEL_WARNING, "No name identifier for %s\n", remote_providerID); return(-5); } /* remove federation of the remote provider */ lasso_identity_remove_remote_nameIdentifier(identity); - debug(INFO, "Remote name identifier removed from federation with %s\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_INFO, "Remote name identifier removed from federation with %s\n", + profileContext->remote_providerID); return(0); } diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c index 24a309e3..90649e07 100644 --- a/lasso/id-ff/lecp.c +++ b/lasso/id-ff/lecp.c @@ -38,7 +38,7 @@ lasso_lecp_build_authn_request_msg(LassoLecp *lecp) lecp->msg_body = lasso_node_export_to_soap(lecp->authnRequest); if(lecp->msg_body==NULL){ - debug(ERROR, "Error while exporting the AuthnRequest to soap msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while exporting the AuthnRequest to soap msg\n"); return(-2); } @@ -53,7 +53,7 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp) /* FIXME : export to base 64 or simple xml dump */ lecp->msg_body = lasso_node_export_to_base64(lecp->request); if(lecp->msg_body==NULL){ - debug(ERROR, "Error while exporting the AuthnRequestEnvelope to msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while exporting the AuthnRequestEnvelope to msg\n"); return(-2); } @@ -67,7 +67,7 @@ lasso_lecp_build_authn_response_msg(LassoLecp *lecp) lecp->msg_body = lasso_node_export_to_soap(lecp->authnResponse); if(lecp->msg_body==NULL){ - debug(ERROR, "Error while exporting the AuthnResponse to soap msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while exporting the AuthnResponse to soap msg\n"); return(-2); } @@ -80,8 +80,8 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp) g_return_val_if_fail(LASSO_IS_LECP(lecp), -1); lecp->msg_body = lasso_node_export_to_soap(lecp->response); - if(lecp->msg_body==NULL){ - debug(ERROR, "Error while exporting the AuthnResponseEnvelope to msg\n"); + if (lecp->msg_body == NULL) { + message(G_LOG_LEVEL_ERROR, "Error while exporting the AuthnResponseEnvelope to msg\n"); return(-2); } @@ -114,7 +114,7 @@ lasso_lecp_init_authn_request_envelope(LassoLecp *lecp) g_return_val_if_fail(LASSO_IS_LECP(lecp), -1); if(lecp->authnRequest==NULL){ - debug(ERROR, "AuthnRequest not found\n"); + message(G_LOG_LEVEL_ERROR, "AuthnRequest not found\n"); return(-4); } @@ -135,14 +135,14 @@ lasso_lecp_process_authn_request_envelope_msg(LassoLecp *lecp, g_return_val_if_fail(request_msg!=NULL, -2); lecp->request = lasso_authn_request_envelope_new_from_export(request_msg, lassoNodeExportTypeBase64); - if(lecp->request==NULL){ - debug(ERROR, "Error while building the authentication request envelope\n"); + if (lecp->request == NULL) { + message(G_LOG_LEVEL_ERROR, "Error while building the authentication request envelope\n"); return(-3); } lecp->authnRequest = lasso_authn_request_envelope_get_authnRequest(LASSO_AUTHN_REQUEST_ENVELOPE(lecp->request)); - if(lecp->authnRequest==NULL){ - debug(ERROR, "AuthnRequest not found\n"); + if (lecp->authnRequest == NULL) { + message(G_LOG_LEVEL_ERROR, "AuthnRequest not found\n"); return(-4); } @@ -157,21 +157,21 @@ lasso_lecp_process_authn_response_envelope_msg(LassoLecp *lecp, g_return_val_if_fail(response_msg!=NULL, -2); lecp->response = lasso_authn_response_envelope_new_from_export(response_msg, lassoNodeExportTypeBase64); - if(lecp->response==NULL){ - debug(ERROR, "Error while building the authentication response envelope\n"); + if (lecp->response == NULL) { + message(G_LOG_LEVEL_ERROR, "Error while building the authentication response envelope\n"); return(-3); } lecp->authnResponse = lasso_authn_response_envelope_get_authnResponse(LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->response)); - if(lecp->authnResponse==NULL){ - debug(ERROR, "AuthnResponse not found\n"); + if (lecp->authnResponse == NULL) { + message(G_LOG_LEVEL_ERROR, "AuthnResponse not found\n"); return(-4); } lecp->assertionConsumerServiceURL = lasso_authn_response_envelope_get_assertionConsumerServiceURL( LASSO_AUTHN_RESPONSE_ENVELOPE(lecp->response)); - if(lecp->assertionConsumerServiceURL){ - debug(ERROR, "Assertion consumer service url not found\n"); + if (lecp->assertionConsumerServiceURL == NULL){ + message(G_LOG_LEVEL_ERROR, "Assertion consumer service URL not found\n"); return(-5); } @@ -185,7 +185,7 @@ lasso_lecp_process_authn_response_envelope_msg(LassoLecp *lecp, static void lasso_lecp_finalize(LassoLecp *lecp) { - debug(INFO, "Lecp object 0x%x finalized ...\n", lecp); + debug("Lecp object 0x%x finalized ...\n", lecp); parent_class->finalize(G_OBJECT(lecp)); } diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c index e9aeb275..8e4dff5c 100644 --- a/lasso/id-ff/login.c +++ b/lasso/id-ff/login.c @@ -59,7 +59,7 @@ lasso_login_get_assertion_nameIdentifier(LassoNode *assertion) return (ni); } else { - debug(ERROR, "NameIdentifier value not found in AuthenticationStatement element.\n"); + message(G_LOG_LEVEL_ERROR, "NameIdentifier value not found in AuthenticationStatement element.\n"); return (NULL); } } @@ -80,7 +80,7 @@ lasso_login_add_response_assertion(LassoLogin *login, "RequestID", &err); if (requestID == NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); return(ret); @@ -98,7 +98,7 @@ lasso_login_add_response_assertion(LassoLogin *login, LASSO_SAML_AUTHENTICATION_STATEMENT(authentication_statement)); } else { - debug(ERROR, "Failed to build the AuthenticationStatement element of the Assertion.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to build the AuthenticationStatement element of the Assertion.\n"); lasso_node_destroy(assertion); return(-3); } @@ -147,7 +147,7 @@ lasso_login_process_federation(LassoLogin *login) } } else if (xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeFederated)) { - debug(DEBUG, "NameIDPolicy is federated\n"); + debug("NameIDPolicy is federated\n"); if (identity == NULL) { identity = lasso_identity_new(LASSO_PROFILE_CONTEXT(login)->remote_providerID); @@ -165,7 +165,7 @@ lasso_login_process_federation(LassoLogin *login) identity); } else { - debug(DEBUG, "An identity was found.\n"); + debug("An identity was found.\n"); } } else if (xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeOneTime)) { @@ -205,7 +205,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) { /* store NameIdentifier */ login->nameIdentifier = lasso_login_get_assertion_nameIdentifier(assertion); if (login->nameIdentifier == NULL) { - debug(ERROR, "NameIdentifier element not found in Assertion.\n"); + message(G_LOG_LEVEL_ERROR, "NameIdentifier element not found in Assertion.\n"); ret = -4; goto done; } @@ -215,14 +215,14 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) { status = lasso_node_get_child(LASSO_PROFILE_CONTEXT(login)->response, "Status", lassoSamlProtocolHRef); if (status == NULL) { - debug(ERROR, "Status element not found in response.\n"); + message(G_LOG_LEVEL_ERROR, "Status element not found in response.\n"); ret = -9; goto done; } statusCode = lasso_node_get_child(status, "StatusCode", lassoSamlProtocolHRef); if (statusCode == NULL) { - debug(ERROR, "StatusCode element not found in Status.\n"); + message(G_LOG_LEVEL_ERROR, "StatusCode element not found in Status.\n"); ret = -8; goto done; } @@ -233,7 +233,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) { } } else { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); } @@ -265,15 +265,17 @@ lasso_login_build_artifact_msg(LassoLogin *login, xmlChar *relayState; xmlChar *assertionHandle, *identityProviderSuccinctID; + g_return_val_if_fail(authenticationMethod != NULL && reauthenticateOnOrAfter != NULL, -1); + if (method != lassoHttpMethodRedirect && method != lassoHttpMethodPost) { - debug(ERROR, "Invalid HTTP method, it could be REDIRECT or POST\n."); - return (-1); + message(G_LOG_LEVEL_ERROR, "Invalid HTTP method, it could be REDIRECT or POST\n."); + return (-2); } /* ProtocolProfile must be BrwsArt */ if (login->protocolProfile != lassoLoginProtocolProfileBrwsArt) { - debug(WARNING, "Failed to build artifact message, an AuthnResponse is required by ProtocolProfile.\n"); - return (-2); + message(WARNING, "Failed to build artifact message, an AuthnResponse is required by ProtocolProfile.\n"); + return (-3); } /* federation */ @@ -283,14 +285,14 @@ lasso_login_build_artifact_msg(LassoLogin *login, /* fill the response with the assertion */ if (identity != NULL && authentication_result == 1) { - debug(DEBUG, "An identity found, so build an assertion.\n"); + debug("An identity found, so build an assertion.\n"); lasso_login_add_response_assertion(login, identity, authenticationMethod, reauthenticateOnOrAfter); } else { - debug(DEBUG, "No identity or login failed !!!\n"); + debug("No identity or login failed !!!\n"); if (authentication_result == 0) { lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login), lassoSamlStatusCodeRequestDenied); @@ -298,7 +300,7 @@ lasso_login_build_artifact_msg(LassoLogin *login, } /* save response dump */ login->response_dump = lasso_node_export_to_soap(LASSO_PROFILE_CONTEXT(login)->response); - debug(DEBUG, "SOAP enveloped Samlp:response = %s\n", LASSO_LOGIN(login)->response_dump); + debug("SOAP enveloped Samlp:response = %s\n", LASSO_LOGIN(login)->response_dump); remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server, LASSO_PROFILE_CONTEXT(login)->remote_providerID); @@ -309,7 +311,7 @@ lasso_login_build_artifact_msg(LassoLogin *login, identityProviderSuccinctID = lasso_str_hash(LASSO_PROFILE_CONTEXT(login)->server->providerID, LASSO_PROFILE_CONTEXT(login)->server->private_key); assertionHandle = lasso_build_random_sequence(20); - sprintf(samlArt, "%c%c%s%s", 0, 3, identityProviderSuccinctID, assertionHandle); + g_sprintf(samlArt, "%c%c%s%s", 0, 3, identityProviderSuccinctID, assertionHandle); g_free(assertionHandle); xmlFree(identityProviderSuccinctID); b64_samlArt = (gchar *)xmlSecBase64Encode(samlArt, 42, 0); @@ -320,9 +322,9 @@ lasso_login_build_artifact_msg(LassoLogin *login, switch (method) { case lassoHttpMethodRedirect: LASSO_PROFILE_CONTEXT(login)->msg_url = g_new(gchar, 1024+1); - sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s?SAMLArt=%s", url, b64_samlArt); + g_sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s?SAMLArt=%s", url, b64_samlArt); if (relayState != NULL) { - sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s&RelayState=%s", + g_sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s&RelayState=%s", LASSO_PROFILE_CONTEXT(login)->msg_url, relayState); } break; @@ -367,14 +369,14 @@ lasso_login_build_authn_request_msg(LassoLogin *login) else { /* FIXME : is there a default value for AuthnRequestsSigned */ must_sign = 0; - debug(WARNING, "The element 'AuthnRequestsSigned' is missing in metadata of server.\n"); + message(WARNING, "The element 'AuthnRequestsSigned' is missing in metadata of server.\n"); } /* export request depending on the request ProtocolProfile */ request_protocolProfile = lasso_provider_get_singleSignOnProtocolProfile(remote_provider); if (request_protocolProfile == NULL) { /* FIXME : is there a default value for SingleSignOnProtocolProfile */ - debug(WARNING, "The element 'SingleSignOnProtocolProfile' is missing in metadata of remote provider.\n"); + message(WARNING, "The element 'SingleSignOnProtocolProfile' is missing in metadata of remote provider.\n"); ret = -1; } @@ -382,7 +384,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login) if (ret == 0) { url = lasso_provider_get_singleSignOnServiceURL(remote_provider); if (url == NULL) { - debug(ERROR, "The element 'SingleSignOnServiceURL' is missing in metadata of remote provider.\n"); + message(G_LOG_LEVEL_ERROR, "The element 'SingleSignOnServiceURL' is missing in metadata of remote provider.\n"); ret = -2; } } @@ -395,14 +397,14 @@ lasso_login_build_authn_request_msg(LassoLogin *login) LASSO_PROFILE_CONTEXT(login)->server->signature_method, LASSO_PROFILE_CONTEXT(login)->server->private_key); if (query == NULL) { - debug(ERROR, "Failed to create AuthnRequest query (signed).\n"); + message(G_LOG_LEVEL_ERROR, "Failed to create AuthnRequest query (signed).\n"); ret = -3; } } else { query = lasso_node_export_to_query(LASSO_PROFILE_CONTEXT(login)->request, 0, NULL); if (query == NULL) { - debug(ERROR, "Failed to create AuthnRequest query.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to create AuthnRequest query.\n"); ret = -3; } } @@ -422,7 +424,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login) LASSO_PROFILE_CONTEXT(login)->msg_body = lareq; } else { - debug(ERROR, "Failed to export AuthnRequest (Base64 encoded).\n"); + message(G_LOG_LEVEL_ERROR, "Failed to export AuthnRequest (Base64 encoded).\n"); ret = -3; } } @@ -457,14 +459,14 @@ lasso_login_build_authn_response_msg(LassoLogin *login, /* fill the response with the assertion */ if (identity != NULL && authentication_result == 1) { - printf("DEBUG - an identity found, so build an assertion\n"); + debug("An identity found, so build an assertion\n"); lasso_login_add_response_assertion(login, identity, authenticationMethod, reauthenticateOnOrAfter); } else { - printf("No identity or login failed !!!\n"); + debug("No identity or login failed !!!\n"); if (authentication_result == 0) { lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login), lassoSamlStatusCodeRequestDenied); @@ -505,7 +507,7 @@ lasso_login_create_user(LassoLogin *login, if (user_dump != NULL) { LASSO_PROFILE_CONTEXT(login)->user = lasso_user_new_from_dump(user_dump); if (LASSO_PROFILE_CONTEXT(login)->user == NULL) { - debug(ERROR, "Failed to create the user from the user dump\n"); + message(G_LOG_LEVEL_ERROR, "Failed to create the user from the user dump\n"); ret = -1; goto done; } @@ -518,7 +520,7 @@ lasso_login_create_user(LassoLogin *login, assertion = lasso_node_get_child(LASSO_PROFILE_CONTEXT(login)->response, "Assertion", lassoLibHRef); if (assertion == NULL) { - debug(ERROR, "Assertion element not found in response.\n"); + message(G_LOG_LEVEL_ERROR, "Assertion element not found in response.\n"); ret = -2; goto done; } @@ -531,14 +533,14 @@ lasso_login_create_user(LassoLogin *login, /* put the 2 NameIdentifiers in user object */ nameIdentifier = lasso_node_get_child(assertion, "NameIdentifier", lassoSamlAssertionHRef); if (nameIdentifier == NULL) { - debug(ERROR, "NameIdentifier element not found in assertion.\n"); + message(G_LOG_LEVEL_ERROR, "NameIdentifier element not found in assertion.\n"); ret = -3; goto done; } idpProvidedNameIdentifier = lasso_node_get_child(assertion, "IDPProvidedNameIdentifier", lassoLibHRef); if (idpProvidedNameIdentifier == NULL) { - debug(ERROR, "IDPProvidedNameIdentifier element not found in assertion.\n"); + message(G_LOG_LEVEL_ERROR, "IDPProvidedNameIdentifier element not found in assertion.\n"); ret = -4; goto done; } @@ -559,7 +561,7 @@ lasso_login_create_user(LassoLogin *login, identity); } else { - debug(ERROR, "response attribute is empty.\n"); + message(G_LOG_LEVEL_ERROR, "response attribute is empty.\n"); } done: @@ -587,7 +589,7 @@ lasso_login_dump(LassoLogin *login) node = lasso_node_new_from_dump(parent_dump); g_free(parent_dump); - sprintf(protocolProfile, "%d", login->protocolProfile); + g_sprintf(protocolProfile, "%d", login->protocolProfile); LASSO_NODE_GET_CLASS(node)->new_child(node, "ProtocolProfile", protocolProfile, FALSE); g_free(protocolProfile); @@ -637,7 +639,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login, if (authn_request_method != lassoHttpMethodRedirect && \ authn_request_method != lassoHttpMethodGet && \ authn_request_method != lassoHttpMethodPost) { - debug(ERROR, "Invalid HTTP method, it could be REDIRECT/GET or POST\n."); + message(G_LOG_LEVEL_ERROR, "Invalid HTTP method, it could be REDIRECT/GET or POST\n."); return (-1); } @@ -653,7 +655,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login, break; case lassoHttpMethodPost: /* TODO LibAuthnRequest send by method POST */ - debug(ERROR, "HTTP method POST isn't implemented yet.\n"); + message(G_LOG_LEVEL_ERROR, "HTTP method POST isn't implemented yet.\n"); return (-2); } LASSO_PROFILE_CONTEXT(login)->request_type = lassoMessageTypeAuthnRequest; @@ -689,7 +691,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login, /* get remote ProviderID */ LASSO_PROFILE_CONTEXT(login)->remote_providerID = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request, "ProviderID", NULL); - printf("remote_providerID = %s\n", LASSO_PROFILE_CONTEXT(login)->remote_providerID); + remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server, LASSO_PROFILE_CONTEXT(login)->remote_providerID); /* Is authnRequest signed ? */ @@ -700,7 +702,7 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login, switch (authn_request_method) { case lassoHttpMethodGet: case lassoHttpMethodRedirect: - debug(DEBUG, "Query signature has been verified\n"); + debug("Query signature has been verified\n"); signature_status = lasso_query_verify_signature(authn_request_msg, remote_provider->public_key, LASSO_PROFILE_CONTEXT(login)->server->private_key); @@ -740,7 +742,7 @@ lasso_login_init_request(LassoLogin *login, if (response_method != lassoHttpMethodRedirect && \ response_method != lassoHttpMethodGet && \ response_method != lassoHttpMethodPost) { - debug(ERROR, "Invalid HTTP method, it could be REDIRECT/GET or POST\n."); + message(G_LOG_LEVEL_ERROR, "Invalid HTTP method, it could be REDIRECT/GET or POST\n."); return (-1); } @@ -853,7 +855,7 @@ lasso_login_process_response_msg(LassoLogin *login, static void lasso_login_finalize(LassoLogin *login) { - debug(DEBUG, "Login object 0x%x finalized ...\n", login); + debug("Login object 0x%x finalized ...\n", login); g_free(login->assertionArtifact); g_free(login->nameIdentifier); diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c index 84711782..5bb8a529 100644 --- a/lasso/id-ff/logout.c +++ b/lasso/id-ff/logout.c @@ -54,7 +54,7 @@ lasso_logout_build_request_msg(LassoLogout *logout) provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider %s not found\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID); return(-2); } @@ -62,12 +62,12 @@ lasso_logout_build_request_msg(LassoLogout *logout) protocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider); if(protocolProfile==NULL){ - debug(ERROR, "Single Logout Protocol profile not found\n"); + message(G_LOG_LEVEL_ERROR, "Single Logout Protocol profile not found\n"); return(-3); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "Building a soap request message\n"); + debug("Building a soap request message\n"); profileContext->request_type = lassoHttpMethodSoap; /* sign the request message */ @@ -80,7 +80,7 @@ lasso_logout_build_request_msg(LassoLogout *logout) profileContext->msg_body = lasso_node_export_to_soap(profileContext->request); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "Building a http get request message\n"); + debug("Building a http get request message\n"); profileContext->request_type = lassoHttpMethodRedirect; profileContext->msg_url = lasso_provider_get_singleLogoutServiceURL(provider); profileContext->msg_url = lasso_node_export_to_query(profileContext->request, @@ -100,7 +100,7 @@ lasso_logout_build_response_msg(LassoLogout *logout) xmlChar *protocolProfile; if(!LASSO_IS_LOGOUT(logout)){ - debug(ERROR, "Not a Logout object\n"); + message(G_LOG_LEVEL_ERROR, "Not a Logout object\n"); return(-1); } @@ -108,23 +108,23 @@ lasso_logout_build_response_msg(LassoLogout *logout) provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider not found %s\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider not found %s\n", profileContext->remote_providerID); return(-2); } protocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider); if(protocolProfile==NULL){ - debug(ERROR, "Single Logout Protocol profile not found\n"); + message(G_LOG_LEVEL_ERROR, "Single Logout Protocol profile not found\n"); return(-3); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "Building a soap response message\n"); + debug("Building a soap response message\n"); profileContext->msg_url = NULL; profileContext->msg_body = lasso_node_export_to_soap(profileContext->response); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "Building a http get response message\n"); + debug("Building a http get response message\n"); profileContext->response_type = lassoHttpMethodRedirect; profileContext->msg_url = lasso_node_export_to_query(profileContext->response, profileContext->server->signature_method, @@ -158,7 +158,7 @@ lasso_logout_get_next_providerID(LassoLogout *logout) current_provider_id = g_strdup(g_ptr_array_index(profileContext->user->assertion_providerIDs, i)); if(logout->first_remote_providerID!=NULL){ if(xmlStrEqual(current_provider_id, logout->first_remote_providerID)){ - /* debug(INFO, "It's the ProviderID of the SP requester (%s) : %s, pass it\n", logout->first_remote_providerID, current_provider_id); */ + /* message(G_LOG_LEVEL_INFO, "It's the ProviderID of the SP requester (%s) : %s, pass it\n", logout->first_remote_providerID, current_provider_id); */ xmlFree(current_provider_id); continue; } @@ -184,23 +184,23 @@ lasso_logout_init_request(LassoLogout *logout, profileContext = LASSO_PROFILE_CONTEXT(logout); if(remote_providerID==NULL){ - /* debug(INFO, "No remote provider id, get the next assertion peer provider id\n"); */ + /* message(G_LOG_LEVEL_INFO, "No remote provider id, get the next assertion peer provider id\n"); */ profileContext->remote_providerID = lasso_user_get_next_assertion_remote_providerID(profileContext->user); } else{ - /* debug(INFO, "A remote provider id for logout request : %s\n", remote_providerID); */ + /* message(G_LOG_LEVEL_INFO, "A remote provider id for logout request : %s\n", remote_providerID); */ profileContext->remote_providerID = g_strdup(remote_providerID); } if(profileContext->remote_providerID==NULL){ - debug(ERROR, "No provider id for init request\n"); + message(G_LOG_LEVEL_ERROR, "No provider id for init request\n"); return(-2); } /* get identity */ identity = lasso_user_get_identity(profileContext->user, profileContext->remote_providerID); if(identity==NULL){ - debug(ERROR, "Identity not found\n"); + message(G_LOG_LEVEL_ERROR, "Identity not found\n"); return(-3); } @@ -217,12 +217,12 @@ lasso_logout_init_request(LassoLogout *logout, nameIdentifier = LASSO_NODE(lasso_identity_get_local_nameIdentifier(identity)); break; default: - debug(ERROR, "Unknown provider type\n"); + message(G_LOG_LEVEL_ERROR, "Unknown provider type\n"); return(-4); } if(!nameIdentifier){ - debug(ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID); return(-5); } @@ -236,7 +236,7 @@ lasso_logout_init_request(LassoLogout *logout, format); if(profileContext->request==NULL){ - debug(ERROR, "Error while creating the request\n"); + message(G_LOG_LEVEL_ERROR, "Error while creating the request\n"); return(-6); } @@ -262,22 +262,22 @@ lasso_logout_process_request_msg(LassoLogout *logout, switch(request_method){ case lassoHttpMethodSoap: - debug(DEBUG, "Build a logout request from soap msg\n"); + debug("Build a logout request from soap msg\n"); profileContext->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeSoap); break; case lassoHttpMethodRedirect: - debug(DEBUG, "Build a logout request from query msg\n"); + debug("Build a logout request from query msg\n"); profileContext->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeQuery); break; case lassoHttpMethodGet: - debug(WARNING, "TODO, implement the get method\n"); + message(G_LOG_LEVEL_WARNING, "TODO, implement the get method\n"); break; default: - debug(ERROR, "Unknown request method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown request method\n"); return(-3); } if(profileContext->request==NULL){ - debug(ERROR, "Error while building the request from msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while building the request from msg\n"); return(-4); } @@ -291,7 +291,7 @@ lasso_logout_process_request_msg(LassoLogout *logout, profileContext->request); if(profileContext->response==NULL){ - debug(ERROR, "Error while building response\n"); + message(G_LOG_LEVEL_ERROR, "Error while building response\n"); return(-5); } @@ -300,26 +300,26 @@ lasso_logout_process_request_msg(LassoLogout *logout, nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL); if(nameIdentifier==NULL){ - debug(ERROR, "Name identifier not found in logout request\n"); + message(G_LOG_LEVEL_ERROR, "Name identifier not found in logout request\n"); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); return(-6); } remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL); if(remote_providerID==NULL){ - debug(ERROR, "Provider id not found in logout request\n"); + message(G_LOG_LEVEL_ERROR, "Provider id not found in logout request\n"); return(-7); } /* verify authentication */ if(profileContext->user==NULL){ - debug(WARNING, "User environ not found\n"); + message(G_LOG_LEVEL_WARNING, "User environ not found\n"); statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied); } assertion = lasso_user_get_assertion(profileContext->user, remote_providerID); if(assertion==NULL){ - debug(WARNING, "%s has no assertion\n", remote_providerID); + message(G_LOG_LEVEL_WARNING, "%s has no assertion\n", remote_providerID); statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied); return(-8); } @@ -327,13 +327,13 @@ lasso_logout_process_request_msg(LassoLogout *logout, /* Verify federation */ identity = lasso_user_get_identity(profileContext->user, remote_providerID); if(identity==NULL){ - debug(WARNING, "No identity for %s\n", remote_providerID); + message(G_LOG_LEVEL_WARNING, "No identity for %s\n", remote_providerID); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); return(-9); } if(lasso_identity_verify_nameIdentifier(identity, nameIdentifier)==FALSE){ - debug(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); return(-10); } @@ -359,7 +359,7 @@ lasso_logout_process_request_msg(LassoLogout *logout, break; default: - debug(ERROR, "Uknown provider type\n"); + message(G_LOG_LEVEL_ERROR, "Uknown provider type\n"); } return(0); @@ -388,18 +388,18 @@ lasso_logout_process_response_msg(LassoLogout *logout, profileContext->response = lasso_logout_response_new_from_export(response_msg, lassoNodeExportTypeQuery); break; default: - debug(ERROR, "Unknown response method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown response method\n"); return(-3); } if(profileContext->response==NULL){ - debug(ERROR, "LogoutResponse is NULL\n"); + message(G_LOG_LEVEL_ERROR, "LogoutResponse is NULL\n"); return(-1); } statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL); if(statusCode==NULL){ - debug(ERROR, "StatusCode node not found\n"); + message(G_LOG_LEVEL_ERROR, "StatusCode node not found\n"); return(-1); } @@ -417,11 +417,11 @@ lasso_logout_process_response_msg(LassoLogout *logout, case lassoProviderTypeIdp: /* response os ok, delete the assertion */ lasso_user_remove_assertion(profileContext->user, profileContext->remote_providerID); - debug(INFO, "Remove assertion for %s\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_INFO, "Remove assertion for %s\n", profileContext->remote_providerID); /* if no more assertion for other providers, remove assertion of the original provider and restore the original requester infos */ if(profileContext->user->assertion_providerIDs->len == 1){ - debug(WARNING, "remove assertion of the original provider\n"); + message(G_LOG_LEVEL_WARNING, "remove assertion of the original provider\n"); lasso_user_remove_assertion(profileContext->user, logout->first_remote_providerID); profileContext->remote_providerID = logout->first_remote_providerID; @@ -431,7 +431,7 @@ lasso_logout_process_response_msg(LassoLogout *logout, break; default: - debug(ERROR, "Unkown provider type\n"); + message(G_LOG_LEVEL_ERROR, "Unkown provider type\n"); } return(0); @@ -444,7 +444,7 @@ lasso_logout_process_response_msg(LassoLogout *logout, static void lasso_logout_finalize(LassoLogout *logout) { - debug(INFO, "Logout object 0x%x finalized ...\n", logout); + debug("Logout object 0x%x finalized ...\n", logout); parent_class->finalize(G_OBJECT(logout)); } diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c index 2eb0a507..b4871f44 100644 --- a/lasso/id-ff/name_identifier_mapping.c +++ b/lasso/id-ff/name_identifier_mapping.c @@ -55,26 +55,26 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp /* get the prototocol profile of the name_identifier_mapping */ provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider %s not found\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID); return(-2); } protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider, &err); if(err != NULL){ - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); return (ret); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "building a soap request message\n"); + debug("building a soap request message\n"); profileContext->request_type = lassoHttpMethodSoap; profileContext->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL); profileContext->msg_body = lasso_node_export_to_soap(profileContext->request); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "building a http get request message\n"); + debug("building a http get request message\n"); profileContext->request_type = lassoHttpMethodRedirect; profileContext->msg_url = lasso_node_export_to_query(profileContext->request, profileContext->server->signature_method, @@ -100,25 +100,25 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider %s not found\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID); return(-2); } protocolProfile = lasso_provider_get_nameIdentifierMappingProtocolProfile(provider, &err); if(err != NULL){ - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); return(ret); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "building a soap response message\n"); + debug("building a soap response message\n"); profileContext->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL); profileContext->msg_body = lasso_node_export_to_soap(profileContext->response); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "building a http get response message\n"); + debug("building a http get response message\n"); profileContext->response_type = lassoHttpMethodRedirect; profileContext->msg_url = lasso_node_export_to_query(profileContext->response, profileContext->server->signature_method, @@ -149,7 +149,7 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping, /* get identity */ identity = lasso_user_get_identity(profileContext->user, profileContext->remote_providerID); if(identity==NULL){ - debug(ERROR, "error, identity not found\n"); + message(G_LOG_LEVEL_ERROR, "error, identity not found\n"); return(-3); } @@ -169,12 +169,12 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping, nameIdentifier = LASSO_NODE(lasso_identity_get_local_nameIdentifier(identity)); break; default: - debug(ERROR, "Unknown provider type\n"); + message(G_LOG_LEVEL_ERROR, "Unknown provider type\n"); return(-4); } if(!nameIdentifier){ - debug(ERROR, "Name identifier not found\n"); + message(G_LOG_LEVEL_ERROR, "Name identifier not found\n"); return(-5); } @@ -211,18 +211,18 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma switch(request_method){ case lassoHttpMethodSoap: - debug(DEBUG, "build a name_identifier_mapping request from soap msg\n"); + debug("build a name_identifier_mapping request from soap msg\n"); profileContext->request = lasso_name_identifier_mapping_request_new_from_soap(request_msg); break; case lassoHttpMethodRedirect: - debug(DEBUG, "build a name_identifier_mapping request from query msg\n"); + debug("build a name_identifier_mapping request from query msg\n"); profileContext->request = lasso_name_identifier_mapping_request_new_from_query(request_msg); break; case lassoHttpMethodGet: - debug(WARNING, "TODO, implement the get method\n"); + message(G_LOG_LEVEL_WARNING, "TODO, implement the get method\n"); break; default: - debug(ERROR, "Unknown request method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown request method\n"); return(-3); } @@ -251,13 +251,13 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma /* Verify federation */ identity = lasso_user_get_identity(profileContext->user, remote_providerID); if(identity==NULL){ - debug(WARNING, "No identity for %s\n", remote_providerID); + message(G_LOG_LEVEL_WARNING, "No identity for %s\n", remote_providerID); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); return(-6); } if(lasso_identity_verify_nameIdentifier(identity, nameIdentifier)==FALSE){ - debug(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); return(-7); } @@ -286,7 +286,7 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m case lassoHttpMethodSoap: profileContext->response = lasso_name_identifier_mapping_response_new_from_soap(response_msg); default: - debug(ERROR, "Unknown response method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown response method\n"); return(-3); } @@ -298,7 +298,7 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m } } else { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); return (ret); diff --git a/lasso/id-ff/profile_context.c b/lasso/id-ff/profile_context.c index a3ba875d..ee2110cc 100644 --- a/lasso/id-ff/profile_context.c +++ b/lasso/id-ff/profile_context.c @@ -53,13 +53,13 @@ lasso_profile_context_get_request_type_from_soap_msg(gchar *soap) soap_node = lasso_node_new_from_dump(soap); if(soap_node==NULL){ - debug(ERROR, "Error while build node from soap msg\n"); + message(G_LOG_LEVEL_ERROR, "Error while build node from soap msg\n"); return(-1); } body_node = lasso_node_get_child(soap_node, "Body", NULL); if(body_node==NULL){ - debug(ERROR, "Body node not found\n"); + message(G_LOG_LEVEL_ERROR, "Body node not found\n"); return(-2); } @@ -69,7 +69,7 @@ lasso_profile_context_get_request_type_from_soap_msg(gchar *soap) name = lasso_node_get_name(request_node); if(xmlStrEqual(name, "Request")){ - debug(INFO, "A Request node found\n"); + message(G_LOG_LEVEL_INFO, "A Request node found\n"); type = lassoRequestTypeLogin; } else if(xmlStrEqual(name, "LogoutRequest")){ @@ -85,7 +85,7 @@ lasso_profile_context_get_request_type_from_soap_msg(gchar *soap) type = lassoRequestTypeNameIdentifierMapping; } else{ - debug(ERROR, "Unkown node name : %s\n", name); + message(G_LOG_LEVEL_ERROR, "Unkown node name : %s\n", name); } } @@ -201,7 +201,7 @@ lasso_profile_context_dispose(LassoProfileContext *ctx) } ctx->private->dispose_has_run = TRUE; - debug(DEBUG, "ProfileContext object 0x%x disposed ...\n", ctx); + debug("ProfileContext object 0x%x disposed ...\n", ctx); /* unref reference counted objects */ lasso_node_destroy(ctx->request); @@ -214,7 +214,7 @@ lasso_profile_context_dispose(LassoProfileContext *ctx) static void lasso_profile_context_finalize(LassoProfileContext *ctx) { - debug(DEBUG, "ProfileContext object 0x%x finalized ...\n", ctx); + debug("ProfileContext object 0x%x finalized ...\n", ctx); g_free(ctx->remote_providerID); g_free(ctx->msg_url); diff --git a/lasso/id-ff/register_name_identifier.c b/lasso/id-ff/register_name_identifier.c index 05325e2a..4dbd9b27 100644 --- a/lasso/id-ff/register_name_identifier.c +++ b/lasso/id-ff/register_name_identifier.c @@ -55,18 +55,18 @@ lasso_register_name_identifier_build_request_msg(LassoRegisterNameIdentifier *re /* get the prototocol profile of the register_name_identifier */ provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider %s not found\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID); return(-2); } protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider); if(protocolProfile==NULL){ - debug(ERROR, "Register_Name_Identifier Protocol profile not found\n"); + message(G_LOG_LEVEL_ERROR, "Register_Name_Identifier Protocol profile not found\n"); return(-3); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "Building a soap request message\n"); + debug("Building a soap request message\n"); profileContext->request_type = lassoHttpMethodSoap; /* sign the request message */ @@ -79,7 +79,7 @@ lasso_register_name_identifier_build_request_msg(LassoRegisterNameIdentifier *re profileContext->msg_body = lasso_node_export_to_soap(profileContext->request); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "Building a http get request message\n"); + debug("Building a http get request message\n"); } return(0); @@ -98,23 +98,23 @@ lasso_register_name_identifier_build_response_msg(LassoRegisterNameIdentifier *r provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID); if(provider==NULL){ - debug(ERROR, "Provider not found (ProviderID = %s)\n", profileContext->remote_providerID); + message(G_LOG_LEVEL_ERROR, "Provider not found (ProviderID = %s)\n", profileContext->remote_providerID); return(-2); } protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider); if(protocolProfile==NULL){ - debug(ERROR, "Register name identifier protocol profile not found\n"); + message(G_LOG_LEVEL_ERROR, "Register name identifier protocol profile not found\n"); return(-3); } if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){ - debug(DEBUG, "building a soap response message\n"); + debug("building a soap response message\n"); profileContext->msg_url = lasso_provider_get_registerNameIdentifierServiceURL(provider); profileContext->msg_body = lasso_node_export_to_soap(profileContext->response); } else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){ - debug(DEBUG, "building a http get response message\n"); + debug("building a http get response message\n"); } return(0); @@ -131,7 +131,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe gchar *remote_providerID) { LassoProfileContext *profileContext; - LassoNode *nameIdentifier, *nameIdentifier_node; + LassoNode *nameIdentifier_node; LassoIdentity *identity; xmlChar *spNameIdentifier, *spNameQualifier, *spFormat; @@ -144,15 +144,15 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier); if(remote_providerID==NULL){ - debug(INFO, "No remote provider id, get the next identity peer provider id\n"); + message(G_LOG_LEVEL_INFO, "No remote provider id, get the next identity peer provider id\n"); profileContext->remote_providerID = lasso_user_get_next_identity_remote_providerID(profileContext->user); } else{ - debug(INFO, "A remote provider id for register name identifier request : %s\n", remote_providerID); + message(G_LOG_LEVEL_INFO, "A remote provider id for register name identifier request : %s\n", remote_providerID); profileContext->remote_providerID = g_strdup(remote_providerID); } if(profileContext->remote_providerID==NULL){ - debug(ERROR, "No provider id for init request\n"); + message(G_LOG_LEVEL_ERROR, "No provider id for init request\n"); return(-2); } @@ -161,7 +161,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe /* get identity */ identity = lasso_user_get_identity(profileContext->user, profileContext->remote_providerID); if(identity==NULL){ - debug(ERROR, "Identity not found\n"); + message(G_LOG_LEVEL_ERROR, "Identity not found\n"); return(-3); } @@ -175,7 +175,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe /* get the old name identifier */ identity = lasso_user_get_identity(profileContext->user, remote_providerID); if(identity==NULL){ - debug(ERROR, "Identity not found\n"); + message(G_LOG_LEVEL_ERROR, "Identity not found\n"); return(-3); } nameIdentifier_node = lasso_identity_get_local_nameIdentifier(identity); @@ -201,7 +201,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe /* get the old name identifier */ identity = lasso_user_get_identity(profileContext->user, remote_providerID); if(identity==NULL){ - debug(ERROR, "Identity not found\n"); + message(G_LOG_LEVEL_ERROR, "Identity not found\n"); return(-4); } nameIdentifier_node = lasso_identity_get_local_nameIdentifier(identity); @@ -217,7 +217,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe break; default: - debug(ERROR, "Unknown provider type (%d)\n", profileContext->provider_type); + message(G_LOG_LEVEL_ERROR, "Unknown provider type (%d)\n", profileContext->provider_type); return(-5); } @@ -234,7 +234,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe if(profileContext->request==NULL){ - debug(ERROR, "Error while creating the request\n"); + message(G_LOG_LEVEL_ERROR, "Error while creating the request\n"); return(-6); } @@ -260,18 +260,18 @@ lasso_register_name_identifier_process_request_msg(LassoRegisterNameIdentifier * switch(request_method){ case lassoHttpMethodSoap: - debug(DEBUG, "build a register_name_identifier request from soap msg\n"); + debug("build a register_name_identifier request from soap msg\n"); profileContext->request = lasso_register_name_identifier_request_new_from_soap(request_msg); break; case lassoHttpMethodRedirect: - debug(DEBUG, "build a register_name_identifier request from query msg\n"); + debug("build a register_name_identifier request from query msg\n"); profileContext->request = lasso_register_name_identifier_request_new_from_query(request_msg); break; case lassoHttpMethodGet: - debug(WARNING, "TODO, implement the get method\n"); + message(G_LOG_LEVEL_WARNING, "TODO, implement the get method\n"); break; default: - debug(ERROR, "Unknown request method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown request method\n"); return(-3); } @@ -285,7 +285,7 @@ lasso_register_name_identifier_process_request_msg(LassoRegisterNameIdentifier * profileContext->request); if(profileContext->response==NULL){ - debug(ERROR, "Error while building response\n"); + message(G_LOG_LEVEL_ERROR, "Error while building response\n"); return(-4); } @@ -294,27 +294,27 @@ lasso_register_name_identifier_process_request_msg(LassoRegisterNameIdentifier * nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL); if(nameIdentifier==NULL){ - debug(ERROR, "No name identifier found in register_name_identifier request\n"); + message(G_LOG_LEVEL_ERROR, "No name identifier found in register_name_identifier request\n"); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); return(-5); } remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL); if(remote_providerID==NULL){ - debug(ERROR, "No provider id found in register_name_identifier request\n"); + message(G_LOG_LEVEL_ERROR, "No provider id found in register_name_identifier request\n"); return(-6); } /* Verify federation */ identity = lasso_user_get_identity(profileContext->user, remote_providerID); if(identity==NULL){ - debug(WARNING, "No identity for %s\n", remote_providerID); + message(G_LOG_LEVEL_WARNING, "No identity for %s\n", remote_providerID); statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist); return(-7); } if(lasso_identity_verify_nameIdentifier(identity, nameIdentifier)==FALSE){ - debug(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); return(-8); } @@ -322,7 +322,7 @@ lasso_register_name_identifier_process_request_msg(LassoRegisterNameIdentifier * /* verify authentication (if ok, delete assertion) */ assertion = lasso_user_get_assertion(profileContext->user, remote_providerID); if(assertion==NULL){ - debug(WARNING, "%s has no assertion\n", remote_providerID); + message(G_LOG_LEVEL_WARNING, "%s has no assertion\n", remote_providerID); statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied); return(-9); } @@ -355,7 +355,7 @@ lasso_register_name_identifier_process_response_msg(LassoRegisterNameIdentifier profileContext->response = lasso_register_name_identifier_response_new_from_query(response_msg); break; default: - debug(ERROR, "Unknown response method\n"); + message(G_LOG_LEVEL_ERROR, "Unknown response method\n"); return(-3); } @@ -367,7 +367,7 @@ lasso_register_name_identifier_process_response_msg(LassoRegisterNameIdentifier } } else { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); ret = err->code; g_error_free(err); return (ret); @@ -382,7 +382,7 @@ lasso_register_name_identifier_process_response_msg(LassoRegisterNameIdentifier static void lasso_register_name_identifier_finalize(LassoRegisterNameIdentifier *register_name_identifier) { - debug(INFO, "Register Name Identifier object 0x%x finalized ...\n", register_name_identifier); + message(G_LOG_LEVEL_INFO, "Register Name Identifier object 0x%x finalized ...\n", register_name_identifier); parent_class->finalize(G_OBJECT(register_name_identifier)); } @@ -492,12 +492,12 @@ lasso_register_name_identifier_new(LassoServer *server, /* spNameQualifier = providerID; */ /* spFormat = "federated"; */ -/* debug(DEBUG, "new name identifier : %s, name qualifier : %s, format : %s\n", spNameIdentifier, spNameQualifier, spFormat); */ +/* debug("new name identifier : %s, name qualifier : %s, format : %s\n", spNameIdentifier, spNameQualifier, spFormat); */ /* /\* get the old name identifier *\/ */ /* identity = lasso_user_get_identity(profileContext->user, remote_providerID); */ /* if(identity==NULL){ */ -/* debug(ERROR, "Identity not found\n"); */ +/* message(G_LOG_LEVEL_ERROR, "Identity not found\n"); */ /* return(-3); */ /* } */ /* nameIdentifier_node = lasso_identity_get_local_nameIdentifier(identity); */ @@ -523,7 +523,7 @@ lasso_register_name_identifier_new(LassoServer *server, /* /\* get the old name identifier *\/ */ /* identity = lasso_user_get_identity(profileContext->user, remote_providerID); */ /* if(identity==NULL){ */ -/* debug(ERROR, "Identity not found\n"); */ +/* message(G_LOG_LEVEL_ERROR, "Identity not found\n"); */ /* return(-4); */ /* } */ /* nameIdentifier_node = lasso_identity_get_local_nameIdentifier(identity); */ @@ -539,7 +539,7 @@ lasso_register_name_identifier_new(LassoServer *server, /* break; */ /* default: */ -/* debug(ERROR, "Unknown provider type (%d)\n", profileContext->provider_type); */ +/* message(G_LOG_LEVEL_ERROR, "Unknown provider type (%d)\n", profileContext->provider_type); */ /* return(-5); */ /* } */ diff --git a/lasso/id-ff/server.c b/lasso/id-ff/server.c index 41fba64d..f36b7c81 100644 --- a/lasso/id-ff/server.c +++ b/lasso/id-ff/server.c @@ -290,7 +290,7 @@ lasso_server_new(gchar *metadata, /* get ProviderID in metadata */ providerID = lasso_node_get_attr_value(md_node, "ProviderID", &err); if (providerID == NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); g_error_free(err); lasso_node_destroy(md_node); return (NULL); @@ -326,7 +326,7 @@ lasso_server_new_from_dump(gchar *dump) server_node = lasso_node_new_from_dump(dump); if(server_node==NULL){ - debug(ERROR, "Error while loading server dump\n"); + message(G_LOG_LEVEL_ERROR, "Error while loading server dump\n"); return(NULL); } server_class = LASSO_NODE_GET_CLASS(server_node); diff --git a/lasso/id-ff/user.c b/lasso/id-ff/user.c index 817c0cbb..2d6b8257 100644 --- a/lasso/id-ff/user.c +++ b/lasso/id-ff/user.c @@ -57,7 +57,7 @@ lasso_user_add_assertion(LassoUser *user, found = TRUE; } if(found==TRUE){ - debug(ERROR, "A provider id already exists\n"); + message(G_LOG_LEVEL_ERROR, "A provider id already exists\n"); return(-4); } @@ -209,7 +209,7 @@ lasso_user_get_authentication_method(LassoUser *user, as = lasso_node_get_child(assertion, "AuthenticationStatement", NULL); authentication_method = lasso_node_get_attr_value(as, "AuthenticationMethod", &err); if (authentication_method == NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); g_error_free(err); goto done; } @@ -312,13 +312,13 @@ lasso_user_remove_identity(LassoUser *user, g_hash_table_steal(user->identities, remote_providerID); } else { - debug(DEBUG, "Failed to remove identity for remote Provider %s\n", remote_providerID); + debug("Failed to remove identity for remote Provider %s\n", remote_providerID); } /* remove the identity remote provider id */ for(i = 0; iidentity_providerIDs->len; i++){ if(xmlStrEqual(remote_providerID, g_ptr_array_index(user->identity_providerIDs, i))){ - debug(DEBUG, "Remove assertion of %s\n", remote_providerID); + debug("Remove assertion of %s\n", remote_providerID); g_ptr_array_remove_index(user->identity_providerIDs, i); break; } @@ -334,7 +334,7 @@ lasso_user_remove_identity(LassoUser *user, static void lasso_user_finalize(LassoUser *user) { - debug(INFO, "User object 0x%x finalized ...\n", user); + message(G_LOG_LEVEL_INFO, "User object 0x%x finalized ...\n", user); parent_class->finalize(G_OBJECT(user)); } @@ -424,7 +424,7 @@ lasso_user_new_from_dump(gchar *dump) /* get user */ user_node = lasso_node_new_from_dump(dump); if (user_node == NULL) { - debug(WARNING, "Can't create a user from dump\n"); + message(G_LOG_LEVEL_WARNING, "Can't create a user from dump\n"); return (NULL); } @@ -442,7 +442,7 @@ lasso_user_new_from_dump(gchar *dump) assertion_node = lasso_node_new_from_xmlNode(assertion_xmlNode); remote_providerID = lasso_node_get_attr_value(assertion_node, LASSO_USER_REMOTE_PROVIDERID_NODE, &err); if (remote_providerID == NULL) { - debug(ERROR, err->message); + message(G_LOG_LEVEL_ERROR, err->message); g_error_free(err); continue; } diff --git a/lasso/xml/debug.c b/lasso/xml/debug.c index cc98d23a..8ba8bab0 100644 --- a/lasso/xml/debug.c +++ b/lasso/xml/debug.c @@ -36,6 +36,7 @@ /* #define yellow "\033[33m" */ /* #define blue "\033[34m" */ +int debug_type; int debug_line; char debug_filename[512]; char debug_function[512]; @@ -51,6 +52,7 @@ set_debug_info(int line, char *filename, char *function) { + debug_type = 1; debug_line = line; strncpy(debug_filename, filename, 512); strncpy(debug_function, function, 512); @@ -67,10 +69,10 @@ _debug(GLogLevelFlags level, /* char new_debug_string[2048]; */ /* char *color = NULL; */ - /* if ((level < 0) || (level > 3)) { */ - /* printf("DEBUG LEVEL level=%d, must be 0<=x<=3 !!!\n", level); */ - /* return; */ - /* } */ + if (level == G_LOG_LEVEL_DEBUG && debug_type == 0) { + g_warning("message() function should not be used with G_LOG_LEVEL_DEBUG level. Use debug() function rather."); + } + debug_type = 0; va_start(args, format); vsnprintf(debug_string, sizeof(debug_string), format, args); diff --git a/lasso/xml/debug.h b/lasso/xml/debug.h index 4f344571..08b91b87 100644 --- a/lasso/xml/debug.h +++ b/lasso/xml/debug.h @@ -46,7 +46,7 @@ void _debug(GLogLevelFlags level, const char *format, ...); #define debug(format, ...); #endif -#define message _debug +#define message(level, format, args...) _debug(level, format, ##args); #ifdef __cplusplus } diff --git a/lasso/xml/errors.c b/lasso/xml/errors.c index 256d7eba..073f8a95 100644 --- a/lasso/xml/errors.c +++ b/lasso/xml/errors.c @@ -29,7 +29,7 @@ const char* lasso_strerror(int error_code) { switch (error_code) { - case LASSO_ERROR_XML_ATTR_VALUE_NOTFOUND: + case LASSO_XML_ERROR_ATTR_VALUE_NOTFOUND: return "Unable to get '%s' attribute value in '%s' element.\n"; default: return "Undefined error code !!!\n"; diff --git a/lasso/xml/errors.h b/lasso/xml/errors.h index 5de7f4ba..8593d34e 100644 --- a/lasso/xml/errors.h +++ b/lasso/xml/errors.h @@ -23,6 +23,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define LASSO_ERROR_XML_ATTR_VALUE_NOTFOUND -1 +#define LASSO_XML_ERROR_ATTR_VALUE_NOTFOUND -1 const char* lasso_strerror(int error_code); diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 4e567f18..79bcf100 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -731,8 +731,8 @@ lasso_node_impl_get_attr_value(LassoNode *node, if (value == NULL) { g_set_error(err, g_quark_from_string("Lasso"), - LASSO_ERROR_XML_ATTR_VALUE_NOTFOUND, - lasso_strerror(LASSO_ERROR_XML_ATTR_VALUE_NOTFOUND), + LASSO_XML_ERROR_ATTR_VALUE_NOTFOUND, + lasso_strerror(LASSO_XML_ERROR_ATTR_VALUE_NOTFOUND), name, node->private->node->name); } @@ -946,7 +946,7 @@ lasso_node_impl_verify_signature(LassoNode *node, signature = xmlSecFindNode(node->private->node, xmlSecNodeSignature, xmlSecDSigNs); if (signature == NULL) { - debug(ERROR, "Signature element not found.\n"); + message(G_LOG_LEVEL_ERROR, "Signature element not found.\n"); ret = -2; goto done; } @@ -954,12 +954,12 @@ lasso_node_impl_verify_signature(LassoNode *node, /* create simple keys mngr */ mngr = xmlSecKeysMngrCreate(); if (mngr == NULL) { - debug(ERROR, "Failed to create keys manager.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to create keys manager.\n"); goto done; } if (xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) { - debug(ERROR, "Failed to initialize keys manager.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to initialize keys manager.\n"); goto done; } @@ -967,21 +967,21 @@ lasso_node_impl_verify_signature(LassoNode *node, if (xmlSecCryptoAppKeysMngrCertLoad(mngr, certificate_file, xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) { - debug(ERROR, "Failed to load pem certificate from \"%s\".\n", - certificate_file); + message(G_LOG_LEVEL_ERROR, "Failed to load pem certificate from \"%s\".\n", + certificate_file); goto done; } /* create signature context */ dsigCtx = xmlSecDSigCtxCreate(mngr); if (dsigCtx == NULL) { - debug(ERROR, "Failed to create signature context.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to create signature context.\n"); goto done; } /* verify signature */ if (xmlSecDSigCtxVerify(dsigCtx, signature) < 0) { - debug(ERROR, "Failed to verify signature.\n"); + message(G_LOG_LEVEL_ERROR, "Failed to verify signature.\n"); goto done; } @@ -989,7 +989,7 @@ lasso_node_impl_verify_signature(LassoNode *node, ret = 0; } else { - debug(ERROR, "The signature of response is invalid.\n"); + message(G_LOG_LEVEL_ERROR, "The signature of response is invalid.\n"); ret = -1; } @@ -1322,7 +1322,7 @@ lasso_node_dispose(LassoNode *node) } node->private->dispose_has_run = TRUE; - debug(DEBUG, "%s 0x%x disposed ...\n", lasso_node_get_name(node), node); + debug("%s 0x%x disposed ...\n", lasso_node_get_name(node), node); /* unref reference counted objects */ /* we don't have any here */ @@ -1333,7 +1333,7 @@ lasso_node_dispose(LassoNode *node) static void lasso_node_finalize(LassoNode *node) { - debug(DEBUG, "%s 0x%x finalized ...\n", lasso_node_get_name(node), node); + debug("%s 0x%x finalized ...\n", lasso_node_get_name(node), node); if (node->private->node_is_weak_ref == FALSE) { xmlUnlinkNode(node->private->node);