Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 60058 invoked from network); 11 Jun 2007 09:43:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jun 2007 09:43:07 -0000 Received: (qmail 73564 invoked by uid 500); 11 Jun 2007 09:43:10 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 73459 invoked by uid 500); 11 Jun 2007 09:43:10 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 73448 invoked by uid 500); 11 Jun 2007 09:43:10 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 73445 invoked by uid 99); 11 Jun 2007 09:43:10 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2007 02:43:10 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2007 02:43:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 61F941A981A; Mon, 11 Jun 2007 02:42:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r546062 - in /webservices/axis2/trunk/c/neethi: include/ src/ src/secpolicy/builder/ src/secpolicy/model/ Date: Mon, 11 Jun 2007 09:42:43 -0000 To: axis2-cvs@ws.apache.org From: manjula@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070611094244.61F941A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: manjula Date: Mon Jun 11 02:42:41 2007 New Revision: 546062 URL: http://svn.apache.org/viewvc?view=rev&rev=546062 Log: Fixing memory leaks by keeping a ref count. Modified: webservices/axis2/trunk/c/neethi/include/neethi_operator.h webservices/axis2/trunk/c/neethi/include/neethi_policy.h webservices/axis2/trunk/c/neethi/include/rp_algorithmsuite.h webservices/axis2/trunk/c/neethi/include/rp_layout.h webservices/axis2/trunk/c/neethi/include/rp_property.h webservices/axis2/trunk/c/neethi/include/rp_supporting_tokens.h webservices/axis2/trunk/c/neethi/include/rp_username_token.h webservices/axis2/trunk/c/neethi/include/rp_wss10.h webservices/axis2/trunk/c/neethi/include/rp_x509_token.h webservices/axis2/trunk/c/neethi/src/all.c webservices/axis2/trunk/c/neethi/src/assertion.c webservices/axis2/trunk/c/neethi/src/engine.c webservices/axis2/trunk/c/neethi/src/exactlyone.c webservices/axis2/trunk/c/neethi/src/operator.c webservices/axis2/trunk/c/neethi/src/policy.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/layout_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_binding_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/algorithmsuite.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/asymmetric_binding.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/binding_commons.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/layout.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/supporting_tokens.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/wss10.c webservices/axis2/trunk/c/neethi/src/secpolicy/model/x509_token.c Modified: webservices/axis2/trunk/c/neethi/include/neethi_operator.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/neethi_operator.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/neethi_operator.h (original) +++ webservices/axis2/trunk/c/neethi/include/neethi_operator.h Mon Jun 11 02:42:41 2007 @@ -80,6 +80,10 @@ neethi_operator_t *neethi_operator, const axutil_env_t *env); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + neethi_operator_increment_ref( + neethi_operator_t *neethi_operator, + const axutil_env_t *env); /** @} */ Modified: webservices/axis2/trunk/c/neethi/include/neethi_policy.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/neethi_policy.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/neethi_policy.h (original) +++ webservices/axis2/trunk/c/neethi/include/neethi_policy.h Mon Jun 11 02:42:41 2007 @@ -106,7 +106,7 @@ neethi_policy_set_components_null( neethi_policy_t *policy, const axutil_env_t *env); - + /** @} */ #ifdef __cplusplus Modified: webservices/axis2/trunk/c/neethi/include/rp_algorithmsuite.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_algorithmsuite.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_algorithmsuite.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_algorithmsuite.h Mon Jun 11 02:42:41 2007 @@ -169,6 +169,11 @@ const axutil_env_t *env, axis2_char_t *xpath); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_algorithmsuite_increment_ref(rp_algorithmsuite_t *algorithmsuite, + const axutil_env_t *env); + + #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/neethi/include/rp_layout.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_layout.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_layout.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_layout.h Mon Jun 11 02:42:41 2007 @@ -47,6 +47,11 @@ const axutil_env_t *env, axis2_char_t *value); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_layout_increment_ref(rp_layout_t *layout, + const axutil_env_t *env); + + #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/neethi/include/rp_property.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_property.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_property.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_property.h Mon Jun 11 02:42:41 2007 @@ -61,6 +61,12 @@ rp_property_t *property, const axutil_env_t *env); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_property_increment_ref(rp_property_t *property, + const axutil_env_t *env); + + + #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/neethi/include/rp_supporting_tokens.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_supporting_tokens.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_supporting_tokens.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_supporting_tokens.h Mon Jun 11 02:42:41 2007 @@ -111,6 +111,11 @@ const axutil_env_t *env, int type); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_supporting_tokens_increment_ref(rp_supporting_tokens_t *supporting_tokens, + const axutil_env_t *env); + + #ifdef __cplusplus } Modified: webservices/axis2/trunk/c/neethi/include/rp_username_token.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_username_token.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_username_token.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_username_token.h Mon Jun 11 02:42:41 2007 @@ -83,6 +83,12 @@ const axutil_env_t *env, axis2_bool_t useUTprofile11); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_username_token_increment_ref( + rp_username_token_t *username_token, + const axutil_env_t *env); + + #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/neethi/include/rp_wss10.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_wss10.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_wss10.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_wss10.h Mon Jun 11 02:42:41 2007 @@ -74,6 +74,11 @@ const axutil_env_t *env, axis2_bool_t must_support_ref_embedded_token); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_wss10_increment_ref(rp_wss10_t *wss10, + const axutil_env_t *env); + + #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/neethi/include/rp_x509_token.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/rp_x509_token.h?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/include/rp_x509_token.h (original) +++ webservices/axis2/trunk/c/neethi/include/rp_x509_token.h Mon Jun 11 02:42:41 2007 @@ -101,8 +101,10 @@ const axutil_env_t *env, axis2_char_t *token_version_and_type); - - + AXIS2_EXTERN axis2_status_t AXIS2_CALL + rp_x509_token_increment_ref(rp_x509_token_t *x509_token, + const axutil_env_t *env); + #ifdef __cplusplus } Modified: webservices/axis2/trunk/c/neethi/src/all.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/all.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/all.c (original) +++ webservices/axis2/trunk/c/neethi/src/all.c Mon Jun 11 02:42:41 2007 @@ -67,7 +67,7 @@ { neethi_operator_t *operator = NULL; operator = (neethi_operator_t *) - axutil_array_list_get(neethi_all->policy_components,env, i); + axutil_array_list_get(neethi_all->policy_components, env, i); if (operator) neethi_operator_free(operator, env); @@ -76,7 +76,7 @@ axutil_array_list_free(neethi_all->policy_components , env); neethi_all->policy_components = NULL; } - AXIS2_FREE(env->allocator,neethi_all); + AXIS2_FREE(env->allocator, neethi_all); neethi_all = NULL; } return; @@ -112,7 +112,8 @@ { void *value = NULL; value = axutil_array_list_get(arraylist ,env ,i); - axutil_array_list_add(all->policy_components,env,value); + neethi_operator_increment_ref((neethi_operator_t *)value, env); + axutil_array_list_add(all->policy_components, env, value); } return AXIS2_SUCCESS; } @@ -126,7 +127,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - axutil_array_list_add(neethi_all->policy_components,env,operator); + neethi_operator_increment_ref(operator, env); + axutil_array_list_add(neethi_all->policy_components, env, operator); return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/assertion.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/assertion.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/assertion.c (original) +++ webservices/axis2/trunk/c/neethi/src/assertion.c Mon Jun 11 02:42:41 2007 @@ -18,6 +18,13 @@ #include +#include +#include +#include +#include +#include +#include +#include struct neethi_assertion_t { @@ -92,6 +99,40 @@ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } + + if(type == ASSERTION_TYPE_X509_TOKEN) + { + rp_x509_token_increment_ref((rp_x509_token_t *)value, env); + } + if(type == ASSERTION_TYPE_INITIATOR_TOKEN) + { + rp_property_increment_ref((rp_property_t *)value, env); + } + if(type == ASSERTION_TYPE_RECIPIENT_TOKEN) + { + rp_property_increment_ref((rp_property_t *)value, env); + } + if(type == ASSERTION_TYPE_LAYOUT) + { + rp_layout_increment_ref((rp_layout_t *)value, env); + } + if(type == ASSERTION_TYPE_ALGORITHM_SUITE) + { + rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *)value, env); + } + if(type == ASSERTION_TYPE_WSS10) + { + rp_wss10_increment_ref((rp_wss10_t *)value, env); + } + if(type == ASSERTION_TYPE_SUPPORTING_TOKENS) + { + rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env); + } + if(type == ASSERTION_TYPE_USERNAME_TOKEN) + { + rp_username_token_increment_ref((rp_username_token_t *)value, env); + } + neethi_assertion->value = value; neethi_assertion->type = type; neethi_assertion->element = NULL; @@ -122,13 +163,13 @@ { neethi_operator_t *operator = NULL; operator = (neethi_operator_t *) - axutil_array_list_get(neethi_assertion->policy_components,env, i); + axutil_array_list_get(neethi_assertion->policy_components, env, i); if (operator) neethi_operator_free(operator, env); operator = NULL; } - axutil_array_list_free(neethi_assertion->policy_components , env); + axutil_array_list_free(neethi_assertion->policy_components, env); neethi_assertion->policy_components = NULL; } if(neethi_assertion->value) @@ -138,7 +179,7 @@ neethi_assertion->free_func(neethi_assertion->value, env); } } - AXIS2_FREE(env->allocator,neethi_assertion); + AXIS2_FREE(env->allocator, neethi_assertion); neethi_assertion = NULL; } return; @@ -174,6 +215,10 @@ AXIS2_ENV_CHECK(env, AXIS2_FAILURE); neethi_assertion->type = type; + if(type == ASSERTION_TYPE_X509_TOKEN) + { + rp_x509_token_increment_ref((rp_x509_token_t *)value, env); + } neethi_assertion->value =(void *)value; return AXIS2_SUCCESS; @@ -270,7 +315,8 @@ { void *value = NULL; value = axutil_array_list_get(arraylist ,env ,i); - axutil_array_list_add(neethi_assertion->policy_components,env,value); + neethi_operator_increment_ref((neethi_operator_t *)value, env); + axutil_array_list_add(neethi_assertion->policy_components, env, value); } return AXIS2_SUCCESS; } @@ -282,7 +328,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - axutil_array_list_add(neethi_assertion->policy_components,env,operator); + neethi_operator_increment_ref(operator, env); + axutil_array_list_add(neethi_assertion->policy_components, env, operator); return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/engine.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/engine.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/engine.c (original) +++ webservices/axis2/trunk/c/neethi/src/engine.c Mon Jun 11 02:42:41 2007 @@ -116,14 +116,13 @@ { return NULL; } - neethi_operator_set_value(neethi_operator,env,all,OPERATOR_TYPE_ALL); - process_operation_element(env,neethi_operator,node,element); + neethi_operator_set_value(neethi_operator, env, all, OPERATOR_TYPE_ALL); + process_operation_element(env, neethi_operator, node, element); neethi_operator_set_value_null(neethi_operator, env); - neethi_operator_free(neethi_operator, env); neethi_operator = NULL; - + return all; } @@ -150,7 +149,6 @@ process_operation_element(env,neethi_operator,node,element); neethi_operator_set_value_null(neethi_operator, env); - neethi_operator_free(neethi_operator, env); neethi_operator = NULL; @@ -208,11 +206,10 @@ { return NULL; } - neethi_operator_set_value(neethi_operator,env,neethi_policy,OPERATOR_TYPE_POLICY); - process_operation_element(env,neethi_operator,node,element); + neethi_operator_set_value(neethi_operator, env, neethi_policy, OPERATOR_TYPE_POLICY); + process_operation_element(env, neethi_operator, node, element); neethi_operator_set_value_null(neethi_operator, env); - neethi_operator_free(neethi_operator, env); neethi_operator = NULL; @@ -233,8 +230,8 @@ axiom_children_iterator_t *children_iter = NULL; void *value = NULL; - type = neethi_operator_get_type(neethi_operator,env); - value = neethi_operator_get_value(neethi_operator,env); + type = neethi_operator_get_type(neethi_operator, env); + value = neethi_operator_get_value(neethi_operator, env); if(type == OPERATOR_TYPE_POLICY) { /*Adding attribute values to the hashmap logic @@ -305,31 +302,31 @@ { if(axutil_strcmp(local_name,NEETHI_POLICY)==0) { - neethi_policy_t *neethi_policy = get_operator_neethi_policy(env,child_node,child_element); + neethi_policy_t *neethi_policy = get_operator_neethi_policy(env, child_node, child_element); operator = neethi_operator_create(env); - neethi_operator_set_value(operator,env,neethi_policy,OPERATOR_TYPE_POLICY); - neethi_engine_add_policy_component(env,neethi_operator,operator); + neethi_operator_set_value(operator, env, neethi_policy, OPERATOR_TYPE_POLICY); + neethi_engine_add_policy_component(env, neethi_operator, operator); } else if(axutil_strcmp(local_name,NEETHI_ALL)==0) { - neethi_all_t *all = get_operator_all(env,child_node,child_element); + neethi_all_t *all = get_operator_all(env, child_node, child_element); operator = neethi_operator_create(env); - neethi_operator_set_value(operator,env,all,OPERATOR_TYPE_ALL); - neethi_engine_add_policy_component(env,neethi_operator,operator); + neethi_operator_set_value(operator,env, all, OPERATOR_TYPE_ALL); + neethi_engine_add_policy_component(env, neethi_operator, operator); } else if(axutil_strcmp(local_name,NEETHI_EXACTLYONE)==0) { - neethi_exactlyone_t *exactlyone = get_operator_exactlyone(env,child_node,child_element); + neethi_exactlyone_t *exactlyone = get_operator_exactlyone(env, child_node, child_element); operator = neethi_operator_create(env); - neethi_operator_set_value(operator,env,exactlyone,OPERATOR_TYPE_EXACTLYONE); - neethi_engine_add_policy_component(env,neethi_operator,operator); + neethi_operator_set_value(operator, env, exactlyone, OPERATOR_TYPE_EXACTLYONE); + neethi_engine_add_policy_component(env, neethi_operator, operator); } else if(axutil_strcmp(local_name,NEETHI_REFERENCE)==0) { - neethi_reference_t *reference = get_operator_reference(env,child_node,child_element); + neethi_reference_t *reference = get_operator_reference(env, child_node, child_element); operator = neethi_operator_create(env); - neethi_operator_set_value(operator,env,reference,OPERATOR_TYPE_REFERENCE); - neethi_engine_add_policy_component(env,neethi_operator,operator); + neethi_operator_set_value(operator, env, reference, OPERATOR_TYPE_REFERENCE); + neethi_engine_add_policy_component(env, neethi_operator, operator); } } else @@ -337,7 +334,7 @@ neethi_assertion_t *assertion = neethi_assertion_builder_build(env, child_node, child_element); operator = neethi_operator_create(env); neethi_operator_set_value(operator, env, assertion, OPERATOR_TYPE_ASSERTION); - neethi_engine_add_policy_component(env,neethi_operator,operator); + neethi_engine_add_policy_component(env, neethi_operator, operator); } } } @@ -362,8 +359,8 @@ neethi_all_t *all = NULL; neethi_assertion_t *assertion = NULL; - type = neethi_operator_get_type(container_operator,env); - value = neethi_operator_get_value(container_operator,env); + type = neethi_operator_get_type(container_operator, env); + value = neethi_operator_get_value(container_operator, env); if(value) { @@ -371,19 +368,19 @@ { case OPERATOR_TYPE_POLICY: neethi_policy = (neethi_policy_t *)value; - neethi_policy_add_operator(neethi_policy,env,component); + neethi_policy_add_operator(neethi_policy, env, component); /*printf("neethi_policy\n");*/ break; case OPERATOR_TYPE_ALL: all = (neethi_all_t *)value; - neethi_all_add_operator(all,env,component); + neethi_all_add_operator(all, env, component); /*printf("all\n");*/ break; case OPERATOR_TYPE_EXACTLYONE: exactlyone = (neethi_exactlyone_t *)value; - neethi_exactlyone_add_operator(exactlyone,env,component); + neethi_exactlyone_add_operator(exactlyone, env, component); /*printf("exactlyone\n");*/ break; @@ -477,20 +474,19 @@ } operator = neethi_operator_create(env); - neethi_operator_set_value(operator,env,neethi_policy,OPERATOR_TYPE_POLICY); + neethi_operator_set_value(operator, env, neethi_policy, OPERATOR_TYPE_POLICY); - exactlyone = normalize_operator(operator,registry,deep,env); + exactlyone = normalize_operator(operator, registry, deep, env); neethi_operator_set_value_null(operator, env); - neethi_operator_free(operator, env); operator = NULL; - + if(exactlyone) { component = neethi_operator_create(env); - neethi_operator_set_value(component,env,exactlyone,OPERATOR_TYPE_EXACTLYONE); - neethi_policy_add_operator(resultant_neethi_policy,env,component); + neethi_operator_set_value(component, env, exactlyone, OPERATOR_TYPE_EXACTLYONE); + neethi_policy_add_operator(resultant_neethi_policy, env, component); /*check_neethi_policy(resultant_neethi_policy,env);*/ return resultant_neethi_policy; @@ -511,21 +507,21 @@ neethi_policy_t *neethi_policy = NULL; neethi_operator_t *component = NULL; - exactlyone1 = neethi_policy_get_exactlyone(neethi_policy1,env); - exactlyone2 = neethi_policy_get_exactlyone(neethi_policy2,env); + exactlyone1 = neethi_policy_get_exactlyone(neethi_policy1, env); + exactlyone2 = neethi_policy_get_exactlyone(neethi_policy2, env); if(!exactlyone1 || !exactlyone2) { /*printf("Merged fail Input wrong \n");*/ return NULL; } - exactlyone = get_cross_product(exactlyone1,exactlyone2,env); + exactlyone = get_cross_product(exactlyone1, exactlyone2, env); neethi_policy = neethi_policy_create(env); component = neethi_operator_create(env); - neethi_operator_set_value(component,env,exactlyone,OPERATOR_TYPE_EXACTLYONE); - neethi_policy_add_operator(neethi_policy,env,component); + neethi_operator_set_value(component, env, exactlyone, OPERATOR_TYPE_EXACTLYONE); + neethi_policy_add_operator(neethi_policy, env, component); return neethi_policy; } @@ -651,9 +647,9 @@ axutil_array_list_t *arraylist = NULL; int i = 0; - neethi_operator_type_t type = neethi_operator_get_type(operator,env); + neethi_operator_type_t type = neethi_operator_get_type(operator, env); - if(operator_is_empty(operator,env)) + if(operator_is_empty(operator, env)) { neethi_exactlyone_t *exactlyone = NULL; exactlyone = neethi_exactlyone_create(env); @@ -663,20 +659,20 @@ neethi_operator_t *component = NULL; all = neethi_all_create(env); component = neethi_operator_create(env); - neethi_operator_set_value(component,env,all,OPERATOR_TYPE_ALL); - neethi_exactlyone_add_operator(exactlyone,env,component); + neethi_operator_set_value(component, env, all, OPERATOR_TYPE_ALL); + neethi_exactlyone_add_operator(exactlyone, env, component); } return exactlyone; } - child_component_list = axutil_array_list_create(env,0); - arraylist = operator_get_components(operator,env); + child_component_list = axutil_array_list_create(env, 0); + arraylist = operator_get_components(operator, env); - for (i = 0; i < axutil_array_list_size(arraylist,env); i++) + for (i = 0; i < axutil_array_list_size(arraylist, env); i++) { neethi_operator_type_t component_type; child_component = (neethi_operator_t *)axutil_array_list_get(arraylist ,env ,i); - component_type = neethi_operator_get_type(child_component,env); + component_type = neethi_operator_get_type(child_component, env); if(component_type == OPERATOR_TYPE_ASSERTION) { @@ -697,7 +693,7 @@ op = neethi_operator_create(env); neethi_all_add_operator(all, env, child_component); - neethi_operator_set_value(op, env, all,OPERATOR_TYPE_ALL); + neethi_operator_set_value(op, env, all, OPERATOR_TYPE_ALL); neethi_exactlyone_add_operator(exactlyone, env, op); axutil_array_list_add(child_component_list, env, exactlyone); } @@ -711,15 +707,13 @@ neethi_exactlyone_t *exactlyone = NULL; all = neethi_all_create(env); - neethi_policy = (neethi_policy_t *)neethi_operator_get_value(child_component,env); - children = neethi_policy_get_policy_components(neethi_policy,env); - neethi_all_add_policy_components(all,children,env); - axutil_array_list_free(children, env); - children = NULL; + neethi_policy = (neethi_policy_t *)neethi_operator_get_value(child_component, env); + children = neethi_policy_get_policy_components(neethi_policy, env); + neethi_all_add_policy_components(all, children, env); to_normalize = neethi_operator_create(env); - neethi_operator_set_value(to_normalize,env,all,OPERATOR_TYPE_ALL); - exactlyone = normalize_operator(to_normalize,registry,deep,env); - axutil_array_list_add(child_component_list,env,exactlyone); + neethi_operator_set_value(to_normalize, env, all, OPERATOR_TYPE_ALL); + exactlyone = normalize_operator(to_normalize, registry, deep, env); + axutil_array_list_add(child_component_list, env, exactlyone); } else if(component_type == OPERATOR_TYPE_REFERENCE) { @@ -747,26 +741,23 @@ neethi_operator_set_value(child_component, env, policy, OPERATOR_TYPE_POLICY); all = neethi_all_create(env); - policy = (neethi_policy_t *)neethi_operator_get_value(child_component,env); - children = neethi_policy_get_policy_components(policy,env); - neethi_all_add_policy_components(all,children,env); - axutil_array_list_free(children, env); - children = NULL; + policy = (neethi_policy_t *)neethi_operator_get_value(child_component, env); + children = neethi_policy_get_policy_components(policy, env); + neethi_all_add_policy_components(all, children, env); to_normalize = neethi_operator_create(env); - neethi_operator_set_value(to_normalize,env,all,OPERATOR_TYPE_ALL); - exactlyone = normalize_operator(to_normalize,registry,deep,env); - axutil_array_list_add(child_component_list,env,exactlyone); + neethi_operator_set_value(to_normalize, env, all, OPERATOR_TYPE_ALL); + exactlyone = normalize_operator(to_normalize, registry, deep, env); + axutil_array_list_add(child_component_list, env, exactlyone); } else { neethi_exactlyone_t *exactlyone = NULL; - exactlyone = normalize_operator(child_component,registry,deep,env); - axutil_array_list_add(child_component_list,env,exactlyone); + exactlyone = normalize_operator(child_component, registry, deep, env); + axutil_array_list_add(child_component_list, env, exactlyone); } } - axutil_array_list_free(arraylist, env); - arraylist = NULL; - return compute_resultant_component(child_component_list,type,env); + + return compute_resultant_component(child_component_list, type, env); } @@ -777,7 +768,7 @@ const axutil_env_t *env) { neethi_exactlyone_t *exactlyone = NULL; - exactlyone = neethi_exactlyone_create(env); + /*exactlyone = neethi_exactlyone_create(env);*/ if(type == OPERATOR_TYPE_EXACTLYONE) { @@ -786,57 +777,54 @@ for(i=0; i1) + if(axutil_array_list_size(normalized_inner_components, env)>1) { int i = 0; - exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(normalized_inner_components,env,0); - if(!neethi_exactlyone_is_empty(exactlyone,env)) + exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(normalized_inner_components, env, 0); + if(!neethi_exactlyone_is_empty(exactlyone, env)) { neethi_exactlyone_t *current_exactlyone = NULL; i = 1; - for(i=1; ipolicy_components,env, i); + axutil_array_list_get(neethi_exactlyone->policy_components, env, i); if (operator) neethi_operator_free(operator, env); operator = NULL; } - axutil_array_list_free(neethi_exactlyone->policy_components , env); + axutil_array_list_free(neethi_exactlyone->policy_components, env); neethi_exactlyone->policy_components = NULL; } - AXIS2_FREE(env->allocator,neethi_exactlyone); + AXIS2_FREE(env->allocator, neethi_exactlyone); neethi_exactlyone = NULL; } return; @@ -103,7 +103,7 @@ const axutil_env_t *env) { - int size = axutil_array_list_size(arraylist,env); + int size = axutil_array_list_size(arraylist, env); int i = 0; if (axutil_array_list_ensure_capacity(exactlyone->policy_components , env, size + 1) != AXIS2_SUCCESS) @@ -113,7 +113,8 @@ { void *value = NULL; value = axutil_array_list_get(arraylist ,env ,i); - axutil_array_list_add(exactlyone->policy_components,env,value); + neethi_operator_increment_ref((neethi_operator_t *)value, env); + axutil_array_list_add(exactlyone->policy_components, env, value); } return AXIS2_SUCCESS; } @@ -126,7 +127,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - axutil_array_list_add(neethi_exactlyone->policy_components,env,operator); + neethi_operator_increment_ref(operator, env); + axutil_array_list_add(neethi_exactlyone->policy_components, env, operator); return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/operator.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/operator.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/operator.c (original) +++ webservices/axis2/trunk/c/neethi/src/operator.c Mon Jun 11 02:42:41 2007 @@ -28,7 +28,7 @@ { void *value; neethi_operator_type_t type; - + int ref; }; AXIS2_EXTERN neethi_operator_t *AXIS2_CALL @@ -48,6 +48,7 @@ } neethi_operator->value = NULL; neethi_operator->type = OPERATOR_TYPE_UNKNOWN; + neethi_operator->ref = 0; return neethi_operator; } @@ -60,6 +61,11 @@ if(neethi_operator) { + if (--(neethi_operator->ref) > 0) + { + return; + } + if(neethi_operator->value) { switch(neethi_operator->type) @@ -201,3 +207,11 @@ return AXIS2_SUCCESS; } +AXIS2_EXTERN axis2_status_t AXIS2_CALL +neethi_operator_increment_ref(neethi_operator_t *operator, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + operator->ref++; + return AXIS2_SUCCESS; +} Modified: webservices/axis2/trunk/c/neethi/src/policy.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/policy.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/policy.c (original) +++ webservices/axis2/trunk/c/neethi/src/policy.c Mon Jun 11 02:42:41 2007 @@ -77,6 +77,7 @@ if(neethi_policy) { + if(neethi_policy->policy_components) { int i = 0; @@ -94,7 +95,7 @@ axutil_array_list_free(neethi_policy->policy_components , env); neethi_policy->policy_components = NULL; } - AXIS2_FREE(env->allocator,neethi_policy); + AXIS2_FREE(env->allocator, neethi_policy); neethi_policy = NULL; } return; @@ -130,7 +131,8 @@ { void *value = NULL; value = axutil_array_list_get(arraylist ,env ,i); - axutil_array_list_add(neethi_policy->policy_components,env,value); + neethi_operator_increment_ref((neethi_operator_t *)value, env); + axutil_array_list_add(neethi_policy->policy_components, env, value); } return AXIS2_SUCCESS; } @@ -144,7 +146,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - axutil_array_list_add(neethi_policy->policy_components,env,operator); + neethi_operator_increment_ref(operator, env); + axutil_array_list_add(neethi_policy->policy_components, env, operator); return AXIS2_SUCCESS; } @@ -182,6 +185,9 @@ return NULL; } exactlyone = (neethi_exactlyone_t *)neethi_operator_get_value(op,env); + /*neethi_operator_set_value_null(op, env); + neethi_operator_free(op, env); + op = NULL;*/ return exactlyone; } else @@ -312,4 +318,7 @@ policy->policy_components = NULL; return AXIS2_SUCCESS; } + + + Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c Mon Jun 11 02:42:41 2007 @@ -65,23 +65,17 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); + alternatives = neethi_policy_get_alternatives(normalized_policy, env); neethi_policy_free(policy, env); policy = NULL; - alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); asymmetric_binding_process_alternatives(env, all, asymmetric_binding); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, asymmetric_binding, ASSERTION_TYPE_ASSYMMETRIC_BINDING);*/ - neethi_policy_set_components_null(normalized_policy, env); - neethi_policy_free(normalized_policy, env); - normalized_policy = NULL; assertion = neethi_assertion_create_with_args(env, (void *)rp_asymmetric_binding_free, asymmetric_binding, ASSERTION_TYPE_ASSYMMETRIC_BINDING); - /*neethi_policy_free(policy, env); - policy = NULL;*/ + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; return assertion; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c Mon Jun 11 02:42:41 2007 @@ -50,7 +50,6 @@ neethi_all_t *all = NULL; neethi_assertion_t *assertion = NULL; neethi_policy_t *normalized_policy = NULL; - axutil_array_list_t *temp = NULL; initiator_token = rp_property_create(env); @@ -67,24 +66,18 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); neethi_policy_free(policy, env); policy = NULL; - alternatives =neethi_policy_get_alternatives(normalized_policy, env); + alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); initiator_token_process_alternatives(env, all, initiator_token); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, initiator_token, ASSERTION_TYPE_INITIATOR_TOKEN);*/ - temp = neethi_policy_get_policy_components(normalized_policy, env); - axutil_array_list_free(temp, env); - temp = NULL; - neethi_policy_set_components_null(normalized_policy, env); + assertion = neethi_assertion_create_with_args(env, (void *)rp_property_free, initiator_token, ASSERTION_TYPE_INITIATOR_TOKEN); + neethi_policy_free(normalized_policy, env); normalized_policy = NULL; - assertion = neethi_assertion_create_with_args(env, (void *)rp_property_free, initiator_token, ASSERTION_TYPE_INITIATOR_TOKEN); return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/layout_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/layout_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/layout_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/layout_builder.c Mon Jun 11 02:42:41 2007 @@ -57,8 +57,6 @@ if(!local_name) return NULL; rp_layout_set_value(layout, env, local_name); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, layout, ASSERTION_TYPE_LAYOUT);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_layout_free, layout, ASSERTION_TYPE_LAYOUT); return assertion; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c Mon Jun 11 02:42:41 2007 @@ -66,7 +66,6 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); neethi_policy_free(policy, env); policy = NULL; alternatives =neethi_policy_get_alternatives(normalized_policy, env); @@ -74,13 +73,11 @@ all = (neethi_all_t *)neethi_operator_get_value(component ,env); recipient_token_process_alternatives(env, all, recipient_token); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, recipient_token, ASSERTION_TYPE_RECIPIENT_TOKEN);*/ - neethi_policy_set_components_null(normalized_policy, env); + assertion = neethi_assertion_create_with_args(env, (void *)rp_property_free, recipient_token, ASSERTION_TYPE_RECIPIENT_TOKEN); + neethi_policy_free(normalized_policy, env); normalized_policy = NULL; - assertion = neethi_assertion_create_with_args(env, (void *)rp_property_free, recipient_token, ASSERTION_TYPE_RECIPIENT_TOKEN); return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c Mon Jun 11 02:42:41 2007 @@ -87,17 +87,18 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE,policy); - neethi_policy_set_components_null(policy, env); + alternatives = neethi_policy_get_alternatives(normalized_policy, env); neethi_policy_free(policy, env); policy = NULL; - alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); supporting_tokens_process_alternatives(env, all, supporting_tokens); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, supporting_tokens, ASSERTION_TYPE_SUPPORTING_TOKENS);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_supporting_tokens_free, supporting_tokens, ASSERTION_TYPE_SUPPORTING_TOKENS); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + return assertion; } else return NULL; @@ -136,7 +137,7 @@ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env); if(algorithmsuite) { - rp_supporting_tokens_set_algorithmsuite(supporting_tokens,env,algorithmsuite); + rp_supporting_tokens_set_algorithmsuite(supporting_tokens, env, algorithmsuite); } else return AXIS2_FAILURE; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_binding_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_binding_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_binding_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_binding_builder.c Mon Jun 11 02:42:41 2007 @@ -48,6 +48,7 @@ neethi_operator_t *component = NULL; neethi_all_t *all = NULL; neethi_assertion_t *assertion = NULL; + neethi_policy_t *normalized_policy = NULL; transport_binding = rp_transport_binding_create(env); @@ -63,15 +64,19 @@ { return NULL; } - policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - alternatives = neethi_policy_get_alternatives(policy, env); + normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); + neethi_policy_free(policy, env); + policy = NULL; + alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); transport_binding_process_alternatives(env, all, transport_binding); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, transport_binding, ASSERTION_TYPE_TRANSPORT_BINDING);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_transport_binding_free, transport_binding, ASSERTION_TYPE_TRANSPORT_BINDING); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_token_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/transport_token_builder.c Mon Jun 11 02:42:41 2007 @@ -49,6 +49,7 @@ neethi_operator_t *component = NULL; neethi_all_t *all = NULL; neethi_assertion_t *assertion = NULL; + neethi_policy_t *normalized_policy = NULL; transport_token = rp_property_create(env); @@ -64,15 +65,18 @@ { return NULL; } - policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - alternatives =neethi_policy_get_alternatives(policy, env); + normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); + policy = NULL; + alternatives =neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); transport_token_process_alternatives(env, all, transport_token); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, transport_token, ASSERTION_TYPE_TRANSPORT_TOKEN);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_property_free, transport_token, ASSERTION_TYPE_TRANSPORT_TOKEN); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c Mon Jun 11 02:42:41 2007 @@ -81,7 +81,6 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); neethi_policy_free(policy, env); policy = NULL; alternatives = neethi_policy_get_alternatives(normalized_policy, env); @@ -89,9 +88,11 @@ all = (neethi_all_t *)neethi_operator_get_value(component ,env); username_token_process_alternatives(env, all, username_token); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, username_token, ASSERTION_TYPE_USERNAME_TOKEN);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_username_token_free, username_token, ASSERTION_TYPE_USERNAME_TOKEN); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c Mon Jun 11 02:42:41 2007 @@ -65,7 +65,6 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); neethi_policy_free(policy, env); policy = NULL; alternatives = neethi_policy_get_alternatives(normalized_policy, env); @@ -73,9 +72,11 @@ all = (neethi_all_t *)neethi_operator_get_value(component ,env); wss10_process_alternatives(env, all, wss10); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, wss10, ASSERTION_TYPE_WSS10);*/ assertion = neethi_assertion_create_with_args(env, (void *)rp_wss10_free, wss10, ASSERTION_TYPE_WSS10); + + neethi_policy_free(normalized_policy, env); + normalized_policy = NULL; + return assertion; } else return NULL; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c Mon Jun 11 02:42:41 2007 @@ -51,6 +51,7 @@ axutil_qname_t *qname = NULL; neethi_assertion_t *assertion = NULL; neethi_policy_t *normalized_policy = NULL; + /*axutil_array_list_t *temp = NULL;*/ x509_token = rp_x509_token_create(env); qname = axutil_qname_create(env,RP_INCLUDE_TOKEN,RP_SP_NS,RP_SP_PREFIX); @@ -75,20 +76,18 @@ return NULL; } normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy); - neethi_policy_set_components_null(policy, env); neethi_policy_free(policy, env); policy = NULL; alternatives = neethi_policy_get_alternatives(normalized_policy, env); component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0); all = (neethi_all_t *)neethi_operator_get_value(component ,env); x509_token_process_alternatives(env, all, x509_token); + + assertion = neethi_assertion_create_with_args(env, (void *)rp_x509_token_free, x509_token, ASSERTION_TYPE_X509_TOKEN); - /*assertion = neethi_assertion_create(env); - neethi_assertion_set_value(assertion, env, x509_token, ASSERTION_TYPE_X509_TOKEN);*/ neethi_policy_free(normalized_policy, env); normalized_policy = NULL; - assertion = neethi_assertion_create_with_args(env, (void *)rp_x509_token_free, x509_token, ASSERTION_TYPE_X509_TOKEN); return assertion; } else return NULL; @@ -139,6 +138,10 @@ } else if(type == ASSERTION_TYPE_WSS_X509_V3_TOKEN_10) { + /*neethi_assertion_free(assertion, env); + assertion = NULL;*/ + /*neethi_operator_free(operator, env); + operator = NULL;*/ rp_x509_token_set_token_version_and_type(x509_token, env, RP_WSS_X509_V3_TOKEN_10); } else return AXIS2_FAILURE; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/algorithmsuite.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/algorithmsuite.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/algorithmsuite.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/algorithmsuite.c Mon Jun 11 02:42:41 2007 @@ -38,6 +38,7 @@ axis2_char_t *soap_normalization; axis2_char_t *str_transformation; axis2_char_t *xpath; + int ref; }; @@ -74,7 +75,7 @@ algorithmsuite->soap_normalization = NULL; algorithmsuite->str_transformation = NULL; algorithmsuite->xpath = NULL; - + algorithmsuite->ref = 0; return algorithmsuite; } @@ -86,6 +87,11 @@ if(algorithmsuite) { + if (--(algorithmsuite->ref) > 0) + { + return; + } + AXIS2_FREE(env->allocator, algorithmsuite); algorithmsuite = NULL; } @@ -592,3 +598,13 @@ algorithmsuite->xpath = xpath; return AXIS2_SUCCESS; } + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_algorithmsuite_increment_ref(rp_algorithmsuite_t *algorithmsuite, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + algorithmsuite->ref++; + return AXIS2_SUCCESS; +} + Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/asymmetric_binding.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/asymmetric_binding.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/asymmetric_binding.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/asymmetric_binding.c Mon Jun 11 02:42:41 2007 @@ -125,8 +125,10 @@ rp_property_t *initiator_token) { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - AXIS2_PARAM_CHECK(env->error,initiator_token,AXIS2_FAILURE); - asymmetric_binding->initiator_token =initiator_token; + AXIS2_PARAM_CHECK(env->error, initiator_token, AXIS2_FAILURE); + + rp_property_increment_ref(initiator_token, env); + asymmetric_binding->initiator_token = initiator_token; return AXIS2_SUCCESS; } @@ -139,7 +141,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error,recipient_token,AXIS2_FAILURE); - + + rp_property_increment_ref(recipient_token, env); asymmetric_binding->recipient_token = recipient_token; return AXIS2_SUCCESS; Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/binding_commons.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/binding_commons.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/binding_commons.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/binding_commons.c Mon Jun 11 02:42:41 2007 @@ -145,7 +145,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error,algorithmsuite,AXIS2_FAILURE); - + + rp_algorithmsuite_increment_ref(algorithmsuite, env); binding_commons->algorithmsuite = algorithmsuite; return AXIS2_SUCCESS; } @@ -168,7 +169,8 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error,layout,AXIS2_FAILURE); - + + rp_layout_increment_ref(layout, env); binding_commons->layout = layout; return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/layout.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/layout.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/layout.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/layout.c Mon Jun 11 02:42:41 2007 @@ -20,6 +20,7 @@ struct rp_layout_t { axis2_char_t *value; + int ref; }; AXIS2_EXTERN rp_layout_t *AXIS2_CALL @@ -38,6 +39,7 @@ return NULL; } layout->value = RP_LAYOUT_STRICT; + layout->ref = 0; return layout; } @@ -50,6 +52,10 @@ if(layout) { + if (--(layout->ref) > 0) + { + return; + } AXIS2_FREE(env->allocator, layout); layout = NULL; } @@ -79,4 +85,14 @@ layout->value = value; return AXIS2_SUCCESS; } + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_layout_increment_ref(rp_layout_t *layout, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + layout->ref++; + return AXIS2_SUCCESS; +} + Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/property.c Mon Jun 11 02:42:41 2007 @@ -28,6 +28,7 @@ { int type; void *value; + int ref; }; @@ -48,6 +49,7 @@ } property->type = 0; property->value = NULL; + property->ref = 0; return property; } @@ -61,6 +63,11 @@ if(property) { + if (--(property->ref) > 0) + { + return; + } + if(property->value) { switch(property->type) @@ -149,6 +156,24 @@ AXIS2_PARAM_CHECK(env->error,value,AXIS2_FAILURE); property->type = type; + + if(type == RP_TOKEN_X509) + { + rp_x509_token_increment_ref((rp_x509_token_t *)value, env); + } + if(type == RP_WSS_WSS10) + { + rp_wss10_increment_ref((rp_wss10_t *)value, env); + } + if(type == RP_TOKEN_USERNAME) + { + rp_username_token_increment_ref((rp_username_token_t *)value, env); + } + if(type == RP_SUPPORTING_SIGNED_SUPPORTING) + { + rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env); + } + property->value =(void *)value; return AXIS2_SUCCESS; @@ -164,3 +189,13 @@ return property->type; } + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_property_increment_ref(rp_property_t *property, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + property->ref++; + return AXIS2_SUCCESS; +} + Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/supporting_tokens.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/supporting_tokens.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/supporting_tokens.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/supporting_tokens.c Mon Jun 11 02:42:41 2007 @@ -28,6 +28,7 @@ rp_signed_encrypted_elements_t *encrypted_elements; rp_signed_encrypted_parts_t *encrypted_parts; int type; + int ref; }; AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL @@ -60,6 +61,7 @@ supporting_tokens->encrypted_parts = NULL; supporting_tokens->encrypted_elements = NULL; supporting_tokens->type = 0; + supporting_tokens->ref = 0; return supporting_tokens; } @@ -72,6 +74,11 @@ if(supporting_tokens) { + if (--(supporting_tokens->ref) > 0) + { + return; + } + if(supporting_tokens->tokens) { int i = 0; @@ -140,9 +147,10 @@ rp_property_t *token) { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); - AXIS2_PARAM_CHECK(env->error,token,AXIS2_FAILURE); + AXIS2_PARAM_CHECK(env->error, token, AXIS2_FAILURE); - axutil_array_list_add(supporting_tokens->tokens,env,token); + rp_property_increment_ref(token, env); + axutil_array_list_add(supporting_tokens->tokens, env, token); return AXIS2_SUCCESS; } @@ -166,6 +174,7 @@ AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error,algorithmsuite,AXIS2_FAILURE); + rp_algorithmsuite_increment_ref(algorithmsuite, env); supporting_tokens->algorithmsuite = algorithmsuite; return AXIS2_SUCCESS; } @@ -278,3 +287,13 @@ supporting_tokens->type = type; return AXIS2_SUCCESS; } + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_supporting_tokens_increment_ref(rp_supporting_tokens_t *supporting_tokens, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + supporting_tokens->ref++; + return AXIS2_SUCCESS; +} + Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/ut.c Mon Jun 11 02:42:41 2007 @@ -25,6 +25,7 @@ axis2_bool_t derivedkeys; axis2_bool_t useUTprofile10; axis2_bool_t useUTprofile11; + int ref; }; AXIS2_EXTERN rp_username_token_t *AXIS2_CALL @@ -46,7 +47,8 @@ username_token->derivedkeys = AXIS2_FALSE; username_token->useUTprofile10 = AXIS2_TRUE; username_token->useUTprofile11 = AXIS2_FALSE; - + username_token->ref = 0; + return username_token; } @@ -58,6 +60,11 @@ { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + if (--(username_token->ref) > 0) + { + return; + } + if(username_token) { AXIS2_FREE(env->allocator, username_token); @@ -162,5 +169,14 @@ AXIS2_PARAM_CHECK(env->error,useUTprofile11,AXIS2_FAILURE); username_token->useUTprofile11 = useUTprofile11; + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_username_token_increment_ref(rp_username_token_t *username_token, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + username_token->ref++; return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/wss10.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/wss10.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/wss10.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/wss10.c Mon Jun 11 02:42:41 2007 @@ -26,6 +26,7 @@ axis2_bool_t must_support_ref_external_uri; axis2_bool_t must_support_ref_embedded_token; axis2_bool_t must_support_direct_reference; + int ref; }; AXIS2_EXTERN rp_wss10_t *AXIS2_CALL @@ -48,6 +49,7 @@ wss10->must_support_ref_external_uri = AXIS2_FALSE; wss10->must_support_ref_embedded_token = AXIS2_FALSE; wss10->must_support_direct_reference = AXIS2_TRUE; + wss10->ref = 0; return wss10; @@ -61,6 +63,11 @@ if(wss10) { + if (--(wss10->ref) > 0) + { + return; + } + AXIS2_FREE(env->allocator, wss10); wss10 = NULL; } @@ -151,6 +158,16 @@ AXIS2_PARAM_CHECK(env->error,must_support_ref_embedded_token,AXIS2_FAILURE); wss10->must_support_ref_embedded_token = must_support_ref_embedded_token; + return AXIS2_SUCCESS; +} + + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_wss10_increment_ref(rp_wss10_t *wss10, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + wss10->ref++; return AXIS2_SUCCESS; } Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/model/x509_token.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/model/x509_token.c?view=diff&rev=546062&r1=546061&r2=546062 ============================================================================== --- webservices/axis2/trunk/c/neethi/src/secpolicy/model/x509_token.c (original) +++ webservices/axis2/trunk/c/neethi/src/secpolicy/model/x509_token.c Mon Jun 11 02:42:41 2007 @@ -28,6 +28,7 @@ axis2_bool_t require_embedded_token_reference; axis2_bool_t require_thumb_print_reference; axis2_char_t *token_version_and_type; + int ref; }; @@ -41,6 +42,7 @@ x509_token = (rp_x509_token_t *) AXIS2_MALLOC (env->allocator, sizeof (rp_x509_token_t)); + if(x509_token == NULL) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); @@ -52,7 +54,8 @@ x509_token->require_issuer_serial_reference = AXIS2_FALSE; x509_token->require_embedded_token_reference = AXIS2_FALSE; x509_token->require_thumb_print_reference = AXIS2_FALSE; - x509_token->token_version_and_type = RP_WSS_X509_V3_TOKEN_10; + x509_token->token_version_and_type = RP_WSS_X509_V3_TOKEN_10; + x509_token->ref = 0; return x509_token; } @@ -64,6 +67,10 @@ if(x509_token) { + if (--(x509_token->ref) > 0) + { + return; + } AXIS2_FREE(env->allocator, x509_token); x509_token = NULL; } @@ -223,3 +230,14 @@ x509_token->token_version_and_type = token_version_and_type; return AXIS2_SUCCESS; } + + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +rp_x509_token_increment_ref(rp_x509_token_t *x509_token, + const axutil_env_t *env) +{ + AXIS2_ENV_CHECK(env, AXIS2_FAILURE); + x509_token->ref++; + return AXIS2_SUCCESS; +} + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org