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/08/13 07:01:11 UTC
svn commit: r565236 - in /webservices/rampart/trunk/c: ./ include/ samples/
samples/callback/ samples/data/ samples/secpolicy/scenario5/ src/util/
Author: kaushalye
Date: Sun Aug 12 22:01:08 2007
New Revision: 565236
URL: http://svn.apache.org/viewvc?view=rev&rev=565236
Log:
1. Memory leak fix in
Credentails
PW callback
Authentication modules
2. Policy assertion (inserted and Commented out) for AuthnModuleName is shown in the scenario 5
3. Other memory leak fixes in the rampart engine
Modified:
webservices/rampart/trunk/c/configure.ac
webservices/rampart/trunk/c/include/rampart_authn_provider.h
webservices/rampart/trunk/c/include/rampart_callback.h
webservices/rampart/trunk/c/include/rampart_credentials.h
webservices/rampart/trunk/c/include/rampart_util.h
webservices/rampart/trunk/c/samples/callback/pwcb.c
webservices/rampart/trunk/c/samples/configure.ac
webservices/rampart/trunk/c/samples/data/passwords.txt
webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml
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_util.c
Modified: webservices/rampart/trunk/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/configure.ac?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/configure.ac (original)
+++ webservices/rampart/trunk/c/configure.ac Sun Aug 12 22:01:08 2007
@@ -47,7 +47,7 @@
dnl Checks for libraries.
AC_CHECK_LIB(dl, dlopen)
-CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -g"
+CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -g3"
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -ansi -Wall -Werror -Wno-implicit-function-declaration"
#CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
Modified: webservices/rampart/trunk/c/include/rampart_authn_provider.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_authn_provider.h?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_authn_provider.h (original)
+++ webservices/rampart/trunk/c/include/rampart_authn_provider.h Sun Aug 12 22:01:08 2007
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <axutil_param.h>
#ifndef RAMPART_AUTHN_PROVIDER_H
#define RAMPART_AUTHN_PROVIDER_H
@@ -123,6 +124,7 @@
struct rampart_authn_provider
{
rampart_authn_provider_ops_t *ops;
+ axutil_param_t *param;
};
/*************************** Function macros **********************************/
Modified: webservices/rampart/trunk/c/include/rampart_callback.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_callback.h?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_callback.h (original)
+++ webservices/rampart/trunk/c/include/rampart_callback.h Sun Aug 12 22:01:08 2007
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <axutil_utils_defines.h>
+#include <axis2_defines.h>
+#include <axutil_param.h>
#ifndef RAMPART_CALLBACK_H
#define RAMPART_CALLBACK_H
@@ -84,6 +86,7 @@
struct rampart_callback
{
rampart_callback_ops_t *ops;
+ axutil_param_t *param;
};
/*************************** Function macros **********************************/
Modified: webservices/rampart/trunk/c/include/rampart_credentials.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_credentials.h?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_credentials.h (original)
+++ webservices/rampart/trunk/c/include/rampart_credentials.h Sun Aug 12 22:01:08 2007
@@ -23,7 +23,7 @@
#include <axutil_env.h>
#include <axutil_utils.h>
#include <axis2_msg_ctx.h>
-
+#include <axutil_param.h>
/**
* @file rampart_credentials.h
* @brief The credentials interface for rampart. To retrieve a username and password pair.
@@ -88,6 +88,7 @@
struct rampart_credentials
{
rampart_credentials_ops_t *ops;
+ axutil_param_t *param;
};
/*************************** Function macros **********************************/
Modified: webservices/rampart/trunk/c/include/rampart_util.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_util.h?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_util.h (original)
+++ webservices/rampart/trunk/c/include/rampart_util.h Sun Aug 12 22:01:08 2007
@@ -50,7 +50,8 @@
*/
AXIS2_EXTERN void* AXIS2_CALL
rampart_load_module(const axutil_env_t *env,
- axis2_char_t *module_name);
+ axis2_char_t *module_name,
+ axutil_param_t **param);
/**
* Load the credentials module
Modified: webservices/rampart/trunk/c/samples/callback/pwcb.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/callback/pwcb.c?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/samples/callback/pwcb.c (original)
+++ webservices/rampart/trunk/c/samples/callback/pwcb.c Sun Aug 12 22:01:08 2007
@@ -25,6 +25,12 @@
#include <axis2_svc_skeleton.h>
#include <axutil_string.h>
+axis2_status_t AXIS2_CALL
+my_free_function(rampart_callback_t *rcb,
+ const axutil_env_t *env)
+{
+ return AXIS2_SUCCESS;
+}
axis2_char_t* AXIS2_CALL
get_sample_password(rampart_callback_t *rcb,
@@ -83,6 +89,7 @@
return pw;
};
+
/**
* Following block distinguish the exposed part of the dll.
*/
@@ -101,6 +108,7 @@
/*assign function pointers*/
rcb->ops->callback_password = get_sample_password;
+ rcb->ops->free = my_free_function;
*inst = rcb;
Modified: webservices/rampart/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/configure.ac?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/samples/configure.ac (original)
+++ webservices/rampart/trunk/c/samples/configure.ac Sun Aug 12 22:01:08 2007
@@ -47,7 +47,7 @@
dnl Checks for libraries.
AC_CHECK_LIB(dl, dlopen)
-CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
+CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -g3 -O0"
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
fi
Modified: webservices/rampart/trunk/c/samples/data/passwords.txt
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/data/passwords.txt?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/samples/data/passwords.txt (original)
+++ webservices/rampart/trunk/c/samples/data/passwords.txt Sun Aug 12 22:01:08 2007
@@ -2,6 +2,7 @@
Raigama:RaigamaPW
Gampola:GampolaPW
alice:password
+Alice:abcd!1234
a:a12345
b:b12345
c:c12345
Modified: webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml (original)
+++ webservices/rampart/trunk/c/samples/secpolicy/scenario5/services.xml Sun Aug 12 22:01:08 2007
@@ -76,6 +76,7 @@
<rampc:EncryptionUser>b</rampc:EncryptionUser>
<rampc:PasswordType>Digest</rampc:PasswordType>
<rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <!--rampc:AuthnModuleName>/home/kau/axis2/c/deploy/bin/samples/rampart/authn_provider/libauthn.so</rampc:AuthnModuleName-->
<rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/alice_cert.cert</rampc:ReceiverCertificate>
<rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
<rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
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?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Sun Aug 12 22:01:08 2007
@@ -184,6 +184,7 @@
rampart_context_free(rampart_context_t *rampart_context,
const axutil_env_t *env)
{
+ axis2_status_t status = AXIS2_FAILURE;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
if(rampart_context)
@@ -199,6 +200,39 @@
rp_secpolicy_free(rampart_context->secpolicy,env);
rampart_context->secpolicy = NULL;
}
+
+ if(rampart_context->password_callback_module)
+ {
+ axutil_param_t *param = NULL;
+ param = rampart_context->password_callback_module->param;
+ if(param){
+ /*We actually free the dll_desc, which is set as the value of the axutil parameter.*/
+ axutil_dll_desc_t *dll_desc_l = NULL;
+ dll_desc_l = axutil_param_get_value(param, env);
+ status = axutil_class_loader_delete_dll(env, dll_desc_l);
+ dll_desc_l = NULL;
+ }
+ /*User specific free logic*/
+ /*RAMPART_CALLBACK_FREE(rampart_context->password_callback_module , env);*/
+ rampart_context->password_callback_module = NULL;
+ }
+
+ if(rampart_context->authn_provider)
+ {
+ axutil_param_t *param = NULL;
+ param = rampart_context->authn_provider->param;
+ if(param){
+ /*We actually free the dll_desc, which is set as the value of the axutil parameter.*/
+ axutil_dll_desc_t *dll_desc_l = NULL;
+ dll_desc_l = axutil_param_get_value(param, env);
+ status = axutil_class_loader_delete_dll(env, dll_desc_l);
+ dll_desc_l = NULL;
+ }
+ /*User specific free logic*/
+ /*RAMPART_AUTHN_PROVIDER_FREE(rampart_context->authn_provider, env);*/
+ rampart_context->authn_provider = NULL;
+ }
+
AXIS2_FREE(env->allocator,rampart_context);
rampart_context = NULL;
}
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?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_engine.c Sun Aug 12 22:01:08 2007
@@ -278,7 +278,7 @@
if(pwcb_module_name)
{
- password_callback_module = rampart_load_pwcb_module(env,pwcb_module_name);
+ password_callback_module = rampart_load_pwcb_module(env, pwcb_module_name);
if(password_callback_module)
rampart_context_set_password_callback(rampart_context,env,password_callback_module);
}
Modified: webservices/rampart/trunk/c/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_util.c?view=diff&rev=565236&r1=565235&r2=565236
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_util.c Sun Aug 12 22:01:08 2007
@@ -44,7 +44,8 @@
AXIS2_EXTERN void* AXIS2_CALL
rampart_load_module(const axutil_env_t *env,
- axis2_char_t *module_name)
+ axis2_char_t *module_name,
+ axutil_param_t **param)
{
axutil_dll_desc_t *dll_desc = NULL;
axutil_param_t *impl_info_param = NULL;
@@ -53,10 +54,13 @@
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[rampart][rampart_util] Trying to load module = %s", module_name);
dll_desc = axutil_dll_desc_create(env);
axutil_dll_desc_set_name(dll_desc, env, module_name);
- impl_info_param = axutil_param_create(env, NULL, NULL);
- axutil_param_set_value(impl_info_param, env, dll_desc);
+ impl_info_param = axutil_param_create(env, NULL, dll_desc);
+ /*axutil_param_set_value(impl_info_param, env, dll_desc);*/
+ axutil_param_set_value_free(impl_info_param, env, axutil_dll_desc_free_void_arg);
axutil_class_loader_init(env);
ptr = axutil_class_loader_create_dll(env, impl_info_param);
+
+ *param = impl_info_param;
if (!ptr)
{
@@ -85,13 +89,17 @@
axis2_char_t *cred_module_name)
{
rampart_credentials_t *cred = NULL;
+ axutil_param_t *param = NULL;
- cred = (rampart_credentials_t*)rampart_load_module(env, cred_module_name);
+ cred = (rampart_credentials_t*)rampart_load_module(env, cred_module_name, ¶m);
if (!cred)
{
AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the credentials module %s. ERROR", cred_module_name);
return AXIS2_FAILURE;
}
+ if(param){
+ cred->param = param;
+ }
return cred;
}
@@ -101,17 +109,42 @@
axis2_char_t *auth_module_name)
{
rampart_authn_provider_t *authp = NULL;
+ axutil_param_t *param = NULL;
- authp = (rampart_authn_provider_t*)rampart_load_module(env, auth_module_name);
+ authp = (rampart_authn_provider_t*)rampart_load_module(env, auth_module_name, ¶m);
if (!authp)
{
AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the authentication module %s. ERROR", auth_module_name);
return AXIS2_FAILURE;
}
+ if(param){
+ authp->param = param;
+ }
return authp;
}
+
+AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
+rampart_load_pwcb_module(const axutil_env_t *env,
+ axis2_char_t *callback_module_name)
+{
+ rampart_callback_t *cb = NULL;
+ axutil_param_t *param = NULL;
+
+ cb = (rampart_callback_t*)rampart_load_module(env, callback_module_name, ¶m);
+ if (!cb)
+ {
+ AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the callback module %s. ERROR", callback_module_name);
+ return AXIS2_FAILURE;
+ }
+ if(param){
+ cb->param = param;
+ }
+ return cb;
+
+}
+
AXIS2_EXTERN rampart_authn_provider_status_t AXIS2_CALL
rampart_authenticate_un_pw(const axutil_env_t *env,
rampart_authn_provider_t *authp,
@@ -137,24 +170,6 @@
return auth_status;
}
-
-AXIS2_EXTERN rampart_callback_t* AXIS2_CALL
-rampart_load_pwcb_module(const axutil_env_t *env,
- axis2_char_t *callback_module_name)
-{
- rampart_callback_t *cb = NULL;
-
- cb = (rampart_callback_t*)rampart_load_module(env, callback_module_name);
- if (!cb)
- {
- AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify the callback module %s. ERROR", callback_module_name);
- return AXIS2_FAILURE;
- }
-
- return cb;
-
-}
-
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
rampart_callback_password(const axutil_env_t *env,