Author: dumindu
Date: Wed Jan 9 13:06:31 2008
New Revision: 12087
Log:
checking ppid using dso
Modified:
trunk/solutions/identity/modules/mod-cspace/configure.ac
trunk/solutions/identity/modules/mod-cspace/mod_cspace.c
Modified: trunk/solutions/identity/modules/mod-cspace/configure.ac
==============================================================================
--- trunk/solutions/identity/modules/mod-cspace/configure.ac (original)
+++ trunk/solutions/identity/modules/mod-cspace/configure.ac Wed Jan 9
13:06:31 2008
@@ -6,7 +6,7 @@
AC_INIT([mod-cspace-src], [1.0], [EMAIL PROTECTED])
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE([tar-ustar])
+AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr/local/mod-cspace)
dnl Checks for programs.
Modified: trunk/solutions/identity/modules/mod-cspace/mod_cspace.c
==============================================================================
--- trunk/solutions/identity/modules/mod-cspace/mod_cspace.c (original)
+++ trunk/solutions/identity/modules/mod-cspace/mod_cspace.c Wed Jan 9
13:06:31 2008
@@ -415,10 +415,44 @@
/* should not be necessary...
* when only only pool allocators are used*/
cspace_process_context_free(ctx);
+
+ return state;
+}
+#define CARDSPACE_HEADER_PPID
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier"
-
- return state;
+static int is_valid_ppid(char *ppid, char *uri, char *dso_filename, apr_pool_t
*p)
+{
+ apr_status_t rv;
+ apr_dso_handle_sym_t sym = NULL;
+ apr_dso_handle_t *hand = NULL;
+ int (*func)(char*, char *); /*ppid, uri*/
+
+ rv = apr_dso_load(&hand, dso_filename, p);
+ if (rv)
+ {
+ /*read error using: apr_dso_error(hand, char [128], 128)*/
+ /*log error*/
+ apr_dso_unload(hand);
+ return FAIL;
+ }
+
+ rv = apr_dso_sym(&sym, hand, "find_ppid");
+ if (rv)
+ {
+ /*read error using: apr_dso_error(hand, char [128], 128)*/
+ /*log error*/
+ apr_dso_unload(hand);
+ return FAIL;
+ }
+
+ /*is it meaningful to do a if(func)?*/
+ func = (int (*)(char *, char *))sym;
+ rv = (*func)(ppid, uri);
+
+ apr_dso_unload(hand);
+
+ return rv;
}
static int handle_session_nosso(request_rec *r, cspace_dir_cfg *dir_cfg,
@@ -460,13 +494,13 @@
/*TODO:DONE xmlToken can be different! yet another config option*/
if ((buf) && (buf = ap_strstr(buf, dir_cfg->xml_token))) {
int state = FAIL;
- char *tmp = buf;
-
- /*remove any trailing params*/
- while (*tmp && *tmp != '&') {
- tmp++;
- }
- *tmp = '\0';
+
+ char *tmp = buf;
+ /*remove any trailing params*/
+ while (*tmp && *tmp != '&') {
+ tmp++;
+ }
+ *tmp = '\0';
cspace_decode_url((char *)buf);
@@ -475,19 +509,26 @@
auth_state = apr_table_get(r->subprocess_env,
CARDSPACE_HEADER_STATE);
-
+
if ((auth_state) &&
(strcmp(auth_state,
CARDSPACE_STATE_SUCCESS) == 0)) {
- if (!gen_session(SESSION_ID_LEN, session_ctx,
- &session_id))
- return HTTP_INTERNAL_SERVER_ERROR;
-
- if (session_id)
- set_cookie(r, session_id);
- /*log success/failure of this*/
+
+ char *ppid = apr_table_get(r->subprocess_env,
+ CARDSPACE_HEADER_PPID);
+
+ if (is_valid_ppid(ppid, r->uri, "dummy_ppid_validator.so",
+ r->pool)) {
+ if (!gen_session(SESSION_ID_LEN, session_ctx,
+ &session_id))
+ return HTTP_INTERNAL_SERVER_ERROR;
+
+ if (session_id)
+ set_cookie(r, session_id);
+ /*log success/failure of this*/
- return OK;
+ return OK;
+ }
} else {
return UNAUTHORIZED_REDIRECT(r, NULL);
}
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev