#include <rx/rxkad.h>
#define TKT_LIFE ( 12 * 60 * 60 )
-#define SLEEP_TIME ( TKT_LIFE - 5*60 )
+#define SLEEP_TIME ( TKT_LIFE - 5*60 )
#define WAKLOG_ON 1
#define WAKLOG_OFF 2
#include <afs/ptuser.h>
#include <rx/rxkad.h>
-#define KEYTAB "/etc/keytab.wwwserver"
-#define PRINCIPAL "someplacewwwserver"
+#define KEYTAB "/etc/keytab.wwwserver"
+#define PRINCIPAL "someplacewwwserver"
#define AFS_CELL "someplace.edu"
/* If there's an error, retry more aggressively */
-#define ERR_SLEEP_TIME 5*60
+#define ERR_SLEEP_TIME 5*60
-#define K5PATH "FILE:/tmp/waklog.creds.k5"
+#define K5PATH "FILE:/tmp/waklog.creds.k5"
static void
log_error (const char *file, int line, int level, int status,
- const server_rec * s, const char *fmt, ...)
+ const server_rec * s, const char *fmt, ...)
{
char errstr[4096];
va_list ap;
cfg = retrieve_config(r);
} else {
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: set_auth using no config" );
+ "mod_waklog: set_auth using no config" );
getModConfig (cfg, s);
}
cfg->configured = 0;
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: server config created.");
+ "mod_waklog: server config created.");
return (cfg);
}
cfg->protect = flag;
cfg->configured = 1;
log_error (APLOG_MARK, APLOG_DEBUG, 0, params->server,
- "mod_waklog: waklog_protect set on %s", cfg->path ? cfg->path : "NULL");
+ "mod_waklog: waklog_protect set on %s", cfg->path ? cfg->path : "NULL");
return (NULL);
}
( waklog_config * ) ap_get_module_config(params->server->module_config, &waklog_module );
log_error (APLOG_MARK, APLOG_DEBUG, 0, params->server,
- "mod_waklog: configuring principal: %s, keytab: %s", principal, keytab);
-
- cfg->principal = ap_pstrdup(params->pool, principal);
+ "mod_waklog: configuring principal: %s, keytab: %s", principal, keytab);
+
+ cfg->principal = ap_pstrdup(params->pool, principal);
cfg->keytab = ap_pstrdup (params->pool, keytab);
add_to_renewtable(params->pool, keytab, principal);
( waklog_config * ) ap_get_module_config(params->server->module_config, &waklog_module );
log_error (APLOG_MARK, APLOG_DEBUG, 0, params->server,
- "mod_waklog: will use afs_cell: %s", file);
+ "mod_waklog: will use afs_cell: %s", file);
cfg->afs_cell = ap_pstrdup (params->pool, file);
cfg->configured = 1;
waklog_config *srvcfg = ( waklog_config * ) ap_get_module_config(params->server->module_config, &waklog_module );
log_error (APLOG_MARK, APLOG_DEBUG, 0, params->server,
- "mod_waklog: set default princ/keytab: %s, %s for %s", principal, keytab, cfg->path ? cfg->path : "NULL");
+ "mod_waklog: set default princ/keytab: %s, %s for %s", principal, keytab, cfg->path ? cfg->path : "NULL");
cfg->default_principal = ap_pstrdup (params->pool, principal);
cfg->default_keytab = ap_pstrdup(params->pool, keytab );
cfg->configured = 1;
log_error (APLOG_MARK, APLOG_DEBUG, 0, params->server,
- "mod_waklog: waklog_use_user_tokens set");
+ "mod_waklog: waklog_use_user_tokens set");
return (NULL);
}
ktc_ForgetAllTokens ();
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: waklog_child_exit complete");
+ "mod_waklog: waklog_child_exit complete");
#ifdef STANDARD20_MODULE_STUFF
return APR_SUCCESS;
#endif
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: child_init returned");
+ "mod_waklog: child_init returned");
return;
}
command_rec waklog_cmds[] = {
command ("WaklogProtected", set_waklog_protect, 0, FLAG,
- "enable waklog on a location or directory basis"),
+ "enable waklog on a location or directory basis"),
command ("WaklogPrincipal", set_waklog_principal, 0, TAKE2,
- "Use the supplied keytab rather than the default"),
+ "Use the supplied keytab rather than the default"),
command ("WaklogUseAFSCell", set_waklog_use_afs_cell, 0, TAKE1,
- "Use the supplied AFS cell rather than the default"),
+ "Use the supplied AFS cell rather than the default"),
command ("WaklogUseUserTokens", set_waklog_use_usertokens, 0, FLAG,
"Use the requesting user tokens (from webauth)"),
ktc_ForgetAllTokens ();
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: ktc_ForgetAllTokens succeeded: pid: %d",
- getpid ());
+ "mod_waklog: ktc_ForgetAllTokens succeeded: pid: %d",
+ getpid ());
}
return 0;
}
#ifdef STANDARD20_MODULE_STUFF
static int
waklog_init_handler (apr_pool_t * p, apr_pool_t * plog,
- apr_pool_t * ptemp, server_rec * s)
+ apr_pool_t * ptemp, server_rec * s)
{
int rv;
extern char *version;
if (!data)
{
apr_pool_userdata_set ((const void *) 1, userdata_key,
- apr_pool_cleanup_null, s->process->pool);
+ apr_pool_cleanup_null, s->process->pool);
}
else
{
log_error (APLOG_MARK, APLOG_INFO, 0, s,
- "mod_waklog: version %s initialized.", version);
+ "mod_waklog: version %s initialized.", version);
if ( sharedspace ) {
log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: shared memory already allocated." );
rv = apr_proc_fork (proc, s->process->pool);
if (rv == APR_INCHILD)
- {
- waklog_child_routine (s, NULL);
- }
+ {
+ waklog_child_routine (s, NULL);
+ }
else
- {
- apr_pool_note_subprocess (s->process->pool, proc, APR_KILL_ALWAYS);
- }
+ {
+ apr_pool_note_subprocess (s->process->pool, proc, APR_KILL_ALWAYS);
+ }
/* parent and child */
cfg->forked = proc->pid;
pag_for_children = 1;
#endif
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: version %s initialized.", version);
+ "mod_waklog: version %s initialized.", version);
if ( sharedspace ) {
log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: shared memory already allocated." );
/* set our default tokens */
getModConfig (cfg, s);
-
- oldrenewcount = sharedspace->renewcount;
-
- pag_for_children = 0;
-
- pid = ap_bspawn_child (p, waklog_child_routine, s, kill_always,
- NULL, NULL, NULL);
-
- pag_for_children = 1;
-
+
+ oldrenewcount = sharedspace->renewcount;
+
+ pag_for_children = 0;
+
+ pid = ap_bspawn_child (p, waklog_child_routine, s, kill_always,
+ NULL, NULL, NULL);
+
+ pag_for_children = 1;
+
log_error (APLOG_MARK, APLOG_DEBUG, 0, s,
- "mod_waklog: ap_bspawn_child: %d.", pid);
+ "mod_waklog: ap_bspawn_child: %d.", pid);
if ( use_existing == 0 ) {
/* wait here until our child process has gone and done it's renewing thing. */
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase0 called");
+ "mod_waklog: phase0 called");
cfg = retrieve_config(r);
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase1 called");
+ "mod_waklog: phase1 called");
cfg = retrieve_config(r);
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase 3 called");
+ "mod_waklog: phase 3 called");
cfg = retrieve_config(r);
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase6 called");
+ "mod_waklog: phase6 called");
cfg = retrieve_config(r);
int rc = 0;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase7 called");
+ "mod_waklog: phase7 called");
cfg = retrieve_config (r);
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase9 called");
+ "mod_waklog: phase9 called");
getModConfig (cfg, r->server);
#endif
waklog_new_connection (conn_rec * c
#ifdef STANDARD20_MODULE_STUFF
- , void *dummy
+ , void *dummy
#endif
)
{
waklog_config *cfg;
log_error (APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
- "mod_waklog: new_connection called: pid: %d", getpid ());
-
- getModConfig(cfg, c->base_server);
-
- if ( cfg->default_principal ) {
- log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server, "mod_waklog: new conn setting default user %s",
- cfg->default_principal);
- set_auth( c->base_server, NULL, 0, cfg->default_principal, cfg->default_keytab, 0);
- }
-
-
+ "mod_waklog: new_connection called: pid: %d", getpid ());
+
+ getModConfig(cfg, c->base_server);
+
+ if ( cfg->default_principal ) {
+ log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server, "mod_waklog: new conn setting default user %s",
+ cfg->default_principal);
+ set_auth( c->base_server, NULL, 0, cfg->default_principal, cfg->default_keytab, 0);
+ }
+
+
return
#ifdef STANDARD20_MODULE_STUFF
0
{
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase2 called");
+ "mod_waklog: phase2 called");
if (child.token.ticketLen)
{
ktc_ForgetAllTokens ();
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: ktc_ForgetAllTokens succeeded: pid: %d",
- getpid ());
+ "mod_waklog: ktc_ForgetAllTokens succeeded: pid: %d",
+ getpid ());
}
log_error (APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_waklog: phase2 returning");
+ "mod_waklog: phase2 returning");
return DECLINED;
}
#ifndef STANDARD20_MODULE_STUFF
module MODULE_VAR_EXPORT waklog_module = {
STANDARD_MODULE_STUFF,
- waklog_init, /* module initializer */
- waklog_create_dir_config, /* create per-dir config structures */
- waklog_merge_dir_config, /* merge per-dir config structures */
- waklog_create_server_config, /* create per-server config structures */
- waklog_merge_dir_config, /* merge per-server config structures */
- waklog_cmds, /* table of config file commands */
- NULL, /* [#8] MIME-typed-dispatched handlers */
- waklog_phase1, /* [#1] URI to filename translation */
- NULL, /* [#4] validate user id from request */
- NULL, /* [#5] check if the user is ok _here_ */
- waklog_phase3, /* [#3] check access by host address */
- waklog_phase6, /* [#6] determine MIME type */
- waklog_phase7, /* [#7] pre-run fixups */
- waklog_phase9, /* [#9] log a transaction */
- NULL, /* [#2] header parser */
- waklog_child_init, /* child_init */
- waklog_child_exit, /* child_exit */
- waklog_phase0 /* [#0] post read-request */
+ waklog_init, /* module initializer */
+ waklog_create_dir_config, /* create per-dir config structures */
+ waklog_merge_dir_config, /* merge per-dir config structures */
+ waklog_create_server_config, /* create per-server config structures */
+ waklog_merge_dir_config, /* merge per-server config structures */
+ waklog_cmds, /* table of config file commands */
+ NULL, /* [#8] MIME-typed-dispatched handlers */
+ waklog_phase1, /* [#1] URI to filename translation */
+ NULL, /* [#4] validate user id from request */
+ NULL, /* [#5] check if the user is ok _here_ */
+ waklog_phase3, /* [#3] check access by host address */
+ waklog_phase6, /* [#6] determine MIME type */
+ waklog_phase7, /* [#7] pre-run fixups */
+ waklog_phase9, /* [#9] log a transaction */
+ NULL, /* [#2] header parser */
+ waklog_child_init, /* child_init */
+ waklog_child_exit, /* child_exit */
+ waklog_phase0 /* [#0] post read-request */
#ifdef EAPI
- , NULL, /* EAPI: add_module */
- NULL, /* EAPI: remove_module */
- NULL, /* EAPI: rewrite_command */
- waklog_new_connection /* EAPI: new_connection */
+ , NULL, /* EAPI: add_module */
+ NULL, /* EAPI: remove_module */
+ NULL, /* EAPI: rewrite_command */
+ waklog_new_connection /* EAPI: new_connection */
#endif
};
#else
module AP_MODULE_DECLARE_DATA waklog_module = {
STANDARD20_MODULE_STUFF,
- waklog_create_dir_config, /* create per-dir conf structures */
- waklog_merge_dir_config, /* merge per-dir conf structures */
- waklog_create_server_config, /* create per-server conf structures */
- waklog_merge_dir_config, /* merge per-server conf structures */
- waklog_cmds, /* table of configuration directives */
- waklog_register_hooks /* register hooks */
+ waklog_create_dir_config, /* create per-dir conf structures */
+ waklog_merge_dir_config, /* merge per-dir conf structures */
+ waklog_create_server_config, /* create per-server conf structures */
+ waklog_merge_dir_config, /* merge per-server conf structures */
+ waklog_cmds, /* table of configuration directives */
+ waklog_register_hooks /* register hooks */
};
#endif