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/10/24 10:51:24 UTC
svn commit: r467279 - in /webservices/axis2/trunk/c/rampart: include/
samples/callback/ samples/callback/htpasswd_callback/ src/util/
Author: kaushalye
Date: Tue Oct 24 01:51:23 2006
New Revision: 467279
URL: http://svn.apache.org/viewvc?view=rev&rev=467279
Log:
Modified callback module. Now it is posisble to pass any parameter (i.e.string, struct...) to the callback module using the message context.
This is specifically done for PHP extension to pass parameters to its password call back modules.
Modified:
webservices/axis2/trunk/c/rampart/include/rampart_callback.h
webservices/axis2/trunk/c/rampart/include/rampart_constants.h
webservices/axis2/trunk/c/rampart/samples/callback/Makefile.am
webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/Makefile.am
webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/htpwcb.c
webservices/axis2/trunk/c/rampart/samples/callback/pwcb.c
webservices/axis2/trunk/c/rampart/src/util/username_token.c
Modified: webservices/axis2/trunk/c/rampart/include/rampart_callback.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_callback.h?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_callback.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_callback.h Tue Oct 24 01:51:23 2006
@@ -54,11 +54,14 @@
* @param callback rampart callback pointer
* @param env environment must not be null
* @param username The username of the password expected.
+ * @param param any parameter that is to be passed to the callback function.
* @return returns password if any. Otherwise NULL returns
*/
axis2_char_t *(AXIS2_CALL*
callback_password)(rampart_callback_t *callback,
- const axis2_env_t *env, const axis2_char_t *username);
+ const axis2_env_t *env,
+ const axis2_char_t *username,
+ void *param);
/**
* Free function of the rampart callback
@@ -82,8 +85,8 @@
#define RAMPART_CALLBACK_FREE(callback, env) \
((callback)->ops->free (callback, env))
-#define RAMPART_CALLBACK_CALLBACK_PASSWORD(callback, env, username) \
- ((callback)->ops->callback_password(callback, env, username))
+#define RAMPART_CALLBACK_CALLBACK_PASSWORD(callback, env, username, param) \
+ ((callback)->ops->callback_password(callback, env, username, param))
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/rampart/include/rampart_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_constants.h?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_constants.h Tue Oct 24 01:51:23 2006
@@ -122,7 +122,7 @@
/*Dynamically set values*/
#define RAMPART_ACTION_PASSWORD "password"
-
+#define RAMPART_CALLBACK_SPECIFIC_PROPERTY "callbackSpecificProperty"
#ifdef __cplusplus
}
#endif
Modified: webservices/axis2/trunk/c/rampart/samples/callback/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/callback/Makefile.am?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/callback/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/samples/callback/Makefile.am Tue Oct 24 01:51:23 2006
@@ -1,7 +1,7 @@
-SUBDIRS=htpasswd_callback
+#SUBDIRS=htpasswd_callback
prglibdir=$(prefix)/bin/samples/rampart/callback
prglib_LTLIBRARIES = libpwcb.la
libpwcb_la_SOURCES = pwcb.c
libpwcb_la_LIBADD =
-INCLUDES = -I$(AXIS2C_HOME)/include \
- -I ../../include
+INCLUDES = -I ../../include\
+ -I$(AXIS2C_HOME)/include
Modified: webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/Makefile.am?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/Makefile.am Tue Oct 24 01:51:23 2006
@@ -2,5 +2,5 @@
prglib_LTLIBRARIES = libhtpwcb.la
libhtpwcb_la_SOURCES = htpwcb.c
libhtpwcb_la_LIBADD =
-INCLUDES = -I$(AXIS2C_HOME)/include \
- -I ../../include
+INCLUDES = -I ../../include \
+ -I$(AXIS2C_HOME)/include
Modified: webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/htpwcb.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/htpwcb.c?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/htpwcb.c (original)
+++ webservices/axis2/trunk/c/rampart/samples/callback/htpasswd_callback/htpwcb.c Tue Oct 24 01:51:23 2006
@@ -11,12 +11,20 @@
axis2_char_t* AXIS2_CALL
get_ht_password(rampart_callback_t *rcb,
- const axis2_env_t *env, const axis2_char_t *username)
+ const axis2_env_t *env,
+ const axis2_char_t *username,
+ void *param)
{
axis2_char_t * password = NULL;
- /*TODO : Hard coded value must be changed. This is the common place to have
- * the htpasswd files. But not always*/
+ /*The default location is the following. But this will be overridden by the property values set in the meg_ctx*/
axis2_char_t *filename = "/usr/local/apache2/passwd/passwords";
+
+ if(param){
+ filename = (axis2_char_t *)param;
+ }else{
+ AXIS2_LOG_INFO(env->log, "Using the default password file location %s", filename);
+ }
+
FILE *file = NULL;
file = fopen ( filename, "r" );
@@ -50,9 +58,8 @@
AXIS2_LOG_INFO(env->log, "Cannot load the password file %s in the callback module", filename);
perror ( filename );
}
-
return password;
-}
+ };
/**
Modified: webservices/axis2/trunk/c/rampart/samples/callback/pwcb.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/callback/pwcb.c?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/callback/pwcb.c (original)
+++ webservices/axis2/trunk/c/rampart/samples/callback/pwcb.c Tue Oct 24 01:51:23 2006
@@ -11,7 +11,9 @@
axis2_char_t* AXIS2_CALL
get_sample_password(rampart_callback_t *rcb,
- const axis2_env_t *env, const axis2_char_t *username)
+ const axis2_env_t *env,
+ const axis2_char_t *username,
+ void *param)
{
axis2_char_t * pw = NULL;
if (0 == AXIS2_STRCMP(username, "Raigama"))
Modified: webservices/axis2/trunk/c/rampart/src/util/username_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/username_token.c?view=diff&rev=467279&r1=467278&r2=467279
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/username_token.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/username_token.c Tue Oct 24 01:51:23 2006
@@ -62,7 +62,8 @@
static axis2_char_t*
rampart_username_token_callback_pw(const axis2_env_t *env,
axis2_char_t *callback_module_name,
- const axis2_char_t *username);
+ const axis2_char_t *username,
+ axis2_ctx_t *ctx);
/** public functions*/
axis2_status_t AXIS2_CALL
@@ -119,7 +120,7 @@
if (pw_callback_module)
{
username = RAMPART_ACTIONS_GET_USER(actions, env);
- password = rampart_username_token_callback_pw(env, pw_callback_module, username);
+ password = rampart_username_token_callback_pw(env, pw_callback_module, username, ctx);
}
return password;
}
@@ -128,13 +129,16 @@
static axis2_char_t*
rampart_username_token_callback_pw(const axis2_env_t *env,
axis2_char_t *callback_module_name,
- const axis2_char_t *username)
+ const axis2_char_t *username,
+ axis2_ctx_t *ctx)
{
rampart_callback_t* rcb = NULL;
axis2_char_t *password = NULL;
axis2_dll_desc_t *dll_desc = NULL;
void *ptr = NULL;
axis2_param_t *impl_info_param = NULL;
+ axis2_property_t* property = NULL;
+ void *cb_prop_val = NULL;
dll_desc = axis2_dll_desc_create(env);
AXIS2_DLL_DESC_SET_NAME(dll_desc, env, callback_module_name);
@@ -156,8 +160,16 @@
printf("\nrampart_callback_t is null");
return NULL;
}
+ /*Get callback specific property if any from the ctx*/
+ property = AXIS2_CTX_GET_PROPERTY(ctx, env, RAMPART_CALLBACK_SPECIFIC_PROPERTY, AXIS2_FALSE);
+ if (property)
+ {
+ cb_prop_val = AXIS2_PROPERTY_GET_VALUE(property, env);
+ property = NULL;
+ }
+
/*Get the password thru the callback*/
- password = RAMPART_CALLBACK_CALLBACK_PASSWORD(rcb, env, username);
+ password = RAMPART_CALLBACK_CALLBACK_PASSWORD(rcb, env, username, cb_prop_val);
return password;
}
@@ -529,7 +541,7 @@
ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
pw_callback_module = RAMPART_ACTIONS_GET_PW_CB_CLASS(actions, env);
- password_from_svr = rampart_username_token_callback_pw(env, pw_callback_module, username);
+ password_from_svr = rampart_username_token_callback_pw(env, pw_callback_module, username, ctx);
if (!password_from_svr)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org