Author: kaushalye
Date: Tue Oct 16 19:20:38 2007
New Revision: 585330

URL: http://svn.apache.org/viewvc?rev=585330&view=rev
Log:
replay detection - modification to support windows compilation. (patch for      
RAMPARTC-35 - 
https://issues.apache.org/jira/secure/attachment/12367816/replay_detection_win_modification.patch)

Modified:
    webservices/rampart/trunk/c/build/win32/deploy_rampart.bat
    webservices/rampart/trunk/c/build/win32/makefile
    webservices/rampart/trunk/c/include/rampart_context.h
    
webservices/rampart/trunk/c/samples/replay_detector/rampart_replay_detector_flat_file.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/build/win32/deploy_rampart.bat
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/build/win32/deploy_rampart.bat?rev=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- webservices/rampart/trunk/c/build/win32/deploy_rampart.bat (original)
+++ webservices/rampart/trunk/c/build/win32/deploy_rampart.bat Tue Oct 16 
19:20:38 2007
@@ -10,6 +10,9 @@
 md %AXIS2C_HOME%\bin\samples\rampart\authn_provider\
 copy bin\samples\authn_provider\authn.dll 
%AXIS2C_HOME%\bin\samples\rampart\authn_provider\
 
+md %AXIS2C_HOME%\bin\samples\rampart\replay_detector\
+copy bin\samples\replay_detector\rdflatfile.dll 
%AXIS2C_HOME%\bin\samples\rampart\replay_detector\
+
 md %AXIS2C_HOME%\bin\samples\rampart\data\
 copy bin\samples\data\passwords.txt %AXIS2C_HOME%\bin\samples\rampart\data\
 

Modified: webservices/rampart/trunk/c/build/win32/makefile
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/build/win32/makefile?rev=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- webservices/rampart/trunk/c/build/win32/makefile (original)
+++ webservices/rampart/trunk/c/build/win32/makefile Tue Oct 16 19:20:38 2007
@@ -72,6 +72,7 @@
        if not exist $(RAMPART_DISTDIR) mkdir $(RAMPART_DISTDIR)
        mkdir $(RAMPART_DISTDIR)\bin\samples\callback
        mkdir $(RAMPART_DISTDIR)\bin\samples\authn_provider
+       mkdir $(RAMPART_DISTDIR)\bin\samples\replay_detector
        mkdir $(RAMPART_DISTDIR)\bin\samples\services\sec_echo
        mkdir $(RAMPART_DISTDIR)\bin\samples\client\sec_echo
        mkdir $(RAMPART_DISTDIR)\bin\samples\client\sec_echo\data
@@ -89,6 +90,7 @@
 
        if not exist $(RAMPART_INTDIR)\samples\callback\pwcb mkdir 
$(RAMPART_INTDIR)\samples\callback\pwcb
        if not exist $(RAMPART_INTDIR)\samples\authn_provider mkdir 
$(RAMPART_INTDIR)\samples\authn_provider
+       if not exist $(RAMPART_INTDIR)\samples\replay_detector mkdir 
$(RAMPART_INTDIR)\samples\replay_detector
        if not exist $(RAMPART_INTDIR)\samples\services\sec_echo\ mkdir 
$(RAMPART_INTDIR)\samples\services\sec_echo
        if not exist $(RAMPART_INTDIR)\samples\client\sec_echo\ mkdir 
$(RAMPART_INTDIR)\samples\client\sec_echo
        if not exist $(RAMPART_INTDIR)\samples\credential_provider\ mkdir 
$(RAMPART_INTDIR)\samples\credential_provider
@@ -117,6 +119,12 @@
        $(LD) $(LDFLAGS) $(RAMPART_INTDIR)\samples\authn_provider\*.obj 
mod_rampart.lib axutil.lib /LIBPATH:$(RAMPART_DISTDIR)\modules\rampart /DLL \
              /OUT:$(RAMPART_DISTDIR)\bin\samples\authn_provider\authn.dll
 
+mod_rampart_rd:
+       $(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) 
$(RAMPART_SOURCE_DIR)\samples\replay_detector\rampart_replay_detector_flat_file.c
 \
+                 /Fo$(RAMPART_INTDIR)\samples\replay_detector\ /c
+       $(LD) $(LDFLAGS) $(RAMPART_INTDIR)\samples\replay_detector\*.obj 
mod_rampart.lib axutil.lib axis2_engine.lib 
/LIBPATH:$(RAMPART_DISTDIR)\modules\rampart /DLL \
+                 
/OUT:$(RAMPART_DISTDIR)\bin\samples\replay_detector\rdflatfile.dll
+
 mod_rampart_services_sec_echo:
        $(CC) $(CFLAGS) $(MOD_RAMPART_INCLUDE_PATH) 
/I$(RAMPART_SOURCE_DIR)\samples\server\sec_echo \
              $(RAMPART_SOURCE_DIR)\samples\server\sec_echo\*.c \
@@ -177,7 +185,7 @@
 
 #copy make_bin_dist.bat $(RAMPART_DISTDIR)
 
-mod_rampart_all: mod_rampart mod_rampart_authn mod_rampart_pwcb 
mod_rampart_htpwcb mod_rampart_samples mod_rampart_copy_include copy_dist_files
+mod_rampart_all: mod_rampart mod_rampart_authn mod_rampart_rd mod_rampart_pwcb 
mod_rampart_htpwcb mod_rampart_samples mod_rampart_copy_include copy_dist_files
 
 mv_dist:
        move $(RAMPART_DISTDIR) $(RAMPART_DIST_NAME)
@@ -190,7 +198,7 @@
 copy_docs:
        if exist $(RAMPART_SOURCE_DIR)\docs xcopy /E /I /Y 
$(RAMPART_SOURCE_DIR)\docs $(RAMPART_DISTDIR)\docs 
 
-dist: clean distdir intdirs mod_rampart mod_rampart_pwcb mod_rampart_authn 
mod_rampart_services_sec_echo mod_rampart_samples_sec_echo 
mod_rampart_samples_credential_provider mod_rampart_copy_deploy 
mod_rampart_copy_include copy_dist_files copy_sec_policy mod_rampart_copy_keys 
del_am mod_rampart_sample_data copy_docs
+dist: clean distdir intdirs mod_rampart mod_rampart_pwcb mod_rampart_authn 
mod_rampart_rd mod_rampart_services_sec_echo mod_rampart_samples_sec_echo 
mod_rampart_samples_credential_provider mod_rampart_copy_deploy 
mod_rampart_copy_include copy_dist_files copy_sec_policy mod_rampart_copy_keys 
del_am mod_rampart_sample_data copy_docs
 
 dist_no_samples: clean distdir intdirs mod_rampart mod_rampart_copy_include 
copy_dist_files
 

Modified: webservices/rampart/trunk/c/include/rampart_context.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_context.h?rev=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_context.h (original)
+++ webservices/rampart/trunk/c/include/rampart_context.h Tue Oct 16 19:20:38 
2007
@@ -347,6 +347,11 @@
     rampart_context_set_authn_provider(rampart_context_t *rampart_context,
                                        const axutil_env_t *env,
                                        rampart_authn_provider_t 
*authn_provider);
+       
+       AXIS2_EXTERN axis2_status_t AXIS2_CALL
+       rampart_context_set_replay_detector(rampart_context_t *rampart_context,
+                                   const axutil_env_t *env,
+                                   struct rampart_replay_detector_t 
*replay_detector);
 
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
     rampart_context_get_require_timestamp(

Modified: 
webservices/rampart/trunk/c/samples/replay_detector/rampart_replay_detector_flat_file.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/replay_detector/rampart_replay_detector_flat_file.c?rev=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- 
webservices/rampart/trunk/c/samples/replay_detector/rampart_replay_detector_flat_file.c
 (original)
+++ 
webservices/rampart/trunk/c/samples/replay_detector/rampart_replay_detector_flat_file.c
 Tue Oct 16 19:20:38 2007
@@ -27,8 +27,8 @@
 
 #define BUFFER_LEN 10000
 #define DELIMIT 16
-#define INDICATOR_FILE "indicator"
-#define REPLAY_FILE "replay.content"
+#define INDICATOR_FILE "/indicator"
+#define REPLAY_FILE "/replay.content"
 
 AXIS2_EXTERN axis2_char_t * AXIS2_CALL
 rampart_replay_detector_file_dir(const axutil_env_t* env)
@@ -38,7 +38,7 @@
        if (axis_home)
                return axutil_strdup(env, axis_home);
        else
-               return axutil_strdup(env, "c:/");
+               return axutil_strdup(env, "c:\\logs\\");
 #else
        return axutil_strdup(env, "/tmp/");
 #endif 
@@ -60,119 +60,6 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_replay_detector_with_flat_file(rampart_replay_detector_t *rrd,
-               const axutil_env_t *env,
-        axis2_msg_ctx_t* msg_ctx,
-        rampart_context_t *rampart_context)
-{
-    axutil_linked_list_t *ll = NULL;
-    const axis2_char_t *msg_id = NULL;
-    const axis2_char_t *ts = NULL;
-    const axis2_char_t *addr_msg_id = NULL;
-    int max_rcds = RAMPART_RD_DEF_MAX_RCDS;
-    axis2_status_t status = AXIS2_FAILURE;
-       
-
-    /* By using just Timestamps we dont need addressing. But there is a chance 
that
-     * two messages might generated exactly at the same time*/
-    ts = rampart_replay_detector_get_ts( env, msg_ctx);
-    addr_msg_id = axis2_msg_ctx_get_wsa_message_id(msg_ctx, env);
-
-    if(!ts && addr_msg_id)
-       {
-        msg_id = addr_msg_id;
-    }
-       else if(ts && !addr_msg_id)
-       {
-        msg_id = ts;
-    }
-       else if(ts && addr_msg_id)
-       {
-        msg_id = axutil_strcat(env, addr_msg_id, ts, NULL);
-    }
-       else
-       {
-        msg_id = NULL;
-    }
-    if(!msg_id)
-       {
-        msg_id = "RAMPART-DEFAULT-TS";/*This has to be changed to generate the 
hash???*/
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] NO msg_id 
specified, using default = %s", msg_id);
-    }
-
-
-    ll = axutil_linked_list_create(env);
-    if(!ll)
-       {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rrd] linked list 
creation failed");
-        return AXIS2_FAILURE;
-    }
-
-       status = rampart_replay_detector_read_file(env, ll);
-       if(AXIS2_FAILURE == status)
-       {
-               rampart_replay_detector_write_file(env, ll, AXIS2_FALSE);
-        return AXIS2_FAILURE;
-    }
-       else
-       {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Number of 
records =%d", axutil_linked_list_size(ll, env));
-        /*Get the valid duration for a record*/
-        if(rampart_context_get_rd_val(rampart_context, env))
-               {
-            max_rcds = axutil_atoi(rampart_context_get_rd_val(rampart_context, 
env));
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the 
specified max_rcds  %d\n", max_rcds );
-        }
-               else
-               {
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the 
default max_rcds  %d\n", max_rcds );
-        }
-
-        /*If the table already have the same key it's a replay*/
-        if(AXIS2_TRUE == rampart_replay_detector_linked_list_contains(ll, env, 
(void*)msg_id))
-               {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] For ID=%s, 
a replay detected", msg_id);
-                       rampart_replay_detector_write_file(env, ll, 
AXIS2_FALSE);
-            return AXIS2_FAILURE;
-        }
-
-        while(axutil_linked_list_size(ll, env) >= max_rcds)
-               {
-            axis2_char_t *tmp_msg_id = NULL;
-            tmp_msg_id = (axis2_char_t*)axutil_linked_list_remove_first(ll, 
env);
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Deleting 
record  %s\n", tmp_msg_id );
-            AXIS2_FREE(env->allocator, tmp_msg_id);
-            tmp_msg_id = NULL;
-        }
-
-        /*Add current record*/
-        status = axutil_linked_list_add(ll, env, 
(void*)axutil_strdup(env,msg_id));
-        if(AXIS2_SUCCESS == status)
-               {
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Adding 
record  %s\n", msg_id );
-        }
-               else
-               {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] Cannot add 
record %s\n", msg_id);
-                       rampart_replay_detector_write_file(env, ll, 
AXIS2_FALSE);
-            return AXIS2_FAILURE;
-        }
-               status =  rampart_replay_detector_write_file(env, ll, 
AXIS2_TRUE);
-               axutil_linked_list_free(ll, env);
-        if(AXIS2_SUCCESS == status)
-               {
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] writing to 
file succeed" );
-                       return AXIS2_SUCCESS;
-        }
-               else
-               {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] writing to 
file failed");
-            return AXIS2_FAILURE;
-        }
-    }
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_replay_detector_read_file(const axutil_env_t *env,
                                                                  
axutil_linked_list_t* ll)
 {
@@ -181,11 +68,13 @@
        axis2_char_t buffer[sizeof(axis2_char_t) * (BUFFER_LEN + 1)];
        int ch_read = 0;
        char* key = NULL;
+       axis2_char_t *file_dir = NULL;
+       axis2_char_t *file_name = NULL;
+
        char dilim[2];
        dilim[0] = DELIMIT;
        dilim[1] = 0;
-       axis2_char_t *file_dir = NULL;
-       axis2_char_t *file_name = NULL;
+       
 
        /*
         * check whether some other threads are using the file. In that case, 
the file will not be empty.
@@ -198,7 +87,11 @@
        while (temp_file)
        {
                fclose (temp_file);
+#ifdef WIN32
+               Sleep (5000);
+#else
                sleep (5);
+#endif
                temp_file = fopen(file_name, "r");
        }
 
@@ -320,6 +213,119 @@
        AXIS2_FREE(env->allocator, file_name);
        AXIS2_FREE(env->allocator, file_dir);
        return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_replay_detector_with_flat_file(rampart_replay_detector_t *rrd,
+               const axutil_env_t *env,
+        axis2_msg_ctx_t* msg_ctx,
+        rampart_context_t *rampart_context)
+{
+    axutil_linked_list_t *ll = NULL;
+    const axis2_char_t *msg_id = NULL;
+    const axis2_char_t *ts = NULL;
+    const axis2_char_t *addr_msg_id = NULL;
+    int max_rcds = RAMPART_RD_DEF_MAX_RCDS;
+    axis2_status_t status = AXIS2_FAILURE;
+       
+
+    /* By using just Timestamps we dont need addressing. But there is a chance 
that
+     * two messages might generated exactly at the same time*/
+    ts = rampart_replay_detector_get_ts( env, msg_ctx);
+    addr_msg_id = axis2_msg_ctx_get_wsa_message_id(msg_ctx, env);
+
+    if(!ts && addr_msg_id)
+       {
+        msg_id = addr_msg_id;
+    }
+       else if(ts && !addr_msg_id)
+       {
+        msg_id = ts;
+    }
+       else if(ts && addr_msg_id)
+       {
+        msg_id = axutil_strcat(env, addr_msg_id, ts, NULL);
+    }
+       else
+       {
+        msg_id = NULL;
+    }
+    if(!msg_id)
+       {
+        msg_id = "RAMPART-DEFAULT-TS";/*This has to be changed to generate the 
hash???*/
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] NO msg_id 
specified, using default = %s", msg_id);
+    }
+
+
+    ll = axutil_linked_list_create(env);
+    if(!ll)
+       {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rrd] linked list 
creation failed");
+        return AXIS2_FAILURE;
+    }
+
+       status = rampart_replay_detector_read_file(env, ll);
+       if(AXIS2_FAILURE == status)
+       {
+               rampart_replay_detector_write_file(env, ll, AXIS2_FALSE);
+        return AXIS2_FAILURE;
+    }
+       else
+       {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Number of 
records =%d", axutil_linked_list_size(ll, env));
+        /*Get the valid duration for a record*/
+        if(rampart_context_get_rd_val(rampart_context, env))
+               {
+            max_rcds = axutil_atoi(rampart_context_get_rd_val(rampart_context, 
env));
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the 
specified max_rcds  %d\n", max_rcds );
+        }
+               else
+               {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Using the 
default max_rcds  %d\n", max_rcds );
+        }
+
+        /*If the table already have the same key it's a replay*/
+        if(AXIS2_TRUE == rampart_replay_detector_linked_list_contains(ll, env, 
(void*)msg_id))
+               {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] For ID=%s, 
a replay detected", msg_id);
+                       rampart_replay_detector_write_file(env, ll, 
AXIS2_FALSE);
+            return AXIS2_FAILURE;
+        }
+
+        while(axutil_linked_list_size(ll, env) >= max_rcds)
+               {
+            axis2_char_t *tmp_msg_id = NULL;
+            tmp_msg_id = (axis2_char_t*)axutil_linked_list_remove_first(ll, 
env);
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Deleting 
record  %s\n", tmp_msg_id );
+            AXIS2_FREE(env->allocator, tmp_msg_id);
+            tmp_msg_id = NULL;
+        }
+
+        /*Add current record*/
+        status = axutil_linked_list_add(ll, env, 
(void*)axutil_strdup(env,msg_id));
+        if(AXIS2_SUCCESS == status)
+               {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] Adding 
record  %s\n", msg_id );
+        }
+               else
+               {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] Cannot add 
record %s\n", msg_id);
+                       rampart_replay_detector_write_file(env, ll, 
AXIS2_FALSE);
+            return AXIS2_FAILURE;
+        }
+               status =  rampart_replay_detector_write_file(env, ll, 
AXIS2_TRUE);
+               axutil_linked_list_free(ll, env);
+        if(AXIS2_SUCCESS == status)
+               {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rrd] writing to 
file succeed" );
+                       return AXIS2_SUCCESS;
+        }
+               else
+               {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][rrd] writing to 
file failed");
+            return AXIS2_FAILURE;
+        }
+    }
 }
 
 

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=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Tue Oct 16 19:20:38 
2007
@@ -792,12 +792,12 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_replay_detector(rampart_context_t *rampart_context,
                                    const axutil_env_t *env,
-                                   rampart_replay_detector_t *replay_detector)
+                                   struct rampart_replay_detector_t 
*replay_detector)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error,replay_detector,AXIS2_FAILURE);
 
-    rampart_context->replay_detector = replay_detector;
+    rampart_context->replay_detector = 
(rampart_replay_detector_t*)replay_detector;
     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?rev=585330&r1=585329&r2=585330&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Tue Oct 16 19:20:38 
2007
@@ -340,7 +340,7 @@
     {
         replay_detector = 
rampart_load_replay_detector(env,replay_detector_name);
         if(replay_detector)
-            
rampart_context_set_replay_detector(rampart_context,env,replay_detector);
+            
rampart_context_set_replay_detector(rampart_context,env,(void*)replay_detector);
     }
     return status;
 }

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=585330&r1=585329&r2=585330&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 Oct 
16 19:20:38 2007
@@ -1442,7 +1442,7 @@
             }
         }
 
-        if((NULL == rampart_context_get_rd_val(rampart_context, env)) && (NULL 
== rampart_context_get_replay_detector(rampart_context, env)))
+        if((NULL == rampart_context_get_rd_val(rampart_context, env)) && (NULL 
== rampart_context_get_replay_detector_name(rampart_context, env)))
                {
             AXIS2_LOG_INFO(env->log, "[rampart][shp] Replay detection is not 
specified. Nothing to do");
             need_replay_detection = AXIS2_FALSE;
@@ -1454,9 +1454,17 @@
         }
         if(AXIS2_TRUE == need_replay_detection)
                {/*TODO Chk for the policy configuration*/
-                       rampart_replay_detector_t* replay_detector = 
(rampart_replay_detector_t*)rampart_context_get_replay_detector(rampart_context,
 env);
-                       if (replay_detector)
+                       axis2_char_t* replay_detector_name = 
rampart_context_get_replay_detector_name(rampart_context, env);
+                       if (replay_detector_name)
                        {
+                               rampart_replay_detector_t* replay_detector = 
(rampart_replay_detector_t*)rampart_context_get_replay_detector(rampart_context,
 env);
+                               if (!replay_detector)
+                               {
+                                       AXIS2_LOG_ERROR(env->log, 
AXIS2_LOG_SI,"[rampart][shp] Cannot find the replay detector module");
+                                       rampart_create_fault_envelope(env, 
RAMPART_FAULT_INVALID_SECURITY, "Message is replayed", 
RAMPART_FAULT_MSG_REPLAYED, msg_ctx);
+                                       return AXIS2_FAILURE;
+                               }
+
                                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[rampart][shp] Using replay module.");
                                status = 
RAMPART_REPLAY_DETECTOR_IS_REPLAYED(replay_detector, env, msg_ctx, 
rampart_context);
                                if(status != AXIS2_SUCCESS)
@@ -1473,8 +1481,8 @@
                        }
                        else
                        {
-                               AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[rampart][shp] Replay module not defined. Using replay function.");
                                rampart_is_replayed_fn rd_fn = NULL;
+                               AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[rampart][shp] Replay module not defined. Using replay function.");
                                
                                /*Is replayed*/
                                rd_fn = 
rampart_context_get_replay_detect_function(rampart_context, env);
@@ -1570,8 +1578,8 @@
                        }
                        else
                        {
-                               AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[rampart][shp] Replay module not defined. Using replay function.");
                                rampart_is_replayed_fn rd_fn = NULL;
+                               AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[rampart][shp] Replay module not defined. Using replay function.");
                                
                                /*Is replayed*/
                                rd_fn = 
rampart_context_get_replay_detect_function(rampart_context, env);


Reply via email to