ws-rampart-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r574450 [1/3] - in /webservices/rampart/trunk/c/src: omxmlsec/c14n/ util/
Date Tue, 11 Sep 2007 04:41:12 GMT
Author: kaushalye
Date: Mon Sep 10 21:41:08 2007
New Revision: 574450

URL: http://svn.apache.org/viewvc?rev=574450&view=rev
Log:
Code cleaning and memory leak fixing

Modified:
    webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.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_engine.c
    webservices/rampart/trunk/c/src/util/rampart_handler_util.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
    webservices/rampart/trunk/c/src/util/rampart_signature.c
    webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c
    webservices/rampart/trunk/c/src/util/rampart_username_token.c
    webservices/rampart/trunk/c/src/util/rampart_util.c

Modified: webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c?rev=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c Mon Sep 10 21:41:08 2007
@@ -710,7 +710,7 @@
     if (text)
     {
         axis2_char_t *textval = (axis2_char_t*)axiom_text_get_text(text, ctx->env);
-        
+
         if (textval)
             textval = c14n_normalize_text(textval, ctx);
         else /*should never occur*/
@@ -1368,11 +1368,11 @@
     if (ns)
     {
         if (axutil_strlen(axiom_namespace_get_prefix((axiom_namespace_t *)ns,
-                         ctx->env)) == 0)
+                          ctx->env)) == 0)
         {
             axiom_namespace_t *def_ns = c14n_ns_stack_get_default(ctx);
             if (def_ns || axutil_strlen(axiom_namespace_get_uri(
-                                           (axiom_namespace_t *)ns, ctx->env)) != 0)
+                                            (axiom_namespace_t *)ns, ctx->env)) != 0)
             {
                 if (ns_uri_compare(ns, def_ns, ctx) != 0)
                 {
@@ -1479,7 +1479,7 @@
     if (ctx->use_stream)
     {
         axutil_stream_write(ctx->outstream, ctx->env, str,
-                           axutil_strlen(str)*sizeof(axis2_char_t));
+                            axutil_strlen(str)*sizeof(axis2_char_t));
     }
 #endif
 }
@@ -1533,7 +1533,7 @@
     else
     {
         axutil_hash_t *attr_ht = axiom_element_get_all_attributes(
-                                    (axiom_element_t *)ele, ctx->env);
+                                     (axiom_element_t *)ele, ctx->env);
         axutil_hash_index_t *hi = NULL;
         if (attr_ht)
         {

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=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Mon Sep 10 21:41:08 2007
@@ -196,13 +196,13 @@
             rampart_context->ref--;
             return;
         }
-        
+
         if(rampart_context->secpolicy)
         {
             rp_secpolicy_free(rampart_context->secpolicy,env);
             rampart_context->secpolicy = NULL;
         }
-    
+
         if(rampart_context->password_callback_module)
         {
             axutil_param_t *param = NULL;
@@ -218,7 +218,7 @@
             /*RAMPART_CALLBACK_FREE(rampart_context->password_callback_module , env);*/
             rampart_context->password_callback_module = NULL;
         }
-        
+
         if(rampart_context->authn_provider)
         {
             axutil_param_t *param = NULL;
@@ -234,7 +234,7 @@
             /*RAMPART_AUTHN_PROVIDER_FREE(rampart_context->authn_provider, env);*/
             rampart_context->authn_provider = NULL;
         }
-       
+
         if(rampart_context->session_key)
         {
             oxs_key_free(rampart_context->session_key, env);
@@ -453,8 +453,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_private_key_file(rampart_context_t *rampart_context,
-                           const axutil_env_t *env,
-                           axis2_char_t *private_key_file)
+                                     const axutil_env_t *env,
+                                     axis2_char_t *private_key_file)
 {
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -465,8 +465,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_certificate_file(rampart_context_t *rampart_context,
-                           const axutil_env_t *env,
-                           axis2_char_t *certificate_file)
+                                     const axutil_env_t *env,
+                                     axis2_char_t *certificate_file)
 {
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -477,8 +477,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_reciever_certificate_file(rampart_context_t *rampart_context,
-                           const axutil_env_t *env,
-                           axis2_char_t *reciever_certificate_file)
+        const axutil_env_t *env,
+        axis2_char_t *reciever_certificate_file)
 {
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -789,8 +789,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_session_key(rampart_context_t *rampart_context,
-                                   const axutil_env_t *env,
-                                   oxs_key_t *session_key)
+                                const axutil_env_t *env,
+                                oxs_key_t *session_key)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, session_key, AXIS2_FAILURE);
@@ -1689,7 +1689,7 @@
                 }
             }
         }
-    }        
+    }
 
     if(rp_signed_encrypted_parts_get_body(signed_encrypted_parts,env))
     {
@@ -1709,9 +1709,9 @@
         {
             axutil_array_list_add(nodes_to_sign_or_encrypt, env, body_child_node);
         }
-        
+
         return AXIS2_SUCCESS;
-    }    
+    }
 
     return status;
 }
@@ -2246,7 +2246,7 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_increment_ref(rampart_context_t *rampart_context,
-    const axutil_env_t *env)
+                              const axutil_env_t *env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     rampart_context->ref++;

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=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Mon Sep 10 21:41:08 2007
@@ -45,30 +45,30 @@
     axis2_status_t status2 = AXIS2_SUCCESS;
 
     status1 = rampart_context_get_nodes_to_encrypt(
-            rampart_context, env, soap_envelope, nodes_to_encrypt);
+                  rampart_context, env, soap_envelope, nodes_to_encrypt);
 
     status2 = rampart_context_get_elements_to_encrypt(
-            rampart_context, env, soap_envelope, nodes_to_encrypt);
+                  rampart_context, env, soap_envelope, nodes_to_encrypt);
 
     if(status1 == AXIS2_SUCCESS || status2 == AXIS2_SUCCESS)
-    {    
+    {
         return AXIS2_SUCCESS;
-    }    
+    }
     else
-    {    
+    {
         return AXIS2_FAILURE;
-    }    
+    }
 }
 
 
 /*Public functions*/
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_enc_encrypt_message(
-        const axutil_env_t *env,
-        axis2_msg_ctx_t *msg_ctx,
-        rampart_context_t *rampart_context,
-        axiom_soap_envelope_t *soap_envelope,
-        axiom_node_t *sec_node)
+    const axutil_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_context_t *rampart_context,
+    axiom_soap_envelope_t *soap_envelope,
+    axiom_node_t *sec_node)
 {
 
     axutil_array_list_t *nodes_to_encrypt = NULL;
@@ -95,20 +95,20 @@
 
 
     /*Get nodes to be encrypted*/
-    
+
     server_side = axis2_msg_ctx_get_server_side(msg_ctx, env);
     nodes_to_encrypt = axutil_array_list_create(env, 0);
 
     signature_protection = rampart_context_is_encrypt_signature(
-            rampart_context, env);
+                               rampart_context, env);
 
     status = rampart_enc_get_nodes_to_encrypt(
-            rampart_context, env, soap_envelope, nodes_to_encrypt);
+                 rampart_context, env, soap_envelope, nodes_to_encrypt);
 
     if(status != AXIS2_SUCCESS)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "[rampart][rampart_signature]Error occured in Adding Encrypted parts..");
+                        "[rampart][rampart_signature]Error occured in Adding Encrypted parts..");
         axutil_array_list_free(nodes_to_encrypt, env);
         nodes_to_encrypt = NULL;
         return AXIS2_FAILURE;
@@ -117,60 +117,60 @@
     if((axutil_array_list_size(nodes_to_encrypt, env)==0))
     {
         if(!signature_protection)
-        {    
-            AXIS2_LOG_INFO(env->log, 
-                "[rampart][rampart_encryption] No parts specified or specified parts can't
be found for encryprion.");
+        {
+            AXIS2_LOG_INFO(env->log,
+                           "[rampart][rampart_encryption] No parts specified or specified
parts can't be found for encryprion.");
             return AXIS2_SUCCESS;
-        }    
+        }
     }
 
     if(signature_protection)
-    {    
+    {
         if(!(rampart_context_is_encrypt_before_sign(rampart_context, env)))
         {
             sig_node = oxs_axiom_get_node_by_local_name(env, sec_node, OXS_NODE_SIGNATURE);
             if(!sig_node)
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "[rampart][rampart_encryption]Encrypting signature, Sigature Not found");
+                                "[rampart][rampart_encryption]Encrypting signature, Sigature
Not found");
                 return AXIS2_FAILURE;
             }
             axutil_array_list_add(nodes_to_encrypt, env, sig_node);
-        }    
+        }
     }
 
     /*Now we have to check whether a token is specified.*/
-    token = rampart_context_get_token(rampart_context, env, 
-            AXIS2_TRUE, server_side, AXIS2_FALSE);
+    token = rampart_context_get_token(rampart_context, env,
+                                      AXIS2_TRUE, server_side, AXIS2_FALSE);
     if(!token)
     {
         AXIS2_LOG_INFO(env->log,
-            "[rampart][rampart_encryption]Encryption Token is not specified");
+                       "[rampart][rampart_encryption]Encryption Token is not specified");
         return AXIS2_SUCCESS;
     }
     token_type = rp_property_get_type(token, env);
 
     if(!rampart_context_is_token_type_supported(token_type, env))
-    {   
+    {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "[rampart][rampart_encryption]Specified token type not supported.");
+                        "[rampart][rampart_encryption]Specified token type not supported.");
         return AXIS2_FAILURE;
     }
     if(rampart_context_check_is_derived_keys(env,token))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "[rampart][rampart_encryption]We still do not support derived keys");
+                        "[rampart][rampart_encryption]We still do not support derived keys");
         return AXIS2_FAILURE;
     }
 
     /*Get the symmetric encryption algorithm*/
     enc_sym_algo = rampart_context_get_enc_sym_algo(rampart_context, env);
-    
+
     /*If not specified set the default*/
     if(!enc_sym_algo ||  (0 == axutil_strcmp(enc_sym_algo, "")))
     {
-        AXIS2_LOG_INFO(env->log, 
-            "[rampart][rampart_encryption]No symmetric algorithm is specified for encryption.
Using the default");
+        AXIS2_LOG_INFO(env->log,
+                       "[rampart][rampart_encryption]No symmetric algorithm is specified
for encryption. Using the default");
         enc_sym_algo = OXS_DEFAULT_SYM_ALGO;
     }
 
@@ -180,14 +180,14 @@
     if(AXIS2_FAILURE == status)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "[rampart][rampart_encryption] Cannot generate the key for the algorithm
%s, ", enc_sym_algo);
+                        "[rampart][rampart_encryption] Cannot generate the key for the algorithm
%s, ", enc_sym_algo);
         return AXIS2_FAILURE;
     }
 
     /*Key will be duplicated inside the function. So no worries freeing it here*/
     if(rampart_context_is_encrypt_before_sign(rampart_context, env)
-        && signature_protection)
-    {    
+            && signature_protection)
+    {
         rampart_context_set_session_key(rampart_context, env, session_key);
     }
 
@@ -207,11 +207,11 @@
 
         /*Get the node to be encrypted*/
         node_to_enc = (axiom_node_t *)axutil_array_list_get
-                (nodes_to_encrypt, env, i);
+                      (nodes_to_encrypt, env, i);
         if(!node_to_enc)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "[rampart][rampart_encryption] Cannot get the node from the list to encrypt");
+                            "[rampart][rampart_encryption] Cannot get the node from the list
to encrypt");
             return AXIS2_FAILURE;
         }
         /*Create the encryption context for OMXMLSEC*/
@@ -225,19 +225,19 @@
         id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID);
 
         if(parent_of_node_to_enc || id)
-        {    
-            enc_data_node = oxs_token_build_encrypted_data_element(env, 
-                parent_of_node_to_enc, OXS_TYPE_ENC_ELEMENT, id );
-            enc_status = oxs_xml_enc_encrypt_node(env, enc_ctx, 
-                    node_to_enc, &enc_data_node);
+        {
+            enc_data_node = oxs_token_build_encrypted_data_element(env,
+                            parent_of_node_to_enc, OXS_TYPE_ENC_ELEMENT, id );
+            enc_status = oxs_xml_enc_encrypt_node(env, enc_ctx,
+                                                  node_to_enc, &enc_data_node);
             axutil_array_list_add(id_list, env, id);
             if(AXIS2_FAILURE == enc_status)
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "[rampart][rampart_encryption] Cannot encrypt the node " );
+                                "[rampart][rampart_encryption] Cannot encrypt the node "
);
                 return AXIS2_FAILURE;
             }
-        }   
+        }
         oxs_ctx_free(enc_ctx, env);
         enc_ctx = NULL;
 
@@ -254,8 +254,8 @@
     /*First we should check whether we include the token in the
      *message.*/
 
-    if(rampart_context_is_token_include(rampart_context, 
-            token, token_type, server_side, AXIS2_FALSE, env))
+    if(rampart_context_is_token_include(rampart_context,
+                                        token, token_type, server_side, AXIS2_FALSE, env))
     {
         eki = RAMPART_STR_DIRECT_REFERENCE;
     }
@@ -266,7 +266,7 @@
     if(!eki)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "[rampart][rampart_encryption] No mechanism for attaching the certificate info.");
+                        "[rampart][rampart_encryption] No mechanism for attaching the certificate
info.");
         return AXIS2_FAILURE;
     }
 
@@ -291,10 +291,10 @@
     else
     {
         certificate_file = rampart_context_get_receiver_certificate_file(
-                    rampart_context, env);
+                               rampart_context, env);
         oxs_asym_ctx_set_file_name(asym_ctx, env, certificate_file);
-        oxs_asym_ctx_set_format(asym_ctx, env, 
-            oxs_util_get_format_by_file_extension(env, certificate_file));
+        oxs_asym_ctx_set_format(asym_ctx, env,
+                                oxs_util_get_format_by_file_extension(env, certificate_file));
 
         /*Get the password to retrieve the key from key store*/
         password = rampart_context_get_prv_key_password(rampart_context, env);
@@ -304,7 +304,7 @@
             enc_user = rampart_context_get_encryption_user(rampart_context, env);
 
             if(!enc_user)
-            {    
+            {
                 enc_user = rampart_context_get_user(rampart_context, env);
             }
 
@@ -319,11 +319,11 @@
                 else
                 {
                     password_callback = rampart_context_get_password_callback
-                        (rampart_context, env);
+                                        (rampart_context, env);
                     if(!password_callback)
                     {
                         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "[rampart][rampart_encryption] Password call back module is not
loaded.");
+                                        "[rampart][rampart_encryption] Password call back
module is not loaded.");
                         return AXIS2_FAILURE;
                     }
                     password = rampart_callback_password(env, password_callback, enc_user);
@@ -335,17 +335,17 @@
             }
         }
     }
-    oxs_asym_ctx_set_operation(asym_ctx, env, 
-                OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT);
+    oxs_asym_ctx_set_operation(asym_ctx, env,
+                               OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT);
     oxs_asym_ctx_set_st_ref_pattern(asym_ctx, env, eki);
-    
+
     /*Encrypt the session key*/
-    status = oxs_xml_enc_encrypt_key(env, asym_ctx, 
-            sec_node, session_key, id_list);
+    status = oxs_xml_enc_encrypt_key(env, asym_ctx,
+                                     sec_node, session_key, id_list);
     if(AXIS2_FAILURE == status)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                            "[rampart][rampart_encryption] Session key encryption failed.");
+                        "[rampart][rampart_encryption] Session key encryption failed.");
         return AXIS2_FAILURE;
     }
 
@@ -366,7 +366,7 @@
         axutil_array_list_free(id_list, env);
         id_list = NULL;
     }
-  
+
 
     oxs_asym_ctx_free(asym_ctx, env);
     asym_ctx = NULL;
@@ -380,11 +380,11 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_enc_add_key_info(
-        const axutil_env_t *env,
-        axis2_msg_ctx_t *msg_ctx,
-        rampart_context_t *rampart_context,
-        axiom_soap_envelope_t *soap_envelope,
-        axiom_node_t *sec_node)
+    const axutil_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_context_t *rampart_context,
+    axiom_soap_envelope_t *soap_envelope,
+    axiom_node_t *sec_node)
 {
 
     axis2_char_t *key_id = NULL;
@@ -401,52 +401,52 @@
     axiom_element_t *encrypted_data_ele = NULL;
 
     encrypted_key_node = oxs_axiom_get_node_by_local_name(
-        env, sec_node,  OXS_NODE_ENCRYPTED_KEY); 
+                             env, sec_node,  OXS_NODE_ENCRYPTED_KEY);
     if(!encrypted_key_node)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[rampart][rampart_encryption]Encrypting signature, EncryptedKey Not found");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption]Encrypting signature, EncryptedKey
Not found");
         return AXIS2_FAILURE;
-    }    
+    }
 
     key_id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCKEY_ID);
 
     if(key_id)
     {
-        oxs_axiom_add_attribute(env, encrypted_key_node, NULL/*OXS_WSU*/, 
-            NULL/*RAMPART_WSU_XMLNS*/, OXS_ATTR_ID, key_id);
+        oxs_axiom_add_attribute(env, encrypted_key_node, NULL/*OXS_WSU*/,
+                                NULL/*RAMPART_WSU_XMLNS*/, OXS_ATTR_ID, key_id);
     }
-    
+
     body = axiom_soap_envelope_get_body(soap_envelope, env);
     body_node = axiom_soap_body_get_base_node(body, env);
 
     body_ele = (axiom_element_t *)
-        axiom_node_get_data_element(body_node, env);
+               axiom_node_get_data_element(body_node, env);
 
     encrypted_data_ele = axiom_util_get_first_child_element_with_localname(
-        body_ele, env, body_node, OXS_NODE_ENCRYPTED_DATA, &encrypted_data_node); 
+                             body_ele, env, body_node, OXS_NODE_ENCRYPTED_DATA, &encrypted_data_node);
 
     if(encrypted_data_ele)
     {
         key_info_node = oxs_token_build_key_info_element(
-                env, encrypted_data_node);
+                            env, encrypted_data_node);
         if(key_info_node)
         {
             str_node = oxs_token_build_security_token_reference_element(
-                env, key_info_node);
+                           env, key_info_node);
             if(str_node)
             {
                 axis2_char_t *key_id_ref = NULL;
                 key_id_ref = axutil_stracat(env, "#",key_id);
                 reference_node = oxs_token_build_reference_element(
-                    env, str_node, key_id_ref, NULL);
+                                     env, str_node, key_id_ref, NULL);
                 AXIS2_FREE(env->allocator, key_id);
                 key_id = NULL;
 
                 if(!reference_node)
                 {
-                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                        "[rampart][rampart_encryption]Encrypting signature, Reference Node
build failed");
+                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                    "[rampart][rampart_encryption]Encrypting signature, Reference
Node build failed");
                     return AXIS2_FAILURE;
                 }
                 else
@@ -455,32 +455,32 @@
                 }
             }
             else{
-                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                        "[rampart][rampart_encryption]Encrypting signature, Cannot build
the STR node");
-                    return AXIS2_FAILURE;
-                }
-        }
-        else{
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                        "[rampart][rampart_encryption] Encrypting signature, cannot build
the key indfo node");
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][rampart_encryption]Encrypting signature, Cannot
build the STR node");
                 return AXIS2_FAILURE;
             }
+        }
+        else{
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_encryption] Encrypting signature, cannot build
the key indfo node");
+            return AXIS2_FAILURE;
+        }
     }
-    else{ 
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                  "[rampart][rampart_encryption]Encrypting signature, Cannot get the encryption
data element");
+    else{
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption]Encrypting signature, Cannot get the
encryption data element");
         return AXIS2_FAILURE;
-        }
+    }
 }
 
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_enc_encrypt_signature(
-        const axutil_env_t *env,
-        axis2_msg_ctx_t *msg_ctx,
-        rampart_context_t *rampart_context,
-        axiom_soap_envelope_t *soap_envelope,
-        axiom_node_t *sec_node)
+    const axutil_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_context_t *rampart_context,
+    axiom_soap_envelope_t *soap_envelope,
+    axiom_node_t *sec_node)
 {
 
     oxs_key_t *session_key = NULL;
@@ -500,56 +500,56 @@
     if(!session_key)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "[rampart][rampart_encryption]Encrypting Signature.Session key not found");
+                        "[rampart][rampart_encryption]Encrypting Signature.Session key not
found");
         return AXIS2_FAILURE;
     }
 
     node_to_enc = oxs_axiom_get_node_by_local_name(
-        env, sec_node, OXS_NODE_SIGNATURE); 
+                      env, sec_node, OXS_NODE_SIGNATURE);
 
     if(!node_to_enc)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[rampart][rampart_encryption]Encrypting Signature. Signature node not found");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption]Encrypting Signature. Signature node
not found");
         return AXIS2_FAILURE;
-    }   
+    }
 
     encrypted_key_node = oxs_axiom_get_node_by_local_name(
-            env, sec_node,  OXS_NODE_ENCRYPTED_KEY);
+                             env, sec_node,  OXS_NODE_ENCRYPTED_KEY);
     if(!encrypted_key_node)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[rampart][rampart_encryption]Encrypting signature, EncryptedKey Not found");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption]Encrypting signature, EncryptedKey
Not found");
         return AXIS2_FAILURE;
     }
-    
+
     enc_ctx = oxs_ctx_create(env);
     oxs_ctx_set_key(enc_ctx, env, session_key);
 
-    enc_sym_algo = rampart_context_get_enc_sym_algo(rampart_context, env); 
+    enc_sym_algo = rampart_context_get_enc_sym_algo(rampart_context, env);
 
     oxs_ctx_set_enc_mtd_algorithm(enc_ctx, env, enc_sym_algo);
-   
+
     id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID);
 
     enc_data_node = oxs_token_build_encrypted_data_element(
-            env, sec_node, OXS_TYPE_ENC_ELEMENT, id );
+                        env, sec_node, OXS_TYPE_ENC_ELEMENT, id );
     enc_status = oxs_xml_enc_encrypt_node(
-            env, enc_ctx, node_to_enc, &enc_data_node);
-    
+                     env, enc_ctx, node_to_enc, &enc_data_node);
+
     /*FREE*/
     oxs_ctx_free(enc_ctx, env);
     enc_ctx = NULL;
-   
+
     if(enc_status != AXIS2_SUCCESS)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[rampart][rampart_encryption] Encrypting node failed");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption] Encrypting node failed");
         return AXIS2_FAILURE;
     }
 
     node_to_move = oxs_axiom_get_node_by_local_name(
-        env, sec_node,  OXS_NODE_REFERENCE_LIST);
+                       env, sec_node,  OXS_NODE_REFERENCE_LIST);
 
     if(node_to_move)
     {
@@ -557,33 +557,33 @@
         if(temp_node)
         {
             enc_status = axiom_node_insert_sibling_after(
-                    enc_data_node, env, temp_node);
+                             enc_data_node, env, temp_node);
             if(enc_status != AXIS2_SUCCESS)
             {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "[rampart][rampart_encryption]Encrypting signature, Node moving failed.");
   
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][rampart_encryption]Encrypting signature, Node
moving failed.");
                 return AXIS2_FAILURE;
-            }    
-        }    
-    }    
+            }
+        }
+    }
 
     id_list = axutil_array_list_create(env, 0);
 
     axutil_array_list_add(id_list, env, id);
 
     enc_status = oxs_token_build_data_reference_list(
-            env, encrypted_key_node, id_list);    
+                     env, encrypted_key_node, id_list);
     if(enc_status != AXIS2_SUCCESS)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[rampart][rampart_encryption]Encrypting signature,Building reference list failed");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "[rampart][rampart_encryption]Encrypting signature,Building reference
list failed");
         return AXIS2_FAILURE;
     }
-  
-    if(id_list){ 
+
+    if(id_list){
         /*TODO need to free data of the list*/
-        int size = 0;    
-        int j = 0; 
+        int size = 0;
+        int j = 0;
         size = axutil_array_list_size(id_list, env);
         for (j = 0; j < size; j++)
         {

Modified: webservices/rampart/trunk/c/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_engine.c?rev=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Mon Sep 10 21:41:08 2007
@@ -78,9 +78,9 @@
         if(!policy)
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-               "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
+                                          "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY,
msg_ctx);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-               "[rampart][rampart_engine] Policy creation failed.");
+                            "[rampart][rampart_engine] Policy creation failed.");
             return NULL;
         }
     }
@@ -95,13 +95,13 @@
         else
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
          
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[rampart][rampart_engine] Cannot get saved rampart_context");
+                                          "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY,
msg_ctx);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_engine] Cannot get saved rampart_context");
             return NULL;
         }
     }
-    
+
     /*secpolicy = rp_secpolicy_builder_build(env, policy);
     if(!secpolicy)
     {
@@ -120,10 +120,10 @@
             if(!secpolicy)
             {
                 rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                    "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "[rampart][rampart_engine] Cannot create security policy from policy.");
-                
+                                              "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY,
msg_ctx);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][rampart_engine] Cannot create security policy
from policy.");
+
                 return NULL;
             }
             rampart_context_set_secpolicy(rampart_context, env, secpolicy);
@@ -137,13 +137,13 @@
         if(!secpolicy)
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[rampart][rampart_engine] Cannot create security policy from policy.");
+                                          "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY,
msg_ctx);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_engine] Cannot create security policy from
policy.");
 
-                return NULL;
+            return NULL;
         }
-        
+
         rampart_context_set_secpolicy(rampart_context, env, secpolicy);
 
         status = set_rampart_user_properties(env, rampart_context);
@@ -151,11 +151,11 @@
         if(status != AXIS2_SUCCESS)
         {
             rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,
-                "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY, msg_ctx);
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,    
-                "[rampart][rampart_engine] rampc policies creation failed.");
+                                          "Error in the Internal configuration.", RAMPART_FAULT_IN_POLICY,
msg_ctx);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_engine] rampc policies creation failed.");
 
-                return NULL;
+            return NULL;
         }
     }
 
@@ -164,8 +164,8 @@
         conf_ctx =  axis2_msg_ctx_get_conf_ctx(msg_ctx,env);
         if(!conf_ctx)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[rampart][engine] Conf context is NULL ");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][engine] Conf context is NULL ");
             return NULL;
         }
 
@@ -173,11 +173,11 @@
         if(!ctx)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                 "[rampart][engine] axis2 context is NULL ");
+                            "[rampart][engine] axis2 context is NULL ");
             return NULL;
         }
         property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST ,
-            AXIS2_TRUE, (void *)rampart_context_free, rampart_context);
+                   AXIS2_TRUE, (void *)rampart_context_free, rampart_context);
         axis2_ctx_set_property(ctx, env, RAMPART_CONTEXT, property);
     }
     else
@@ -210,7 +210,7 @@
     if(!svc)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_neethi] Service is NULL.");
+                        "[rampart][rampart_neethi] Service is NULL.");
         return NULL;
     }
 
@@ -218,7 +218,7 @@
     if(!op)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_engine] Operation is NULL.");
+                        "[rampart][rampart_engine] Operation is NULL.");
         return NULL;
     }
 
@@ -234,7 +234,7 @@
     if(!msg)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_engine] Message is NULL.");
+                        "[rampart][rampart_engine] Message is NULL.");
         return NULL;
     }
 
@@ -244,7 +244,7 @@
     if(!desc)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_engine] axis2 description is NULL.");
+                        "[rampart][rampart_engine] axis2 description is NULL.");
         return NULL;
     }
 
@@ -252,7 +252,7 @@
     if(!policy_include)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_engine] Policy include is NULL.");
+                        "[rampart][rampart_engine] Policy include is NULL.");
         return NULL;
     }
     /*service_policy = axis2_policy_include_get_policy(policy_include, env);*/
@@ -262,7 +262,7 @@
     if(!service_policy)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-             "[rampart][rampart_engine] Policy is NULL.");
+                        "[rampart][rampart_engine] Policy is NULL.");
         return NULL;
     }
 

Modified: webservices/rampart/trunk/c/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_handler_util.c?rev=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_handler_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_handler_util.c Mon Sep 10 21:41:08 2007
@@ -112,33 +112,33 @@
     axiom_node_t *header_block_node = NULL;
 
 
-        header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env);
-        if (!header_block_ht)
-            return AXIS2_FAILURE;
+    header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env);
+    if (!header_block_ht)
+        return AXIS2_FAILURE;
 
-        /*BETTER IF : If there are multiple security header elements, get the one with @role=rampart*/
-        for (hash_index = axutil_hash_first(header_block_ht, env); hash_index;
-                hash_index = axutil_hash_next(env, hash_index))
-        {
+    /*BETTER IF : If there are multiple security header elements, get the one with @role=rampart*/
+    for (hash_index = axutil_hash_first(header_block_ht, env); hash_index;
+            hash_index = axutil_hash_next(env, hash_index))
+    {
 
-            void *hb = NULL;
-            axiom_soap_header_block_t *header_block =    NULL;
-            axis2_char_t *ele_localname = NULL;
+        void *hb = NULL;
+        axiom_soap_header_block_t *header_block =    NULL;
+        axis2_char_t *ele_localname = NULL;
 
-            axutil_hash_this(hash_index, NULL, NULL, &hb);
-            header_block = (axiom_soap_header_block_t *)hb;
-            header_block_node = axiom_soap_header_block_get_base_node(header_block, env);
-            header_block_ele  = (axiom_element_t*)axiom_node_get_data_element(header_block_node,
env);
-            ele_localname = axiom_element_get_localname(header_block_ele, env);
+        axutil_hash_this(hash_index, NULL, NULL, &hb);
+        header_block = (axiom_soap_header_block_t *)hb;
+        header_block_node = axiom_soap_header_block_get_base_node(header_block, env);
+        header_block_ele  = (axiom_element_t*)axiom_node_get_data_element(header_block_node,
env);
+        ele_localname = axiom_element_get_localname(header_block_ele, env);
 
-            if (axutil_strcmp(ele_localname, RAMPART_SECURITY) == 0)
-            {
-                /*Set mustUnderstand = 0*/
-                axiom_soap_header_block_set_must_understand_with_bool(header_block, env,
AXIS2_FALSE);
-                return header_block_node;
-            }
+        if (axutil_strcmp(ele_localname, RAMPART_SECURITY) == 0)
+        {
+            /*Set mustUnderstand = 0*/
+            axiom_soap_header_block_set_must_understand_with_bool(header_block, env, AXIS2_FALSE);
+            return header_block_node;
+        }
 
-        }/*End of for*/
+    }/*End of for*/
 
     return header_block_node;
 

Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c?rev=574450&r1=574449&r2=574450&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c Mon Sep 10 21:41:08
2007
@@ -57,10 +57,10 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_shb_build_message(
-        const axutil_env_t *env,
-        axis2_msg_ctx_t *msg_ctx,
-        rampart_context_t *rampart_context,
-        axiom_soap_envelope_t *soap_envelope)
+    const axutil_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_context_t *rampart_context,
+    axiom_soap_envelope_t *soap_envelope)
 {
 
     axis2_status_t status = AXIS2_SUCCESS;
@@ -122,7 +122,7 @@
             if (status == AXIS2_FAILURE)
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "[rampart][shb] Timestamp Token build failed. ERROR");
+                                "[rampart][shb] Timestamp Token build failed. ERROR");
                 return AXIS2_FAILURE;
             }
         }
@@ -146,7 +146,7 @@
                 if (status == AXIS2_FAILURE)
                 {
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] UsernmaeToken build failed. ERROR");
+                                    "[rampart][shb] UsernmaeToken build failed. ERROR");
                     return AXIS2_FAILURE;
                 }
             }
@@ -158,7 +158,7 @@
         if(rampart_context_is_encrypt_before_sign(rampart_context, env))
         {
             is_encrypt_before_sign = AXIS2_TRUE;
-            
+
             if(signature_protection)
             {
                 /*First Encrypt the parts specified in encrypted parts*/
@@ -167,26 +167,26 @@
                 if(status != AXIS2_SUCCESS)
                 {
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Encryption failed. ERROR");
+                                    "[rampart][shb] Encryption failed. ERROR");
                     return AXIS2_FAILURE;
-                }    
-                
+                }
+
                 /*Add a key reference in Encrypted Data in the Body*/
-                
+
                 status = rampart_enc_add_key_info(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
                 if(status != AXIS2_SUCCESS)
                 {
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Cannot add Key information");
+                                    "[rampart][shb] Cannot add Key information");
                     return AXIS2_FAILURE;
                 }
                 /*Then Sign the message*/
 
                 status = rampart_sig_sign_message(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
                 if(status != AXIS2_SUCCESS)
-                {    
+                {
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Signing failed. ERROR");
+                                    "[rampart][shb] Signing failed. ERROR");
                     return AXIS2_FAILURE;
                 }
 
@@ -196,27 +196,27 @@
                 if(status != AXIS2_SUCCESS)
                 {
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Encrypt signature failed. ERROR");
+                                    "[rampart][shb] Encrypt signature failed. ERROR");
                     return AXIS2_FAILURE;
-                }    
-            
-            }    
+                }
+
+            }
             else
-            {    
+            {
                 status = rampart_enc_encrypt_message(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
                 if(status != AXIS2_SUCCESS){
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Encryption failed. ERROR");
+                                    "[rampart][shb] Encryption failed. ERROR");
                     return AXIS2_FAILURE;
                 }
                 /*Then do signature specific things*/
                 status = rampart_sig_sign_message(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
                 if(status != AXIS2_SUCCESS){
                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Signature failed. ERROR");
+                                    "[rampart][shb] Signature failed. ERROR");
                     return AXIS2_FAILURE;
                 }
-            }    
+            }
 
             /*Then Handle Supporting token stuff  */
         }
@@ -226,8 +226,8 @@
             /*First do signature specific stuff*/
             status = rampart_sig_sign_message(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
             if(status != AXIS2_SUCCESS){
-                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Signing failed. ERROR");
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][shb] Signing failed. ERROR");
                 return AXIS2_FAILURE;
             }
             /*Then Handle Encryption stuff*/
@@ -235,7 +235,7 @@
             status = rampart_enc_encrypt_message(env, msg_ctx, rampart_context, soap_envelope,
sec_node);
             if(status!=AXIS2_SUCCESS ){
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                        "[rampart][shb] Encryption failed. ERROR");
+                                "[rampart][shb] Encryption failed. ERROR");
                 return AXIS2_FAILURE;
             }
         }
@@ -265,7 +265,7 @@
                 }
             }
         }
-        
+
         else if(enc_key_node && signature_protection)
         {
             if(!is_encrypt_before_sign)
@@ -284,10 +284,10 @@
                     {
                         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][shb]Cannot interchange
enc_key and enc_data nodes");
                         return AXIS2_FAILURE;
-                    }    
-                }    
-            }    
-        }    
+                    }
+                }
+            }
+        }
 
         return AXIS2_SUCCESS;
     }
@@ -347,5 +347,5 @@
     }
     else{
         return AXIS2_FAILURE;
-    }        
+    }
 }



Mime
View raw message