You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ka...@apache.org on 2007/05/17 13:43:51 UTC

svn commit: r538877 - in /webservices/rampart/trunk/c/src: omxmlsec/xml_encryption.c util/rampart_context.c util/rampart_engine.c util/rampart_sec_header_processor.c

Author: kaushalye
Date: Thu May 17 04:43:50 2007
New Revision: 538877

URL: http://svn.apache.org/viewvc?view=rev&rev=538877
Log:
1. Fixing JIRA https://issues.apache.org/jira/browse/RAMPARTC-16
2. Replay detection code in Rampart context

Modified:
    webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_engine.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c

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?view=diff&rev=538877&r1=538876&r2=538877
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c Thu May 17 04:43:50 2007
@@ -484,6 +484,7 @@
     axiom_node_t *cd_node = NULL;
     axis2_char_t *enc_mtd_algo = NULL;
     axis2_char_t *cipher_val = NULL;
+    axis2_char_t *new_cipher_val = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     oxs_buffer_t *input_buf = NULL;
     oxs_buffer_t *result_buf = NULL;
@@ -500,6 +501,8 @@
     if(!cipher_val){
         return AXIS2_FAILURE;
     }
+    
+    new_cipher_val = oxs_util_get_newline_removed_string(env, cipher_val);
 
     /*Get key used to encrypt*/
     key_info_node = oxs_axiom_get_first_child_node_by_name(env, encrypted_key_node, OXS_NODE_KEY_INFO,OXS_DSIG_NS,OXS_DS);
@@ -511,7 +514,7 @@
     /*Get the pkey used to decrypt the session key. If found set it to the asym_ctx*/
     /*Create the input buffer*/
     input_buf = oxs_buffer_create(env);
-    oxs_buffer_populate(input_buf, env, (unsigned char*)cipher_val, axutil_strlen(cipher_val));
+    oxs_buffer_populate(input_buf, env, (unsigned char*)new_cipher_val, axutil_strlen(new_cipher_val));
 
     /*Create a results buffer*/
     result_buf = oxs_buffer_create(env);

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?view=diff&rev=538877&r1=538876&r2=538877
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Thu May 17 04:43:50 2007
@@ -1417,10 +1417,7 @@
         return AXIS2_FAILURE;
 
     rd_val = rp_rampart_config_get_rd_val(config,env);
-    if(!rd_val)
-        rampart_context->rd_val = "6000";
-    else
-        rampart_context->rd_val = rd_val;
+    rampart_context->rd_val = rd_val;
 
     return AXIS2_SUCCESS;
 }

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?view=diff&rev=538877&r1=538876&r2=538877
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Thu May 17 04:43:50 2007
@@ -188,32 +188,38 @@
     rampart_context_set_secpolicy(rampart_context,env,secpolicy);
 
     status = rampart_context_set_user_from_file(rampart_context,env);
-    if(status!=AXIS2_SUCCESS)
+    if(status!=AXIS2_SUCCESS){
         return NULL;
-
+    }
     status = rampart_context_set_ttl_from_file(rampart_context,env);
-    if(status!=AXIS2_SUCCESS)
+    if(status!=AXIS2_SUCCESS){
         return NULL;
-
+    }
     status = rampart_context_set_password_type_from_file(rampart_context,env);
-    if(status!=AXIS2_SUCCESS)
+    if(status!=AXIS2_SUCCESS){
         return NULL;
-
+    }
+    status = rampart_context_set_rd_val_from_file(rampart_context,env);
+    if(status!=AXIS2_SUCCESS){
+            return NULL;
+    }
     pwcb_module_name = rampart_context_get_password_callback_class(rampart_context,env);
 
     if(pwcb_module_name)
     {
         password_callback_module = rampart_load_pwcb_module(env,pwcb_module_name);
-        if(password_callback_module)
+        if(password_callback_module){
             rampart_context_set_password_callback(rampart_context,env,password_callback_module);
+        }            
     }
     authn_provider_name = rampart_context_get_authn_module_name(rampart_context,env);
 
     if(authn_provider_name)
     {
         authn_provider = rampart_load_auth_module(env,authn_provider_name);
-        if(authn_provider)
+        if(authn_provider){
             rampart_context_set_authn_provider(rampart_context,env,authn_provider);
+        }            
     }
     return rampart_context;
 

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?view=diff&rev=538877&r1=538876&r2=538877
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c Thu May 17 04:43:50 2007
@@ -902,8 +902,10 @@
                 return status;
         }
         if(NULL == rampart_context_get_rd_val(rampart_context, env)){
+            AXIS2_LOG_INFO(env->log, "[rampart][shp] Replay detection is not specified. Nothing to do");
             need_replay_detection = AXIS2_FALSE;
         }else{
+            AXIS2_LOG_INFO(env->log, "[rampart][shp] Checking message for replay.");
             need_replay_detection = AXIS2_TRUE;
         }
         if(AXIS2_TRUE == need_replay_detection){/*TODO Chk for the policy configuration*/