ws-rampart-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mili...@apache.org
Subject svn commit: r666997 - in /webservices/rampart/trunk/c: include/ samples/replay_detector/ src/handlers/ src/util/
Date Thu, 12 Jun 2008 07:36:41 GMT
Author: milinda
Date: Thu Jun 12 00:36:40 2008
New Revision: 666997

URL: http://svn.apache.org/viewvc?rev=666997&view=rev
Log:
Improving password function handling logic and adding new members to rampart context to enable
parsing extra void pointer to replay detector function.

Modified:
    webservices/rampart/trunk/c/include/rampart_context.h
    webservices/rampart/trunk/c/include/rampart_replay_detector.h
    webservices/rampart/trunk/c/samples/replay_detector/   (props changed)
    webservices/rampart/trunk/c/src/handlers/   (props changed)
    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_replay_detector.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
    webservices/rampart/trunk/c/src/util/rampart_username_token.c

Modified: webservices/rampart/trunk/c/include/rampart_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_context.h?rev=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_context.h (original)
+++ webservices/rampart/trunk/c/include/rampart_context.h Thu Jun 12 00:36:40 2008
@@ -53,12 +53,13 @@
     typedef axis2_char_t *(AXIS2_CALL*
                            password_callback_fn)(const axutil_env_t *env,
                                                  const axis2_char_t *username,
-                                                 void *ctx);
+                                                 void *user_params);
 
     typedef axis2_status_t (AXIS2_CALL*
                             rampart_is_replayed_fn)(const axutil_env_t *env,
                                                     axis2_msg_ctx_t* msg_ctx,
-                                                    rampart_context_t *rampart_context);
+                                                    rampart_context_t *rampart_context,
+                                                    void *user_params);
 
     typedef rampart_authn_provider_status_t (AXIS2_CALL*
             auth_password_func)(const axutil_env_t* env,
@@ -247,7 +248,7 @@
     rampart_context_set_pwcb_function(rampart_context_t *rampart_context,
                                       const axutil_env_t *env,
                                       password_callback_fn pwcb_function,
-                                      void *ctx);
+                                      void *user_params);
     /**
      *
      * @param rampart_context
@@ -259,8 +260,19 @@
 
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
     rampart_context_set_replay_detect_function(rampart_context_t *rampart_context,
-            const axutil_env_t *env,
-            rampart_is_replayed_fn is_replayed_function);
+        const axutil_env_t *env,
+        rampart_is_replayed_fn is_replayed_function,
+        void *user_params);
+    
+    /**
+     * @param rampart_context
+     * @param env pointer to environment struct,Must not be NULL.
+     * @returns user parameters for replay detector function or NULL
+     */
+    AXIS2_EXTERN void * AXIS2_CALL
+    rampart_context_get_rd_user_params(
+        rampart_context_t *rampart_context,
+        const axutil_env_t *env);
     /**
      *
      * @param rampart_context
@@ -496,8 +508,8 @@
      * AXIS2_SUCCESS on success and AXIS2_FAILURE on error          
      */
 
-    AXIS2_EXTERN void* AXIS2_CALL
-    rampart_context_get_ctx(
+    AXIS2_EXTERN void * AXIS2_CALL
+    rampart_context_get_pwcb_user_params(
         rampart_context_t *rampart_context,
         const axutil_env_t *env);
     /**

Modified: webservices/rampart/trunk/c/include/rampart_replay_detector.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_replay_detector.h?rev=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_replay_detector.h (original)
+++ webservices/rampart/trunk/c/include/rampart_replay_detector.h Thu Jun 12 00:36:40 2008
@@ -88,10 +88,10 @@
      * @returns status of the op. AXIS2_SUCCESS on success and AXIS2_FAILURE on error   
      
      */
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    rampart_replay_detector_with_linked_list(
-        const axutil_env_t *env,
+    rampart_replay_detector_with_linked_list(const axutil_env_t *env,
         axis2_msg_ctx_t* msg_ctx,
-        rampart_context_t *rampart_context);
+        rampart_context_t *rampart_context,
+        void *user_params);
     
     /**
      * @param linked_list linked list structure where messages/fields are stored

Propchange: webservices/rampart/trunk/c/samples/replay_detector/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 12 00:36:40 2008
@@ -0,0 +1,2 @@
+.deps
+.libs

Propchange: webservices/rampart/trunk/c/src/handlers/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 12 00:36:40 2008
@@ -0,0 +1,2 @@
+.deps
+.libs

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=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Thu Jun 12 00:36:40 2008
@@ -70,8 +70,15 @@
     axis2_bool_t require_ut;
 
     axutil_array_list_t *key_list;
-    /*This is used in callback functions.*/
-    void *ctx;
+    /* This is used in callback functions.
+     * Used to store password callback user parameters.
+     */
+    void *pwcb_user_params;
+    
+    /* This is used in replay detector functions.
+     * Used to store replay detector user parameters.
+     */
+    void *rd_user_params;
     
     /* Used to store and track whether we found the clients certificate while processing
      * the security headers key info element. found_cert_in_shp is used to track the status.
@@ -190,7 +197,8 @@
     rampart_context->authenticate_with_digest = NULL;
     rampart_context->require_ut = AXIS2_FALSE;
     rampart_context->require_timestamp = AXIS2_FALSE;
-    rampart_context->ctx = NULL;
+    rampart_context->rd_user_params = NULL;
+    rampart_context->pwcb_user_params = NULL;
     rampart_context->ref = 0;
 
     rampart_context->encryption_token_id = NULL;
@@ -491,26 +499,36 @@
 rampart_context_set_pwcb_function(rampart_context_t *rampart_context,
                                   const axutil_env_t *env,
                                   password_callback_fn pwcb_function,
-                                  void *ctx)
+                                  void *user_params)
 {
     AXIS2_PARAM_CHECK(env->error,pwcb_function,AXIS2_FAILURE);
 
     rampart_context->pwcb_function = pwcb_function;
-    rampart_context->ctx = ctx;
+    rampart_context->pwcb_user_params = user_params;
     return AXIS2_SUCCESS;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_replay_detect_function(rampart_context_t *rampart_context,
         const axutil_env_t *env,
-        rampart_is_replayed_fn is_replayed_function)
+        rampart_is_replayed_fn is_replayed_function,
+        void *user_params)
 {
     AXIS2_PARAM_CHECK(env->error, is_replayed_function, AXIS2_FAILURE);
     rampart_context->is_replayed_function = is_replayed_function;
+    rampart_context->rd_user_params = user_params;
 
     return AXIS2_SUCCESS;
 }
 
+AXIS2_EXTERN void * AXIS2_CALL
+rampart_context_get_rd_user_params(
+    rampart_context_t *rampart_context,
+    const axutil_env_t *env)
+{
+    return rampart_context->rd_user_params;
+}
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_context_set_password_type(rampart_context_t *rampart_context,
                                   const axutil_env_t *env,
@@ -707,12 +725,12 @@
 }
 
 
-AXIS2_EXTERN void* AXIS2_CALL
-rampart_context_get_ctx(
+AXIS2_EXTERN void * AXIS2_CALL
+rampart_context_get_pwcb_user_params(
     rampart_context_t *rampart_context,
     const axutil_env_t *env)
 {
-    return rampart_context->ctx;
+    return rampart_context->pwcb_user_params;
 }
 
 AXIS2_EXTERN int AXIS2_CALL

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=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Thu Jun 12 00:36:40 2008
@@ -81,8 +81,7 @@
     axis2_char_t *pkcs12_password = NULL;
     axis2_char_t *pkcs12_buf = NULL;
     password_callback_fn password_function = NULL;
-    rampart_callback_t *password_callback = NULL;
-    void *param = NULL;
+    rampart_callback_t *password_callback = NULL;   
     pkcs12_keystore_t *key_store = NULL;
 
     is_server_side = axis2_msg_ctx_get_server_side(msg_ctx, env);
@@ -235,6 +234,8 @@
         password_function = rampart_context_get_pwcb_function(rampart_context, env);
         if(password_function)
         {
+            void *param = NULL;
+            param = rampart_context_get_pwcb_user_params(rampart_context, env);
             password = (*password_function)(env, enc_user, param);
             pkcs12_password = password;
         }
@@ -346,7 +347,9 @@
 		 * this function will be used*/
         if(is_inflow)
         {
-            rampart_context_set_replay_detect_function(rampart_context, env, rampart_replay_detector_with_linked_list);
+            void *rd_param = NULL;
+            rd_param = rampart_context_get_rd_user_params(rampart_context, env);
+            rampart_context_set_replay_detect_function(rampart_context, env, rampart_replay_detector_with_linked_list,
rd_param);
         }
     }
     return rampart_context;

Modified: webservices/rampart/trunk/c/src/util/rampart_replay_detector.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_replay_detector.c?rev=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_replay_detector.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_replay_detector.c Thu Jun 12 00:36:40 2008
@@ -259,7 +259,8 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 rampart_replay_detector_with_linked_list(const axutil_env_t *env,
         axis2_msg_ctx_t* msg_ctx,
-        rampart_context_t *rampart_context)
+        rampart_context_t *rampart_context,
+        void *user_params)
 {
     axutil_linked_list_t *ll = NULL;
     const axis2_char_t *msg_id = NULL;

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=666997&r1=666996&r2=666997&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 Jun 12 00:36:40
2008
@@ -1686,7 +1686,7 @@
 				rd_fn = rampart_context_get_replay_detect_function(rampart_context, env);
 				if(rd_fn)
 				{
-					status  = (*rd_fn)(env, msg_ctx, rampart_context);
+					status  = (*rd_fn)(env, msg_ctx, rampart_context, rampart_context_get_rd_user_params(rampart_context,
env));
 					if(status != AXIS2_SUCCESS)
 					{
 						/*Scream .. replayed*/

Modified: webservices/rampart/trunk/c/src/util/rampart_username_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_username_token.c?rev=666997&r1=666996&r2=666997&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_username_token.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_username_token.c Thu Jun 12 00:36:40 2008
@@ -83,7 +83,7 @@
         password_function = rampart_context_get_pwcb_function(rampart_context, env);
         if(password_function)
         {
-            param = rampart_context_get_ctx(rampart_context, env);
+            param = rampart_context_get_pwcb_user_params(rampart_context, env);
             if(!param)
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
@@ -510,7 +510,7 @@
             password_function = rampart_context_get_pwcb_function(rampart_context, env);
             if(password_function)
             {
-                param = rampart_context_get_ctx(rampart_context, env);
+                param = rampart_context_get_pwcb_user_params(rampart_context, env);
                 if(!param)
                 {
                     rampart_create_fault_envelope(env, RAMPART_FAULT_FAILED_CHECK,



Mime
View raw message