Author: shankar
Date: Tue Feb 12 19:39:56 2008
New Revision: 627235

URL: http://svn.apache.org/viewvc?rev=627235&view=rev
Log:
memory leak fixes

Modified:
    webservices/rampart/trunk/c/include/rampart_sct_provider.h
    webservices/rampart/trunk/c/include/trust_policy_util.h
    webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
    webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
    webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
    webservices/rampart/trunk/c/src/secconv/sct_provider.c
    webservices/rampart/trunk/c/src/secconv/security_context_token.c
    webservices/rampart/trunk/c/src/trust/context.c
    webservices/rampart/trunk/c/src/trust/policy_util.c
    webservices/rampart/trunk/c/src/trust/rst.c
    webservices/rampart/trunk/c/src/trust/rstr.c
    webservices/rampart/trunk/c/src/trust/sts_client.c
    webservices/rampart/trunk/c/src/trust/trust_util.c
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_policy_validator.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c

Modified: webservices/rampart/trunk/c/include/rampart_sct_provider.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_sct_provider.h?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_sct_provider.h (original)
+++ webservices/rampart/trunk/c/include/rampart_sct_provider.h Tue Feb 12 
19:39:56 2008
@@ -35,6 +35,7 @@
 #include <axis2_conf_ctx.h>
 #include <rampart_context.h>
 #include <secconv_security_context_token.h>
+#include <axutil_hash.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -123,6 +124,11 @@
         rampart_context_t* rampart_context, 
         axis2_msg_ctx_t* msg_ctx);
 
+       AXIS2_EXTERN axutil_hash_t* AXIS2_CALL
+    sct_provider_get_sct_db(
+        const axutil_env_t *env, 
+        axis2_msg_ctx_t* msg_ctx);
+
     /*************************** Function macros 
**********************************/
 #define RAMPART_SCT_PROVIDER_GET_TOKEN(sct_provider, env, token, server_side, 
is_enc, sct_id, rampart_ctx, msg_ctx) \
         ((sct_provider)->ops->get_token(sct_provider, env, token, server_side, 
is_enc, sct_id, rampart_ctx, msg_ctx))
@@ -136,4 +142,5 @@
 #endif
 
 #endif                          /* RAMPART_SCT_PROVIDER_H */
+
 

Modified: webservices/rampart/trunk/c/include/trust_policy_util.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/trust_policy_util.h?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/trust_policy_util.h (original)
+++ webservices/rampart/trunk/c/include/trust_policy_util.h Tue Feb 12 19:39:56 
2008
@@ -33,7 +33,8 @@
     AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
     trust_policy_util_get_algorithmsuite(
         const axutil_env_t * env,
-        neethi_policy_t * policy);
+        neethi_policy_t * policy,
+               rp_secpolicy_t **secpolicy);
 
     AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
     trust_policy_util_get_binding_commons(
@@ -43,7 +44,8 @@
     AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
     trust_policy_util_get_trust10(
         const axutil_env_t * env,
-        neethi_policy_t * policy);
+        neethi_policy_t * policy,
+               rp_secpolicy_t **secpolicy);
 
 #ifdef __cplusplus
 }

Modified: 
webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c 
(original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c 
Tue Feb 12 19:39:56 2008
@@ -29,9 +29,6 @@
 static security_context_token_t* 
 sct_provider_obtain_token_from_sts(const axutil_env_t* env, rp_property_t 
*token, axis2_msg_ctx_t* msg_ctx);
 
-static axutil_hash_t *
-sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx);
-
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sct_provider_free(rampart_sct_provider_t *sct_provider,
                                                                const 
axutil_env_t* env)
@@ -193,6 +190,8 @@
     trust_rst_t* rst = NULL;
     trust_rstr_t* rstr = NULL;
     security_context_token_t *sct = NULL;
+       neethi_policy_t *sts_policy = NULL;
+       neethi_policy_t *normalised_policy = NULL;
 
     /*check whether rp_property is valid*/
     rp_sct = (rp_security_context_token_t*)rp_property_get_value(token, env);
@@ -249,11 +248,17 @@
     trust_rst_set_request_type(rst, env, TRUST_REQ_TYPE_ISSUE);
     trust_rst_set_token_type(rst, env, OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN);
     trust_rst_set_wst_ns_uri(rst, env, TRUST_WST_XMLNS_05_02);
+    trust_rst_set_wsa_action(rst, env, 
"http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT";);
     trust_context_set_rst(trust_context, env, rst);
 
     /*call sts_client to get the token from sts*/
-    trust_sts_client_request_security_token_using_policy(sts_client, env, 
trust_context, 
-                rp_security_context_token_get_bootstrap_policy(rp_sct, env));
+       sts_policy = rp_security_context_token_get_bootstrap_policy(rp_sct, 
env);
+       if(sts_policy)
+       {
+               normalised_policy = neethi_engine_get_normalize(env, 
AXIS2_FALSE, sts_policy);
+       }
+               
+    trust_sts_client_request_security_token_using_policy(sts_client, env, 
trust_context, normalised_policy);
 
     /*obtain the reply from sts*/
     rstr = trust_context_get_rstr(trust_context, env);
@@ -272,52 +277,11 @@
 
     /*now we can clear unwanted stuff*/
     trust_context_free(trust_context, env);
+       trust_sts_client_free(sts_client, env);
 
     return sct;
 }
 
-static axutil_hash_t *
-sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx)
-{
-    axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_ctx_t *ctx = NULL;
-    axutil_property_t *property = NULL;
-    axutil_hash_t *db = NULL;
-    
-    /*Get the conf ctx*/
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    if(!conf_ctx)
-    {
-        AXIS2_LOG_ERROR(env->log,AXIS2_LOG_SI, "[rampart][sct_provider_sample] 
Conf context is NULL ");
-        return NULL;
-    }
-    ctx = axis2_conf_ctx_get_base(conf_ctx,env);
-    if(!ctx)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][sct_provider_sample] 
axis2 context is NULL ");
-        return NULL;
-    }
-
-    /*Get the DB property*/
-    property = axis2_ctx_get_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB);
-    if(property)
-    {
-        /*Get the DB*/
-        db = (axutil_hash_t*)axutil_property_get_value(property, env);
-    }
-    else
-    {
-        axutil_property_t *db_prop = NULL;
-
-        db = axutil_hash_make(env);
-        db_prop = axutil_property_create(env);
-        axutil_property_set_value(db_prop, env, db);
-        axis2_ctx_set_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB, 
db_prop);
-    }
-
-    return db;
-}
-
 /*
 static security_context_token_t *
 sct_provider_get_stored_token(const axutil_env_t *env, axis2_char_t *sct_id)
@@ -342,4 +306,4 @@
     security_context_token_set_local_identifier(sct, env, axutil_strdup(env, 
"#sctId-29530019"));
 
     return sct;
-}*/
\ No newline at end of file
+}*/

Modified: 
webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c 
(original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c 
Tue Feb 12 19:39:56 2008
@@ -16,19 +16,16 @@
  */
 
 #include <stdio.h>
-#include <rampart_sct_provider.h>
 #include <axutil_string.h>
 #include <axutil_utils.h>
 #include <oxs_utility.h>
 #include <rampart_util.h>
+#include <rampart_sct_provider.h>
 
 #define SCT_DB_LABLE_ENC "Encryption"
 #define SCT_DB_LABLE_SIG "Signature"
 #define SCT_DB_LABLE_COM "Common"
 
-static axutil_hash_t *
-sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx);
-
 static security_context_token_t *
 sct_provider_get_stored_token(const axutil_env_t *env, axis2_char_t *sct_id);
 
@@ -144,48 +141,6 @@
     return status;
 }
 
-static axutil_hash_t *
-sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx)
-{
-    axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_ctx_t *ctx = NULL;
-    axutil_property_t *property = NULL;
-    axutil_hash_t *db = NULL;
-    
-    /*Get the conf ctx*/
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    if(!conf_ctx)
-    {
-        AXIS2_LOG_ERROR(env->log,AXIS2_LOG_SI, "[rampart][sct_provider_sample] 
Conf context is NULL ");
-        return NULL;
-    }
-    ctx = axis2_conf_ctx_get_base(conf_ctx,env);
-    if(!ctx)
-    {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][sct_provider_sample] 
axis2 context is NULL ");
-        return NULL;
-    }
-
-    /*Get the DB property*/
-    property = axis2_ctx_get_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB);
-    if(property)
-    {
-        /*Get the DB*/
-        db = (axutil_hash_t*)axutil_property_get_value(property, env);
-    }
-    else
-    {
-        axutil_property_t *db_prop = NULL;
-
-        db = axutil_hash_make(env);
-        db_prop = axutil_property_create(env);
-        axutil_property_set_value(db_prop, env, db);
-        axis2_ctx_set_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB, 
db_prop);
-    }
-
-    return db;
-}
-
 static security_context_token_t *
 sct_provider_get_stored_token(const axutil_env_t *env, axis2_char_t *sct_id)
 {
@@ -209,4 +164,4 @@
     security_context_token_set_local_identifier(sct, env, axutil_strdup(env, 
"#sctId-29530019"));
 
     return sct;
-}
\ No newline at end of file
+}

Modified: webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c (original)
+++ webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c Tue Feb 12 
19:39:56 2008
@@ -28,6 +28,7 @@
 #include <axis2_ctx.h>
 #include <axutil_property.h>
 #include <rampart_constants.h>
+#include <rampart_sct_provider.h>
 
 axiom_node_t *
 build_om_programatically(const axutil_env_t *env, axis2_char_t *text);
@@ -133,7 +134,7 @@
     security_context_token_set_local_identifier(sct, env, local_id);
 
     /*store SCT so that when server needs it, can be extracted*/
-    db = secconv_echo_get_sct_db(env, msg_ctx);
+    db = sct_provider_get_sct_db(env, msg_ctx);
     if(!db)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][secconv_service] 
Cannot get sct datastore");
@@ -162,6 +163,9 @@
 
     /*clear stuff*/
     trust_rstr_free(rstr, env);
+
+    /*set the action*/
+    axis2_msg_ctx_set_wsa_action(msg_ctx, env, 
"http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT";);
 
     /*return the node*/
     return rstr_node;

Modified: webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c Tue Feb 12 
19:39:56 2008
@@ -266,8 +266,6 @@
     AXIS2_FREE(env->allocator, serialized_data);
     serialized_data = NULL;
 
-    serialized_data = axiom_node_to_string_non_optimized(*enc_type_node, env);
-
     /*Return success*/
     return AXIS2_SUCCESS;
 }

Modified: webservices/rampart/trunk/c/src/secconv/sct_provider.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/secconv/sct_provider.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/secconv/sct_provider.c (original)
+++ webservices/rampart/trunk/c/src/secconv/sct_provider.c Tue Feb 12 19:39:56 
2008
@@ -18,6 +18,7 @@
 #include <oxs_constants.h>
 #include <oxs_buffer.h>
 #include <axiom_element.h>
+#include <rampart_constants.h>
 
 security_context_token_t*
 sct_provider_get_sct(const axutil_env_t* env, rp_property_t *token, 
@@ -131,3 +132,67 @@
 
     return security_context_token_get_unattached_reference(sct, env); 
 }
+
+AXIS2_EXTERN void AXIS2_CALL
+sct_provider_sct_db_free(axutil_hash_t *sct_db,
+                     const axutil_env_t *env)
+{
+       axutil_hash_t *attr_hash = NULL;
+       axutil_hash_index_t *hi = NULL;
+
+       for (hi = axutil_hash_first(sct_db, env); hi != NULL; hi = 
axutil_hash_next(env, hi))
+       {
+               void *v = NULL;
+        axutil_hash_this(hi, NULL, NULL, &v);
+               if (v)
+               {
+                       
security_context_token_free((security_context_token_t*)v, env);         
+               }
+       }
+
+       axutil_hash_free(sct_db, env);
+
+}
+
+AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
+sct_provider_get_sct_db(const axutil_env_t *env, axis2_msg_ctx_t* msg_ctx)
+{
+    axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_ctx_t *ctx = NULL;
+    axutil_property_t *property = NULL;
+    axutil_hash_t *db = NULL;
+    
+    /*Get the conf ctx*/
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    if(!conf_ctx)
+    {
+        AXIS2_LOG_ERROR(env->log,AXIS2_LOG_SI, "[rampart][sct_provider_sample] 
Conf context is NULL ");
+        return NULL;
+    }
+    ctx = axis2_conf_ctx_get_base(conf_ctx,env);
+    if(!ctx)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][sct_provider_sample] 
axis2 context is NULL ");
+        return NULL;
+    }
+
+    /*Get the DB property*/
+    property = axis2_ctx_get_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB);
+    if(property)
+    {
+        /*Get the DB*/
+        db = (axutil_hash_t*)axutil_property_get_value(property, env);
+    }
+    else
+    {
+        axutil_property_t *db_prop = NULL;
+
+        db = axutil_hash_make(env);
+               db_prop = axutil_property_create_with_args(env, 
AXIS2_SCOPE_SESSION ,
+               AXIS2_TRUE, (void *)sct_provider_sct_db_free, db);
+        axis2_ctx_set_property(ctx, env, RAMPART_SCT_PROVIDER_DB_PROB, 
db_prop);
+    }
+
+    return db;
+}
+

Modified: webservices/rampart/trunk/c/src/secconv/security_context_token.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/secconv/security_context_token.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/secconv/security_context_token.c (original)
+++ webservices/rampart/trunk/c/src/secconv/security_context_token.c Tue Feb 12 
19:39:56 2008
@@ -60,6 +60,15 @@
     {
         oxs_buffer_free(sct->buffer, env);
     }
+    if(sct->local_id)
+    {
+        AXIS2_FREE(env->allocator, sct->local_id);
+    }
+    if(sct->global_id)
+    {
+        AXIS2_FREE(env->allocator, sct->global_id);
+    }
+
     AXIS2_FREE(env->allocator, sct);
     return;
 }
@@ -94,6 +103,10 @@
     const axutil_env_t * env,
     oxs_buffer_t *buffer)
 {
+    if(sct->buffer)
+    {
+        oxs_buffer_free(sct->buffer, env);
+    }
     sct->buffer = buffer;
     return AXIS2_SUCCESS;
 }
@@ -104,6 +117,10 @@
     const axutil_env_t * env,
     axis2_char_t *global_id)
 {
+    if(sct->global_id)
+    {
+        AXIS2_FREE(env->allocator, sct->global_id);
+    }
     sct->global_id = global_id;
     return AXIS2_SUCCESS;
 }
@@ -114,6 +131,10 @@
     const axutil_env_t * env,
     axis2_char_t *local_id)
 {
+    if(sct->local_id)
+    {
+        AXIS2_FREE(env->allocator, sct->local_id);
+    }
     sct->local_id = local_id;
     return AXIS2_SUCCESS;
 }
@@ -136,15 +157,11 @@
         AXIS2_LOG_INFO(env->log, "[rampart][security context token] Security 
context token does not have a shared secret");
         return NULL;
     }
-
-    encodedlen = axutil_base64_encode_len(oxs_buffer_get_size(sct->buffer, 
env));
-    encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
-    axutil_base64_encode(encoded_str, (const char 
*)oxs_buffer_get_data(sct->buffer, env), oxs_buffer_get_size(sct->buffer, env));
     
     ns_obj_wst = axiom_namespace_create(env, TRUST_WST_XMLNS, TRUST_WST);
     proof_token_ele = axiom_element_create(env, NULL, 
TRUST_REQUESTED_PROOF_TOKEN, ns_obj_wst, &proof_token);
     if (!proof_token_ele)
-    {
+       {
         AXIS2_LOG_INFO(env->log, "[rampart][security context token] Cannot 
create requested proof token");
         return NULL;
     }
@@ -155,7 +172,12 @@
         AXIS2_LOG_INFO(env->log, "[rampart][security context token] Cannot 
create binary secret token");
         return NULL;
     }
+
+       encodedlen = axutil_base64_encode_len(oxs_buffer_get_size(sct->buffer, 
env));
+    encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
+    axutil_base64_encode(encoded_str, (const char 
*)oxs_buffer_get_data(sct->buffer, env), oxs_buffer_get_size(sct->buffer, env));
     axiom_element_set_text(secret_ele, env, encoded_str, secret_node);
+       AXIS2_FREE(env->allocator, encoded_str);
 
     return proof_token;
 }
@@ -228,9 +250,12 @@
 
     if(sct->local_id)
     {
+               axis2_char_t *id = NULL;
+               id = axutil_string_substring_starting_at(axutil_strdup(env, 
sct->local_id), 1);
         ns_obj_wsu = axiom_namespace_create(env, OXS_WSU_XMLNS, OXS_WSU);
-        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, 
axutil_string_substring_starting_at(axutil_strdup(env, sct->local_id), 1), 
ns_obj_wsu);
+        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, ns_obj_wsu);
         axiom_element_add_attribute(token_ele, env, id_attr, sct_token);
+               AXIS2_FREE(env->allocator, id);
     }
 
     identifier_ele = axiom_element_create(env, sct_token, OXS_NODE_IDENTIFIER, 
ns_obj_sc, &identifier_node);
@@ -255,6 +280,7 @@
     axis2_char_t *shared_secret = NULL;
     int decoded_len = 0;
     axis2_char_t *decoded_shared_secret = NULL;
+    oxs_buffer_t *buffer = NULL;
 
     AXIS2_PARAM_CHECK(env->error, node, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, sct, AXIS2_FAILURE);
@@ -277,12 +303,11 @@
        decoded_shared_secret = AXIS2_MALLOC(env->allocator, decoded_len);
        axutil_base64_decode_binary((unsigned char*)decoded_shared_secret, 
shared_secret);
 
-    sct->buffer = oxs_buffer_create(env);
-    oxs_buffer_populate(sct->buffer, env, (unsigned 
char*)decoded_shared_secret, decoded_len);
-
+    buffer = oxs_buffer_create(env);
+    oxs_buffer_populate(buffer, env, (unsigned char*)decoded_shared_secret, 
decoded_len);
     AXIS2_FREE(env->allocator, decoded_shared_secret);
 
-    return AXIS2_SUCCESS;
+    return security_context_token_set_secret(sct, env, buffer);
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -311,8 +336,7 @@
         return AXIS2_FAILURE;
     }
     
-    sct->local_id = local_id;
-    return AXIS2_SUCCESS;
+    return security_context_token_set_local_identifier(sct, env, 
axutil_strdup(env, local_id));
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -341,8 +365,7 @@
         return AXIS2_FAILURE;
     }
     
-    sct->global_id = reference_id;
-    return AXIS2_SUCCESS;
+    return security_context_token_set_global_identifier(sct, env, 
axutil_strdup(env, reference_id));
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -353,5 +376,6 @@
 {
     return AXIS2_SUCCESS;
 }
+
 
 

Modified: webservices/rampart/trunk/c/src/trust/context.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/context.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/context.c (original)
+++ webservices/rampart/trunk/c/src/trust/context.c Tue Feb 12 19:39:56 2008
@@ -67,6 +67,11 @@
 {
     if (trust_context)
     {
+               if(trust_context->rst)
+                       trust_rst_free(trust_context->rst, env);
+               if(trust_context->rstr)
+                       trust_rstr_free(trust_context->rstr, env);
+
         /*Free Other Contexts*/
         AXIS2_FREE(env->allocator, trust_context);
     }
@@ -276,6 +281,7 @@
     }
     return AXIS2_FAILURE;
 }
+
 
 
 

Modified: webservices/rampart/trunk/c/src/trust/policy_util.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/policy_util.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/policy_util.c (original)
+++ webservices/rampart/trunk/c/src/trust/policy_util.c Tue Feb 12 19:39:56 2008
@@ -20,20 +20,22 @@
 AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
 trust_policy_util_get_algorithmsuite(
     const axutil_env_t * env,
-    neethi_policy_t * policy)
+    neethi_policy_t * policy, 
+       rp_secpolicy_t **secpolicy)
 {
-    rp_secpolicy_t *secpolicy = NULL;
     rp_binding_commons_t *binding_commons = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    secpolicy = rp_secpolicy_builder_build(env, policy);
-    if (!secpolicy)
+       if(!*secpolicy)
+               *secpolicy = rp_secpolicy_builder_build(env, policy);
+    
+       if (!*secpolicy)
     {
         return NULL;
     }
 
-    binding_commons = trust_policy_util_get_binding_commons(env, secpolicy);
+    binding_commons = trust_policy_util_get_binding_commons(env, *secpolicy);
 
     return rp_binding_commons_get_algorithmsuite(binding_commons, env);
 }
@@ -41,19 +43,19 @@
 AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
 trust_policy_util_get_trust10(
     const axutil_env_t * env,
-    neethi_policy_t * policy)
+    neethi_policy_t * policy, 
+       rp_secpolicy_t **secpolicy)
 {
-    rp_secpolicy_t *secpolicy = NULL;
-
     AXIS2_ENV_CHECK(env, NULL);
 
-    secpolicy = rp_secpolicy_builder_build(env, policy);
-    if (!secpolicy)
+       if(!*secpolicy)
+               secpolicy = rp_secpolicy_builder_build(env, policy);
+    if (!*secpolicy)
     {
         return NULL;
     }
 
-    return rp_secpolicy_get_trust10(secpolicy, env);
+    return rp_secpolicy_get_trust10(*secpolicy, env);
 }
 
 AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL

Modified: webservices/rampart/trunk/c/src/trust/rst.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/rst.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/rst.c (original)
+++ webservices/rampart/trunk/c/src/trust/rst.c Tue Feb 12 19:39:56 2008
@@ -250,6 +250,7 @@
     {
         rst->attr_context = attr_ctx;
     }
+       axutil_qname_free(attr_ctx_qname, env);
     
     
     /*TokenType*/
@@ -269,6 +270,7 @@
             rst->token_type = token_type;
         }        
     }
+       axutil_qname_free(token_type_qname, env);
         
     /* RequestType */
     req_type_qname = axutil_qname_create(env, TRUST_REQUEST_TYPE, 
rst->wst_ns_uri, TRUST_WST);
@@ -287,6 +289,7 @@
             rst->request_type = req_type;
         }
     }
+       axutil_qname_free(req_type_qname, env);
     
     /* AppliesTo */
     applies_to_qname = axutil_qname_create(env, TRUST_APPLIES_TO, 
TRUST_WSP_XMLNS, TRUST_WSP);
@@ -315,6 +318,9 @@
             }
         }
     }
+       axutil_qname_free(applies_to_qname, env);
+       axutil_qname_free(applies_to_epr_qname, env);
+       axutil_qname_free(applies_to_addr_qname, env);
     
     
     /* Claims */
@@ -333,7 +339,8 @@
             rst->claims = claims;
         }
     }
-    
+    axutil_qname_free(claims_qname, env);
+
     /*Entropy */
     entropy_qname = axutil_qname_create(env, TRUST_ENTROPY, rst->wst_ns_uri, 
TRUST_WST);
     if (!entropy_qname)
@@ -341,7 +348,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Entropy Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     entropy_ele = axiom_element_get_first_child_with_qname(rst_ele, env, 
entropy_qname, rst_node, &entropy_node);
     if(entropy_ele)
     {
@@ -353,6 +359,7 @@
             rst->entropy = entropy;
         }
     }
+       axutil_qname_free(entropy_qname, env);
     
     /*LifeTime*/
     lifetime_qname = axutil_qname_create(env, TRUST_LIFE_TIME, 
rst->wst_ns_uri, TRUST_WST);
@@ -361,7 +368,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime Qname 
creation failed.");
         return AXIS2_FAILURE;        
     }
-    
     lifetime_ele = axiom_element_get_first_child_with_qname(rst_ele, env, 
lifetime_qname, rst_node, &lifetime_node);
     if(lifetime_ele)
     {
@@ -370,6 +376,7 @@
             rst->life_time = NULL;
         }
     }
+       axutil_qname_free(lifetime_qname, env);
  
     /*Key and Encryption Requirements*/
     
@@ -380,7 +387,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] KeyType Qname 
creation failed.");
         return AXIS2_FAILURE;        
     }
-    
     key_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, 
key_type_qname, rst_node, &key_type_node);
     if(key_type_ele)
     {
@@ -390,6 +396,7 @@
             rst->key_type = key_type;
         }
     }
+       axutil_qname_free(key_type_qname, env);
     
     
     /* KeySize */
@@ -403,7 +410,8 @@
             rst->key_size = atoi(key_size);
         }
     }
-    
+    axutil_qname_free(key_size_qname, env);
+
     /*AuthenticationType*/
     authnetication_type_qname = axutil_qname_create(env, 
TRUST_AUTHENTICATION_TYPE, rst->wst_ns_uri, TRUST_WST); 
     authnetication_type_ele = 
axiom_element_get_first_child_with_qname(rst_ele, env, 
authnetication_type_qname, rst_node, &authnetication_type_node);
@@ -415,6 +423,7 @@
             rst->authentication_type = authnetication_type;
         }
     }
+       axutil_qname_free(authnetication_type_qname, env);
     
     /*SignatureAlgorithm*/
     signature_algo_qname = axutil_qname_create(env, TRUST_SIGNATURE_ALGO, 
rst->wst_ns_uri, TRUST_WST); 
@@ -427,6 +436,7 @@
             rst->signature_algo = signature_algo;
         }
     }
+       axutil_qname_free(signature_algo_qname, env);
     
     /*EncryptionAlgorithm*/
     encryption_algo_qname = axutil_qname_create(env, TRUST_ENCRYPTION_ALGO, 
rst->wst_ns_uri, TRUST_WST); 
@@ -439,6 +449,7 @@
             rst->encryption_algo = encryption_algo;
         }
     }
+       axutil_qname_free(encryption_algo_qname, env);
     
     /*CanonicalizationAlgorithm*/
     canonocalization_algo_qname = axutil_qname_create(env, 
TRUST_CANONICAL_ALGO, rst->wst_ns_uri, TRUST_WST); 
@@ -451,6 +462,7 @@
             rst->canonicalization_algo = canonocalization_algo;
         }
     }
+       axutil_qname_free(canonocalization_algo_qname, env);
 
     /*ComputedKeyAlgorithm*/
     computedkey_algo_qname = axutil_qname_create(env, TRUST_COMPUTED_KEY_ALGO, 
rst->wst_ns_uri, TRUST_WST); 
@@ -463,6 +475,7 @@
             rst->computed_key_algo = computedkey_algo;
         }
     }
+       axutil_qname_free(computedkey_algo_qname, env);
     
     
     /*(Desired)Encryption */
@@ -472,13 +485,13 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Encryption Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     desired_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, 
env, desired_encryption_qname, rst_node, &desired_encryption_node);
     if(desired_encryption_ele)
     {                
         desired_encryption_key_ele = 
axiom_element_get_first_element(desired_encryption_ele, env, 
desired_encryption_node, &desired_encryption_key_node);
         rst->desired_encryption = desired_encryption_key_node;      
     }
+       axutil_qname_free(desired_encryption_qname, env);
     
     /*ProofEncryption*/
     proof_encryption_qname = axutil_qname_create(env, TRUST_PROOF_ENCRYPTION, 
rst->wst_ns_uri, TRUST_WST);
@@ -487,7 +500,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] ProofEncryption Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     proof_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, 
env, proof_encryption_qname, rst_node, &proof_encryption_node);
     if(proof_encryption_ele)
     {                
@@ -495,6 +507,7 @@
         rst->proof_encryption = proof_encryption_key_node;             
         
     }
+       axutil_qname_free(proof_encryption_qname, env);
     
     /*UseKey*/
     use_key_qname = axutil_qname_create(env, TRUST_USE_KEY, rst->wst_ns_uri, 
TRUST_WST);
@@ -504,13 +517,13 @@
         return AXIS2_FAILURE;   
         
     }
-    
     use_key_ele = axiom_element_get_first_child_with_qname(rst_ele, env, 
use_key_qname, rst_node, &use_key_node);
     if(use_key_ele)
     {
         usekey_key_ele = axiom_element_get_first_element(use_key_ele, env, 
use_key_node, &usekey_key_node);
         rst->usekey = usekey_key_node;
     }
+       axutil_qname_free(use_key_qname, env);
     
     /*SignWith*/
     sign_with_qname = axutil_qname_create(env, TRUST_SIGN_WITH, 
rst->wst_ns_uri, TRUST_WST); 
@@ -523,6 +536,7 @@
             rst->sign_with = sign_with;
         }
     }
+       axutil_qname_free(sign_with_qname, env);
     
     /*EncryptWith*/
     encrypt_with_qname = axutil_qname_create(env, TRUST_ENCRYPT_WITH, 
rst->wst_ns_uri, TRUST_WST); 
@@ -540,27 +554,7 @@
             rst->encrypt_with = encrypt_with;
         }
     }
-    
-    AXIS2_FREE(env->allocator, key_size_qname);
-    AXIS2_FREE(env->allocator, key_type_qname);
-    AXIS2_FREE(env->allocator, lifetime_qname);
-    AXIS2_FREE(env->allocator, entropy_qname);    
-    AXIS2_FREE(env->allocator, claims_qname);
-    AXIS2_FREE(env->allocator, applies_to_qname);
-    AXIS2_FREE(env->allocator, applies_to_epr_qname);
-    AXIS2_FREE(env->allocator, applies_to_addr_qname);
-    AXIS2_FREE(env->allocator, req_type_qname);
-    AXIS2_FREE(env->allocator, token_type_qname);
-    AXIS2_FREE(env->allocator, attr_ctx_qname);
-    AXIS2_FREE(env->allocator, authnetication_type_qname);
-    AXIS2_FREE(env->allocator, signature_algo_qname);
-    AXIS2_FREE(env->allocator, encryption_algo_qname);
-    AXIS2_FREE(env->allocator, canonocalization_algo_qname);
-    AXIS2_FREE(env->allocator, computedkey_algo_qname);    
-    AXIS2_FREE(env->allocator, proof_encryption_qname);
-    AXIS2_FREE(env->allocator, use_key_qname);
-    AXIS2_FREE(env->allocator, sign_with_qname);
-    AXIS2_FREE(env->allocator, encrypt_with_qname);
+       axutil_qname_free(encrypt_with_qname, env);
         
     return AXIS2_SUCCESS;
 }
@@ -1292,7 +1286,7 @@
         trust_rst_t *rst,
         const axutil_env_t *env)
 {
-    return;
+    AXIS2_FREE(env->allocator, rst);
 }
 
 

Modified: webservices/rampart/trunk/c/src/trust/rstr.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/rstr.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/rstr.c (original)
+++ webservices/rampart/trunk/c/src/trust/rstr.c Tue Feb 12 19:39:56 2008
@@ -76,6 +76,7 @@
         trust_rstr_t *rstr,
         const axutil_env_t *env)
 {
+       AXIS2_FREE(env->allocator, rstr);
     return AXIS2_SUCCESS;
 }
 
@@ -145,13 +146,11 @@
         return AXIS2_FAILURE;
     }
     attr_ctx = axiom_element_get_attribute_value(rstr_ele, env, 
attr_ctx_qname);
-
     if (attr_ctx)
     {
         rstr->attr_context = attr_ctx;
     }
-    
-    
+       axutil_qname_free(attr_ctx_qname, env);
     
     /*TokenType*/
     token_type_qname = axutil_qname_create(env, TRUST_TOKEN_TYPE, 
rstr->wst_ns_uri, TRUST_WST);
@@ -160,7 +159,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] TokenType Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     token_type_ele = axiom_element_get_first_child_with_qname(rstr_ele, env, 
token_type_qname, rstr_node, &token_type_node);
     if (token_type_ele)
     {
@@ -170,6 +168,7 @@
             rstr->token_type = token_type;
         }        
     }
+       axutil_qname_free(token_type_qname, env);
     
     
     /*RequestedSecurityToken*/
@@ -185,6 +184,7 @@
     {
         axiom_element_get_first_element(requested_security_token_ele, env, 
requested_security_token_node, &rstr->requested_sec_token);
     }
+       axutil_qname_free(requested_security_token_qname, env);
 
        
        /*RequestedProofToken*/
@@ -199,9 +199,8 @@
        {
                axiom_element_get_first_element(proof_token_ele, env, 
proof_token_node, &rstr->requested_proof_token);
        }
+       axutil_qname_free(proof_token_qname, env);
     
-
-
     /*AppliesTo*/
     applies_to_qname = axutil_qname_create(env, TRUST_APPLIES_TO, 
TRUST_WSP_XMLNS, TRUST_WSP);
     if (!applies_to_qname)
@@ -209,7 +208,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Appliesto Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     appliesto_ele = axiom_element_get_first_child_with_qname(rstr_ele, env, 
applies_to_qname, rstr_node, &appliesto_node);
     if(appliesto_ele)
     {
@@ -219,7 +217,7 @@
             rstr->applies_to = axiom_element_get_text(first_ele, env, 
first_node);
         }
     }
-    
+       axutil_qname_free(applies_to_qname, env);
     
     /*Entropy*/
     entropy_qname = axutil_qname_create(env, TRUST_ENTROPY, rstr->wst_ns_uri, 
TRUST_WST);
@@ -228,7 +226,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Entropy Qname 
creation failed.");
         return AXIS2_FAILURE;
     }
-    
     entropy_ele = axiom_element_get_first_child_with_qname(rstr_ele, env, 
entropy_qname, rstr_node, &entropy_node);
     if(entropy_ele)
     {
@@ -237,6 +234,7 @@
             rstr->entropy = entropy;
         }
     }
+       axutil_qname_free(entropy_qname, env);
     
     
     /*LifeTime*/
@@ -246,7 +244,6 @@
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] LifeTime Qname 
creation failed.");
         return AXIS2_FAILURE;        
     }
-
     lifetime_ele = axiom_element_get_first_child_with_qname(rstr_ele, env, 
lifetime_qname, rstr_node, &lifetime_node);
     if(lifetime_ele)
     {
@@ -256,7 +253,8 @@
             
         }
     }
-    
+    axutil_qname_free(lifetime_qname, env);
+
         /* KeySize */
     key_size_qname = axutil_qname_create(env, TRUST_KEY_SIZE, 
rstr->wst_ns_uri, TRUST_WST);
     key_size_ele = axiom_element_get_first_child_with_qname(rstr_ele, env, 
key_size_qname, rstr_node, &key_size_node);
@@ -268,6 +266,7 @@
             rstr->key_size = atoi(key_size);
         }
     }
+       axutil_qname_free(key_size_qname, env);
 
     /*Attached reference*/
        attached_reference_qname = axutil_qname_create(env, 
TRUST_REQUESTED_ATTACHED_REFERENCE, rstr->wst_ns_uri, TRUST_WST);
@@ -281,7 +280,8 @@
        {
                axiom_element_get_first_element(attached_reference_ele, env, 
attached_reference_node, &rstr->requested_attached_ref);
        }
-    
+    axutil_qname_free(attached_reference_qname, env);
+
     /*Unattached reference*/
        unattached_reference_qname = axutil_qname_create(env, 
TRUST_REQUESTED_UNATTACHED_REFERENCE, rstr->wst_ns_uri, TRUST_WST);
        if(!unattached_reference_qname)
@@ -294,15 +294,8 @@
        {
                axiom_element_get_first_element(unattached_reference_ele, env, 
unattached_reference_node, &rstr->requested_unattached_ref);
        }
+       axutil_qname_free(unattached_reference_qname, env);
 
-    AXIS2_FREE(env->allocator, lifetime_qname);
-    AXIS2_FREE(env->allocator, entropy_qname);    
-    AXIS2_FREE(env->allocator, applies_to_qname);
-    AXIS2_FREE(env->allocator, token_type_qname);
-    AXIS2_FREE(env->allocator, attr_ctx_qname);
-    AXIS2_FREE(env->allocator, attached_reference_qname);
-    AXIS2_FREE(env->allocator, unattached_reference_qname);
-    
     return AXIS2_SUCCESS;
     
 }

Modified: webservices/rampart/trunk/c/src/trust/sts_client.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/sts_client.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/sts_client.c (original)
+++ webservices/rampart/trunk/c/src/trust/sts_client.c Tue Feb 12 19:39:56 2008
@@ -55,6 +55,8 @@
        /*RECEIVED In_msg_ctx*/
        axis2_msg_ctx_t *received_in_msg_ctx;
 
+       rp_secpolicy_t *sec_policy;
+
 
 };
 
@@ -73,6 +75,7 @@
     sts_client->issuer_policy_location = NULL;
     sts_client->service_policy_location = NULL;
        sts_client->svc_client = NULL;
+       sts_client->sec_policy = NULL;
 
     return sts_client;
 }
@@ -90,6 +93,12 @@
                sts_client->svc_client = NULL;
        }
 
+       /*if(sts_client->sec_policy)
+       {
+               rp_secpolicy_free(sts_client->sec_policy, env->allocator);
+               sts_client->sec_policy = NULL;
+       }*/
+
     if (sts_client)
     {
         AXIS2_FREE(env->allocator, sts_client);
@@ -222,7 +231,16 @@
     axis2_options_set_to(options, env, endpoint_ref);
     axis2_options_set_action(options, env, action);
 
-    svc_client = axis2_svc_client_create(env, sts_client->home_dir);
+       if(!(sts_client->svc_client))
+       {
+               svc_client = axis2_svc_client_create(env, sts_client->home_dir);
+               sts_client->svc_client = svc_client;
+       }
+       else
+       {
+               svc_client = sts_client->svc_client;
+       }
+
     if (!svc_client)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error 
code:" " %d :: %s",
@@ -250,12 +268,12 @@
 
     if (issuer_policy)
     {
-        sts_client->algo_suite = trust_policy_util_get_algorithmsuite(env, 
issuer_policy);
+        sts_client->algo_suite = trust_policy_util_get_algorithmsuite(env, 
issuer_policy, &sts_client->sec_policy);
     }
 
     if (service_policy)
     {
-        sts_client->trust10 = trust_policy_util_get_trust10(env, 
service_policy);
+        sts_client->trust10 = trust_policy_util_get_trust10(env, 
service_policy, &sts_client->sec_policy);
     }
 
     return AXIS2_SUCCESS;
@@ -365,8 +383,6 @@
     trust_context_t *trust_context,
     neethi_policy_t *issuer_policy)
 {
-    axis2_svc_client_t *svc_client = NULL;
-
     axis2_status_t status = AXIS2_SUCCESS;
     axiom_node_t *rst_node = NULL;
     axiom_node_t *return_node = NULL;
@@ -406,22 +422,22 @@
     sts_client->svc_client =
     trust_sts_client_get_svc_client(sts_client, env, wsa_action);              
                                                                                
                  
 
-    if (svc_client)
+    if (sts_client->svc_client)
     {
-        status = axis2_svc_client_set_policy(svc_client, env, issuer_policy);
-
-        if (status == AXIS2_FAILURE)
-        {
-            axis2_svc_client_free(svc_client, env);
-            svc_client = NULL;
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Policy setting failed.");
-        }
+               if(issuer_policy)
+               {
+                       status = 
axis2_svc_client_set_policy(sts_client->svc_client, env, issuer_policy);
+                       if (status == AXIS2_FAILURE)
+                       {
+                               AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Policy 
setting failed.");
+                       }
+               }
 
                /*Building the RST */
         rst_node = trust_context_build_rst_node(trust_context, env);
         if(rst_node)
         {
-            return_node = axis2_svc_client_send_receive(svc_client, env, 
rst_node);
+            return_node = 
axis2_svc_client_send_receive(sts_client->svc_client, env, rst_node);
                        sts_client->sent_rst_node = return_node;
 
                        /*Processing Response*/
@@ -432,7 +448,7 @@
                        else
                        {
                                /*Processing IN_MSG_CONTEXT*/
-                               op_client = 
axis2_svc_client_get_op_client(svc_client, env);
+                               op_client = 
axis2_svc_client_get_op_client(sts_client->svc_client, env);
                                if(op_client)
                                {
                                        in_msg_ctx = (axis2_msg_ctx_t 
*)axis2_op_client_get_msg_ctx (op_client, env, AXIS2_WSDL_MESSAGE_LABEL_IN);

Modified: webservices/rampart/trunk/c/src/trust/trust_util.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/trust/trust_util.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/trust/trust_util.c (original)
+++ webservices/rampart/trunk/c/src/trust/trust_util.c Tue Feb 12 19:39:56 2008
@@ -146,6 +146,7 @@
     {
         req_type_str = axutil_stracat(env, wst_ns_uri, request_type);
         status = axiom_element_set_text(request_type_ele, env, req_type_str, 
request_type_node);
+               AXIS2_FREE(env->allocator, req_type_str);
     }
     else
     {

Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Tue Feb 12 19:39:56 
2008
@@ -260,6 +260,40 @@
             }
         }
 
+        if(rampart_context->replay_detector)
+        {
+            axutil_param_t *param = NULL;
+            param = rampart_context->replay_detector->param;
+                       /*User specific free logic*/
+            RAMPART_REPLAY_DETECTOR_FREE(rampart_context->replay_detector, 
env);
+            rampart_context->replay_detector = NULL;
+            if(param){
+                /*We actually free the dll_desc, which is set as the value of 
the axutil parameter.*/
+                               axutil_param_free(param, env);
+                /*axutil_dll_desc_t *dll_desc_l = NULL;
+                dll_desc_l = axutil_param_get_value(param, env);
+                status = axutil_class_loader_delete_dll(env, dll_desc_l);
+                dll_desc_l = NULL;*/
+            }
+        }
+
+        if(rampart_context->sct_provider)
+        {
+            axutil_param_t *param = NULL;
+            param = rampart_context->sct_provider->param;
+                       /*User specific free logic*/
+            RAMPART_SCT_PROVIDER_FREE(rampart_context->sct_provider, env);
+            rampart_context->sct_provider = NULL;
+            if(param){
+                /*We actually free the dll_desc, which is set as the value of 
the axutil parameter.*/
+                               axutil_param_free(param, env);
+                /*axutil_dll_desc_t *dll_desc_l = NULL;
+                dll_desc_l = axutil_param_get_value(param, env);
+                status = axutil_class_loader_delete_dll(env, dll_desc_l);
+                dll_desc_l = NULL;*/
+            }
+        }
+
         /*Free derived key list*/
                if (rampart_context->key_list)
                {

Modified: webservices/rampart/trunk/c/src/util/rampart_encryption.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_encryption.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Tue Feb 12 
19:39:56 2008
@@ -580,6 +580,7 @@
         mod_id = axutil_stracat(env, "#",id);
         oxs_token_build_data_reference_element(env, data_ref_list_node, 
mod_id);
                AXIS2_FREE(env->allocator, id);
+               AXIS2_FREE(env->allocator, mod_id);
        }
     axutil_array_list_free(id_list, env);
     id_list = NULL; 

Modified: webservices/rampart/trunk/c/src/util/rampart_policy_validator.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_policy_validator.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_policy_validator.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_policy_validator.c Tue Feb 12 
19:39:56 2008
@@ -148,7 +148,8 @@
                   rampart_context, env, soap_envelope, nodes_to_encrypt);
 
     /*See if the body need to be encrypted*/
-    if(nodes_to_encrypt && (axutil_array_list_size(nodes_to_encrypt, env) > 
0)){
+    if(nodes_to_encrypt && (axutil_array_list_size(nodes_to_encrypt, env) > 0))
+       {
         for(i=0 ; i < axutil_array_list_size(nodes_to_encrypt, env); i++)
         {
             axiom_node_t *node_to_enc = NULL;
@@ -156,30 +157,43 @@
             /*Get the node to be encrypted*/
             node_to_enc = (axiom_node_t *)axutil_array_list_get
                       (nodes_to_encrypt, env, i);
-            if(node_to_enc){
-                if(0 == axutil_strcmp( OXS_NODE_BODY , 
axiom_util_get_localname(axiom_node_get_parent(node_to_enc,env), env))){
+            if(node_to_enc)
+                       {
+                if(0 == axutil_strcmp( OXS_NODE_BODY , 
axiom_util_get_localname(axiom_node_get_parent(node_to_enc,env), env)))
+                               {
                     body_encryption = AXIS2_TRUE;
                     break;
                 }
             }
         }/*Eof loop*/
-    }else{
+    }
+       else
+       {
+               axutil_array_list_free(nodes_to_encrypt, env);
         return AXIS2_SUCCESS;
     }
     
-    if(AXIS2_TRUE == body_encryption){
+       axutil_array_list_free(nodes_to_encrypt, env);
+
+    if(AXIS2_TRUE == body_encryption)
+       {
         axis2_char_t* body_encrypted = NULL;
         body_encrypted = 
(axis2_char_t*)rampart_get_security_processed_result(env, msg_ctx, 
RAMPART_SPR_BODY_ENCRYPTED);
-        if(0 == axutil_strcmp(RAMPART_YES, body_encrypted)){
+        if(0 == axutil_strcmp(RAMPART_YES, body_encrypted))
+               {
             return AXIS2_SUCCESS;
-        }else{
+        }
+               else
+               {
             /*Error*/
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rpv] Body need 
to be encrypted.");
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK, 
"Body need to be encrypted", 
                         RAMPART_FAULT_INVALID_SECURITY, msg_ctx);
             return AXIS2_FAILURE;
         }
-    }else{
+    }
+       else
+       {
         return AXIS2_SUCCESS;
     }
 }
@@ -209,6 +223,7 @@
     {
         if(axutil_array_list_size(nodes_to_sign, env) <= 0)
         {
+                       axutil_array_list_free(nodes_to_sign, env);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rpv] Signature 
is not expected.");
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK, 
"Signature is not expected", 
                         RAMPART_FAULT_INVALID_SECURITY, msg_ctx);
@@ -219,12 +234,15 @@
     {
         if(axutil_array_list_size(nodes_to_sign, env) > 0)
         {
+                       axutil_array_list_free(nodes_to_sign, env);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rpv] Could not 
find signature.");
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK, 
"Could not find signature", 
                         RAMPART_FAULT_INVALID_SECURITY, msg_ctx);
             return AXIS2_FAILURE;
         }
     }
+
+       axutil_array_list_free(nodes_to_sign, env);
     return AXIS2_SUCCESS;
 }
 
@@ -264,5 +282,6 @@
     /*All the policy reqmnts are met. We are good to go*/
     return AXIS2_SUCCESS;
 }
+
 
 

Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c?rev=627235&r1=627234&r2=627235&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c 
(original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c Tue Feb 
12 19:39:56 2008
@@ -254,6 +254,7 @@
         key = rampart_context_get_key(rampart_context, env, id);
     }
 
+       AXIS2_FREE(env->allocator, id);
     return key;
 }
     
@@ -1692,4 +1693,5 @@
     }
     return AXIS2_SUCCESS;
 }
+
 


Reply via email to