You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ka...@apache.org on 2006/12/11 07:18:09 UTC

svn commit: r485527 - in /webservices/axis2/trunk/c/rampart: include/rampart_handler_util.h src/util/rampart_encryption.c src/util/rampart_handler_util.c src/util/rampart_sec_header_processor.c src/util/rampart_util.c

Author: kaushalye
Date: Sun Dec 10 22:18:05 2006
New Revision: 485527

URL: http://svn.apache.org/viewvc?view=rev&rev=485527
Log:
-Moved callback function to rampart_handler ustls
-Utlised get milli second function in the axis2_date_time

Modified:
    webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_util.c

Modified: webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h?view=diff&rev=485527&r1=485526&r2=485527
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h Sun Dec 10 22:18:05 2006
@@ -27,6 +27,8 @@
 #include <axis2_msg_info_headers.h>
 #include <axis2_property.h>
 #include <rampart_constants.h>
+#include <rampart_action.h>
+#include <rampart_util.h>
 #include <axis2_conf_ctx.h>
 
 
@@ -39,6 +41,17 @@
 {
 #endif
 
+/**
+ * Get the encryption user password from the callback module
+ * @param env pointer to environment struct
+ * @param ctx axis2 context
+ * @param actions rampart actions to get parameters
+ * @return password or NULL on failure
+ */
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+rampart_callback_encuser_password(const axis2_env_t *env,
+            rampart_actions_t *actions,
+            axis2_msg_ctx_t *msg_ctx);
 
 /**
  * Get properties from the axis2 context

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c?view=diff&rev=485527&r1=485526&r2=485527
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Sun Dec 10 22:18:05 2006
@@ -31,6 +31,7 @@
 #include <oxs_key.h>
 #include <rampart_action.h>
 #include <rampart_constants.h>
+#include <rampart_handler_util.h>
 #include <oxs_token_reference_list.h>
 #include <axis2_array_list.h>
 #include <oxs_axiom.h>
@@ -158,7 +159,7 @@
     /*Get the certificate file name*/
     certificate_file = RAMPART_ACTIONS_GET_ENC_KEY_FILE(actions, env);
     /*Get the password to retrieve the key from key store*/
-    password = RAMPART_ACTIONS_GET_ENC_USER(actions, env);
+    password = rampart_callback_encuser_password(env, actions, msg_ctx);
     /*Get encryption key identifier*/
     eki = RAMPART_ACTIONS_GET_ENC_KEY_IDENTIFIER(actions, env);
     /*Create asymmetric encryption context*/

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c?view=diff&rev=485527&r1=485526&r2=485527
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c Sun Dec 10 22:18:05 2006
@@ -30,7 +30,12 @@
 #include <axis2_conf_ctx.h>
 #include <oxs_axiom.h>
 
-axis2_char_t* AXIS2_CALL
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+rampart_callback_encuser_password(const axis2_env_t *env,
+            rampart_actions_t *actions,
+            axis2_msg_ctx_t *msg_ctx);
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 rampart_get_property_from_ctx(const axis2_env_t *env,
         axis2_ctx_t *ctx,
         const axis2_char_t *key);
@@ -68,6 +73,38 @@
         axiom_node_t *sec_node);
 
 /**********************end of header functions ****************************/
+
+axis2_char_t* AXIS2_CALL
+rampart_callback_encuser_password(const axis2_env_t *env,
+            rampart_actions_t *actions,
+            axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_char_t *enc_user = NULL;
+    axis2_char_t *pw_callback_module = NULL;
+    axis2_char_t *password = NULL;
+    axis2_ctx_t *ctx = NULL;
+
+    enc_user = RAMPART_ACTIONS_GET_ENC_USER(actions, env);
+    pw_callback_module = RAMPART_ACTIONS_GET_PW_CB_CLASS(actions, env);
+    if(!pw_callback_module){
+        return NULL;
+    }
+    if(!enc_user){
+        /*If a special enc_user hasn't specified try to get the user.
+         * But it is advisable to use enc_user instead of user.*/
+        enc_user = RAMPART_ACTIONS_GET_USER(actions, env);
+        if(!enc_user){
+            return NULL;
+        }
+    }
+    /*Get axis2_ctx_t. This is for designed specially for PHP*/
+    ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
+
+    password = rampart_callback_password(env, pw_callback_module, enc_user, ctx);
+
+    return password;
+}
+
 
 axis2_char_t* AXIS2_CALL
 rampart_get_property_from_ctx(const axis2_env_t *env,

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=485527&r1=485526&r2=485527
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c Sun Dec 10 22:18:05 2006
@@ -98,9 +98,9 @@
     }
 }
 
-
+#if 0
 static axis2_char_t*
-rampart_shp_callback_keystore_password(const axis2_env_t *env,
+rampart_shp_callback_encuser_password(const axis2_env_t *env,
             rampart_actions_t *actions,
             axis2_msg_ctx_t *msg_ctx)
 {
@@ -129,6 +129,7 @@
 
     return password;
 }
+#endif
 
 static axis2_status_t 
 rampart_shp_process_encrypted_key(const axis2_env_t *env,
@@ -166,7 +167,7 @@
     enc_asym_algo = RAMPART_ACTIONS_GET_ENC_KT_ALGO(actions, env);
     certificate_file = RAMPART_ACTIONS_GET_DEC_KEY_FILE(actions, env);
     /*Get the password to retrieve the key from key store*/
-    password = rampart_shp_callback_keystore_password(env, actions, msg_ctx);
+    password = rampart_callback_encuser_password(env, actions, msg_ctx);
     oxs_asym_ctx_set_algorithm(asym_ctx, env, enc_asym_algo);
     oxs_asym_ctx_set_file_name(asym_ctx, env, certificate_file);
     oxs_asym_ctx_set_operation(asym_ctx, env, OXS_ASYM_CTX_OPERATION_PRV_DECRYPT);

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_util.c?view=diff&rev=485527&r1=485526&r2=485527
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_util.c Sun Dec 10 22:18:05 2006
@@ -149,7 +149,7 @@
     hh1 = AXIS2_DATE_TIME_GET_HOUR(dt1, env);
     mi1 = AXIS2_DATE_TIME_GET_MINUTE(dt1, env);
     ss1 = AXIS2_DATE_TIME_GET_SECOND(dt1, env);
-    ml1 = 000;
+    ml1 = AXIS2_DATE_TIME_GET_MSEC(dt1, env);
 
     status = AXIS2_DATE_TIME_DESERIALIZE_DATE_TIME(dt2, env, dt2_str);
     if (status == AXIS2_FAILURE)
@@ -163,7 +163,7 @@
     hh2 = AXIS2_DATE_TIME_GET_HOUR(dt2, env);
     mi2 = AXIS2_DATE_TIME_GET_MINUTE(dt2, env);
     ss2 = AXIS2_DATE_TIME_GET_SECOND(dt2, env);
-    ml2 = 000;
+    ml2 = AXIS2_DATE_TIME_GET_MSEC(dt2, env);
     /**
     Comparison. 
     We expect dt1_str < dt2_str/ Otherwise FAILURE
@@ -203,7 +203,6 @@
     {
         return AXIS2_FAILURE;
     }
-
 
     if (mi1 < mi2)
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org