summaryrefslogtreecommitdiffstats
path: root/lasso/id-wsf-2.0
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-10-01 12:33:24 +0200
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-10-01 15:29:38 +0200
commit462c9a1cd06b5ef9af7e348eef6a27584b98eff2 (patch)
tree0a99e0b9e64d377091a85d880b0ea9f03aaa027b /lasso/id-wsf-2.0
parentb5fcbc645576cd953a4b23ce804ea503b57eec4a (diff)
downloadlasso-462c9a1cd06b5ef9af7e348eef6a27584b98eff2.tar.gz
lasso-462c9a1cd06b5ef9af7e348eef6a27584b98eff2.tar.xz
lasso-462c9a1cd06b5ef9af7e348eef6a27584b98eff2.zip
[Core] replace all use of g_strcmp0 by lasso_strisequal and lasso_strisnotequal
Too much human errors with strcmp kind of functions. Also change name os lasso_is_empty_string to lasso_strisempty.
Diffstat (limited to 'lasso/id-wsf-2.0')
-rw-r--r--lasso/id-wsf-2.0/data_service.c26
-rw-r--r--lasso/id-wsf-2.0/discovery.c10
-rw-r--r--lasso/id-wsf-2.0/idwsf2_helper.c4
-rw-r--r--lasso/id-wsf-2.0/profile.c8
-rw-r--r--lasso/id-wsf-2.0/saml2_login.c2
-rw-r--r--lasso/id-wsf-2.0/soap_binding.c16
6 files changed, 33 insertions, 33 deletions
diff --git a/lasso/id-wsf-2.0/data_service.c b/lasso/id-wsf-2.0/data_service.c
index 6c6ed11c..8f4012e6 100644
--- a/lasso/id-wsf-2.0/data_service.c
+++ b/lasso/id-wsf-2.0/data_service.c
@@ -100,8 +100,8 @@ gint
lasso_idwsf2_data_service_set_service_type(LassoIdWsf2DataService *service, const char *prefix,
const char *service_type)
{
- if (!LASSO_IS_IDWSF2_DATA_SERVICE(service) || lasso_is_empty_string(prefix)
- || lasso_is_empty_string(service_type))
+ if (!LASSO_IS_IDWSF2_DATA_SERVICE(service) || lasso_strisempty(prefix)
+ || lasso_strisempty(service_type))
return LASSO_PARAM_ERROR_INVALID_VALUE;
lasso_assign_string(service->private_data->service_type_prefix, prefix);
lasso_assign_string(service->private_data->service_type, service_type);
@@ -259,7 +259,7 @@ lasso_idwsf2_data_service_add_query_item(LassoIdWsf2DataService *service, const
/* Check duplicates */
lasso_foreach(i, service->private_data->query_items) {
LassoIdWsf2DstRefQueryItem *old_item = (LassoIdWsf2DstRefQueryItem *)i->data;
- if (g_strcmp0(old_item->parent.parent.itemID, item_id) == 0) {
+ if (lasso_strisequal(old_item->parent.parent.itemID,item_id)) {
return LASSO_IDWSF2_DST_ERROR_DUPLICATE_ITEM;
}
}
@@ -298,7 +298,7 @@ lasso_idwsf2_data_service_add_modify_item(LassoIdWsf2DataService *service, const
}
lasso_foreach(i, service->private_data->modify_items) {
LassoIdWsf2DstRefModifyItem *old_item = (LassoIdWsf2DstRefModifyItem *)i->data;
- if (g_strcmp0(old_item->id, item_id) == 0) {
+ if (lasso_strisequal(old_item->id,item_id)) {
return LASSO_IDWSF2_DST_ERROR_DUPLICATE_ITEM;
}
}
@@ -391,7 +391,7 @@ lasso_idwsf2_data_service_get_item(LassoIdWsf2DataService *service,
}
lasso_foreach(i, service->private_data->query_items) {
LassoIdWsf2DstRefQueryItem *old_item = (LassoIdWsf2DstRefQueryItem *)i->data;
- if (g_strcmp0(old_item->parent.parent.itemID, item_id) == 0) {
+ if (lasso_strisequal(old_item->parent.parent.itemID,item_id)) {
return (LassoNode*)old_item;
}
}
@@ -405,7 +405,7 @@ lasso_idwsf2_data_service_get_item(LassoIdWsf2DataService *service,
}
lasso_foreach(i, service->private_data->modify_items) {
LassoIdWsf2DstRefModifyItem *old_item = (LassoIdWsf2DstRefModifyItem *)i->data;
- if (g_strcmp0(old_item->id, item_id) == 0) {
+ if (lasso_strisequal(old_item->id,item_id)) {
return (LassoNode*)old_item;
}
}
@@ -428,12 +428,12 @@ gint
lasso_idwsf2_data_service_add_namespace(LassoIdWsf2DataService *service, const char *prefix,
const char *href)
{
- if (xmlValidateNCName(BAD_CAST prefix, 0) && ! lasso_is_empty_string(href))
+ if (xmlValidateNCName(BAD_CAST prefix, 0) && ! lasso_strisempty(href))
return LASSO_PARAM_ERROR_INVALID_VALUE;
if (g_hash_table_lookup(service->private_data->namespaces, prefix) != NULL ||
- g_strcmp0(service->private_data->service_type_prefix, prefix) == 0 ||
- g_strcmp0(prefix, LASSO_IDWSF2_DSTREF_PREFIX) == 0) {
+ lasso_strisequal(service->private_data->service_type_prefix,prefix) ||
+ lasso_strisequal(prefix,LASSO_IDWSF2_DSTREF_PREFIX)) {
return LASSO_PARAM_ERROR_INVALID_VALUE;
}
@@ -833,13 +833,13 @@ lasso_idwsf2_data_service_process_response_msg(
if (! status || ! status->code) {
goto_cleanup_with_rc(LASSO_PROFILE_ERROR_MISSING_STATUS_CODE);
}
- if (g_strcmp0(status->code, LASSO_DST2_STATUS_CODE1_FAILED) == 0) {
+ if (lasso_strisequal(status->code,LASSO_DST2_STATUS_CODE1_FAILED)) {
goto_cleanup_with_rc(LASSO_PROFILE_ERROR_STATUS_NOT_SUCCESS);
}
- if (g_strcmp0(status->code, LASSO_DST2_STATUS_CODE1_PARTIAL) == 0) {
+ if (lasso_strisequal(status->code,LASSO_DST2_STATUS_CODE1_PARTIAL)) {
rc = LASSO_IDWSF2_DST_ERROR_PARTIAL_FAILURE;
}
- if (g_strcmp0(status->code, LASSO_DST2_STATUS_CODE1_OK) != 0) {
+ if (lasso_strisnotequal(status->code,LASSO_DST2_STATUS_CODE1_OK)) {
rc = LASSO_IDWSF2_DST_ERROR_UNKNOWN_STATUS_CODE;
}
@@ -910,7 +910,7 @@ lasso_idwsf2_data_service_get_query_item_result(LassoIdWsf2DataService *service,
}
lasso_foreach(i, service->private_data->query_datas) {
LassoIdWsf2DstRefData *data = (LassoIdWsf2DstRefData*)i->data;
- if (g_strcmp0(data->parent.itemIDRef, item_id) == 0) {
+ if (lasso_strisequal(data->parent.itemIDRef,item_id)) {
return data;
}
}
diff --git a/lasso/id-wsf-2.0/discovery.c b/lasso/id-wsf-2.0/discovery.c
index 4b8f0388..bc8e58fe 100644
--- a/lasso/id-wsf-2.0/discovery.c
+++ b/lasso/id-wsf-2.0/discovery.c
@@ -227,7 +227,7 @@ lasso_idwsf2_discovery_status2rc(LassoIdWsf2UtilStatus *status)
return LASSO_PROFILE_ERROR_MISSING_STATUS_CODE;
for (i = 0; i < G_N_ELEMENTS(code2rc); ++i) {
- if (g_strcmp0(status->code, code2rc[i].code) == 0) {
+ if (lasso_strisequal(status->code,code2rc[i].code)) {
rc = code2rc[i].rc;
}
}
@@ -572,7 +572,7 @@ lasso_idwsf2_discovery_build_request_msg(LassoIdWsf2Discovery *discovery,
GList *i;
lasso_foreach(i, discovery->private_data->metadatas) {
LassoIdWsf2DiscoSvcMetadata *metadata = (LassoIdWsf2DiscoSvcMetadata *)i->data;
- if (lasso_is_empty_string(metadata->svcMDID)) {
+ if (lasso_strisempty(metadata->svcMDID)) {
message(G_LOG_LEVEL_WARNING, "disco:MetadataReplace method called with " \
"non registered metadatas " \
"(svcMDID attribute is missing)");
@@ -827,7 +827,7 @@ _string_list_intersect(GList *a, GList *b)
lasso_foreach(i, a)
{
lasso_foreach(j, b)
- if (g_strcmp0(i->data, j->data) == 0) {
+ if (lasso_strisequal(i->data,j->data)) {
return TRUE;
}
}
@@ -842,7 +842,7 @@ _string_list_contains(GList *a, const char *str)
if (a == NULL)
return TRUE;
lasso_foreach(i, a)
- if (g_strcmp0(i->data, str) == 0) {
+ if (lasso_strisequal(i->data,str)) {
return TRUE;
}
return FALSE;
@@ -917,7 +917,7 @@ lasso_idwsf2_discovery_match_request_service_and_metadata2(
gboolean has20 = FALSE;
lasso_foreach (k, endpoint_context->Framework) {
LassoIdWsf2SbfFramework *framework = k->data;
- if (LASSO_IS_IDWSF2_SBF_FRAMEWORK(framework) && g_strcmp0(framework->version, "2.0") == 0)
+ if (LASSO_IS_IDWSF2_SBF_FRAMEWORK(framework) && lasso_strisequal(framework->version,"2.0"))
has20 = TRUE;
}
result = result && has20;
diff --git a/lasso/id-wsf-2.0/idwsf2_helper.c b/lasso/id-wsf-2.0/idwsf2_helper.c
index 8e5b6e01..f8577ed9 100644
--- a/lasso/id-wsf-2.0/idwsf2_helper.c
+++ b/lasso/id-wsf-2.0/idwsf2_helper.c
@@ -115,7 +115,7 @@ lasso_wsa_endpoint_reference_get_idwsf2_security_context_for_security_mechanism(
lasso_foreach_full_begin(LassoIdWsf2DiscoSecurityContext*, context, it1, epr->Metadata->any);
if (LASSO_IS_IDWSF2_DISCO_SECURITY_CONTEXT (context)) {
lasso_foreach_full_begin(char*, textnode, it2, context->SecurityMechID);
- if (g_strcmp0 (textnode, security_mech_id) == 0 || sech_mech_predicate(textnode)) {
+ if (lasso_strisequal(textnode,security_mech_id) || sech_mech_predicate(textnode)) {
return context;
}
lasso_foreach_full_end()
@@ -165,7 +165,7 @@ lasso_wsa_endpoint_reference_get_token_by_usage(
epr, sec_mech_predicate, security_mech_id, TRUE);
lasso_foreach_full_begin (LassoIdWsf2SecToken*, token, iter, security_context->Token);
if (LASSO_IS_IDWSF2_SEC_TOKEN (token)) {
- if (usage && g_strcmp0(token->usage, usage) == 0) {
+ if (usage && lasso_strisequal(token->usage,usage)) {
if (LASSO_IS_NODE(token->any)) {
return (LassoNode*)token->any;
} else if (token->ref) {
diff --git a/lasso/id-wsf-2.0/profile.c b/lasso/id-wsf-2.0/profile.c
index 6fce0b01..489c5899 100644
--- a/lasso/id-wsf-2.0/profile.c
+++ b/lasso/id-wsf-2.0/profile.c
@@ -435,7 +435,7 @@ lasso_idwsf2_profile_check_security_mechanism(LassoIdWsf2Profile *profile,
name_qualifier = assertion->Subject->NameID->NameQualifier;
sp_name_qualifier = assertion->Subject->NameID->SPNameQualifier;
}
- if (! name_qualifier || g_strcmp0(name_qualifier, issuer->ProviderID) != 0)
+ if (! name_qualifier || lasso_strisnotequal(name_qualifier,issuer->ProviderID))
goto_cleanup_with_rc(LASSO_PROFILE_ERROR_INVALID_ASSERTION);
/* There is two cases for the NameID of the security assertion:
* - we are the IdP and the Wsp, so the NameQualifier is us and the SPNameQualifier is the
@@ -449,10 +449,10 @@ lasso_idwsf2_profile_check_security_mechanism(LassoIdWsf2Profile *profile,
sender_id = lasso_soap_envelope_sb2_get_provider_id(envelope);
if (! sender_id)
goto_cleanup_with_rc(LASSO_WSF_PROFILE_ERROR_MISSING_SENDER_ID);
- if (local_service_id && g_strcmp0(local_service_id, name_qualifier) == 0 &&
- sp_name_qualifier && g_strcmp0(sp_name_qualifier, sender_id) == 0) {
+ if (local_service_id && lasso_strisequal(local_service_id,name_qualifier) &&
+ sp_name_qualifier && lasso_strisequal(sp_name_qualifier,sender_id)) {
/* Ok. */
- } else if (sp_name_qualifier && g_strcmp0(sp_name_qualifier, local_service_id) == 0) {
+ } else if (sp_name_qualifier && lasso_strisequal(sp_name_qualifier,local_service_id)) {
/* Ok. */
} else {
goto_cleanup_with_rc(LASSO_PROFILE_ERROR_INVALID_ASSERTION);
diff --git a/lasso/id-wsf-2.0/saml2_login.c b/lasso/id-wsf-2.0/saml2_login.c
index f7bee3ad..fc0f074b 100644
--- a/lasso/id-wsf-2.0/saml2_login.c
+++ b/lasso/id-wsf-2.0/saml2_login.c
@@ -241,7 +241,7 @@ lasso_saml2_assertion_idwsf2_get_discovery_bootstrap_epr(LassoSaml2Assertion *as
continue;
attribute = LASSO_SAML2_ATTRIBUTE(j->data);
- if (g_strcmp0(attribute->Name, LASSO_SAML2_ATTRIBUTE_NAME_EPR) != 0)
+ if (lasso_strisnotequal(attribute->Name,LASSO_SAML2_ATTRIBUTE_NAME_EPR))
continue;
/* There should only one attribute value, and the EPR should be the first
* contained node */
diff --git a/lasso/id-wsf-2.0/soap_binding.c b/lasso/id-wsf-2.0/soap_binding.c
index ea922dae..347a1513 100644
--- a/lasso/id-wsf-2.0/soap_binding.c
+++ b/lasso/id-wsf-2.0/soap_binding.c
@@ -240,7 +240,7 @@ lasso_soap_envelope_get_action(LassoSoapEnvelope *soap_envelope)
lasso_foreach(i, soap_envelope->Header->Other) {
if (LASSO_IS_WSA_ATTRIBUTED_URI(i->data)
- && g_strcmp0(lasso_node_get_name((LassoNode*)i->data), "Action")) {
+ && lasso_strisequal(lasso_node_get_name((LassoNode *)i->data),"Action")) {
return ((LassoWsAddrAttributedURI*)i->data)->content;
}
}
@@ -273,9 +273,9 @@ _get_node(GList **list, GType node_type, const char *node_name, const char *node
if (LASSO_IS_NODE(node) &&
(! node_type || ( G_IS_OBJECT(node) && G_OBJECT_TYPE(node) == node_type)) &&
- (! node_name || g_strcmp0(lasso_node_get_name(node), node_name) == 0) &&
+ (! node_name || lasso_strisequal(lasso_node_get_name(node),node_name)) &&
(! node_namespace ||
- g_strcmp0(lasso_node_get_namespace(node), node_namespace) == 0)) {
+ lasso_strisequal(lasso_node_get_namespace(node),node_namespace))) {
return node;
}
}
@@ -284,10 +284,10 @@ _get_node(GList **list, GType node_type, const char *node_name, const char *node
if (! node) {
return NULL;
}
- if (g_strcmp0(lasso_node_get_name(node), node_name) != 0) {
+ if (lasso_strisnotequal(lasso_node_get_name(node),node_name)) {
lasso_node_set_custom_nodename(node, node_name);
}
- if (g_strcmp0(lasso_node_get_namespace(node), node_namespace) == 0) {
+ if (lasso_strisequal(lasso_node_get_namespace(node),node_namespace)) {
lasso_node_set_custom_namespace(node, node_namespace, node_prefix);
}
lasso_list_add_new_gobject(*list, node);
@@ -437,11 +437,11 @@ lasso_soap_envelope_get_sb2_user_interaction_hint(LassoSoapEnvelope *soap_envelo
header = lasso_soap_envelope_get_sb2_user_interaction_header(soap_envelope, FALSE);
if (header) {
hint = header->interact;
- if (g_strcmp0(hint, LASSO_SB2_USER_INTERACTION_INTERACT_IF_NEEDED) == 0)
+ if (lasso_strisequal(hint,LASSO_SB2_USER_INTERACTION_INTERACT_IF_NEEDED))
return LASSO_IDWSF2_SB2_USER_INTERACTION_HINT_INTERACT_IF_NEEDED;
- if (g_strcmp0(hint, LASSO_SB2_USER_INTERACTION_DO_NOT_INTERACT) == 0)
+ if (lasso_strisequal(hint,LASSO_SB2_USER_INTERACTION_DO_NOT_INTERACT))
return LASSO_IDWSF2_SB2_USER_INTERACTION_HINT_DO_NOT_INTERACT;
- if (g_strcmp0(hint, LASSO_SB2_USER_INTERACTION_DO_NOT_INTERACT_FOR_DATA) == 0)
+ if (lasso_strisequal(hint,LASSO_SB2_USER_INTERACTION_DO_NOT_INTERACT_FOR_DATA))
return LASSO_IDWSF2_SB2_USER_INTERACTION_HINT_DO_NOT_INTERACT_FOR_DATA;
}