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/09/14 14:28:33 UTC
svn commit: r575655 - in /webservices/rampart/trunk/c:
include/rampart_sec_processed_result.h
src/util/rampart_sec_processed_result.c src/util/rampart_timestamp_token.c
src/util/rampart_username_token.c
Author: kaushalye
Date: Fri Sep 14 05:28:33 2007
New Revision: 575655
URL: http://svn.apache.org/viewvc?rev=575655&view=rev
Log:
Code cleaning and memory leak fixing
Modified:
webservices/rampart/trunk/c/include/rampart_sec_processed_result.h
webservices/rampart/trunk/c/src/util/rampart_sec_processed_result.c
webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c
webservices/rampart/trunk/c/src/util/rampart_username_token.c
Modified: webservices/rampart/trunk/c/include/rampart_sec_processed_result.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_sec_processed_result.h?rev=575655&r1=575654&r2=575655&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_sec_processed_result.h (original)
+++ webservices/rampart/trunk/c/include/rampart_sec_processed_result.h Fri Sep 14 05:28:33 2007
@@ -85,9 +85,6 @@
axis2_msg_ctx_t *msg_ctx);
- AXIS2_EXTERN void AXIS2_CALL
- rampart_security_processed_results_free(const axutil_env_t *env,
- axutil_hash_t* sec_processed_results);
/* @} */
#ifdef __cplusplus
}
Modified: webservices/rampart/trunk/c/src/util/rampart_sec_processed_result.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_processed_result.c?rev=575655&r1=575654&r2=575655&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_processed_result.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_processed_result.c Fri Sep 14 05:28:33 2007
@@ -57,13 +57,6 @@
return axutil_hash_get(sec_processed_results, key, AXIS2_HASH_KEY_STRING);
}
-AXIS2_EXTERN void AXIS2_CALL
-rampart_security_processed_results_free(const axutil_env_t *env,
- axutil_hash_t* sec_processed_results)
-{
- axutil_hash_free(sec_processed_results, env);
- sec_processed_results = NULL;
-}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_set_security_processed_results_property(const axutil_env_t *env,
@@ -79,10 +72,8 @@
sec_processed_results = axutil_hash_make(env);
sec_processed_results_prop = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST ,
- AXIS2_TRUE, (void *)axutil_hash_free/*rampart_security_processed_results_free*/, sec_processed_results);
+ AXIS2_TRUE, (void *)axutil_hash_free, sec_processed_results);
- /*sec_processed_results_prop = axutil_property_create(env);
- axutil_property_set_value(sec_processed_results_prop, env, sec_processed_results);*/
axis2_msg_ctx_set_property(msg_ctx, env, RAMPART_SECURITY_PROCESSED_RESULTS, sec_processed_results_prop);
return AXIS2_SUCCESS;
Modified: webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c?rev=575655&r1=575654&r2=575655&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_timestamp_token.c Fri Sep 14 05:28:33 2007
@@ -112,23 +112,21 @@
/*Check: TIMESTAMP MUST contain exactly one CREATED*/
if (1 != oxs_axiom_get_number_of_children_with_qname(env, ts_node, RAMPART_SECURITY_TIMESTAMP_CREATED, RAMPART_WSU_XMLNS, RAMPART_WSU))
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Timestamp must contain exactly one Created element");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart][ts]Timestamp not valid: Timestamp must contain exactly one Created element");
return AXIS2_FAILURE;
}
/*Check: TIMESTAMP MUST NOT contain more than one EXPIRES*/
if (1 < oxs_axiom_get_number_of_children_with_qname(env, ts_node, RAMPART_SECURITY_TIMESTAMP_CREATED, RAMPART_WSU_XMLNS, RAMPART_WSU))
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Timestamp must not contain more than one Expires element");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][ts]Timestamp not valid: Timestamp must not contain more than one Expires element");
return AXIS2_FAILURE;
}
-
ts_ele = axiom_node_get_data_element(ts_node, env);
-
if (!ts_ele)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Cannot find timestamp ");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][ts]Timestamp not valid: Cannot find timestamp ");
return AXIS2_FAILURE;
}
@@ -138,7 +136,8 @@
if (axutil_strcmp(RAMPART_SECURITY_TIMESTAMP_CREATED ,
axiom_element_get_localname(created_ele, env)) != 0)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Cannot find created in timestamp element. The first element MUST be CREATED");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][ts]Timestamp not valid: Cannot find created in timestamp element. The first element MUST be CREATED");
return AXIS2_FAILURE;
}
@@ -149,7 +148,7 @@
validity = rampart_compare_date_time(env, current_val, created_val);
if (validity == AXIS2_SUCCESS)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Created time is not valid");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][ts]Timestamp not valid: Created time is not valid");
return AXIS2_FAILURE;
}
@@ -157,7 +156,7 @@
expires_node = axiom_node_get_next_sibling(created_node, env);
if (!expires_node)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Cannot find expires in timestamp element...");
+ AXIS2_LOG_INFO(env->log, "[rampart][ts]Cannot find expires in timestamp element. This is not critical. Assume that the message is not expiring");
/*If the expire element is not present, it means that the message will not be expired.*/
return AXIS2_SUCCESS;
}
@@ -165,7 +164,8 @@
if (axutil_strcmp(RAMPART_SECURITY_TIMESTAMP_EXPIRES ,
axiom_element_get_localname(expires_ele, env)) != 0)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts] Timestamp not valid: The second element of timestamp token (if any) MUST be EXPIRES");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][ts] Timestamp not valid: The second element of timestamp token (if any) MUST be EXPIRES");
return AXIS2_FAILURE;
}
@@ -178,7 +178,8 @@
validity = rampart_compare_date_time(env, current_val, expires_val);
if (validity == AXIS2_FAILURE)
{
- AXIS2_LOG_INFO(env->log, "[rampart][ts]Timestamp not valid: Timestamp token has expired");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][ts]Timestamp not valid: Timestamp token has expired");
return AXIS2_FAILURE;
}
AXIS2_LOG_INFO(env->log, "[rampart][ts] Timstamp is valid");
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=575655&r1=575654&r2=575655&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_username_token.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_username_token.c Fri Sep 14 05:28:33 2007
@@ -34,9 +34,6 @@
/** public functions*/
-
-
-
axis2_status_t AXIS2_CALL
rampart_username_token_build(
const axutil_env_t *env,
@@ -250,8 +247,8 @@
return AXIS2_FAILURE;
}
+
/*Check: Any USERNAME_TOKEN MUST NOT have more than one PASSWORD*/
-
if (1 < oxs_axiom_get_number_of_children_with_qname(env, ut_node,
RAMPART_SECURITY_USERNAMETOKEN_PASSWORD, RAMPART_WSSE_XMLNS, RAMPART_WSSE))
{
@@ -261,7 +258,6 @@
}
/*Check: Any USERNAME_TOKEN MUST NOT have more than one CREATED*/
-
if (1 < oxs_axiom_get_number_of_children_with_qname(env,
ut_node, RAMPART_SECURITY_USERNAMETOKEN_CREATED, RAMPART_WSSE_XMLNS, RAMPART_WSSE))
{
@@ -271,7 +267,6 @@
}
/*Check: Any USERNAME_TOKEN MUST NOT have more than one NONCE*/
-
if (1 < oxs_axiom_get_number_of_children_with_qname(env, ut_node,
RAMPART_SECURITY_USERNAMETOKEN_NONCE, RAMPART_WSSE_XMLNS, RAMPART_WSSE))
{
@@ -280,7 +275,7 @@
return AXIS2_FAILURE;
}
- /*Get thru children of UsernameToken element*/
+ /*Go thru children of UsernameToken element*/
children = axiom_element_get_child_elements(ut_ele, env, ut_node);
if (children)
{
@@ -309,12 +304,12 @@
if (!password_type)
{
- /*R4201 Any PASSWORD MUST specify a Type attribute */
-
+ /*ERROR: R4201 Any PASSWORD MUST specify a Type attribute */
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[rampart][rampart_usernametoken] Password Type is not specified in the password element");
return AXIS2_FAILURE;
}
+
/*Then we must check the password type with policy*/
password_type_pol = rampart_context_get_password_type(rampart_context, env);
if(!password_type_pol)
@@ -385,7 +380,6 @@
}
/*Now we process collected usernametoken parameters*/
-
if (!username)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
@@ -405,11 +399,12 @@
*
* If authentication module is defined use it.
* Else try the usual approach to get password from the callback and compare
- * */
+ **/
+
+
/*In both authentication and password callback methods we should first try to
*use function pointers. */
- /*authn_module_name = "/home/kau/axis2/c/deploy/bin/samples/rampart/authn_provider/libauthn.so";*/
if (0 == axutil_strcmp(password_type, RAMPART_PASSWORD_DIGEST_URI))
{
authenticate_with_digest = rampart_context_get_auth_digest_function(
@@ -459,6 +454,7 @@
}
}
}
+
authn_provider = rampart_context_get_authn_provider(rampart_context, env);
if(authn_provider)
{
@@ -537,7 +533,6 @@
}
/*Alright NOW we have the password. Is digest needed?*/
-
if (0 == axutil_strcmp(password_type, RAMPART_PASSWORD_DIGEST_URI))
{
AXIS2_LOG_INFO(env->log,
@@ -555,7 +550,6 @@
}
/*The BIG moment. Compare passwords*/
-
if (0 == axutil_strcmp(password_to_compare , password))
{
AXIS2_LOG_INFO(env->log,