X-Git-Url: https://git.hcoop.net/hcoop/debian/libapache-mod-waklog.git/blobdiff_plain/52e434d854936c5a8cb9159119f5e3b076595d7c..e6db60c3d5cdfc390fe319e16f8e3fb58947058e:/mod_waklog.c?ds=sidebyside diff --git a/mod_waklog.c b/mod_waklog.c index 9b6ca89..eca89ad 100644 --- a/mod_waklog.c +++ b/mod_waklog.c @@ -48,17 +48,13 @@ module waklog_module; #include "http_connection.h" #include #include +#include #define ap_pcalloc apr_pcalloc #define ap_pdupstr apr_pdupstr #define ap_pstrdup apr_pstrdup #define MK_POOL apr_pool_t #define MK_TABLE_GET apr_table_get #define MK_TABLE_SET apr_table_set -#include "unixd.h" -extern unixd_config_rec unixd_config; -#define ap_user_id unixd_config.user_id -#define ap_group_id unixd_config.group_id -#define ap_user_name unixd_config.user_name #define command(name, func, var, type, usage) \ AP_INIT_ ## type (name, (void*) func, \ NULL, \ @@ -67,6 +63,11 @@ module AP_MODULE_DECLARE_DATA waklog_module; typedef struct { int dummy; } child_info; const char *userdata_key = "waklog_init"; +/* Apache 2.4 */ +#ifdef APLOG_USE_MODULE +APLOG_USE_MODULE(waklog); +#endif + #endif /* APACHE2 */ /**************************************************************************************************/ @@ -79,6 +80,7 @@ const char *userdata_key = "waklog_init"; #include #include #include +#include #include #define TKT_LIFE ( 12 * 60 * 60 ) @@ -165,9 +167,15 @@ int renewcount = 0; #define getModConfig(P, X) P = (waklog_config *) ap_get_module_config( (X)->module_config, &waklog_module ); +#ifdef APLOG_USE_MODULE +static void +log_error (const char *file, int line, int module_index, int level, int status, + const server_rec * s, const char *fmt, ...) +#else static void log_error (const char *file, int line, int level, int status, const server_rec * s, const char *fmt, ...) +#endif { char errstr[4096]; va_list ap; @@ -177,7 +185,12 @@ log_error (const char *file, int line, int level, int status, va_end (ap); #ifdef APACHE2 + #ifdef APLOG_USE_MODULE + /* Apache 2.4 */ + ap_log_error (file, line, module_index, level | APLOG_NOERRNO, status, s, "%s", errstr); + #else ap_log_error (file, line, level | APLOG_NOERRNO, status, s, "(%d) %s", getpid(), errstr); + #endif #else ap_log_error (file, line, level | APLOG_NOERRNO, s, "(%d) %s", getpid(), errstr); #endif @@ -453,11 +466,11 @@ set_auth ( server_rec *s, request_rec *r, int self, char *principal, char *keyta log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: krb5_get_init_creds_password %s", afs_error_message(kerror) ); /* nuke the password so it doesn't end up in core files */ - memset(k5secret, 0, sizeof(k5secret)); + memset(k5secret, 0, strlen(k5secret)); goto cleanup; } - memset(k5secret, 0, sizeof(k5secret)); + memset(k5secret, 0, strlen(k5secret)); } /* initialize the credentials cache and store the stuff we just got */ @@ -533,12 +546,6 @@ set_auth ( server_rec *s, request_rec *r, int self, char *principal, char *keyta log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_waklog: retrieved data from ccache for %s", k5user); increds.times.endtime = 0; - - /* Since we're fetching a key for AFS, we have to use single DES - and explicitely enable weak crypto using the secret API - call */ - increds.keyblock.enctype = ENCTYPE_DES_CBC_CRC; - krb5_allow_weak_crypto (child.kcontext, 1); if ( ( kerror = krb5_get_credentials (child.kcontext, 0, clientccache, &increds, &v5credsp ) ) ) { /* only complain once we've tried both afs@REALM and afs/cell@REALM */ @@ -1398,7 +1405,7 @@ waklog_init_handler (apr_pool_t * p, apr_pool_t * plog, /* wait here until our child process has gone and done it's renewing thing. */ while( sharedspace->renewcount == oldrenewcount ) { log_error( APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: waiting for tokens..." ); - sleep(2); + apr_sleep(150000); } }