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 sh...@apache.org on 2008/04/07 10:18:34 UTC

svn commit: r645407 - in /webservices/rampart/trunk/c: include/ samples/sct_provider/ src/secconv/ src/util/

Author: shankar
Date: Mon Apr  7 01:18:31 2008
New Revision: 645407

URL: http://svn.apache.org/viewvc?rev=645407&view=rev
Log:
Error, Info correction

Modified:
    webservices/rampart/trunk/c/include/secconv_security_context_token.h
    webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
    webservices/rampart/trunk/c/src/secconv/security_context_token.c
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_handler_util.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
    webservices/rampart/trunk/c/src/util/rampart_signature.c

Modified: webservices/rampart/trunk/c/include/secconv_security_context_token.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/secconv_security_context_token.h?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/secconv_security_context_token.h (original)
+++ webservices/rampart/trunk/c/include/secconv_security_context_token.h Mon Apr  7 01:18:31 2008
@@ -122,6 +122,11 @@
         security_context_token_t *sct, 
         const axutil_env_t * env,
         axiom_node_t *node);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    security_context_token_increment_ref(
+        security_context_token_t *sct,
+        const axutil_env_t * env);
    
 #ifdef __cplusplus
 }

Modified: webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c (original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_hash_map.c Mon Apr  7 01:18:31 2008
@@ -62,9 +62,9 @@
      */
 
     /*find the sct_db lable to be used*/
-    if(server_side)
+    if(sct_id)
         sct_db_lable = sct_id;
-    else
+    else if (!server_side)
     {
         if(is_different_session_key_for_encryption_and_signing(env, rampart_context))
         {
@@ -132,7 +132,12 @@
     
     sct = sct_provider_obtain_token_from_sts(env, token, msg_ctx);
     if(sct)
+    {
         axutil_hash_set(sct_db, sct_db_lable, AXIS2_HASH_KEY_STRING, sct);
+        sct_db_lable = security_context_token_get_global_identifier(sct, env);
+        security_context_token_increment_ref(sct, env);
+        axutil_hash_set(sct_db, sct_db_lable, AXIS2_HASH_KEY_STRING, sct);
+    }
 
     return sct;
 }

Modified: webservices/rampart/trunk/c/src/secconv/security_context_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/secconv/security_context_token.c?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/secconv/security_context_token.c (original)
+++ webservices/rampart/trunk/c/src/secconv/security_context_token.c Mon Apr  7 01:18:31 2008
@@ -28,6 +28,7 @@
     axiom_node_t *sct_node;
     axiom_node_t *attached_reference;
     axiom_node_t *unattached_reference;
+    int ref;
 };
 
 AXIS2_EXTERN security_context_token_t *AXIS2_CALL
@@ -53,15 +54,30 @@
     sct->sct_node = NULL;
     sct->attached_reference = NULL;
     sct->unattached_reference = NULL;
+    sct->ref = 1;
     return sct;
 }
 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+security_context_token_increment_ref(
+    security_context_token_t *sct,
+    const axutil_env_t * env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    sct->ref++;
+    return AXIS2_SUCCESS;
+}
+
 AXIS2_EXTERN void AXIS2_CALL
 security_context_token_free(
     security_context_token_t *sct, 
     const axutil_env_t *env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if (--sct->ref > 0)
+        return;
+
     if(sct->buffer)
     {
         oxs_buffer_free(sct->buffer, 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?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Mon Apr  7 01:18:31 2008
@@ -1555,7 +1555,7 @@
     if(!wss)
     {
         /*TODO error*/
-        AXIS2_LOG_INFO(env->log,"wss properties are not set" );
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "wss properties are not set" );
         return AXIS2_FALSE;
     }
 
@@ -1575,7 +1575,7 @@
 
         if(!x509_token)
         {
-            AXIS2_LOG_INFO(env->log,"Cannot get the token value from policy.");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get the token value from policy.");
             return AXIS2_FALSE;
         }
         if(rp_x509_token_get_require_key_identifier_reference(x509_token,env))
@@ -1591,7 +1591,7 @@
         }
         else
         {
-            AXIS2_LOG_INFO(env->log, "Cannot get the token value from policy.");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get the token value from policy.");
             return AXIS2_FALSE;
         }
     }
@@ -1621,7 +1621,7 @@
     wss = rp_secpolicy_get_wss(rampart_context->secpolicy,env);
     if(!wss)
     {
-        AXIS2_LOG_INFO(env->log,"wss properties are not set.." );
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"wss properties are not set.." );
         return AXIS2_FALSE;
     }
 
@@ -1641,7 +1641,7 @@
 
         if(!x509_token)
         {
-            AXIS2_LOG_INFO(env->log,"Cannot get the token value from policy.");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get the token value from policy.");
             return AXIS2_FALSE;
         }
         if(rp_x509_token_get_require_issuer_serial_reference(x509_token,env))
@@ -1673,7 +1673,7 @@
     wss = rp_secpolicy_get_wss(rampart_context->secpolicy,env);
     if(!wss)
     {
-        AXIS2_LOG_INFO(env->log,"wss properties are not set.." );
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "wss properties are not set.." );
         return AXIS2_FALSE;
     }
 
@@ -1693,7 +1693,7 @@
 
         if(!x509_token)
         {
-            AXIS2_LOG_INFO(env->log,"Cannot get the token value from policy.");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get the token value from policy.");
             return AXIS2_FALSE;
         }
         if(rp_x509_token_get_require_embedded_token_reference(x509_token,env))
@@ -2614,7 +2614,7 @@
         return AXIS2_TRUE;
     else
     {
-        AXIS2_LOG_INFO(env->log,"We still only suppport X509 Tokens and security context tokens.");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "We still only suppport X509 Tokens and security context tokens.");
         return AXIS2_FALSE;
     }
     /*This method will be extended when we are supporting other types of tokens.*/
@@ -2659,7 +2659,7 @@
     }
     else
     {
-        AXIS2_LOG_INFO(env->log,"We still only support x509 tokens and security context tokens");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "We still only support x509 tokens and security context tokens");
         return AXIS2_FALSE;
     }
 

Modified: webservices/rampart/trunk/c/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_handler_util.c?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_handler_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_handler_util.c Mon Apr  7 01:18:31 2008
@@ -238,7 +238,7 @@
 
     if (!param_x_flow_security)
     {
-        AXIS2_LOG_INFO(env->log,
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                        "[rampart][rampart_handler_utils] %d parameter is not set.",param_x_flow_security);
         return NULL;
     }
@@ -264,13 +264,13 @@
     conf_ctx =  axis2_msg_ctx_get_conf_ctx(msg_ctx,env);
     if(!conf_ctx)
     {
-        AXIS2_LOG_INFO(env->log, "[rampart][rhu] Conf context is NULL ");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rhu] Conf context is NULL ");
         return AXIS2_FALSE;
     }
     conf =  axis2_conf_ctx_get_conf(conf_ctx, env);
     if(!conf)
     {
-        AXIS2_LOG_INFO(env->log, "[rampart][rhu] Cannot get the axis2 conf from conf context. ");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][rhu] Cannot get the axis2 conf from conf context. ");
         return AXIS2_FALSE;
     }
 

Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c Mon Apr  7 01:18:31 2008
@@ -558,7 +558,7 @@
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shb] Asymmetric Binding failed");
             if(axis2_msg_ctx_get_server_side(msg_ctx,env)){
                 AXIS2_ERROR_SET(env->error, RAMPART_ERROR_INVALID_SECURITY , AXIS2_FAILURE);
-                AXIS2_LOG_INFO(env->log, "[rampart][shb] %s", AXIS2_ERROR_GET_MESSAGE(env->error));
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,  "[rampart][shb] %s", AXIS2_ERROR_GET_MESSAGE(env->error));
                 rampart_create_fault_envelope(env, RAMPART_FAULT_INVALID_SECURITY,
                                   " Asymmetric Binding failed. Check configurations ", RAMPART_FAULT_IN_POLICY, msg_ctx);
             }

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=645407&r1=645406&r2=645407&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 Mon Apr  7 01:18:31 2008
@@ -127,7 +127,7 @@
         str_node = oxs_axiom_get_first_child_node_by_name(env, key_node, OXS_NODE_SECURITY_TOKEN_REFRENCE, OXS_WSSE_XMLNS, NULL);
         if(!str_node)
         {
-            AXIS2_LOG_INFO(env->log, "[rampart][shp] Failed to get security token reference node");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp] Failed to get security token reference node");
             break;
         }
 
@@ -135,7 +135,7 @@
         ref_node = oxs_axiom_get_first_child_node_by_name(env, str_node, OXS_NODE_REFERENCE, OXS_WSSE_XMLNS, NULL);
         if(!ref_node)
         {
-            AXIS2_LOG_INFO(env->log, "[rampart][shp]Failed to get reference node from security token reference");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp]Failed to get reference node from security token reference");
             break;
         }
 
@@ -248,7 +248,7 @@
         key = rampart_context_get_key_using_hash(rampart_context, env, given_hash);
         if(!key)
         {
-            AXIS2_LOG_INFO(env->log, "[rampart][shp]Cannot get key corresponding to EncryptedKeySHA1");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp]Cannot get key corresponding to EncryptedKeySHA1");
         }
         return key;        
     }

Modified: webservices/rampart/trunk/c/src/util/rampart_signature.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_signature.c?rev=645407&r1=645406&r2=645407&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_signature.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_signature.c Mon Apr  7 01:18:31 2008
@@ -1081,7 +1081,7 @@
     token = rampart_context_get_endorsing_token(rampart_context, env);
     if(!token)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+        AXIS2_LOG_INFO(env->log,
                         "[rampart][rampart_signature] Endorsing Token is not specified. No need to endorse");
         return AXIS2_SUCCESS;
     }