Author: kaushalye
Date: Thu Aug 30 04:41:56 2007
New Revision: 571117

URL: http://svn.apache.org/viewvc?rev=571117&view=rev
Log:
1. Hereafter no more prefixes for the Id attribute in EncryptedData element and 
EncryptedKey elements. This change is made to be interop'ble with other 
implementations. Also changed the processing rules not to be strict with such a 
prefix. 
2. Memory leak fixes
3. Code cleaning

Modified:
    webservices/rampart/trunk/c/include/oxs_axiom.h
    webservices/rampart/trunk/c/samples/client/sec_echo/echo.c
    webservices/rampart/trunk/c/src/handlers/rampart_in_handler.c
    webservices/rampart/trunk/c/src/omxmlsec/axiom.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
    webservices/rampart/trunk/c/src/util/rampart_token_processor.c

Modified: webservices/rampart/trunk/c/include/oxs_axiom.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_axiom.h?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_axiom.h (original)
+++ webservices/rampart/trunk/c/include/oxs_axiom.h Thu Aug 30 04:41:56 2007
@@ -96,7 +96,8 @@
     oxs_axiom_get_node_by_id(const axutil_env_t *env,
                              axiom_node_t *node,
                              axis2_char_t *attr,
-                             axis2_char_t *val);
+                             axis2_char_t *val,
+                             axis2_char_t *ns);
 
     /**
      * Traverse thru the node and its children. Check if the node has a 
particular id as in @attr
@@ -109,7 +110,8 @@
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
     oxs_axiom_get_attribute_value_of_node_by_name(const axutil_env_t *env,
             axiom_node_t *node,
-            axis2_char_t *attribute_name);
+            axis2_char_t *attribute_name,
+            axis2_char_t *ns);
 
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
     oxs_axiom_get_attribute_val_of_node_by_qname(const axutil_env_t *env,

Modified: webservices/rampart/trunk/c/samples/client/sec_echo/echo.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/client/sec_echo/echo.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/client/sec_echo/echo.c (original)
+++ webservices/rampart/trunk/c/samples/client/sec_echo/echo.c Thu Aug 30 
04:41:56 2007
@@ -71,6 +71,9 @@
     axis2_options_set_to(options, env, endpoint_ref);
     axis2_options_set_action(options, env,
             "http://example.com/ws/2004/09/policy/Test/EchoRequest";);
+    /*axis2_options_set_action(options, env,
+            "urn:echo");*/
+
 
     /*If the client home is not specified, use the AXIS2C_HOME*/
     if (!client_home)

Modified: webservices/rampart/trunk/c/src/handlers/rampart_in_handler.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/handlers/rampart_in_handler.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/handlers/rampart_in_handler.c (original)
+++ webservices/rampart/trunk/c/src/handlers/rampart_in_handler.c Thu Aug 30 
04:41:56 2007
@@ -144,7 +144,7 @@
     
     if(status!=AXIS2_SUCCESS)
     {
-        AXIS2_LOG_INFO(env->log,
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
             "[rampart][rampart_in_handler] Security Header processing 
failed.");
         return status;
     }        

Modified: webservices/rampart/trunk/c/src/omxmlsec/axiom.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/axiom.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/axiom.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/axiom.c Thu Aug 30 04:41:56 2007
@@ -133,7 +133,8 @@
 oxs_axiom_get_node_by_id(const axutil_env_t *env,
                          axiom_node_t *node,
                          axis2_char_t *attr,
-                         axis2_char_t *val)
+                         axis2_char_t *val,
+                         axis2_char_t *ns)
 {
     axis2_char_t *attribute_value = NULL;
     axis2_char_t *localname = NULL;
@@ -145,7 +146,7 @@
     localname = axiom_util_get_localname(node, env);
     /*AXIS2_LOG_INFO(env->log, "[rampart][axiom] Checking node %s for the 
attribute %s with value = %s", localname, attr, val);*/
 
-    attribute_value = oxs_axiom_get_attribute_value_of_node_by_name(env, node, 
attr);
+    attribute_value = oxs_axiom_get_attribute_value_of_node_by_name(env, node, 
attr, ns);
     if(0 == axutil_strcmp(val, attribute_value) ){
         /*Gottcha.. return this node*/
         return node;
@@ -157,7 +158,7 @@
         while (temp_node)
         {
             axiom_node_t *res_node = NULL;
-            res_node = oxs_axiom_get_node_by_id(env, temp_node, attr, val);
+            res_node = oxs_axiom_get_node_by_id(env, temp_node, attr, val, ns);
             if(res_node){
                 return res_node;
             }
@@ -172,14 +173,15 @@
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_axiom_get_attribute_value_of_node_by_name(const axutil_env_t *env,
         axiom_node_t *node,
-        axis2_char_t *attribute_name)
+        axis2_char_t *attribute_name, 
+        axis2_char_t *ns)
 {
     axis2_char_t *attribute_value = NULL;
     axiom_element_t *ele = NULL;
     axutil_qname_t *qname = NULL;
 
     ele = axiom_node_get_data_element(node, env);
-    qname = axutil_qname_create(env, attribute_name, OXS_WSU_XMLNS, NULL);
+    qname = axutil_qname_create(env, attribute_name, ns 
/*NULL*//*OXS_WSU_XMLNS*/, NULL);
     attribute_value = oxs_axiom_get_attribute_val_of_node_by_qname(env, node, 
qname);
     axutil_qname_free(qname, env);
     qname = NULL;

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c 
(original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c Thu 
Aug 30 04:41:56 2007
@@ -58,14 +58,16 @@
 
     wsu_ns_obj = axiom_namespace_create(env, OXS_WSU_XMLNS, OXS_WSU);
 
-    /*In the following code we pass NULL to axiom_attribute_create to
-     * make the attributr Id="Something" Instead of wsu:Id="Something"
-     * This is done when interoping with BEA Weblogic.*/
-
 
+        if(!id){
+            id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID);
+        }
+        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL 
/*wsu_ns_obj*/);
+        ret = axiom_element_add_attribute(encrypted_data_ele, env, id_attr, 
encrypted_data_node);
+#if 0    
     if (id)
     {
-        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, 
/*NULL*/wsu_ns_obj);
+        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL 
/*wsu_ns_obj*/);
         ret = axiom_element_add_attribute(encrypted_data_ele, env, id_attr, 
encrypted_data_node);
     }
     else
@@ -73,9 +75,10 @@
         /*TODO Get a unique value for this*/
         axis2_char_t *id = NULL;
         id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID);
-        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, /*NULL*/ 
wsu_ns_obj);
+        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, 
NULL/*wsu_ns_obj*/);
         ret = axiom_element_add_attribute(encrypted_data_ele, env, id_attr, 
encrypted_data_node);
     }
+#endif
 
     return encrypted_data_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=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c Thu Aug 30 
04:41:56 2007
@@ -368,8 +368,8 @@
         return AXIS2_FAILURE;
     }
     /*Get ID, Type, MimeType attributes from the EncryptedDataNode*/
-    id = oxs_axiom_get_attribute_value_of_node_by_name(env, enc_type_node, 
OXS_ATTR_ID);
-    type = oxs_axiom_get_attribute_value_of_node_by_name(env, enc_type_node, 
OXS_ATTR_TYPE);
+    id = oxs_axiom_get_attribute_value_of_node_by_name(env, enc_type_node, 
OXS_ATTR_ID, NULL);
+    type = oxs_axiom_get_attribute_value_of_node_by_name(env, enc_type_node, 
OXS_ATTR_TYPE, NULL);
 
     /*Populate the context for future use*/
     oxs_ctx_set_enc_mtd_algorithm(enc_ctx, env, sym_algo);

Modified: webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c Thu Aug 30 
04:41:56 2007
@@ -138,7 +138,7 @@
     node = oxs_sign_part_get_node(sign_part, env);
 
     /*Get the reference ID from the node and hence to the ds:Reference node*/
-    id = oxs_axiom_get_attribute_value_of_node_by_name(env, node, "Id");
+    id = oxs_axiom_get_attribute_value_of_node_by_name(env, node, "Id", 
OXS_WSU_XMLNS);
 
     ref_id = axutil_stracat(env, "#", id);/* <ds:Reference URI="#id">*/
     reference_node = oxs_token_build_ds_reference_element(env, parent ,NULL, 
ref_id, NULL);
@@ -299,7 +299,7 @@
     ref_id2 =  axutil_string_substring_starting_at(axutil_strdup(env, ref_id), 
1);
 
     /*Find the node refered by this ref_id2 and set to the sign part*/
-    reffed_node = oxs_axiom_get_node_by_id(env, scope_node, "Id", ref_id2 );
+    reffed_node = oxs_axiom_get_node_by_id(env, scope_node, "Id", ref_id2, 
OXS_WSU_XMLNS );
     if(reffed_node){
         oxs_sign_part_set_node(sign_part, env, reffed_node);
     }else{

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=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Thu Aug 30 
04:41:56 2007
@@ -405,8 +405,8 @@
 
     if(key_id)
     {
-        oxs_axiom_add_attribute(env, encrypted_key_node, OXS_WSU, 
-            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);

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=571117&r1=571116&r2=571117&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 Thu Aug 
30 04:41:56 2007
@@ -389,7 +389,7 @@
         envelope_node = axiom_soap_envelope_get_base_node(soap_envelope, env);
 
         /*Search for the node by its ID*/
-        enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, 
OXS_ATTR_ID, id2);
+        enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, 
OXS_ATTR_ID, id2, NULL);
         if(!enc_data_node){
             AXIS2_LOG_INFO(env->log, "[rampart][shp] Node with ID=%s cannot be 
found", id);
             /*continue;*/
@@ -429,13 +429,17 @@
         /*Free*/
         oxs_ctx_free(ctx, env);
         ctx = NULL;
-       
+      
+        /*AXIS2_FREE(env->allocator, id);
+        id = NULL;
+        */
+
         if(decrypted_sym_key){
             oxs_key_free(decrypted_sym_key, env);
             decrypted_sym_key = NULL;
         }
         AXIS2_LOG_INFO(env->log, "[rampart][shp] Node ID=%s decrypted 
successfuly", id);
-    }
+    }/*end of For loop*/
 
 
     /*Set the security processed result*/
@@ -445,9 +449,9 @@
     oxs_asym_ctx_free(asym_ctx, env);
     asym_ctx = NULL;
 
-    /*Free the ref list*/
-    
-
+    axutil_array_list_free(reference_list, env);
+    reference_list = NULL;
+   
     return AXIS2_SUCCESS;
 }
 
@@ -493,7 +497,7 @@
         envelope_node = axiom_soap_envelope_get_base_node(soap_envelope, env);
 
         /*Search for the node by its ID*/
-        enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, 
OXS_ATTR_ID, id2);
+        enc_data_node = oxs_axiom_get_node_by_id(env, envelope_node, 
OXS_ATTR_ID, id2, NULL);
         if(!enc_data_node)
         {
             AXIS2_LOG_INFO(env->log, "[rampart][shp] Node with ID=%s cannot be 
found", id);
@@ -529,7 +533,7 @@
                         ref = oxs_token_get_reference(env, str_child_node);
                         ref_id = 
axutil_string_substring_starting_at(axutil_strdup(env, ref), 1);
 
-                        encrypted_key_node = oxs_axiom_get_node_by_id(env, 
sec_node, "Id", ref_id);
+                        encrypted_key_node = oxs_axiom_get_node_by_id(env, 
sec_node, "Id", ref_id, NULL);
                         if(encrypted_key_node)
                         {
                             ref_list_node = axiom_node_detach(ref_list_node, 
env); 

Modified: webservices/rampart/trunk/c/src/util/rampart_token_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_token_processor.c?rev=571117&r1=571116&r2=571117&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_token_processor.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_token_processor.c Thu Aug 30 
04:41:56 2007
@@ -81,7 +81,7 @@
     ref_id = axutil_string_substring_starting_at(axutil_strdup(env, ref), 1);
 
     /*Find the token with the id=ref_id within the scope of scope_node*/
-    bst_node = oxs_axiom_get_node_by_id(env, scope_node,"Id",ref_id);
+    bst_node = oxs_axiom_get_node_by_id(env, scope_node, "Id", ref_id, 
OXS_WSU_XMLNS);
     if(!bst_node){
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_ELEMENT_FAILED, "Error 
retrieving element with ID=%s", ref_id);
         return AXIS2_FAILURE;


Reply via email to