[pubcookie-dev] WEBISO CVS update: fox;
flavor_getcred.c,1.22,1.23 index.cgi.c,1.117,1.118 keyserver.c,2.44,2.45
libpubcookie.c,2.68,2.69 mod_pubcookie.c,1.128,1.129
pbc_apacheconfig.c,2.9,2.10 pbc_apacheconfig.h,2.8,2.9
pbc_config.h,1.91,1.92 pbc_myconfig.c,1.42,1.43 security_legacy.c,1.37,1.38
Jim Fox
fox at cac.washington.edu
Thu Feb 19 15:07:05 PST 2004
Update of /usr/local/cvsroot/webiso/pubcookie/src
In directory webiso-cvs.cac.washington.edu:/var/tmp/cvs-serv29627/webiso/pubcookie/src
Modified Files:
base64.c flavor_basic.c flavor_getcred.c index.cgi.c
keyserver.c libpubcookie.c mod_pubcookie.c pbc_apacheconfig.c
pbc_apacheconfig.h pbc_config.h pbc_myconfig.c
security_legacy.c
Log Message:
Add apache2 compability.
Fix some code that got clobbered in the last merge (keyserver and index.cgi)
Changed the behavior of the module install to prepend a '#' to the
LoadModule line for pubcookie. This can be removed when the admin
adds the other pubcookie config lines.
APACHE1_3 is defined for a version 1.3 build of apache.
APACHE2 is defined for an apache 2.0 build.
APACHE is now defined in the Makefile for any module build.
I left alone a lot of places where a check for
defined (APACHE) || defined (APACHE1_3)
can be reduced to just
defined (APACHE)
Index: webiso/pubcookie/src/base64.c
diff -c webiso/pubcookie/src/base64.c:1.20 webiso/pubcookie/src/base64.c:1.21
*** webiso/pubcookie/src/base64.c:1.20 Tue Feb 17 15:06:38 2004
--- webiso/pubcookie/src/base64.c Thu Feb 19 15:07:02 2004
***************
*** 6,12 ****
/** @file base64.c
* Base64 functions
*
! * $Id: base64.c,v 1.20 2004/02/17 23:06:38 ryanc Exp $
*/
--- 6,12 ----
/** @file base64.c
* Base64 functions
*
! * $Id: base64.c,v 1.21 2004/02/19 23:07:02 fox Exp $
*/
***************
*** 15,21 ****
# include "pbc_path.h"
#endif
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 15,30 ----
# include "pbc_path.h"
#endif
! #ifdef APACHE2
! #undef HAVE_CONFIG_H
! #undef PACKAGE_BUGREPORT
! #undef PACKAGE_NAME
! #undef PACKAGE_STRING
! #undef PACKAGE_TARNAME
! #undef PACKAGE_VERSION
! #endif
!
! #if defined (APACHE)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 23,28 ****
--- 32,42 ----
# include "http_main.h"
# include "http_protocol.h"
# include "util_script.h"
+ # ifdef APACHE2
+ typedef apr_pool_t pool;
+ typedef apr_table_t table;
+ # endif
+
# else
typedef void pool;
#endif
Index: webiso/pubcookie/src/flavor_basic.c
diff -c webiso/pubcookie/src/flavor_basic.c:1.49 webiso/pubcookie/src/flavor_basic.c:1.50
*** webiso/pubcookie/src/flavor_basic.c:1.49 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/flavor_basic.c Thu Feb 19 15:07:02 2004
***************
*** 13,19 ****
* will pass l->realm to the verifier and append it to the username when
* 'append_realm' is set
*
! * $Id: flavor_basic.c,v 1.49 2004/02/16 17:05:31 jteaton Exp $
*/
--- 13,19 ----
* will pass l->realm to the verifier and append it to the username when
* 'append_realm' is set
*
! * $Id: flavor_basic.c,v 1.50 2004/02/19 23:07:02 fox Exp $
*/
***************
*** 321,379 ****
}
pbc_log_activity(p, PBC_LOG_DEBUG_VERBOSE, "%s: goodbye: %s",
! func, field_html);
! return(user_field_html);
!
! }
!
! /* figure out what html to use for user field */
! char *flb_get_user_field(pool *p, login_rec *l, login_rec *c, int reason)
! {
! char func[] = "flb_get_user_field";
! const char *loser = (l != NULL && l->user != NULL ? l->user
! : (c != NULL ? c->user : NULL));
! const char *static_config = libpbc_config_getstring(p, "static_user_field",
! STATIC_USER_FIELD_KIND);
! char *user_field_html;
!
! if ( strcmp(static_config, STATIC_USER_FIELD_KIND) == 0 ) {
! if ( c != NULL && c->user != NULL & reason == FLB_REAUTH ||
! c != NULL && c->user != NULL & reason == FLB_CACHE_CREDS_WRONG ||
! l->user != NULL && l->ride_free_creds == PBC_BASIC_CRED_ID ) {
! user_field_html = flb_get_field_html(p, libpbc_config_getstring(p,
! "tmpl_login_user_static",
! "login_user_static" ), loser);
! l->hide_user = PBC_TRUE;
! }
! else {
! user_field_html = flb_get_field_html(p, libpbc_config_getstring(p,
! "tmpl_login_user_form_field",
! "login_user_form_field" ), loser);
! l->hide_user = PBC_FALSE;
! }
! }
! else if ( strcmp(static_config, STATIC_USER_FIELD_FASCIST) == 0 ) {
! if ( c != NULL && c->user != NULL ||
! l->user != NULL && l->ride_free_creds == PBC_BASIC_CRED_ID ) {
! user_field_html = flb_get_field_html(p, libpbc_config_getstring(p,
! "tmpl_login_user_static",
! "login_user_static" ), loser);
! l->hide_user = PBC_TRUE;
! }
! else {
! user_field_html = flb_get_field_html(p, libpbc_config_getstring(p,
! "tmpl_login_user_form_field",
! "login_user_form_field" ), loser);
! l->hide_user = PBC_FALSE;
! }
! }
! else { /* STATIC_USER_FIELD_NEVER */
! user_field_html = flb_get_field_html(p, libpbc_config_getstring(p,
! "tmpl_login_user_form_field",
! "login_user_form_field" ), loser);
! l->hide_user = PBC_FALSE;
! }
!
return(user_field_html);
}
--- 321,327 ----
}
pbc_log_activity(p, PBC_LOG_DEBUG_VERBOSE, "%s: goodbye: %s",
! func, user_field_html);
return(user_field_html);
}
***************
*** 749,755 ****
int outlen;
char *out64;
! if (!libpbc_mk_priv(p, context, NULL, creds->str, creds->sz,
&outbuf, &outlen)) {
/* save for later */
out64 = malloc(outlen * 4 / 3 + 20);
--- 697,703 ----
int outlen;
char *out64;
! if (!libpbc_mk_priv(p, context, NULL, 0, creds->str, creds->sz,
&outbuf, &outlen)) {
/* save for later */
out64 = malloc(outlen * 4 / 3 + 20);
Index: webiso/pubcookie/src/flavor_getcred.c
diff -c webiso/pubcookie/src/flavor_getcred.c:1.22 webiso/pubcookie/src/flavor_getcred.c:1.23
*** webiso/pubcookie/src/flavor_getcred.c:1.22 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/flavor_getcred.c Thu Feb 19 15:07:02 2004
***************
*** 6,12 ****
/** @file flavor_getcred.c
* Getcred flavor
*
! * $Id: flavor_getcred.c,v 1.22 2004/02/16 17:05:31 jteaton Exp $
*/
--- 6,12 ----
/** @file flavor_getcred.c
* Getcred flavor
*
! * $Id: flavor_getcred.c,v 1.23 2004/02/19 23:07:02 fox Exp $
*/
***************
*** 265,271 ****
}
/* decrypt */
! if (libpbc_rd_priv(p, context, NULL, plain, plainlen,
&(master->str), &(master->sz))) {
pbc_log_activity(p, PBC_LOG_ERROR,
"flavor_getcred: couldn't libpbc_rd_priv %s",
--- 265,271 ----
}
/* decrypt */
! if (libpbc_rd_priv(p, context, NULL, 0, plain, plainlen,
&(master->str), &(master->sz))) {
pbc_log_activity(p, PBC_LOG_ERROR,
"flavor_getcred: couldn't libpbc_rd_priv %s",
***************
*** 292,298 ****
/* put the new credentials in a star cookie so they'll be sent to the
app server */
/* encrypt */
! if (libpbc_mk_priv(p, context, l->host, newcreds->str, newcreds->sz,
&outbuf, &outlen)) {
pbc_log_activity(p, PBC_LOG_ERROR,
"flavor_getcred: libpbc_mk_priv failed");
--- 292,298 ----
/* put the new credentials in a star cookie so they'll be sent to the
app server */
/* encrypt */
! if (libpbc_mk_priv(p, context, l->host, 1, newcreds->str, newcreds->sz,
&outbuf, &outlen)) {
pbc_log_activity(p, PBC_LOG_ERROR,
"flavor_getcred: libpbc_mk_priv failed");
Index: webiso/pubcookie/src/index.cgi.c
diff -c webiso/pubcookie/src/index.cgi.c:1.117 webiso/pubcookie/src/index.cgi.c:1.118
*** webiso/pubcookie/src/index.cgi.c:1.117 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/index.cgi.c Thu Feb 19 15:07:02 2004
***************
*** 6,12 ****
/** @file index.cgi.c
* Login server CGI
*
! * $Id: index.cgi.c,v 1.117 2004/02/16 17:05:31 jteaton Exp $
*/
#ifdef HAVE_CONFIG_H
--- 6,12 ----
/** @file index.cgi.c
* Login server CGI
*
! * $Id: index.cgi.c,v 1.118 2004/02/19 23:07:02 fox Exp $
*/
#ifdef HAVE_CONFIG_H
***************
*** 2892,2898 ****
cookie_local = (char *)
libpbc_get_cookie_with_expire(p, context, user, type, creds, pre_sess_tok,
! create, expire, appsrvid, appid, peer);
if (peer != NULL)
free(peer);
--- 2892,2898 ----
cookie_local = (char *)
libpbc_get_cookie_with_expire(p, context, user, type, creds, pre_sess_tok,
! create, expire, appsrvid, appid, peer, peer ? 1 : 0);
if (peer != NULL)
free(peer);
Index: webiso/pubcookie/src/keyserver.c
diff -c webiso/pubcookie/src/keyserver.c:2.44 webiso/pubcookie/src/keyserver.c:2.45
*** webiso/pubcookie/src/keyserver.c:2.44 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/keyserver.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file keyserver.c
* Server side of key management structure
*
! * $Id: keyserver.c,v 2.44 2004/02/16 17:05:31 jteaton Exp $
*/
--- 6,12 ----
/** @file keyserver.c
* Server side of key management structure
*
! * $Id: keyserver.c,v 2.45 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 308,368 ****
/* no HTML headers for me */
myprintf("\r\n");
-
- switch (op) {
- case PERMIT:
- {
- /* 'peer' has asked us to authorize a new CN (newkey) */
- if(check_access_list(peer) == PBC_FAIL ) {
- myprintf("NO you (%s) are not authorized to authorize\r\n",
- peer);
- pbc_log_activity(p, PBC_LOG_ERROR,
- "operation not allowed: %s", peer);
- return(1);
- }
-
- /* find <cn>;<test> */
- thepeer = strdup(newkey);
- thekey64 = strchr(thepeer, ';');
- if (!thekey64) {
- myprintf("NO bad form for authorize\r\n");
- /* xxx log */
- return(1);
- }
- *thekey64++ = '\0';
-
- if (libpbc_test_crypt_key(p, thepeer) == PBC_OK) {
- myprintf("OK already authorized\r\n");
- pbc_log_activity(p, PBC_LOG_ERROR,
- "already authorized");
- return(1);
- }
-
- /* if just a test, return now */
- if (!strncmp(thekey64, "test", 4)) {
- myprintf("NO server is not authorized\r\n");
- pbc_log_activity(p, PBC_LOG_ERROR,
- "test - not yet");
- return(1);
- }
-
-
- pbc_log_activity(p, PBC_LOG_AUDIT,
- "authorizing %s", thepeer);
-
- if (libpbc_generate_crypt_key(p, thepeer) != PBC_OK) {
- myprintf("NO generate_new_key() failed\r\n");
- pbc_log_activity(p, PBC_LOG_ERROR,
- "generate_new_key() failed");
- return(1);
- }
-
- /* push the new key to the other login servers */
- pushkey(thepeer);
-
- dokeyret = 0; /* don't return the key to this client */
- break;
- }
switch (op) {
case PERMIT:
--- 308,313 ----
Index: webiso/pubcookie/src/libpubcookie.c
diff -c webiso/pubcookie/src/libpubcookie.c:2.68 webiso/pubcookie/src/libpubcookie.c:2.69
*** webiso/pubcookie/src/libpubcookie.c:2.68 Tue Feb 17 15:06:38 2004
--- webiso/pubcookie/src/libpubcookie.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file libpubcookie.c
* Core pubcookie library
*
! * $Id: libpubcookie.c,v 2.68 2004/02/17 23:06:38 ryanc Exp $
*/
--- 6,12 ----
/** @file libpubcookie.c
* Core pubcookie library
*
! * $Id: libpubcookie.c,v 2.69 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 15,20 ****
--- 15,35 ----
# include "pbc_path.h"
#endif
+ #ifdef APACHE2
+ #undef HAVE_CONFIG_H
+ #undef PACKAGE_BUGREPORT
+ #undef PACKAGE_NAME
+ #undef PACKAGE_STRING
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+ #endif
+
+ #if defined (APACHE2)
+ #define pbc_malloc(p, x) apr_palloc(p, x)
+ #define pbc_strdup(p, x) apr_pstrdup(p, x)
+ #endif
+
+
# ifdef HAVE_STDIO_H
# include <stdio.h>
# endif /* HAVE_STDIO_H */
***************
*** 59,65 ****
# include <netdb.h>
# endif /* HAVE_NETDB_H */
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 74,83 ----
# include <netdb.h>
# endif /* HAVE_NETDB_H */
! #if defined (APACHE2)
! #define pbc_malloc(p, x) apr_palloc(p, x)
! #endif
! #if defined (APACHE)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 71,76 ****
--- 89,100 ----
typedef void pool;
#endif
+ #ifdef APACHE2
+ #include "apr_strings.h"
+ typedef apr_pool_t pool;
+ typedef apr_table_t table;
+ #endif
+
#ifdef OPENSSL_IN_DIR
# include <openssl/pem.h>
# include <openssl/des.h>
***************
*** 99,104 ****
--- 123,131 ----
# include "pbc_config.h"
#endif
+ #ifdef APACHE2
+ #endif
+
#include "pbc_version.h"
#include "pbc_logging.h"
#include "libpubcookie.h"
***************
*** 107,113 ****
#include "security.h"
#ifdef HAVE_DMALLOC_H
! # if (!defined(APACHE) && !defined(APACHE1_3))
# include <dmalloc.h>
# endif /* ! APACHE */
#endif /* HAVE_DMALLOC_H */
--- 134,140 ----
#include "security.h"
#ifdef HAVE_DMALLOC_H
! # if !defined(APACHE)
# include <dmalloc.h>
# endif /* ! APACHE */
#endif /* HAVE_DMALLOC_H */
Index: webiso/pubcookie/src/mod_pubcookie.c
diff -c webiso/pubcookie/src/mod_pubcookie.c:1.128 webiso/pubcookie/src/mod_pubcookie.c:1.129
*** webiso/pubcookie/src/mod_pubcookie.c:1.128 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/mod_pubcookie.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file mod_pubcookie.c
* Apache pubcookie module
*
! * $Id: mod_pubcookie.c,v 1.128 2004/02/16 17:05:31 jteaton Exp $
*/
--- 6,12 ----
/** @file mod_pubcookie.c
* Apache pubcookie module
*
! * $Id: mod_pubcookie.c,v 1.129 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 15,20 ****
--- 15,30 ----
# include "pbc_path.h"
#endif
+ #ifdef APACHE2
+ #undef HAVE_CONFIG_H
+ #undef PACKAGE_BUGREPORT
+ #undef PACKAGE_NAME
+ #undef PACKAGE_STRING
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+ #endif
+
+
/* apache includes */
#include "httpd.h"
#include "http_config.h"
***************
*** 38,44 ****
--- 48,60 ----
# include <err.h>
#endif /* OPENSSL_IN_DIR */
+ #ifdef APACHE2
+ typedef apr_pool_t pool;
+ typedef apr_table_t table;
+ #endif
+
/* pubcookie stuff */
+ #include "pbc_apacheconfig.h"
#include "pbc_myconfig.h"
#include "pbc_logging.h"
#include "pubcookie.h"
***************
*** 47,53 ****
#include "pbc_version.h"
#include "security.h"
#include "mod_pubcookie.h"
- #include "pbc_apacheconfig.h"
#include "pbc_configure.h"
/* system stuff */
--- 63,68 ----
***************
*** 71,78 ****
# include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
void dump_server_rec(request_rec *r, pubcookie_server_rec *scfg) {
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"dump_server_rec:\n\
dirdepth: %d\n\
noblank: %d\n\
--- 86,135 ----
# include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
+ #ifdef APACHE2
+
+ #include "apr_strings.h"
+
+ #define PC_LOG_DEBUG APLOG_MARK,APLOG_DEBUG,0
+ #define PC_LOG_INFO APLOG_MARK,APLOG_INFO,0
+ #define PC_LOG_ERR APLOG_MARK,APLOG_ERR,0
+ #define PC_LOG_EMERG APLOG_MARK,APLOG_EMERG,0
+ #define USER user
+ #define AUTH_TYPE ap_auth_type
+
+ #define ap_palloc apr_palloc
+ #define ap_pcalloc apr_pcalloc
+ #define ap_make_table apr_table_make
+ #define ap_table_add apr_table_add
+ #define ap_table_get apr_table_get
+ #define ap_table_set apr_table_set
+ #define ap_table_setn apr_table_setn
+ #define ap_overlay_tables apr_table_overlay
+ #define ap_psprintf apr_psprintf
+ #define ap_snprintf apr_snprintf
+ #define ap_pstrcat apr_pstrcat
+ #define ap_pstrdup apr_pstrdup
+ #define ap_parse_uri_components apr_uri_parse
+ #define ap_unparse_uri_components apr_uri_unparse
+ #define uri_components apr_uri_t
+ typedef apr_pool_t ap_pool;
+ #define ap_send_http_header(r) ;
+
+ #else /* is apache 1.3 */
+
+ #define PC_LOG_DEBUG APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO
+ #define PC_LOG_INFO APLOG_MARK,APLOG_INFO|APLOG_NOERRNO
+ #define PC_LOG_ERR APLOG_MARK,APLOG_ERR
+ #define PC_LOG_EMERG APLOG_MARK,APLOG_EMERG|APLOG_NOERRNO
+ #define USER connection->user
+ #define AUTH_TYPE connection->ap_auth_type
+ #define APR_SUCCESS HTTP_OK
+
+ #endif
+
+
void dump_server_rec(request_rec *r, pubcookie_server_rec *scfg) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"dump_server_rec:\n\
dirdepth: %d\n\
noblank: %d\n\
***************
*** 88,94 ****
}
void dump_dir_rec(request_rec *r, pubcookie_dir_rec *cfg) {
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"dump_dir_rec:\n\
inact_exp: %d\n\
hard_exp: %d\n\
--- 145,151 ----
}
void dump_dir_rec(request_rec *r, pubcookie_dir_rec *cfg) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"dump_dir_rec:\n\
inact_exp: %d\n\
hard_exp: %d\n\
***************
*** 131,141 ****
if (ap_should_client_block(r)) {
int len_read;
! ap_hard_timeout("copy script args", r);
while ((len_read =
ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0) {
! ap_reset_timeout(r);
if (ap_rwrite(argsbuffer, len_read, r) < len_read) {
/* something went wrong writing, chew up the rest */
while(ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) {
--- 188,198 ----
if (ap_should_client_block(r)) {
int len_read;
! /* AP2 ap_hard_timeout("copy script args", r); */
while ((len_read =
ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN)) > 0) {
! /* ap_reset_timeout(r); */
if (ap_rwrite(argsbuffer, len_read, r) < len_read) {
/* something went wrong writing, chew up the rest */
while(ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) {
***************
*** 145,151 ****
}
}
! ap_kill_timeout(r);
}
return(1);
--- 202,208 ----
}
}
! /* ap_kill_timeout(r); */
}
return(1);
***************
*** 160,170 ****
int i;
if( (i = libpbc_random_int(r->pool)) == -1 ) {
! ap_log_rerror(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, r,
"get_pre_s_token: OpenSSL error");
}
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"get_pre_s_token: token is %d", i);
return(i);
--- 217,227 ----
int i;
if( (i = libpbc_random_int(r->pool)) == -1 ) {
! ap_log_rerror(PC_LOG_EMERG, r,
"get_pre_s_token: OpenSSL error");
}
! ap_log_rerror(PC_LOG_DEBUG, r,
"get_pre_s_token: token is %d", i);
return(i);
***************
*** 185,194 ****
truncate = scfg->dirdepth;
else
truncate = ap_count_dirs(path);
! path_out = ap_make_dirstr(p, path, truncate);
}
else {
! path_out = ap_make_dirstr(p, path, ap_count_dirs(path));
}
return (unsigned char *) path_out;
--- 242,252 ----
truncate = scfg->dirdepth;
else
truncate = ap_count_dirs(path);
! path_out = ap_palloc(p, strlen(path)+1);
! ap_make_dirstr_prefix(path_out, path, truncate);
}
else {
! path_out = ap_make_dirstr_parent(p, path);
}
return (unsigned char *) path_out;
***************
*** 310,317 ****
--- 368,381 ----
/* make sure agents don't cache the redirect */
void set_no_cache_headers(request_rec *r) {
+ #ifdef APACHE2
+ char *datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
+ apr_rfc822_date(datestr, r->request_time);
+ ap_table_set(r->headers_out, "Expires", datestr);
+ #else
ap_table_set(r->headers_out, "Expires", ap_gm_timestr_822(r->pool,
r->request_time));
+ #endif
ap_table_set(r->headers_out, "Cache-Control", "no-cache");
ap_table_set(r->headers_out, "Pragma", "no-cache");
***************
*** 344,350 ****
/* create a brand new cookie, initialized with the present time */
cookie = libpbc_get_cookie(r->pool,
scfg->sectext,
! (unsigned char *)r->connection->user,
PBC_COOKIE_TYPE_S,
cfg->creds,
23,
--- 408,414 ----
/* create a brand new cookie, initialized with the present time */
cookie = libpbc_get_cookie(r->pool,
scfg->sectext,
! (unsigned char *)r->USER,
PBC_COOKIE_TYPE_S,
cfg->creds,
23,
***************
*** 377,383 ****
if (libpbc_mk_priv(r->pool, scfg->sectext, NULL, 0, cfg->cred_transfer,
cfg->cred_transfer_len,
&blob, &bloblen)) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: libpbc_mk_priv() failed");
res = -1;
}
--- 441,447 ----
if (libpbc_mk_priv(r->pool, scfg->sectext, NULL, 0, cfg->cred_transfer,
cfg->cred_transfer_len,
&blob, &bloblen)) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: libpbc_mk_priv() failed");
res = -1;
}
***************
*** 387,393 ****
base64 = ap_palloc(r->pool, (bloblen + 3) / 3 * 4 + 1);
if (!libpbc_base64_encode(r->pool, (unsigned char *) blob,
(unsigned char *) base64, bloblen)) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: libpbc_base64_encode() failed");
res = -1;
}
--- 451,457 ----
base64 = ap_palloc(r->pool, (bloblen + 3) / 3 * 4 + 1);
if (!libpbc_base64_encode(r->pool, (unsigned char *) blob,
(unsigned char *) base64, bloblen)) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: libpbc_base64_encode() failed");
res = -1;
}
***************
*** 515,521 ****
&pubcookie_module);
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config, &pubcookie_module);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"do_end_session_redirect_handler: hello");
r->content_type = "text/html";
--- 579,592 ----
&pubcookie_module);
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config, &pubcookie_module);
! ap_log_rerror(PC_LOG_DEBUG, r,
! "do_end_session_redirect_handler: pre-hello: h=%s", r->handler);
!
! #ifdef APACHE2
! if (strcmp(r->handler, PBC_END_SESSION_REDIR_HANDLER)) return DECLINED;
! #endif
!
! ap_log_rerror(PC_LOG_DEBUG, r,
"do_end_session_redirect_handler: hello");
r->content_type = "text/html";
***************
*** 565,571 ****
&pubcookie_module);
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config, &pubcookie_module);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"stop_the_show_handler: hello");
r->content_type = "text/html";
--- 636,646 ----
&pubcookie_module);
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config, &pubcookie_module);
! #ifdef APACHE2
! if (strcmp(r->handler, PBC_STOP_THE_SHOW_HANDLER)) return DECLINED;
! #endif
!
! ap_log_rerror(PC_LOG_DEBUG, r,
"stop_the_show_handler: hello");
r->content_type = "text/html";
***************
*** 701,707 ****
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"auth_failed_handler: hello");
/* reset these dippy flags */
--- 776,789 ----
scfg=(pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(PC_LOG_DEBUG, r,
! "auth_failed_handler: pre-hello: h=%s", r->handler);
!
! #ifdef APACHE2
! if (strcmp(r->handler, PBC_AUTH_FAILED_HANDLER)) return DECLINED;
! #endif
!
! ap_log_rerror(PC_LOG_DEBUG, r,
"auth_failed_handler: hello");
/* reset these dippy flags */
***************
*** 712,721 ****
args = ap_pcalloc (p, (strlen (r->args) + 3) / 3 * 4 + 1);
libpbc_base64_encode(p, (unsigned char *) r->args,
(unsigned char *) args, strlen(r->args));
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"GET args before encoding length %d, string: %s",
strlen(r->args), r->args);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"GET args after encoding length %d, string: %s",
strlen(args), args);
}
--- 794,803 ----
args = ap_pcalloc (p, (strlen (r->args) + 3) / 3 * 4 + 1);
libpbc_base64_encode(p, (unsigned char *) r->args,
(unsigned char *) args, strlen(r->args));
! ap_log_rerror(PC_LOG_DEBUG, r,
"GET args before encoding length %d, string: %s",
strlen(r->args), r->args);
! ap_log_rerror(PC_LOG_DEBUG, r,
"GET args after encoding length %d, string: %s",
strlen(args), args);
}
***************
*** 784,797 ****
misc_flag);
if (cfg->addl_requests) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"auth_failed_handler: adding %s", cfg->addl_requests);
g_req_contents = ap_pstrcat(p, g_req_contents,
cfg->addl_requests, NULL);
}
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"g_req before encoding length %d, string: %s",
strlen(g_req_contents), g_req_contents);
--- 866,879 ----
misc_flag);
if (cfg->addl_requests) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"auth_failed_handler: adding %s", cfg->addl_requests);
g_req_contents = ap_pstrcat(p, g_req_contents,
cfg->addl_requests, NULL);
}
! ap_log_rerror(PC_LOG_DEBUG, r,
"g_req before encoding length %d, string: %s",
strlen(g_req_contents), g_req_contents);
***************
*** 823,829 ****
PBC_ENTRPRS_DOMAIN,
secure);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"g_req length %d cookie: %s", strlen(g_req_cookie), g_req_cookie);
/* make the pre-session cookie */
--- 905,911 ----
PBC_ENTRPRS_DOMAIN,
secure);
! ap_log_rerror(PC_LOG_DEBUG, r,
"g_req length %d cookie: %s", strlen(g_req_cookie), g_req_cookie);
/* make the pre-session cookie */
***************
*** 864,870 ****
PBC_ENTRPRS_DOMAIN,
secure);
ap_table_add(r->headers_out, "Set-Cookie", g_req_cookie);
! ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r,
"auth_failed_handler: setting Form/Multipart cookie");
}
--- 946,952 ----
PBC_ENTRPRS_DOMAIN,
secure);
ap_table_add(r->headers_out, "Set-Cookie", g_req_cookie);
! ap_log_rerror(PC_LOG_DEBUG, r,
"auth_failed_handler: setting Form/Multipart cookie");
}
***************
*** 907,912 ****
--- 989,998 ----
/* */
static int bad_user_handler(request_rec *r) {
+ #ifdef APACHE2
+ if (strcmp(r->handler, PBC_BAD_USER_HANDLER)) return DECLINED;
+ #endif
+
r->content_type = "text/html";
ap_send_http_header(r);
ap_rprintf(r, "Unauthorized user.");
***************
*** 1003,1015 ****
logging_level == PBC_LOG_DEBUG_OUTPUT )
apri = APLOG_DEBUG|APLOG_NOERRNO;
ap_log_error(APLOG_MARK, apri, NULL, "%s", msg);
! /* fprintf(stderr, msg); */
}
static void pubcookie_init(server_rec *main_s, pool *p) {
! server_rec *s;
pubcookie_server_rec *scfg;
char *fname;
--- 1089,1108 ----
logging_level == PBC_LOG_DEBUG_OUTPUT )
apri = APLOG_DEBUG|APLOG_NOERRNO;
+ #ifdef APACHE2
+ ap_log_error(APLOG_MARK, apri, 0, NULL, "%s", msg);
+ #else
ap_log_error(APLOG_MARK, apri, NULL, "%s", msg);
! #endif
}
+ #ifdef APACHE2
+ static int pubcookie_init(pool *p, pool *plog, pool *ptemp, server_rec *main_s) {
+ #else /* apache 2 */
static void pubcookie_init(server_rec *main_s, pool *p) {
! #endif
! server_rec *s;
pubcookie_server_rec *scfg;
char *fname;
***************
*** 1020,1050 ****
scfg = (pubcookie_server_rec *) ap_get_module_config(s->module_config,
&pubcookie_module);
ap_add_version_component(
ap_pstrcat(p, "mod_pubcookie/", PBC_VERSION_STRING, NULL));
! ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, s,
"pubcookie_init: hello");
/* bail if PubcookieAuthTypes not set */
if( scfg->authtype_names == NULL ) {
! ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, s,
"PubCookieAuthTypeNames configuration directive must be set!");
exit(1);
}
if (ap_table_get(scfg->configlist, "ssl_key_file") == NULL) {
! ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, s,
"PubCookieSessionKeyFile configuration directive must be set!");
exit(1);
}
if (ap_table_get(scfg->configlist, "ssl_cert_file") == NULL) {
! ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, s,
"PubCookieSessionCertFile configuration directive must be set!");
exit(1);
}
- /* old config way */
- /* libpbc_config_init(p, NULL, "mod_pubcookie"); */
pbc_log_init(p, "mod_pubcookie", NULL, &mylog, NULL);
pbc_configure_init(p, "mod_pubcookie",
--- 1113,1144 ----
scfg = (pubcookie_server_rec *) ap_get_module_config(s->module_config,
&pubcookie_module);
ap_add_version_component(
+ #ifdef APACHE2
+ p,
+ #endif
ap_pstrcat(p, "mod_pubcookie/", PBC_VERSION_STRING, NULL));
! ap_log_error(PC_LOG_DEBUG, s,
"pubcookie_init: hello");
/* bail if PubcookieAuthTypes not set */
if( scfg->authtype_names == NULL ) {
! ap_log_error(PC_LOG_EMERG, s,
"PubCookieAuthTypeNames configuration directive must be set!");
exit(1);
}
if (ap_table_get(scfg->configlist, "ssl_key_file") == NULL) {
! ap_log_error(PC_LOG_EMERG, s,
"PubCookieSessionKeyFile configuration directive must be set!");
exit(1);
}
if (ap_table_get(scfg->configlist, "ssl_cert_file") == NULL) {
! ap_log_error(PC_LOG_EMERG, s,
"PubCookieSessionCertFile configuration directive must be set!");
exit(1);
}
pbc_log_init(p, "mod_pubcookie", NULL, &mylog, NULL);
pbc_configure_init(p, "mod_pubcookie",
***************
*** 1056,1062 ****
&libpbc_apacheconfig_getswitch);
if (ap_table_get(scfg->configlist, "granting_cert_file") == NULL) {
! ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, s,
"PubCookieGrantingCertFile configuration directive not set, using %s/%s",
PBC_KEY_DIR, "pubcookie_granting.cert");
}
--- 1150,1156 ----
&libpbc_apacheconfig_getswitch);
if (ap_table_get(scfg->configlist, "granting_cert_file") == NULL) {
! ap_log_error(PC_LOG_EMERG, s,
"PubCookieGrantingCertFile configuration directive not set, using %s/%s",
PBC_KEY_DIR, "pubcookie_granting.cert");
}
***************
*** 1069,1087 ****
/* if the user didn't explicitly configure a login server,
let's default to PBC_LOGIN_URI */
scfg->login = ap_pstrcat(p, PBC_LOGIN_URI, NULL);
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, s,
"pubcookie_init(): login from PBC_LOGIN_URI: %s",
scfg->login);
}
! ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, s,
"pubcookie_init: bye");
}
}
/* */
! static void *pubcookie_server_create(pool *p, server_rec *s) {
pubcookie_server_rec *scfg;
scfg = (pubcookie_server_rec *) ap_pcalloc(p, sizeof(pubcookie_server_rec));
--- 1163,1181 ----
/* if the user didn't explicitly configure a login server,
let's default to PBC_LOGIN_URI */
scfg->login = ap_pstrcat(p, PBC_LOGIN_URI, NULL);
! ap_log_error(PC_LOG_DEBUG, s,
"pubcookie_init(): login from PBC_LOGIN_URI: %s",
scfg->login);
}
! ap_log_error(PC_LOG_DEBUG, s,
"pubcookie_init: bye");
}
}
/* */
! static void *pubcookie_server_create(pool *p, server_rec *s) {
pubcookie_server_rec *scfg;
scfg = (pubcookie_server_rec *) ap_pcalloc(p, sizeof(pubcookie_server_rec));
***************
*** 1093,1099 ****
}
/* */
! static void *pubcookie_dir_create(pool *p, char *dirspec) {
pubcookie_dir_rec *cfg;
cfg = (pubcookie_dir_rec *) ap_pcalloc(p, sizeof(pubcookie_dir_rec));
--- 1187,1193 ----
}
/* */
! static void *pubcookie_dir_create(pool *p, char *dirspec) {
pubcookie_dir_rec *cfg;
cfg = (pubcookie_dir_rec *) ap_pcalloc(p, sizeof(pubcookie_dir_rec));
***************
*** 1107,1113 ****
}
/* */
! static void *pubcookie_server_merge(pool *p, void *parent, void *newloc) {
pubcookie_server_rec *scfg;
pubcookie_server_rec *pscfg = (pubcookie_server_rec *)parent;
pubcookie_server_rec *nscfg = (pubcookie_server_rec *)newloc;
--- 1201,1207 ----
}
/* */
! static void *pubcookie_server_merge(pool *p, void *parent, void *newloc) {
pubcookie_server_rec *scfg;
pubcookie_server_rec *pscfg = (pubcookie_server_rec *)parent;
pubcookie_server_rec *nscfg = (pubcookie_server_rec *)newloc;
***************
*** 1124,1130 ****
nscfg->noblank : pscfg->noblank;
scfg->authtype_names = nscfg->authtype_names ?
nscfg->authtype_names : pscfg->authtype_names;
-
scfg->configlist = ap_overlay_tables(p, nscfg->configlist,
pscfg->configlist);
--- 1218,1223 ----
***************
*** 1132,1138 ****
}
/* */
! static void *pubcookie_dir_merge(pool *p, void *parent, void *newloc) {
pubcookie_dir_rec *cfg;
pubcookie_dir_rec *pcfg = (pubcookie_dir_rec *) parent;
pubcookie_dir_rec *ncfg = (pubcookie_dir_rec *) newloc;
--- 1225,1231 ----
}
/* */
! static void *pubcookie_dir_merge(pool *p, void *parent, void *newloc) {
pubcookie_dir_rec *cfg;
pubcookie_dir_rec *pcfg = (pubcookie_dir_rec *) parent;
pubcookie_dir_rec *ncfg = (pubcookie_dir_rec *) newloc;
***************
*** 1204,1227 ****
pubcookie_server_rec *scfg;
pbc_cookie_data *cookie_data = NULL;
char *cookie = NULL;
! pool *p = r->pool;
cfg = (pubcookie_dir_rec *)ap_get_module_config(r->per_dir_config,
&pubcookie_module);
!
! scfg = (pubcookie_server_rec *)ap_get_module_config(r->server->module_config,
! &pubcookie_module);
!
if( (cookie = get_cookie(r, PBC_PRE_S_COOKIENAME)) == NULL )
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"get_pre_s_from_cookie: no pre_s cookie, uri: %s\n",
r->uri);
else
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, NULL, 0);
if( cookie_data == NULL ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"get_pre_s_from_cookie: can't unbundle pre_s cookie uri: %s\n",
r->uri);
cfg->failed = PBC_BAD_AUTH;
--- 1297,1318 ----
pubcookie_server_rec *scfg;
pbc_cookie_data *cookie_data = NULL;
char *cookie = NULL;
! pool *p = r->pool;
cfg = (pubcookie_dir_rec *)ap_get_module_config(r->per_dir_config,
&pubcookie_module);
! scfg = (pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
! &pubcookie_module);
if( (cookie = get_cookie(r, PBC_PRE_S_COOKIENAME)) == NULL )
! ap_log_rerror(PC_LOG_INFO, r,
"get_pre_s_from_cookie: no pre_s cookie, uri: %s\n",
r->uri);
else
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, NULL, 0);
if( cookie_data == NULL ) {
! ap_log_rerror(PC_LOG_INFO, r,
"get_pre_s_from_cookie: can't unbundle pre_s cookie uri: %s\n",
r->uri);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1233,1239 ****
}
! /* */
static int pubcookie_user(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
--- 1324,1330 ----
}
! /* Check user id */
static int pubcookie_user(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
***************
*** 1254,1260 ****
scfg = (pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: hello, uri: %s auth_type: %s", r->uri, ap_auth_type(r));
/* stash the server_rec away so the get_config callbacks know
--- 1345,1351 ----
scfg = (pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: hello, uri: %s auth_type: %s", r->uri, ap_auth_type(r));
/* stash the server_rec away so the get_config callbacks know
***************
*** 1262,1268 ****
this uses a global variable, and will definately break under apache2 */
libpbc_apacheconfig_storeglobal(scfg);
-
/* get defaults for unset args */
pubcookie_dir_defaults(cfg);
pubcookie_server_defaults(scfg);
--- 1353,1358 ----
***************
*** 1275,1281 ****
if( (cfg->creds = pubcookie_auth_type(r)) == PBC_CREDS_NONE )
return DECLINED;
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: going to check uri: %s creds: %c", r->uri, cfg->creds);
/* maybe dump the directory and server recs */
--- 1365,1371 ----
if( (cfg->creds = pubcookie_auth_type(r)) == PBC_CREDS_NONE )
return DECLINED;
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: going to check uri: %s creds: %c", r->uri, cfg->creds);
/* maybe dump the directory and server recs */
***************
*** 1285,1305 ****
sess_cookie_name = make_session_cookie_name(p, PBC_S_COOKIENAME, appid(r));
/* force SSL */
if (ap_hook_call("ap::mod_ssl::var_lookup", &isssl, p, r->server,
r->connection, r, "HTTPS") && isssl && strcmp (isssl, "on")) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"Not SSL; uri: %s appid: %s", r->uri, appid(r));
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_NOGORS_CODE;
return OK;
}
/* before we check if they hav a valid S or G cookie see if it's a logout */
if( check_end_session(r) & PBC_END_SESSION_ANY ) {
return OK;
}
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: about to look for some cookies; current uri: %s", r->uri);
/* check if the granting cookie's appid matches. if not, then act as
--- 1375,1397 ----
sess_cookie_name = make_session_cookie_name(p, PBC_S_COOKIENAME, appid(r));
/* force SSL */
+ /** AP2
if (ap_hook_call("ap::mod_ssl::var_lookup", &isssl, p, r->server,
r->connection, r, "HTTPS") && isssl && strcmp (isssl, "on")) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"Not SSL; uri: %s appid: %s", r->uri, appid(r));
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_NOGORS_CODE;
return OK;
}
+ **/
/* before we check if they hav a valid S or G cookie see if it's a logout */
if( check_end_session(r) & PBC_END_SESSION_ANY ) {
return OK;
}
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: about to look for some cookies; current uri: %s", r->uri);
/* check if the granting cookie's appid matches. if not, then act as
***************
*** 1308,1316 ****
if( (cookie = get_cookie(r, PBC_G_COOKIENAME)) && strcmp(cookie, "") != 0 ) {
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, ap_get_server_name(r), 1);
if( !cookie_data) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"can't unbundle G cookie; uri: %s\n", r->uri);
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"cookie is:\n%s\n", cookie);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_BADG_CODE;
--- 1400,1408 ----
if( (cookie = get_cookie(r, PBC_G_COOKIENAME)) && strcmp(cookie, "") != 0 ) {
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, ap_get_server_name(r), 1);
if( !cookie_data) {
! ap_log_rerror(PC_LOG_INFO, r,
"can't unbundle G cookie; uri: %s\n", r->uri);
! ap_log_rerror(PC_LOG_INFO, r,
"cookie is:\n%s\n", cookie);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_BADG_CODE;
***************
*** 1324,1330 ****
sizeof(cookie_data->broken.appid)-1) != 0 ){
if( !(cookie = get_cookie(r, sess_cookie_name)) || strcmp(cookie,"") == 0 ){
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"No G or S cookie; uri: %s appid: %s sess_cookie_name: %s",
r->uri, appid(r), sess_cookie_name);
cfg->failed = PBC_BAD_AUTH;
--- 1416,1422 ----
sizeof(cookie_data->broken.appid)-1) != 0 ){
if( !(cookie = get_cookie(r, sess_cookie_name)) || strcmp(cookie,"") == 0 ){
! ap_log_rerror(PC_LOG_DEBUG, r,
"No G or S cookie; uri: %s appid: %s sess_cookie_name: %s",
r->uri, appid(r), sess_cookie_name);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1335,1341 ****
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, NULL, 0);
if( ! cookie_data ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"can't unbundle S cookie; uri: %s\n", r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_BADS_CODE;
--- 1427,1433 ----
cookie_data = libpbc_unbundle_cookie(p, scfg->sectext, cookie, NULL, 0);
if( ! cookie_data ) {
! ap_log_rerror(PC_LOG_INFO, r,
"can't unbundle S cookie; uri: %s\n", r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_BADS_CODE;
***************
*** 1346,1353 ****
}
/* we tell everyone what authentication check we did */
! r->connection->ap_auth_type = ap_pstrdup(r->pool, ap_auth_type(r));
! r->connection->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
/* save the full user/realm for later */
cfg->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
--- 1438,1445 ----
}
/* we tell everyone what authentication check we did */
! r->AUTH_TYPE = ap_pstrdup(r->pool, ap_auth_type(r));
! r->USER = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
/* save the full user/realm for later */
cfg->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
***************
*** 1360,1374 ****
if (tmprealm) {
tmprealm[0] = 0;
tmprealm++;
! r->connection->user = tmpuser;
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
}
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
if (cfg->strip_realm == 1) {
! r->connection->user = tmpuser;
} else {
! r->connection->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
}
if (cfg->accept_realms != NULL) {
--- 1452,1466 ----
if (tmprealm) {
tmprealm[0] = 0;
tmprealm++;
! r->USER = tmpuser;
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
}
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
if (cfg->strip_realm == 1) {
! r->USER = tmpuser;
} else {
! r->USER = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
}
if (cfg->accept_realms != NULL) {
***************
*** 1388,1394 ****
}
if( libpbc_check_exp(p, (*cookie_data).broken.create_ts, cfg->hard_exp) == PBC_FAIL ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"S cookie hard expired; user: %s cookie timestamp: %d timeout: %d now: %d uri: %s\n",
(*cookie_data).broken.user,
(*cookie_data).broken.create_ts,
--- 1480,1486 ----
}
if( libpbc_check_exp(p, (*cookie_data).broken.create_ts, cfg->hard_exp) == PBC_FAIL ) {
! ap_log_rerror(PC_LOG_INFO, r,
"S cookie hard expired; user: %s cookie timestamp: %d timeout: %d now: %d uri: %s\n",
(*cookie_data).broken.user,
(*cookie_data).broken.create_ts,
***************
*** 1402,1408 ****
if( cfg->inact_exp != -1 &&
libpbc_check_exp(p, (*cookie_data).broken.last_ts, cfg->inact_exp) == PBC_FAIL ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"S cookie inact expired; user: %s cookie timestamp %d timeout: %d now: %d uri: %s\n",
(*cookie_data).broken.user,
(*cookie_data).broken.last_ts,
--- 1494,1500 ----
if( cfg->inact_exp != -1 &&
libpbc_check_exp(p, (*cookie_data).broken.last_ts, cfg->inact_exp) == PBC_FAIL ) {
! ap_log_rerror(PC_LOG_INFO, r,
"S cookie inact expired; user: %s cookie timestamp %d timeout: %d now: %d uri: %s\n",
(*cookie_data).broken.user,
(*cookie_data).broken.last_ts,
***************
*** 1424,1438 ****
clear_granting_cookie(r);
clear_pre_session_cookie(r);
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: has granting; current uri is: %s", r->uri);
/* check pre_session cookie */
pre_sess_from_cookie = get_pre_s_from_cookie(r);
if( (*cookie_data).broken.pre_sess_token != pre_sess_from_cookie ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user, pre session tokens mismatched, uri: %s", r->uri);
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user, pre session from G: %d PRE_S: %d, uri: %s",
(*cookie_data).broken.pre_sess_token, pre_sess_from_cookie, r->uri);
cfg->failed = PBC_BAD_AUTH;
--- 1516,1532 ----
clear_granting_cookie(r);
clear_pre_session_cookie(r);
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: has granting; current uri is: %s", r->uri);
/* check pre_session cookie */
pre_sess_from_cookie = get_pre_s_from_cookie(r);
+ ap_log_rerror(PC_LOG_DEBUG, r,
+ "pubcookie_user: ret from get_pre_s_from_cookie");
if( (*cookie_data).broken.pre_sess_token != pre_sess_from_cookie ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user, pre session tokens mismatched, uri: %s", r->uri);
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user, pre session from G: %d PRE_S: %d, uri: %s",
(*cookie_data).broken.pre_sess_token, pre_sess_from_cookie, r->uri);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1443,1449 ****
/* the granting cookie gets blanked too early and another login */
/* server loop is required, this just speeds up that loop */
if( strncmp(cookie, PBC_X_STRING, PBC_XS_IN_X_STRING) == 0 ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: 'speed up that loop' logic; uri is: %s\n", r->uri);
cfg->failed = PBC_BAD_AUTH;
--- 1537,1543 ----
/* the granting cookie gets blanked too early and another login */
/* server loop is required, this just speeds up that loop */
if( strncmp(cookie, PBC_X_STRING, PBC_XS_IN_X_STRING) == 0 ) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: 'speed up that loop' logic; uri is: %s\n", r->uri);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1451,1458 ****
return OK;
}
! r->connection->ap_auth_type = ap_pstrdup(r->pool, ap_auth_type(r));
! r->connection->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
/* save the full user/realm for later */
cfg->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
--- 1545,1556 ----
return OK;
}
! r->AUTH_TYPE = ap_pstrdup(r->pool, ap_auth_type(r));
! r->USER = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
!
! ap_log_rerror(PC_LOG_DEBUG, r,
! "pubcookie_user: set type (%s) and user (%s)",
! r->AUTH_TYPE, r->USER);
/* save the full user/realm for later */
cfg->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
***************
*** 1465,1479 ****
if (tmprealm) {
tmprealm[0] = 0;
tmprealm++;
! r->connection->user = tmpuser;
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
}
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
if (cfg->strip_realm == 1) {
! r->connection->user = tmpuser;
} else {
! r->connection->user = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
}
if (cfg->accept_realms != NULL) {
--- 1563,1577 ----
if (tmprealm) {
tmprealm[0] = 0;
tmprealm++;
! r->USER = tmpuser;
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
}
ap_table_set(r->subprocess_env, "REMOTE_REALM", tmprealm);
if (cfg->strip_realm == 1) {
! r->USER = tmpuser;
} else {
! r->USER = ap_pstrdup(r->pool, (char *) (*cookie_data).broken.user);
}
if (cfg->accept_realms != NULL) {
***************
*** 1493,1499 ****
}
if( libpbc_check_exp(p, (*cookie_data).broken.create_ts, PBC_GRANTING_EXPIRE) == PBC_FAIL ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user: G cookie expired by %ld; user: %s create: %ld uri: %s", time(NULL)-(*cookie_data).broken.create_ts-PBC_GRANTING_EXPIRE, (*cookie_data).broken.user, (*cookie_data).broken.create_ts, r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_GEXP_CODE;
--- 1591,1597 ----
}
if( libpbc_check_exp(p, (*cookie_data).broken.create_ts, PBC_GRANTING_EXPIRE) == PBC_FAIL ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user: G cookie expired by %ld; user: %s create: %ld uri: %s", time(NULL)-(*cookie_data).broken.create_ts-PBC_GRANTING_EXPIRE, (*cookie_data).broken.user, (*cookie_data).broken.create_ts, r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_GEXP_CODE;
***************
*** 1506,1512 ****
if( strncasecmp( (const char *) appid(r),
(const char *) (*cookie_data).broken.appid,
sizeof((*cookie_data).broken.appid)-1) != 0 ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user: wrong appid; current: %s cookie: %s uri: %s",
appid(r), (*cookie_data).broken.appid, r->uri);
cfg->failed = PBC_BAD_AUTH;
--- 1604,1610 ----
if( strncasecmp( (const char *) appid(r),
(const char *) (*cookie_data).broken.appid,
sizeof((*cookie_data).broken.appid)-1) != 0 ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user: wrong appid; current: %s cookie: %s uri: %s",
appid(r), (*cookie_data).broken.appid, r->uri);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1518,1524 ****
if( strncasecmp( (const char *) appsrvid(r),
(const char *) (*cookie_data).broken.appsrvid,
sizeof((*cookie_data).broken.appsrvid)-1) != 0 ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user: wrong app server id; current: %s cookie: %s uri: %s", appsrvid(r), (*cookie_data).broken.appsrvid, r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_WRONGAPPSRVID_CODE;
--- 1616,1622 ----
if( strncasecmp( (const char *) appsrvid(r),
(const char *) (*cookie_data).broken.appsrvid,
sizeof((*cookie_data).broken.appsrvid)-1) != 0 ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user: wrong app server id; current: %s cookie: %s uri: %s", appsrvid(r), (*cookie_data).broken.appsrvid, r->uri);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_WRONGAPPSRVID_CODE;
***************
*** 1527,1533 ****
/* check version id */
if( libpbc_check_version(p, cookie_data) == PBC_FAIL ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user: wrong version id; module: %d cookie: %d uri: %s", PBC_VERSION, (*cookie_data).broken.version);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_WRONGVER_CODE;
--- 1625,1631 ----
/* check version id */
if( libpbc_check_version(p, cookie_data) == PBC_FAIL ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user: wrong version id; module: %d cookie: %d uri: %s", PBC_VERSION, (*cookie_data).broken.version);
cfg->failed = PBC_BAD_AUTH;
cfg->redir_reason_no = PBC_RR_WRONGVER_CODE;
***************
*** 1536,1542 ****
/* check creds */
if( cfg->creds != cookie_data->broken.creds ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
"pubcookie_user: wrong creds; required: %c cookie: %c uri: %s",
cfg->creds, (*cookie_data).broken.creds, r->uri);
cfg->failed = PBC_BAD_AUTH;
--- 1634,1640 ----
/* check creds */
if( cfg->creds != cookie_data->broken.creds ) {
! ap_log_rerror(PC_LOG_INFO, r,
"pubcookie_user: wrong creds; required: %c cookie: %c uri: %s",
cfg->creds, (*cookie_data).broken.creds, r->uri);
cfg->failed = PBC_BAD_AUTH;
***************
*** 1565,1577 ****
char *plain = NULL;
int plainlen;
char *krb5ccname;
FILE *f = NULL;
int res = 0;
/* base64 decode cookie */
if (!libpbc_base64_decode(p, (unsigned char *) cookie,
(unsigned char *) blob, &bloblen)) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: libpbc_base64_decode() failed");
res = -1;
}
--- 1663,1680 ----
char *plain = NULL;
int plainlen;
char *krb5ccname;
+ #ifdef APACHE2
+ apr_file_t *f = NULL;
+ apr_size_t nb;
+ #else
FILE *f = NULL;
+ #endif
int res = 0;
/* base64 decode cookie */
if (!libpbc_base64_decode(p, (unsigned char *) cookie,
(unsigned char *) blob, &bloblen)) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: libpbc_base64_decode() failed");
res = -1;
}
***************
*** 1583,1589 ****
cred_from_trans ? 1 : 0,
blob, bloblen,
&plain, &plainlen)) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: libpbc_rd_priv() failed");
res = -1;
}
--- 1686,1692 ----
cred_from_trans ? 1 : 0,
blob, bloblen,
&plain, &plainlen)) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: libpbc_rd_priv() failed");
res = -1;
}
***************
*** 1599,1619 ****
krb5ccname = ap_psprintf(p, "/tmp/k5cc_%d", getpid());
if (!res) {
/* save these creds in that file */
f = ap_pfopen(p, krb5ccname, "w");
if (!f) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: setenv() failed");
res = -1;
}
}
! if (!res && (fwrite(cfg->cred_transfer, cfg->cred_transfer_len, 1, f) != 1)) {
! ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"credtrans: setenv() failed");
res = -1;
}
if (f) {
ap_pfclose(p, f);
}
if (cred_from_trans) {
--- 1702,1737 ----
krb5ccname = ap_psprintf(p, "/tmp/k5cc_%d", getpid());
if (!res) {
/* save these creds in that file */
+ #ifdef APACHE2
+ apr_file_open(&f, krb5ccname, APR_WRITE|APR_TRUNCATE, 0644, p);
+ #else
f = ap_pfopen(p, krb5ccname, "w");
+ #endif
if (!f) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: setenv() failed");
res = -1;
}
}
! if (!res &&
! #ifdef APACHE2
! (nb = cfg->cred_transfer_len,
! apr_file_write(f, cfg->cred_transfer, &nb)!= APR_SUCCESS)
! #else
! (fwrite(cfg->cred_transfer, cfg->cred_transfer_len, 1, f) != 1)
! #endif
! ) {
! ap_log_rerror(PC_LOG_ERR, r,
"credtrans: setenv() failed");
res = -1;
}
if (f) {
+ #ifdef APACHE2
+ apr_file_close(f);
+ #else
ap_pfclose(p, f);
+ #endif
}
if (cred_from_trans) {
***************
*** 1621,1634 ****
}
}
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_user: everything is o'tay; current uri is: %s", r->uri);
return OK;
}
! /* */
int pubcookie_authz(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
--- 1739,1752 ----
}
}
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_user: everything is o'tay; current uri is: %s", r->uri);
return OK;
}
! /* check auth */
int pubcookie_authz(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
***************
*** 1638,1663 ****
scfg=(pubcookie_server_rec *)ap_get_module_config(r->server->module_config,
&pubcookie_module);
if( !is_pubcookie_auth(cfg) )
return DECLINED;
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_authz: hello");
if(cfg->failed) { /* pubcookie_user has failed so pass to typer */
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_authz: failed: %d", cfg->failed);
return OK;
}
/* if it's a pubcookie logout don't do any authz, skip to pubcookie_typer */
if( check_end_session(r) & PBC_END_SESSION_ANY ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_authz: is a logout so no authz");
return OK;
}
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_authz: say declined");
/* declined means that other authorization modules will be applied */
--- 1756,1784 ----
scfg=(pubcookie_server_rec *)ap_get_module_config(r->server->module_config,
&pubcookie_module);
+ ap_log_rerror(PC_LOG_DEBUG, r,
+ "pubcookie_authz: pre-hello");
+
if( !is_pubcookie_auth(cfg) )
return DECLINED;
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_authz: hello");
if(cfg->failed) { /* pubcookie_user has failed so pass to typer */
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_authz: failed: %d", cfg->failed);
return OK;
}
/* if it's a pubcookie logout don't do any authz, skip to pubcookie_typer */
if( check_end_session(r) & PBC_END_SESSION_ANY ) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_authz: is a logout so no authz");
return OK;
}
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_authz: say declined");
/* declined means that other authorization modules will be applied */
***************
*** 1665,1671 ****
}
! /* */
static int pubcookie_typer(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
--- 1786,1792 ----
}
! /* Set handler */
static int pubcookie_typer(request_rec *r) {
pubcookie_dir_rec *cfg;
pubcookie_server_rec *scfg;
***************
*** 1673,1678 ****
--- 1794,1802 ----
int first_time_in_session = 0;
char *new_cookie = ap_palloc( r->pool, PBC_1K);
+ ap_log_rerror(PC_LOG_DEBUG, r,
+ "pre-typer");
+
if(!ap_auth_type(r))
return DECLINED;
***************
*** 1681,1699 ****
scfg = (pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"in typer, creds=0x%x",(int)cfg->creds);
if( !is_pubcookie_auth(cfg) )
return DECLINED;
if(!ap_requires(r)) {
! ap_log_reason("pubcookie auth configured with no requires lines", r->uri, r);
! return SERVER_ERROR;
}
if( cfg->has_granting ) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_typer: coming in with granting");
first_time_in_session = 1;
cfg->has_granting = 0;
--- 1805,1824 ----
scfg = (pubcookie_server_rec *) ap_get_module_config(r->server->module_config,
&pubcookie_module);
! ap_log_rerror(PC_LOG_DEBUG, r,
"in typer, creds=0x%x",(int)cfg->creds);
if( !is_pubcookie_auth(cfg) )
return DECLINED;
if(!ap_requires(r)) {
! ap_log_rerror(PC_LOG_ERR, r,
! "Pubcookie auth configured with no requires lines");
! return HTTP_INTERNAL_SERVER_ERROR;
}
if( cfg->has_granting ) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_typer: coming in with granting");
first_time_in_session = 1;
cfg->has_granting = 0;
***************
*** 1705,1711 ****
*/
if(!cfg->failed) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_typer: no failure");
if( check_end_session(r) & PBC_END_SESSION_REDIR ) {
--- 1830,1836 ----
*/
if(!cfg->failed) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_typer: no failure");
if( check_end_session(r) & PBC_END_SESSION_REDIR ) {
***************
*** 1720,1736 ****
}
return DECLINED;
} else if(cfg->failed == PBC_BAD_AUTH) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_typer: bad auth");
r->handler = PBC_AUTH_FAILED_HANDLER;
return OK;
} else if (cfg->failed == PBC_BAD_USER) {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_typer: bad user");
r->handler = PBC_BAD_USER_HANDLER;
return OK;
} else {
! ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, r,
"pubcookie_typer: unknown failure");
return DECLINED;
}
--- 1845,1861 ----
}
return DECLINED;
} else if(cfg->failed == PBC_BAD_AUTH) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_typer: bad auth");
r->handler = PBC_AUTH_FAILED_HANDLER;
return OK;
} else if (cfg->failed == PBC_BAD_USER) {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_typer: bad user");
r->handler = PBC_BAD_USER_HANDLER;
return OK;
} else {
! ap_log_rerror(PC_LOG_DEBUG, r,
"pubcookie_typer: unknown failure");
return DECLINED;
}
***************
*** 1793,1799 ****
}
/* */
! const char *pubcookie_set_inact_exp(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
char *err_string;
--- 1918,1924 ----
}
/* */
! static const char *pubcookie_set_inact_exp(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
char *err_string;
***************
*** 1819,1825 ****
* handle the PubCookieHardExpire directive
* does some range checking
*/
! const char *pubcookie_set_hard_exp(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
char *err_string;
--- 1944,1950 ----
* handle the PubCookieHardExpire directive
* does some range checking
*/
! const char *pubcookie_set_hard_exp(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
char *err_string;
***************
*** 1842,1848 ****
* handle the PubCookieLogin directive
* we do a little checking to make sure the url is correctly formatted.
*/
! const char *pubcookie_set_login(cmd_parms *cmd, void *mconfig, char *v) {
server_rec *s = cmd->server;
uri_components uptr;
char *err_string;
--- 1967,1973 ----
* handle the PubCookieLogin directive
* we do a little checking to make sure the url is correctly formatted.
*/
! const char *pubcookie_set_login(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
uri_components uptr;
char *err_string;
***************
*** 1850,1856 ****
ap_get_module_config(s->module_config,
&pubcookie_module);
! if( ap_parse_uri_components(cmd->pool, v, &uptr) != HTTP_OK ) {
err_string = ap_psprintf(cmd->pool, "PUBCOOKIE: PubCookieLogin not correctly formatted URL.");
return(err_string);
}
--- 1975,1982 ----
ap_get_module_config(s->module_config,
&pubcookie_module);
! /** AP2 **/
! if( ap_parse_uri_components(cmd->pool, v, &uptr) != APR_SUCCESS ) {
err_string = ap_psprintf(cmd->pool, "PUBCOOKIE: PubCookieLogin not correctly formatted URL.");
return(err_string);
}
***************
*** 1880,1886 ****
/**
* handle the PubCookieDomain directive
*/
! const char *pubcookie_set_domain(cmd_parms *cmd, void *mconfig, char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg = (pubcookie_server_rec *)
ap_get_module_config(s->module_config,
--- 2006,2012 ----
/**
* handle the PubCookieDomain directive
*/
! const char *pubcookie_set_domain(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg = (pubcookie_server_rec *)
ap_get_module_config(s->module_config,
***************
*** 1892,1898 ****
/**
* handle the PubCookieKeyDir directive
*/
! const char *pubcookie_set_keydir(cmd_parms *cmd, void *mconfig, char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg = (pubcookie_server_rec *)
ap_get_module_config(s->module_config,
--- 2018,2024 ----
/**
* handle the PubCookieKeyDir directive
*/
! const char *pubcookie_set_keydir(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg = (pubcookie_server_rec *)
ap_get_module_config(s->module_config,
***************
*** 1902,1908 ****
}
/* */
! const char *pubcookie_set_appid(cmd_parms *cmd, void *mconfig, unsigned char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
unsigned char *c;
--- 2028,2034 ----
}
/* */
! const char *pubcookie_set_appid(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
unsigned char *c;
***************
*** 1926,1932 ****
const char *pubcookie_add_request(cmd_parms *cmd,
void *mconfig,
! unsigned char *v)
{
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
--- 2052,2058 ----
const char *pubcookie_add_request(cmd_parms *cmd,
void *mconfig,
! const char *v)
{
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
***************
*** 1938,1944 ****
if (!scfg) return "pubcookie_add_request(): scfg is NULL ?!";
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, s,
"pubcookie_add_request(): %s", v);
cfg->addl_requests = (unsigned char *) ap_pstrcat(cmd->pool,
cfg->addl_requests ? cfg->addl_requests :
--- 2064,2070 ----
if (!scfg) return "pubcookie_add_request(): scfg is NULL ?!";
! ap_log_error(PC_LOG_DEBUG, s,
"pubcookie_add_request(): %s", v);
cfg->addl_requests = (unsigned char *) ap_pstrcat(cmd->pool,
cfg->addl_requests ? cfg->addl_requests :
***************
*** 1950,1956 ****
const char *pubcookie_accept_realms(cmd_parms *cmd,
void *mconfig,
! unsigned char *v)
{
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
--- 2076,2082 ----
const char *pubcookie_accept_realms(cmd_parms *cmd,
void *mconfig,
! const char *v)
{
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
***************
*** 1962,1968 ****
if (!scfg) return "pubcookie_accept_realms(): scfg is NULL ?!";
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, s,
"pubcookie_accept_realms(): %s", v);
cfg->accept_realms = ap_pstrcat(cmd->pool,
cfg->accept_realms ? cfg->accept_realms :
--- 2088,2094 ----
if (!scfg) return "pubcookie_accept_realms(): scfg is NULL ?!";
! ap_log_error(PC_LOG_DEBUG, s,
"pubcookie_accept_realms(): %s", v);
cfg->accept_realms = ap_pstrcat(cmd->pool,
cfg->accept_realms ? cfg->accept_realms :
***************
*** 1970,1976 ****
return NULL;
}
! const char *pubcookie_strip_realm(cmd_parms *cmd, void *mconfig, int f) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
if(f != 0) {
--- 2096,2102 ----
return NULL;
}
! const char *pubcookie_strip_realm(cmd_parms *cmd, void *mconfig, const int f) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
if(f != 0) {
***************
*** 1981,1988 ****
return NULL;
}
/* */
! const char *pubcookie_set_appsrvid(cmd_parms *cmd, void *mconfig, unsigned char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
unsigned char *c;
--- 2107,2115 ----
return NULL;
}
+
/* */
! const char *pubcookie_set_appsrvid(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
unsigned char *c;
***************
*** 2009,2015 ****
}
/* */
! const char *pubcookie_set_dirdepth(cmd_parms *cmd, void *mconfig, unsigned char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
--- 2136,2142 ----
}
/* */
! const char *pubcookie_set_dirdepth(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
***************
*** 2035,2041 ****
/**
* handle the PubCookieGrantingCertFile directive
*/
! const char *pubcookie_set_g_certf(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
--- 2162,2168 ----
/**
* handle the PubCookieGrantingCertFile directive
*/
! const char *pubcookie_set_g_certf(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
***************
*** 2047,2053 ****
/**
* handle the PubCookieSessionKeyFile directive
*/
! const char *pubcookie_set_s_keyf(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
--- 2174,2180 ----
/**
* handle the PubCookieSessionKeyFile directive
*/
! const char *pubcookie_set_s_keyf(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
***************
*** 2059,2065 ****
/**
* handle the PubCookieSessionCertFile directive
*/
! const char *pubcookie_set_s_certf(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
--- 2186,2192 ----
/**
* handle the PubCookieSessionCertFile directive
*/
! const char *pubcookie_set_s_certf(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
***************
*** 2073,2079 ****
* I don't think this is actually used anywhere. I think it always uses
* keydir/hostname instead.
*/
! const char *pubcookie_set_crypt_keyf(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
--- 2200,2206 ----
* I don't think this is actually used anywhere. I think it always uses
* keydir/hostname instead.
*/
! const char *pubcookie_set_crypt_keyf(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
***************
*** 2085,2091 ****
* handle the PubCookieEgdDevice directive
*/
! const char *pubcookie_set_egd_device( cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
--- 2212,2218 ----
* handle the PubCookieEgdDevice directive
*/
! const char *pubcookie_set_egd_device( cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_server_rec * scfg = (pubcookie_server_rec *)
ap_get_module_config(cmd->server->module_config, &pubcookie_module);
***************
*** 2094,2113 ****
}
/* */
! const char *set_session_reauth(cmd_parms *cmd, void *mconfig, unsigned char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
! if (!v) cfg->session_reauth = 0;
! else if (!strcasecmp(v, "on")) cfg->session_reauth = 1;
! else if (!strcasecmp(v, "off")) cfg->session_reauth = 0;
! else cfg->session_reauth = atoi((const char *) v);
! if (cfg->session_reauth<0) cfg->session_reauth = 1;
return NULL;
}
/* sets flag to remove session cookie */
/* can also set the action to redirecto the login server */
! const char *set_end_session(cmd_parms *cmd, void *mconfig, char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
cfg->end_session = ap_pstrdup(cmd->pool, v);
--- 2221,2240 ----
}
/* */
! const char *set_session_reauth(cmd_parms *cmd, void *mconfig, int f) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
! if(f != 0)
! cfg->session_reauth = PBC_SESSION_REAUTH;
! else
! cfg->session_reauth = PBC_SESSION_REAUTH_NO;
!
return NULL;
}
/* sets flag to remove session cookie */
/* can also set the action to redirecto the login server */
! const char *set_end_session(cmd_parms *cmd, void *mconfig, const char *v) {
pubcookie_dir_rec *cfg = (pubcookie_dir_rec *) mconfig;
cfg->end_session = ap_pstrdup(cmd->pool, v);
***************
*** 2118,2124 ****
/* allow admin to set a "dont blank the cookie" mode for proxy with pubcookie */
! const char *pubcookie_set_no_blank(cmd_parms *cmd, void *mconfig, char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
ap_pool *p = cmd->pool;
--- 2245,2251 ----
/* allow admin to set a "dont blank the cookie" mode for proxy with pubcookie */
! const char *pubcookie_set_no_blank(cmd_parms *cmd, void *mconfig, const char *v) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
ap_pool *p = cmd->pool;
***************
*** 2142,2148 ****
const char *set_super_debug(cmd_parms *cmd, void *mconfig, int f) {
server_rec *s = cmd->server;
! ap_log_error(APLOG_MARK, APLOG_EMERG|APLOG_NOERRNO, s,
"PubcookieSuperDebug deprecated, please remove.");
return NULL;
--- 2269,2275 ----
const char *set_super_debug(cmd_parms *cmd, void *mconfig, int f) {
server_rec *s = cmd->server;
! ap_log_error(PC_LOG_EMERG, s,
"PubcookieSuperDebug deprecated, please remove.");
return NULL;
***************
*** 2166,2172 ****
* @param args - aguments for directive
* @returns NULL
*/
! const char *set_authtype_names(cmd_parms *cmd, void *mconfig, char *args) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
ap_pool *p = cmd->pool;
--- 2293,2299 ----
* @param args - aguments for directive
* @returns NULL
*/
! const char *set_authtype_names(cmd_parms *cmd, void *mconfig, const char *args) {
server_rec *s = cmd->server;
pubcookie_server_rec *scfg;
ap_pool *p = cmd->pool;
***************
*** 2181,2186 ****
--- 2308,2314 ----
}
/* */
+ #ifdef APACHE1_3
command_rec pubcookie_commands[] = {
{"PubCookieInactiveExpire", pubcookie_set_inact_exp, NULL, OR_OPTIONS|OR_AUTHCFG, TAKE1,
"Set the inactivity expire time for PubCookies."},
***************
*** 2216,2222 ****
{"PubCookieDirDepthforAppID", pubcookie_set_dirdepth, NULL, RSRC_CONF, TAKE1,
"Specify the Directory Depth for generating default AppIDs."},
! {"PubcookieSessionCauseReAuth", set_session_reauth, NULL, OR_AUTHCFG, TAKE1,
"Force reauthentication for new sessions and session timeouts"},
{"PubcookieEndSession", set_end_session, NULL, OR_AUTHCFG, RAW_ARGS,
"End application session and possibly login session"},
--- 2344,2350 ----
{"PubCookieDirDepthforAppID", pubcookie_set_dirdepth, NULL, RSRC_CONF, TAKE1,
"Specify the Directory Depth for generating default AppIDs."},
! {"PubcookieSessionCauseReAuth", set_session_reauth, NULL, OR_AUTHCFG, FLAG,
"Force reauthentication for new sessions and session timeouts"},
{"PubcookieEndSession", set_end_session, NULL, OR_AUTHCFG, RAW_ARGS,
"End application session and possibly login session"},
***************
*** 2237,2243 ****
{NULL}
};
! /* */
handler_rec pubcookie_handlers[] = {
{ PBC_STOP_THE_SHOW_HANDLER, stop_the_show_handler},
{ PBC_AUTH_FAILED_HANDLER, auth_failed_handler},
--- 2365,2371 ----
{NULL}
};
!
handler_rec pubcookie_handlers[] = {
{ PBC_STOP_THE_SHOW_HANDLER, stop_the_show_handler},
{ PBC_AUTH_FAILED_HANDLER, auth_failed_handler},
***************
*** 2245,2252 ****
{ PBC_BAD_USER_HANDLER, bad_user_handler},
{ NULL }
};
-
- /* */
module pubcookie_module = {
STANDARD_MODULE_STUFF,
pubcookie_init, /* initializer */
--- 2373,2378 ----
***************
*** 2272,2275 ****
--- 2398,2537 ----
NULL /* EAPI: new_connection */
#endif
};
+
+ #else /* apache 2 */
+
+ static const command_rec pubcookie_commands[] = {
+ AP_INIT_TAKE1("PubCookieInactiveExpire",
+ pubcookie_set_inact_exp,
+ NULL, OR_AUTHCFG,
+ "Set the inactivity expire time for PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieHardExpire",
+ pubcookie_set_hard_exp,
+ NULL, OR_AUTHCFG,
+ "Set the hard expire time for PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieLogin",
+ pubcookie_set_login,
+ NULL, RSRC_CONF,
+ "Set the login page for PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieDomain",
+ pubcookie_set_domain,
+ NULL, RSRC_CONF,
+ "Set the domain for PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieKeyDir",
+ pubcookie_set_keydir,
+ NULL, RSRC_CONF,
+ "Set the location of PubCookie encryption keys."
+ ),
+
+ AP_INIT_TAKE1("PubCookieGrantingCertfile",
+ pubcookie_set_g_certf,
+ NULL, RSRC_CONF,
+ "Set the name of the certfile for Granting PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieSessionKeyfile",
+ pubcookie_set_s_keyf,
+ NULL, RSRC_CONF,
+ "Set the name of the keyfile for Session PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieSessionCertfile",
+ pubcookie_set_s_certf,
+ NULL, RSRC_CONF,
+ "Set the name of the certfile for Session PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieCryptKeyfile",
+ pubcookie_set_crypt_keyf,
+ NULL, RSRC_CONF,
+ "Set the name of the encryption keyfile for PubCookies."
+ ),
+ AP_INIT_TAKE1("PubCookieEgdDevice",
+ pubcookie_set_egd_device,
+ NULL, RSRC_CONF,
+ "Set the name of the EGD Socket if needed for randomness."
+ ),
+
+ AP_INIT_TAKE1("PubCookieNoBlank",
+ pubcookie_set_no_blank,
+ NULL, RSRC_CONF,
+ "Do not blank cookies."
+ ),
+ AP_INIT_RAW_ARGS("PubCookieAuthTypeNames",
+ set_authtype_names,
+ NULL, RSRC_CONF,
+ "Sets the text names for authtypes."
+ ),
+
+ AP_INIT_TAKE1("PubCookieAppID",
+ pubcookie_set_appid,
+ NULL, OR_AUTHCFG,
+ "Set the name of the application."
+ ),
+ AP_INIT_TAKE1("PubCookieAppSrvID",
+ pubcookie_set_appsrvid,
+ NULL, RSRC_CONF,
+ "Set the name of the server(cluster)."
+ ),
+ AP_INIT_TAKE1("PubCookieDirDepthforAppID",
+ pubcookie_set_dirdepth,
+ NULL, RSRC_CONF,
+ "Specify the Directory Depth for generating default AppIDs."
+ ),
+
+ AP_INIT_FLAG("PubcookieSessionCauseReAuth",
+ set_session_reauth,
+ NULL, OR_AUTHCFG,
+ "Force reauthentication for new sessions and session timeouts"
+ ),
+ AP_INIT_RAW_ARGS("PubcookieEndSession",
+ set_end_session,
+ NULL, OR_AUTHCFG,
+ "End application session and possibly login session"
+ ),
+ AP_INIT_ITERATE("PubCookieAddlRequest",
+ pubcookie_add_request,
+ NULL, OR_AUTHCFG,
+ "Send the following options to the login server along with authentication requests"
+ ),
+
+ AP_INIT_FLAG("PubCookieSuperDebug",
+ set_super_debug,
+ NULL, OR_AUTHCFG,
+ "Deprecated, do not use"
+ ),
+
+ /* maybe for future exploration
+ AP_INIT_TAKE1("PubCookieNoSSLOK",
+ pubcookie_set_no_ssl_ok,
+ NULL, OR_AUTHCFG,
+ "Allow session to go non-ssl."
+ ),
+ */
+ {NULL}
+ };
+ static void register_hooks(pool * p) {
+ ap_hook_post_config(pubcookie_init, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_check_user_id(pubcookie_user, NULL, NULL, APR_HOOK_FIRST);
+ ap_hook_auth_checker(pubcookie_authz, NULL, NULL, APR_HOOK_FIRST);
+ ap_hook_type_checker(pubcookie_typer, NULL, NULL, APR_HOOK_FIRST);
+ ap_hook_fixups(pubcookie_fixups, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_header_parser(pubcookie_hparse, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_handler(stop_the_show_handler, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_handler(auth_failed_handler, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_handler(do_end_session_redirect_handler, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_handler(bad_user_handler, NULL, NULL, APR_HOOK_MIDDLE);
+ }
+ module AP_MODULE_DECLARE_DATA pubcookie_module = {
+ STANDARD20_MODULE_STUFF,
+ pubcookie_dir_create,
+ pubcookie_dir_merge,
+ pubcookie_server_create,
+ pubcookie_server_merge,
+ pubcookie_commands,
+ register_hooks,
+ };
+ #endif /* apache */
Index: webiso/pubcookie/src/pbc_apacheconfig.c
diff -c webiso/pubcookie/src/pbc_apacheconfig.c:2.9 webiso/pubcookie/src/pbc_apacheconfig.c:2.10
*** webiso/pubcookie/src/pbc_apacheconfig.c:2.9 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/pbc_apacheconfig.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file pbc_apacheconfig.c
* Apacheconfig
*
! * $Id: pbc_apacheconfig.c,v 2.9 2004/02/16 17:05:31 jteaton Exp $
*/
--- 6,12 ----
/** @file pbc_apacheconfig.c
* Apacheconfig
*
! * $Id: pbc_apacheconfig.c,v 2.10 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 15,21 ****
# include "pbc_path.h"
#endif
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 15,31 ----
# include "pbc_path.h"
#endif
! #ifdef APACHE2
! #undef HAVE_CONFIG_H
! #undef PACKAGE_BUGREPORT
! #undef PACKAGE_NAME
! #undef PACKAGE_STRING
! #undef PACKAGE_TARNAME
! #undef PACKAGE_VERSION
! #endif
!
!
! #if defined (APACHE1_3) || defined (APACHE2)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 27,32 ****
--- 37,66 ----
typedef void pool;
#endif
+ #ifdef APACHE2
+
+ #include "apr_strings.h"
+ typedef apr_pool_t pool;
+ typedef apr_table_t table;
+ #define ap_table_get apr_table_get
+
+ #define PC_LOG_DEBUG APLOG_MARK,APLOG_DEBUG,0
+ #define PC_LOG_INFO APLOG_MARK,APLOG_INFO,0
+ #define PC_LOG_ERR APLOG_MARK,APLOG_ERR,0
+ #define PC_LOG_EMERG APLOG_MARK,APLOG_EMERG,0
+ #define PC_LOG_CRIT APLOG_MARK,APLOG_CRIT,0
+
+ #else
+
+ #define PC_LOG_DEBUG APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO
+ #define PC_LOG_INFO APLOG_MARK,APLOG_INFO|APLOG_NOERRNO
+ #define PC_LOG_ERR APLOG_MARK,APLOG_ERR
+ #define PC_LOG_EMERG APLOG_MARK,APLOG_EMERG|APLOG_NOERRNO
+ #define PC_LOG_CRIT APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO
+
+ #endif
+
+
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif /* HAVE_STDIO_H */
***************
*** 126,140 ****
if ( key == NULL )
return def;
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "looking for %s", key);
ret = ap_table_get(configlist, key);
if (ret) {
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "found %s with value %s", ret);
return ret;
}
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "failed to find %s, returning default %s", key, def);
return def;
}
--- 160,174 ----
if ( key == NULL )
return def;
! ap_log_error(PC_LOG_DEBUG, NULL, "looking for %s", key);
ret = ap_table_get(configlist, key);
if (ret) {
! ap_log_error(PC_LOG_DEBUG, NULL, "found %s with value %s", ret);
return ret;
}
! ap_log_error(PC_LOG_DEBUG, NULL, "failed to find %s, returning default %s", key, def);
return def;
}
***************
*** 155,168 ****
*
*/
char **libpbc_apacheconfig_getlist(pool *p, const char *key) {
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL,
"libpbc_apacheconfig_getlist not implmented, was looking for %s",
key);
return NULL;
}
int libpbc_apacheconfig_getswitch(pool *p, const char *key, int def) {
! ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL,
"libpbc_apacheconfig_getswitch not implmented, was looking for %s",
key);
return def;
--- 189,202 ----
*
*/
char **libpbc_apacheconfig_getlist(pool *p, const char *key) {
! ap_log_error(PC_LOG_CRIT, NULL,
"libpbc_apacheconfig_getlist not implmented, was looking for %s",
key);
return NULL;
}
int libpbc_apacheconfig_getswitch(pool *p, const char *key, int def) {
! ap_log_error(PC_LOG_CRIT, NULL,
"libpbc_apacheconfig_getswitch not implmented, was looking for %s",
key);
return def;
Index: webiso/pubcookie/src/pbc_apacheconfig.h
diff -c webiso/pubcookie/src/pbc_apacheconfig.h:2.8 webiso/pubcookie/src/pbc_apacheconfig.h:2.9
*** webiso/pubcookie/src/pbc_apacheconfig.h:2.8 Mon Feb 16 09:05:31 2004
--- webiso/pubcookie/src/pbc_apacheconfig.h Thu Feb 19 15:07:03 2004
***************
*** 4,10 ****
*/
/*
! * $Id: pbc_apacheconfig.h,v 2.8 2004/02/16 17:05:31 jteaton Exp $
*/
--- 4,10 ----
*/
/*
! * $Id: pbc_apacheconfig.h,v 2.9 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 13,19 ****
# include "pbc_path.h"
#endif
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 13,19 ----
# include "pbc_path.h"
#endif
! #if defined (APACHE)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 68,74 ****
#include "mod_pubcookie.h"
#ifdef HAVE_DMALLOC_H
! # if (!defined(APACHE) && !defined(APACHE1_3))
# include <dmalloc.h>
# endif /* ! APACHE */
#endif /* HAVE_DMALLOC_H */
--- 68,74 ----
#include "mod_pubcookie.h"
#ifdef HAVE_DMALLOC_H
! # if !defined(APACHE)
# include <dmalloc.h>
# endif /* ! APACHE */
#endif /* HAVE_DMALLOC_H */
Index: webiso/pubcookie/src/pbc_config.h
diff -c webiso/pubcookie/src/pbc_config.h:1.91 webiso/pubcookie/src/pbc_config.h:1.92
*** webiso/pubcookie/src/pbc_config.h:1.91 Tue Feb 17 15:06:38 2004
--- webiso/pubcookie/src/pbc_config.h Thu Feb 19 15:07:03 2004
***************
*** 4,10 ****
*/
/*
! $Id: pbc_config.h,v 1.91 2004/02/17 23:06:38 ryanc Exp $
*/
#ifndef PUBCOOKIE_CONFIG
--- 4,10 ----
*/
/*
! $Id: pbc_config.h,v 1.92 2004/02/19 23:07:03 fox Exp $
*/
#ifndef PUBCOOKIE_CONFIG
***************
*** 14,23 ****
# include "config.h"
#endif
- #if defined (APACHE1_3)
- #define APACHE
- #endif
-
#ifdef WIN32
# define PBC_KEY_DIR (AddSystemRoot(p, "\\inetsrv\\pubcookie\\keys"))
#else
--- 14,19 ----
***************
*** 54,63 ****
#define PBC_AUTHTYPE3 (libpbc_config_getstring(p, "AuthTypeName3", "SECURID"))
#define PBC_FILTER_KEY "System\\CurrentControlSet\\Services\\PubcookieFilter"
#define PBC_CLIENT_LOG_FMT (libpbc_config_getstring(p, "ClientLogFormat", "%w(%p)"))
! #define PBC_WEB_VAR_LOCATION (libpbc_config_getstring(p, "WebVarLocation", PBC_FILTER_KEY))
#define PBC_RELAY_WEB_KEY "_PBC_Relay_CGI"
#define PBC_INSTANCE_KEY "_PBC_Web_Instances"
! #define PBC_DEFAULT_KEY "default"
#endif
#define PBC_REFRESH_TIME 0
--- 50,59 ----
#define PBC_AUTHTYPE3 (libpbc_config_getstring(p, "AuthTypeName3", "SECURID"))
#define PBC_FILTER_KEY "System\\CurrentControlSet\\Services\\PubcookieFilter"
#define PBC_CLIENT_LOG_FMT (libpbc_config_getstring(p, "ClientLogFormat", "%w(%p)"))
! #define PBC_WEB_VAR_LOCATION (libpbc_config_getstring(p, "WebVarLocation", PBC_FILTER_KEY))
#define PBC_RELAY_WEB_KEY "_PBC_Relay_CGI"
#define PBC_INSTANCE_KEY "_PBC_Web_Instances"
! #define PBC_DEFAULT_KEY "default"
#endif
#define PBC_REFRESH_TIME 0
***************
*** 231,243 ****
/* macros to support older version of apache */
! #ifdef APACHE1_3
#define pbc_malloc(p, x) ap_palloc(p, x)
#define pbc_free(p, x) libpbc_void(p, x)
#define pbc_strdup(p, x) ap_pstrdup(p, x)
#define pbc_strndup(p, s, n) ap_pstrdup(p, s, n)
#define pbc_fopen(p, x, y) ap_pfopen(p, x, y)
#define pbc_fclose(p, x) ap_pfclose(p, x)
#endif
#ifndef pbc_malloc
--- 227,249 ----
/* macros to support older version of apache */
! #ifdef APACHE
! #ifndef pbc_malloc
#define pbc_malloc(p, x) ap_palloc(p, x)
+ #endif
#define pbc_free(p, x) libpbc_void(p, x)
+ #ifndef pbc_strdup
#define pbc_strdup(p, x) ap_pstrdup(p, x)
+ #endif
#define pbc_strndup(p, s, n) ap_pstrdup(p, s, n)
+ #ifdef APACHE2
+ /* in the module use apr_file_open etc. */
+ #define pbc_fopen(p, x, y) fopen(x, y)
+ #define pbc_fclose(p, x) fclose(x)
+ #else
#define pbc_fopen(p, x, y) ap_pfopen(p, x, y)
#define pbc_fclose(p, x) ap_pfclose(p, x)
+ #endif
#endif
#ifndef pbc_malloc
Index: webiso/pubcookie/src/pbc_myconfig.c
diff -c webiso/pubcookie/src/pbc_myconfig.c:1.42 webiso/pubcookie/src/pbc_myconfig.c:1.43
*** webiso/pubcookie/src/pbc_myconfig.c:1.42 Tue Feb 17 15:06:38 2004
--- webiso/pubcookie/src/pbc_myconfig.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file pbc_myconfig.c
* Runtime configuration
*
! * $Id: pbc_myconfig.c,v 1.42 2004/02/17 23:06:38 ryanc Exp $
*/
--- 6,12 ----
/** @file pbc_myconfig.c
* Runtime configuration
*
! * $Id: pbc_myconfig.c,v 1.43 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 15,21 ****
# include "pbc_path.h"
#endif
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 15,35 ----
# include "pbc_path.h"
#endif
! #ifdef APACHE2
! #undef HAVE_CONFIG_H
! #undef PACKAGE_BUGREPORT
! #undef PACKAGE_NAME
! #undef PACKAGE_STRING
! #undef PACKAGE_TARNAME
! #undef PACKAGE_VERSION
! #endif
!
! #if defined (APACHE2)
! #define pbc_malloc(p, x) apr_palloc(p, x)
! #define pbc_strdup(p, x) apr_pstrdup(p, x)
! #endif
!
! #if defined (APACHE)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 25,31 ****
# include "util_script.h"
# else
typedef void pool;
! #endif /* APACHE1_3 */
#ifdef HAVE_STDIO_H
# include <stdio.h>
--- 39,51 ----
# include "util_script.h"
# else
typedef void pool;
! #endif /* APACHE */
!
! #ifdef APACHE2
! typedef apr_pool_t pool;
! typedef apr_table_t table;
! #endif
!
#ifdef HAVE_STDIO_H
# include <stdio.h>
***************
*** 74,79 ****
--- 94,103 ----
#include "libpubcookie.h"
#include "pbc_configure.h"
#include "pbc_logging.h"
+
+ #ifdef APACHE2
+ #include "apr_strings.h"
+ #endif
#ifdef HAVE_DMALLOC_H
# if (!defined(APACHE) && !defined(APACHE1_3))
Index: webiso/pubcookie/src/security_legacy.c
diff -c webiso/pubcookie/src/security_legacy.c:1.37 webiso/pubcookie/src/security_legacy.c:1.38
*** webiso/pubcookie/src/security_legacy.c:1.37 Tue Feb 17 15:06:38 2004
--- webiso/pubcookie/src/security_legacy.c Thu Feb 19 15:07:03 2004
***************
*** 6,12 ****
/** @file security_legacy.c
* Heritage message protection
*
! * $Id: security_legacy.c,v 1.37 2004/02/17 23:06:38 ryanc Exp $
*/
--- 6,12 ----
/** @file security_legacy.c
* Heritage message protection
*
! * $Id: security_legacy.c,v 1.38 2004/02/19 23:07:03 fox Exp $
*/
***************
*** 15,21 ****
# include "pbc_path.h"
#endif
! #if defined (APACHE1_3)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
--- 15,35 ----
# include "pbc_path.h"
#endif
! #ifdef APACHE2
! #undef HAVE_CONFIG_H
! #undef PACKAGE_BUGREPORT
! #undef PACKAGE_NAME
! #undef PACKAGE_STRING
! #undef PACKAGE_TARNAME
! #undef PACKAGE_VERSION
! #endif
!
! #if defined (APACHE2)
! #define pbc_malloc(p, x) apr_palloc(p, x)
! #define pbc_strdup(p, x) apr_pstrdup(p, x)
! #endif
!
! #if defined (APACHE)
# include "httpd.h"
# include "http_config.h"
# include "http_core.h"
***************
*** 27,32 ****
--- 41,51 ----
typedef void pool;
#endif
+ #ifdef APACHE2
+ typedef apr_pool_t pool;
+ typedef apr_table_t table;
+ #endif
+
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif /* HAVE_STDIO_H */
***************
*** 92,97 ****
--- 111,120 ----
# include "pbc_configure.h"
# include "security.h"
# include "pubcookie.h"
+ #endif
+
+ #ifdef APACHE2
+ #include "apr_strings.h"
#endif
#ifdef HAVE_DMALLOC_H
end of message
More information about the pubcookie-dev
mailing list