fourth set of UMBC merges; still all inert changes
[hcoop/debian/libapache-mod-waklog.git] / mod_waklog.c
index d3d39ec..de3609c 100644 (file)
@@ -32,7 +32,6 @@
 
 module AP_MODULE_DECLARE_DATA waklog_module;
 
-#include <http_conf_globals.h>
 #define MK_POOL apr_pool_t
 #define MK_TABLE_GET apr_table_get
 #define MK_TABLE_SET apr_table_set
@@ -43,7 +42,7 @@ extern unixd_config_rec unixd_config;
 #define ap_user_name      unixd_config.user_name
 #define command(name, func, var, type, usage)           \
   AP_INIT_ ## type (name, (void*) func,                 \
-        (void*)APR_OFFSETOF(waklog_config, var),     \
+        (void*)APR_OFFSETOF(waklog_commands, var),     \
         OR_AUTHCFG | RSRC_CONF, usage)
 typedef struct {
        int dummy;
@@ -58,11 +57,11 @@ module waklog_module;
 #define MK_TABLE_GET ap_table_get
 #define command(name, func, var, type, usage)           \
   { name, func,                                         \
-    (void*)XtOffsetOf(waklog_config, var),           \
+    (void*)XtOffsetOf(waklog_commands, var),           \
     OR_AUTHCFG | RSRC_CONF, type, usage }
 #endif /* STANDARD20_MODULE_STUFF */
 
-#define getModConfig(P, X) P = (waklog_host_config *) ap_get_module_config( (X)->module_config, &waklog_module );
+#define getModConfig(P, X) P = (waklog_config *) ap_get_module_config( (X)->module_config, &waklog_module );
 
 #include <krb5.h>
 
@@ -77,7 +76,7 @@ module waklog_module;
 #include <rx/rxkad.h>
 
 #define KEYTAB                  "/etc/keytab.wwwserver"
-#define KEYTAB_PRINCIPAL        "someplacewwwserver"
+#define PRINCIPAL        "someplacewwwserver"
 #define AFS_CELL      "someplace.edu" 
 
 #define TKT_LIFE       10*60*60
@@ -94,11 +93,11 @@ typedef struct
     int                configured;
     int                protect;
     char       *keytab;
-    char       *keytab_principal;
+    char       *principal;
     char       *afs_cell;
     MK_POOL      *p;
 }
-waklog_host_config;
+waklog_config;
 
 typedef struct {
        struct ktc_token        token;
@@ -127,15 +126,15 @@ log_error(const char *file, int line, int level, int status,
     static void *
 waklog_create_server_config( MK_POOL *p, server_rec *s )
 {
-    waklog_host_config *cfg;
+    waklog_config *cfg;
 
-    cfg = (waklog_host_config *)ap_pcalloc( p, sizeof( waklog_host_config ));
+    cfg = (waklog_config *)ap_pcalloc( p, sizeof( waklog_config ));
     cfg->p = p;
     cfg->forked = 0;
     cfg->configured = 0;
     cfg->protect = 0;
     cfg->keytab = KEYTAB;
-    cfg->keytab_principal = KEYTAB_PRINCIPAL;
+    cfg->principal = PRINCIPAL;
     cfg->afs_cell = AFS_CELL;
 
     log_error( APLOG_MARK, APLOG_DEBUG, 0, s, "mod_waklog: server config created." );
@@ -147,7 +146,7 @@ waklog_create_server_config( MK_POOL *p, server_rec *s )
     static const char *
 set_waklog_protect( cmd_parms *params, void *mconfig, int flag )
 {
-    waklog_host_config          *cfg;
+    waklog_config          *cfg;
 
     getModConfig(cfg, params->server );
 
@@ -161,7 +160,7 @@ set_waklog_protect( cmd_parms *params, void *mconfig, int flag )
     static const char *
 set_waklog_keytab( cmd_parms *params, void *mconfig, char *file  )
 {
-    waklog_host_config          *cfg;
+    waklog_config          *cfg;
 
     getModConfig(cfg, params->server );
 
@@ -175,16 +174,16 @@ set_waklog_keytab( cmd_parms *params, void *mconfig, char *file  )
 
 
     static const char *
-set_waklog_use_keytab_principal( cmd_parms *params, void *mconfig, char *file  )
+set_waklog_use_principal( cmd_parms *params, void *mconfig, char *file  )
 {
-    waklog_host_config          *cfg;
+    waklog_config          *cfg;
 
     getModConfig(cfg, params->server );
 
     log_error( APLOG_MARK, APLOG_INFO, 0, params->server,
-               "mod_waklog: will use keytab_principal: %s", file );
+               "mod_waklog: will use principal: %s", file );
 
-    cfg->keytab_principal = ap_pstrdup ( params->pool, file );
+    cfg->principal = ap_pstrdup ( params->pool, file );
     cfg->configured = 1;
     return( NULL );
 }
@@ -193,7 +192,7 @@ set_waklog_use_keytab_principal( cmd_parms *params, void *mconfig, char *file  )
     static const char *
 set_waklog_use_afs_cell( cmd_parms *params, void *mconfig, char *file  )
 {
-    waklog_host_config          *cfg;
+    waklog_config          *cfg;
 
     getModConfig(cfg, params->server );
 
@@ -232,7 +231,7 @@ typedef struct {
   char *wak_keytab;
   char *wak_ktprinc;
   char *wak_afscell;
-} waklog_config;
+} waklog_commands;
 
 command_rec waklog_cmds[ ] =
 {
@@ -240,7 +239,7 @@ command_rec waklog_cmds[ ] =
 
     command("WaklogKeytab", set_waklog_keytab, wak_keytab, TAKE1, "Use the supplied keytab rather than the default"),
 
-    command("WaklogUseKeytabPrincipal", set_waklog_use_keytab_principal, wak_ktprinc, TAKE1, "Use the supplied keytab principal rather than the default"),
+    command("WaklogUseKeytabPrincipal", set_waklog_use_principal, wak_ktprinc, TAKE1, "Use the supplied keytab principal rather than the default"),
 
     command("WaklogUseAFSCell", set_waklog_use_afs_cell, wak_afscell, TAKE1, "Use the supplied AFS cell rather than the default"),
 
@@ -277,7 +276,7 @@ waklog_kinit( server_rec *s )
     krb5_keytab                        keytab = NULL;
     char                       ktbuf[ MAX_KEYTAB_NAME_LEN + 1 ];
     int                                i;
-    waklog_host_config *cfg;
+    waklog_config *cfg;
 
     log_error( APLOG_MARK, APLOG_DEBUG, 0, s,
                "mod_waklog: waklog_kinit called: pid: %d", getpid() );
@@ -300,9 +299,9 @@ waklog_kinit( server_rec *s )
     }
 
     log_error( APLOG_MARK, APLOG_DEBUG, 0, s,
-               "mod_waklog: keytab_principal: %s", cfg->keytab_principal );
+               "mod_waklog: principal: %s", cfg->principal );
 
-    if (( kerror = krb5_parse_name( kcontext, cfg->keytab_principal, &kprinc ))) {
+    if (( kerror = krb5_parse_name( kcontext, cfg->principal, &kprinc ))) {
        log_error( APLOG_MARK, APLOG_ERR, 0, s,
                    "mod_waklog: %s", (char *)error_message( kerror ));
 
@@ -390,7 +389,7 @@ waklog_aklog( request_rec *r )
     struct ktc_principal       server = { "afs", "", "" };
     struct ktc_principal       client;
     struct ktc_token           token;
-    waklog_host_config         *cfg;
+    waklog_config              *cfg;
     int                                buflen;
 
     k5path = MK_TABLE_GET( r->subprocess_env, "KRB5CCNAME" );
@@ -585,7 +584,7 @@ waklog_init_handler(apr_pool_t *p, apr_pool_t *plog,
     int rv;
     extern char        *version;
     apr_proc_t *proc;
-    waklog_host_config          *cfg;
+    waklog_config          *cfg;
     void *data;
 
     getModConfig(cfg, s);
@@ -638,7 +637,7 @@ waklog_init( server_rec *s, MK_POOL *p )
     static int
 waklog_phase0( request_rec *r )
 {
-    waklog_host_config  *cfg;
+    waklog_config  *cfg;
 
     log_error( APLOG_MARK, APLOG_DEBUG, 0, r->server,
               "mod_waklog: phase0 called" );
@@ -678,7 +677,7 @@ waklog_phase0( request_rec *r )
     static int
 waklog_phase7( request_rec *r )
 {
-    waklog_host_config *cfg;
+    waklog_config      *cfg;
 
     log_error( APLOG_MARK, APLOG_DEBUG, 0, r->server,
               "mod_waklog: phase7 called" );
@@ -715,7 +714,7 @@ waklog_new_connection (conn_rec * c
   )
 {
   
-  waklog_config *cfg;
+  waklog_commands *cfg;
   
   log_error (APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
             "mod_waklog: new_connection called: pid: %d", getpid ());