diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2005-02-05 16:15:53 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2005-02-05 16:15:53 +0000 |
commit | 6cc0ebee5ae12cceb87472b28b72f324c39e4a5c (patch) | |
tree | f14b2c016aa9ccbeb55746e815a77072f9c2a7e5 /lasso | |
parent | 9da138f18143409795313e34799ce3fba241e011 (diff) | |
download | lasso-6cc0ebee5ae12cceb87472b28b72f324c39e4a5c.tar.gz lasso-6cc0ebee5ae12cceb87472b28b72f324c39e4a5c.tar.xz lasso-6cc0ebee5ae12cceb87472b28b72f324c39e4a5c.zip |
removed all %s escaping sequences from lasso error strings; as a side effect
this simplifies critical_error macro, porting to non-gcc compilers should be
easier. Along the way I also fixed the long standing bug #256.
Diffstat (limited to 'lasso')
-rw-r--r-- | lasso/errors.c | 29 | ||||
-rw-r--r-- | lasso/id-ff/defederation.c | 12 | ||||
-rw-r--r-- | lasso/id-ff/lecp.c | 3 | ||||
-rw-r--r-- | lasso/id-ff/login.c | 23 | ||||
-rw-r--r-- | lasso/id-ff/logout.c | 18 | ||||
-rw-r--r-- | lasso/id-ff/name_identifier_mapping.c | 19 | ||||
-rw-r--r-- | lasso/id-ff/name_registration.c | 22 | ||||
-rw-r--r-- | lasso/xml/private.h | 6 | ||||
-rw-r--r-- | lasso/xml/tools.c | 16 |
9 files changed, 54 insertions, 94 deletions
diff --git a/lasso/errors.c b/lasso/errors.c index 699442a4..f1e73af2 100644 --- a/lasso/errors.c +++ b/lasso/errors.c @@ -32,41 +32,40 @@ lasso_strerror(int error_code) { switch (error_code) { case LASSO_XML_ERROR_NODE_NOT_FOUND: - return "Unable to get '%s' child of '%s' element."; + return "Unable to get child of element."; case LASSO_XML_ERROR_NODE_CONTENT_NOT_FOUND: - return "Unable to get content of '%s' element."; + return "Unable to get content of element."; case LASSO_XML_ERROR_ATTR_NOT_FOUND: - return "Unable to get '%s' attribute of '%s' element."; + return "Unable to get attribute of element."; case LASSO_XML_ERROR_ATTR_VALUE_NOT_FOUND: - return "Unable to get '%s' attribute value of '%s' element."; + return "Unable to get attribute value of element."; case LASSO_DS_ERROR_SIGNATURE_NOT_FOUND: - return "Signature element not found in %s."; + return "Signature element not found."; case LASSO_DS_ERROR_INVALID_SIGNATURE: - return "The signature of %s is invalid."; + return "Invalid signature."; case LASSO_DS_ERROR_CONTEXT_CREATION_FAILED: return "Failed to create signature context."; case LASSO_DS_ERROR_PUBLIC_KEY_LOAD_FAILED: - return "Failed to load public key %s."; + return "Failed to load public key."; case LASSO_DS_ERROR_PRIVATE_KEY_LOAD_FAILED: - return "Failed to load private key %s."; + return "Failed to load private key."; case LASSO_DS_ERROR_CERTIFICATE_LOAD_FAILED: - return "Failed to load certificate %s."; + return "Failed to load certificate."; case LASSO_DS_ERROR_SIGNATURE_FAILED: - return "Failed to sign the node %s."; + return "Failed to sign the node."; case LASSO_DS_ERROR_KEYS_MNGR_CREATION_FAILED: return "Failed to create keys manager."; case LASSO_DS_ERROR_KEYS_MNGR_INIT_FAILED: return "Failed to initialize keys manager."; case LASSO_DS_ERROR_SIGNATURE_VERIFICATION_FAILED: - return "Failed to verify signature of %s."; + return "Failed to verify signature."; case LASSO_DS_ERROR_INVALID_SIGALG: return "Invalid signature algorithm."; case LASSO_DS_ERROR_SIGNATURE_TEMPLATE_NOT_FOUND: return "Signature template has not been found."; case LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND: - return "Failed to get LassoProvider object "\ - "with providerID %s in LassoServer object."; + return "ProviderID unknown to LassoServer"; case LASSO_SERVER_ERROR_ADD_PROVIDER_FAILED: return "Failed to add new provider."; @@ -123,12 +122,12 @@ lasso_strerror(int error_code) "either NULL or contains a NULL error."; case LASSO_LOGIN_ERROR_INVALID_NAMEIDPOLICY: - return "Invalid NameIDPolicy in lib:AuthnRequest: %s"; + return "Invalid NameIDPolicy in lib:AuthnRequest"; case LASSO_DEFEDERATION_ERROR_MISSING_NAME_IDENTIFIER: return "Name identifier not found in request"; default: - return g_strdup_printf("Undefined error code %d.", error_code); + return "Undefined error code."; } } diff --git a/lasso/id-ff/defederation.c b/lasso/id-ff/defederation.c index 6275f0b8..b357f8d9 100644 --- a/lasso/id-ff/defederation.c +++ b/lasso/id-ff/defederation.c @@ -73,8 +73,7 @@ lasso_defederation_build_notification_msg(LassoDefederation *defederation) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* get the protocol profile type */ @@ -167,8 +166,7 @@ lasso_defederation_init_notification(LassoDefederation *defederation, gchar *rem remote_provider = g_hash_table_lookup( profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* get federation */ @@ -285,8 +283,7 @@ lasso_defederation_process_notification_msg(LassoDefederation *defederation, cha remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } profile->signature_status = lasso_provider_verify_signature( @@ -346,8 +343,7 @@ lasso_defederation_validate_notification(LassoDefederation *defederation) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* build the QUERY and the url. Dont need to sign the query, diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c index 18b7a374..25c1b2b6 100644 --- a/lasso/id-ff/lecp.c +++ b/lasso/id-ff/lecp.c @@ -188,8 +188,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp) provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (provider == NULL) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* build lib:AuthnResponse */ diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c index 6c494a23..1e7fcf6c 100644 --- a/lasso/id-ff/login.c +++ b/lasso/id-ff/login.c @@ -347,7 +347,7 @@ lasso_login_process_federation(LassoLogin *login, gboolean is_consent_obtained) if (strcmp(nameIDPolicy, LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED) != 0 && strcmp(nameIDPolicy, LASSO_LIB_NAMEID_POLICY_TYPE_ANY) != 0) { - return critical_error(LASSO_LOGIN_ERROR_INVALID_NAMEIDPOLICY, nameIDPolicy); + return critical_error(LASSO_LOGIN_ERROR_INVALID_NAMEIDPOLICY); } /* consent is necessary, it should be obtained via consent attribute @@ -575,8 +575,7 @@ lasso_login_build_artifact_msg(LassoLogin *login, LassoHttpMethod http_method) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); url = lasso_provider_get_assertion_consumer_service_url(remote_provider, LASSO_LIB_AUTHN_REQUEST(profile->request)->AssertionConsumerServiceID); @@ -656,8 +655,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } protocolProfile = LASSO_LIB_AUTHN_REQUEST(profile->request)->ProtocolProfile; @@ -765,8 +763,7 @@ lasso_login_build_authn_response_msg(LassoLogin *login) remote_provider = g_hash_table_lookup(LASSO_PROFILE(login)->server->providers, LASSO_PROFILE(login)->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); profile->msg_url = lasso_provider_get_assertion_consumer_service_url(remote_provider, LASSO_LIB_AUTHN_REQUEST(profile->request)->AssertionConsumerServiceID); @@ -801,8 +798,7 @@ lasso_login_build_request_msg(LassoLogin *login) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } profile->msg_url = lasso_provider_get_metadata_one(remote_provider, "SoapEndpoint"); return 0; @@ -951,8 +947,7 @@ lasso_login_init_authn_request(LassoLogin *login, const gchar *remote_providerID remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); login->http_method = http_method; @@ -1248,8 +1243,7 @@ lasso_login_process_authn_request_msg(LassoLogin *login, const char *authn_reque must_verify_signature = TRUE; } } else { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify request signature */ @@ -1316,8 +1310,7 @@ lasso_login_process_authn_response_msg(LassoLogin *login, gchar *authn_response_ remote_provider = g_hash_table_lookup(LASSO_PROFILE(login)->server->providers, LASSO_PROFILE(login)->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - LASSO_PROFILE(login)->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); LASSO_PROFILE(login)->msg_relayState = g_strdup(LASSO_LIB_AUTHN_RESPONSE( LASSO_PROFILE(login)->response)->RelayState); diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c index 78ff43ba..0360fe9b 100644 --- a/lasso/id-ff/logout.c +++ b/lasso/id-ff/logout.c @@ -83,8 +83,7 @@ lasso_logout_build_request_msg(LassoLogout *logout) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* build the logout request message */ @@ -164,8 +163,7 @@ lasso_logout_build_response_msg(LassoLogout *logout) /* get the provider */ provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (provider == NULL) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* build logout response message */ @@ -330,8 +328,7 @@ lasso_logout_init_request(LassoLogout *logout, char *remote_providerID, remote_provider = g_hash_table_lookup( profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* before setting profile->request, verify if it is already set */ @@ -429,8 +426,7 @@ gint lasso_logout_process_request_msg(LassoLogout *logout, char *request_msg) remote_provider = g_hash_table_lookup(profile->server->providers, LASSO_LIB_LOGOUT_REQUEST(profile->request)->ProviderID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - LASSO_LIB_LOGOUT_REQUEST(profile->request)->ProviderID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify signatures */ @@ -516,8 +512,7 @@ lasso_logout_process_response_msg(LassoLogout *logout, gchar *response_msg) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify signature */ @@ -692,8 +687,7 @@ lasso_logout_validate_request(LassoLogout *logout) remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* Set LogoutResponse */ diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c index 0cf80fe2..d49cfdf1 100644 --- a/lasso/id-ff/name_identifier_mapping.c +++ b/lasso/id-ff/name_identifier_mapping.c @@ -65,8 +65,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (remote_provider->role != LASSO_PROVIDER_ROLE_IDP) { @@ -127,8 +126,7 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (remote_provider->role != LASSO_PROVIDER_ROLE_SP) { @@ -202,8 +200,7 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping, remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (remote_provider->role != LASSO_PROVIDER_ROLE_IDP) { message(G_LOG_LEVEL_CRITICAL, "Init request method is forbidden for an IDP"); @@ -289,9 +286,7 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma remote_provider = g_hash_table_lookup(profile->server->providers, LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(profile->request)->ProviderID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST( - profile->request)->ProviderID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } profile->remote_providerID = g_strdup(remote_provider->ProviderID); @@ -353,8 +348,7 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m remote_provider = g_hash_table_lookup(profile->server->providers, LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(profile->response)->ProviderID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify signature */ @@ -406,8 +400,7 @@ lasso_name_identifier_mapping_validate_request(LassoNameIdentifierMapping *mappi remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (remote_provider == NULL) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (remote_provider->role != LASSO_PROVIDER_ROLE_SP) { diff --git a/lasso/id-ff/name_registration.c b/lasso/id-ff/name_registration.c index 606cdd1c..fe6e91d8 100644 --- a/lasso/id-ff/name_registration.c +++ b/lasso/id-ff/name_registration.c @@ -68,8 +68,7 @@ lasso_name_registration_build_request_msg(LassoNameRegistration *name_registrati remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (profile->http_request_method == LASSO_HTTP_METHOD_SOAP) { @@ -148,8 +147,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (profile->http_request_method == LASSO_HTTP_METHOD_SOAP) { @@ -234,8 +232,7 @@ lasso_name_registration_init_request(LassoNameRegistration *name_registration, remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* Get federation */ @@ -367,9 +364,7 @@ gint lasso_name_registration_process_request_msg(LassoNameRegistration *name_reg remote_provider = g_hash_table_lookup(profile->server->providers, LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(profile->request)->ProviderID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST( - profile->request)->ProviderID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify signatures */ @@ -460,8 +455,7 @@ lasso_name_registration_process_response_msg(LassoNameRegistration *name_registr remote_provider = g_hash_table_lookup(profile->server->providers, LASSO_LIB_STATUS_RESPONSE(profile->response)->ProviderID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* verify signature */ @@ -488,8 +482,7 @@ lasso_name_registration_process_response_msg(LassoNameRegistration *name_registr remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } if (remote_provider->role == LASSO_PROVIDER_ROLE_SP) { @@ -587,8 +580,7 @@ lasso_name_registration_validate_request(LassoNameRegistration *name_registratio remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); if (LASSO_IS_PROVIDER(remote_provider) == FALSE) { - return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND, - profile->remote_providerID); + return critical_error(LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND); } /* update name identifier in federation */ diff --git a/lasso/xml/private.h b/lasso/xml/private.h index 59424a68..d3a73e3b 100644 --- a/lasso/xml/private.h +++ b/lasso/xml/private.h @@ -138,11 +138,7 @@ int error_code(GLogLevelFlags level, int error, ...); _debug(level, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) #endif -#if defined __GNUC__ -# define critical_error(args...) error_code(G_LOG_LEVEL_CRITICAL, ##args) -#else -# define critical_error(...) error_code(G_LOG_LEVEL_CRITICAL, __VA_ARGS__) -#endif +#define critical_error(rc) error_code(G_LOG_LEVEL_CRITICAL, rc) #ifdef __cplusplus } diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index 75aa6906..8c5f4c89 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -418,7 +418,7 @@ lasso_query_verify_signature(const char *query, const char *sender_public_key_fi RSA *rsa = NULL; DSA *dsa = NULL; gchar **str_split = NULL; - LassoSignatureMethod sign_method; + LassoSignatureMethod sign_method; xmlChar *digest = NULL, *b64_signature = NULL; xmlChar *e_rsa_alg = NULL, *e_dsa_alg = NULL; xmlSecByte *signature = NULL; @@ -428,6 +428,8 @@ lasso_query_verify_signature(const char *query, const char *sender_public_key_fi g_return_val_if_fail(sender_public_key_file != NULL, LASSO_PARAM_ERROR_INVALID_VALUE); /* split query, the signature MUST be the last param of the query */ + /* FIXME: actually there could be more params in the URL; but they + * wouldn't be covered by the signature */ str_split = g_strsplit(query, "&Signature=", 0); if (str_split[1] == NULL) { ret = LASSO_DS_ERROR_SIGNATURE_NOT_FOUND; @@ -437,10 +439,7 @@ lasso_query_verify_signature(const char *query, const char *sender_public_key_fi /* create bio to read public key */ bio = BIO_new_file(sender_public_key_file, "rb"); if (bio == NULL) { - message(G_LOG_LEVEL_CRITICAL, - lasso_strerror(LASSO_DS_ERROR_PUBLIC_KEY_LOAD_FAILED), - sender_public_key_file); - ret = LASSO_DS_ERROR_PUBLIC_KEY_LOAD_FAILED; + ret = critical_error(LASSO_DS_ERROR_PUBLIC_KEY_LOAD_FAILED); goto done; } @@ -634,19 +633,18 @@ lasso_sign_node(xmlNode *xmlnode, const char *id_attr_name, const char *id_value NULL, NULL, NULL); if (dsig_ctx->signKey == NULL) { xmlSecDSigCtxDestroy(dsig_ctx); - return critical_error(LASSO_DS_ERROR_PRIVATE_KEY_LOAD_FAILED, private_key_file); + return critical_error(LASSO_DS_ERROR_PRIVATE_KEY_LOAD_FAILED); } if (certificate_file != NULL && certificate_file[0] != 0) { if (xmlSecCryptoAppKeyCertLoad(dsig_ctx->signKey, certificate_file, xmlSecKeyDataFormatPem) < 0) { xmlSecDSigCtxDestroy(dsig_ctx); - return critical_error(LASSO_DS_ERROR_CERTIFICATE_LOAD_FAILED, - certificate_file); + return critical_error(LASSO_DS_ERROR_CERTIFICATE_LOAD_FAILED); } } if (xmlSecDSigCtxSign(dsig_ctx, sign_tmpl) < 0) { xmlSecDSigCtxDestroy(dsig_ctx); - return critical_error(LASSO_DS_ERROR_SIGNATURE_FAILED, xmlnode->name); + return critical_error(LASSO_DS_ERROR_SIGNATURE_FAILED); } xmlSecDSigCtxDestroy(dsig_ctx); xmlUnlinkNode(xmlnode); |