What does apachectl configtest say ? also have you compiled / enabled
debugging verbosity ?
As a first try check what an strace tells you, usually informative :-)
Good luck !
-----Original Message-----
From: Parag Warudkar [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 17, 2000 11:57 AM
To: [EMAIL PROTECTED]
Subject: [Fwd: Problem loading SO module.]
> Hi,
> I am new to writing apache modules. I am trying to
port a MES module
> to
> apache. To begin with I have written the code to accept
some parameters
> from
> config file , and declare a handler which declares */* as
MIME type it
> is interested in
> the handler_rec. When I try to load it (apxs -c mod_pmc.c
& apxs -i -a
> -n pmc mod_pmc.so)
> it goes fine and a LoadModule entry is correctly written
in httpd.conf.
> After that in httpd.conf, I write <IfModule mod_pmc.c> and
then write
> the parameters to the module. But when I try to
> invoke apache, it just refuses to start (httpd could not
be started)
> Nohing comes in error
> log. I am attaching the code, it's small.
> Maybe it's a silly mistake from my side coz this is my
first mod,
> plz go thru the code and help me out. If it was a core
dump it would
> have been understandable, but here apache is refusing to
start, so might
> be I am fundamentally wrong somewhere.
>
> Parag
>
> *****************************
> mod_pmc.h
> *****************************
>
/***************************************************************************
>
> mod_ap_pmc.h - description
> -------------------
> begin : Mon Jul 17 2000
> copyright : (C) 2000 by Parag Warudkar
> email : [EMAIL PROTECTED]
>
***************************************************************************/
>
>
/***************************************************************************
>
> *
> *
> * This program is free software; you can redistribute
it and/or
> modify *
> * it under the terms of the GNU General Public License
as published
> by *
> * the Free Software Foundation; either version 2 of the
License,
> or *
> * (at your option) any later
> version. *
> *
> *
>
***************************************************************************/
>
> /* ap_pmc.h. The header file for the Protocol Mapper
Plugin (PMC)
> * implementation on Apache Webserver.
> * Declares routines used by the PMC plugin plus some
globals.
> */
>
> /*
> * The Protocol Mapper Component (PMC) is part of the
Wipro
> * WebSecure distribution.
<http://www.wipro.com/wiprowebsecure>
> * This file represents in part, the Apache webserver
port of PMC.
> * Copyright (c) Wipro Technologies (2000-2001) (E-Comm
division, BLR)
> * Unauthorised reproduction / copying strictly
prohibited.
> * Written by : Parag Warudkar (Empid: 80732 Email:
> [EMAIL PROTECTED])
> *
> */
>
> /*
> * The Protocol Mapper Component (PMC) module apache
port.
> * Start date : 11th of July 2000.
> * Planned date of completion : 1st of August 2000.
> * Testing Schedule : 2/8 - 4/8
> * Release targets : SunOS, HPUX, Linux.
> * Compilation Requirements :
> * Apache 1.3.12 <http://www.apache.org>,
> * GNU C 2.95.2 <http://www.gnu.org>,
> * OpenSSL 0.9.5 <http://www.openssl.org>,
> * mod_ssl2.3.6-1.3.12 <http://www.modssl.org>
> *
> */
> #ifndef _ap_pmc_h
> #define _ap_pmc_h 1
> #if defined _WINDOWS
> #error "WIN32 Port Not Supported."
> #endif
>
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/time.h>
> #include <time.h>
> #include <unistd.h>
>
> #include <openssl/des.h>
> #include "base64.h"
> #include "rwlock.h"
> #include "certutil.h"
> #include <ssl/ssl3.h>
> #include <sys/socket.h>
> #include <netdb.h>
> #include <strings.h>
>
> /* Apache Headers */
> #include "httpd.h"
> #include "http_config.h"
> #include "http_core.h"
> #include "http_log.h"
> #include "http_main.h"
> #include "http_protocol.h"
> #include "util_script.h"
>
> #ifndef FALSE
> #define FALSE (0)
> #endif
>
> #ifndef TRUE
> #define TRUE (!FALSE)
> #endif
>
> /*
> * Provide reasonable defines for some types
> */
> #ifndef BOOL
> #define BOOL unsigned int
> #endif
> /*
> * Provide useful shorthands
> */
> #define strEQ(s1,s2) (strcmp(s1,s2) == 0)
> #define strNE(s1,s2) (strcmp(s1,s2) != 0)
> #define strEQn(s1,s2,n) (strncmp(s1,s2,n) == 0)
> #define strNEn(s1,s2,n) (strncmp(s1,s2,n) != 0)
>
> #define strcEQ(s1,s2) (strcasecmp(s1,s2) == 0)
> #define strcNE(s1,s2) (strcasecmp(s1,s2) != 0)
> #define strcEQn(s1,s2,n) (strncasecmp(s1,s2,n) == 0)
> #define strcNEn(s1,s2,n) (strncasecmp(s1,s2,n) != 0)
>
> #define BYTES_PER_DESBUF (2*(sizeof(unsigned
int)/sizeof(char)))
> #define MAX_DES_KEYLEN (32*4) /* 128 char */
> #define DESBUF_PWRD_MAX 8
> #define MAX_USR_KEYLEN DESBUF_PWRD_MAX
>
> #define READ_TIMEOUT 120
>
> typedef list_t seq_t;
>
> /* Extern Declarations */
>
> extern void dump_hex(u_char *buf_p, int length, int
level);
> extern void dump_sequence(seq_t *seq_p, int level);
> extern char *_uudecode(char *);
>
> /* Module specific config data */
> struct pmc_config{
> char *SSL_cred ;
> char *config_mode ;
> char *op_mode;
> char *SSL_Force ;
> char *KeyServer_Url ;
> char *Auth_cookie ;
> char *pdws_url ;
> char *sdws_url ;
> char *validity_end;
> long chkcleantime ;
> long cacclntmt ;
> char *auth_login_val;
> char *ClrCookieKey ;
> char *pwdkey ;
> char *cachecleanprefix ;
> };
> typedef struct pmc_config pmc_config;
> /*
> * The own data structures
> */
> struct AuthCachedUserTbl
> {
> char *key;
> char *sessionid;
> char *expiry;
> char *sessionage;
> char *timeoutflag;
> char *issuecert;
> };
> typedef struct AuthCachedUserTbl AuthCachedUserTbl;
>
> #define DEFAULT_CachedUserTbl_MAX 256
>
> struct SSLCachedUserTbl
> {
> char *key;
> char *userid;
> char *sessionid;
> char *expiry;
> };
>
> typedef struct SSLCachedUserTbl SSLCachedUserTbl;
>
> /* Avoid Globals. Harmful with Apache.
> * Wrap'em in a struct & palloc it.
> */
> struct pmc_cache {
> AuthCachedUserTbl *cachedUserTbl;
> int cachedUserTbl_count;
> int cachedUserTbl_max;
> SSLCachedUserTbl *sslcachedUserTbl;
> int sslcachedUserTbl_count;
> int sslcachedUserTbl_max;
> };
> typedef struct pmc_cache pmc_cache;
>
> static char *headers_nv[] = {
> "accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg",
> "accept-language: en",
> "accept-charset: iso-8859-1,*,utf-8",
> "connection: Keep-Alive"
> };
> static int hex[] = {
> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
> -1, -1, -1, -1, -1, -1, -1,
> 10, 11, 12, 13, 14, 15
> };
>
> static RWLOCK g_plain_lock= NULL;
> static RWLOCK g_ssl_lock= NULL;
>
> #define DEFAULT_SSLCachedUserTbl_MAX 256
>
> /* _ap_pmc_h_ */
> #endif
>
> ***************************
> mod_pmc.c
> ***************************
>
> #include "mod_pmc.h"
>
> /*
> * Declare ourselves so the configuration routines can
find and know us.
>
> * We'll fill it in at the end of the module.
> */
> module pmc_module;
>
> /* Cache storage */
> static pmc_cache *pcache = NULL;
> static int pmc_handler(request_rec *);
> /**
> * -------------Allocate memory for config
structure-------------
> * void *create_pmc_config(pool *p, server_rec *s)
> * Apache \style\ allocation and initialization.
> */
> static void* create_pmc_config(pool *p, server_rec *s)
> {
> /* Configuration Elements*/
> pmc_config* c = (pmc_config *)ap_palloc(p, sizeof
(pmc_config));
> if(c == NULL)
> ap_log_error(APLOG_MARK, APLOG_ERR, s,
> "palloc failed in FILE %s at %d.", __FILE__,
__LINE__);
> c->SSL_cred = NULL;
> c->config_mode = NULL ;
> c->op_mode = NULL;
> c->SSL_Force = NULL ;
> c->KeyServer_Url = NULL;
> c->Auth_cookie = NULL ;
> c->pdws_url = NULL;
> c->sdws_url = NULL ;
> c->validity_end[0] = '\0';
> c->chkcleantime =0 ;
> c->cacclntmt = 0 ;
> c->auth_login_val = NULL;
> c->ClrCookieKey = NULL;
> c->pwdkey = NULL;
> c->cachecleanprefix = NULL ;
>
> return (void *)c;
> }
>
> /* Set all the configuration parameters. All set* funcs
followed by
> pmc_cmds[].*/
>
> static const char* set_ssl_cred(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->SSL_cred = arg;
> return NULL;
> }
>
> static const char* set_config_mode(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->config_mode = arg;
> return NULL;
> }
>
> static const char* set_op_mode(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->op_mode = arg;
> return NULL;
> }
>
> static const char* set_ssl_force(cmd_parms *cmd, void
*dummy, char *arg)
>
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->op_mode = arg;
> return NULL;
> }
>
> static const char* set_keys_url(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->KeyServer_Url = arg;
> return NULL;
> }
>
> static const char* set_auth_cookie(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->Auth_cookie = arg;
> return NULL;
> }
>
> static const char* set_pdws_url(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->pdws_url = arg;
> return NULL;
> }
>
> static const char* set_sdws_url(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->sdws_url = arg;
> return NULL;
> }
>
> static const char* set_validity_end(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->validity_end = arg;
> return NULL;
> }
>
> static const char* set_chk_cltime(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->chkcleantime = atol(arg);
> return NULL;
> }
>
> static const char* set_cacclntmt(cmd_parms *cmd, void
*dummy, char *arg)
>
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->cacclntmt = atol(arg);
> return NULL;
> }
>
> static const char* set_auth_login(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->auth_login_val = arg;
> return NULL;
> }
>
> static const char* set_clr_cookie_key(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->ClrCookieKey = arg;
> return NULL;
> }
>
> static const char* set_pwd_key(cmd_parms *cmd, void
*dummy, char *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->pwdkey = arg;
> return NULL;
> }
>
> static const char* set_c_cln_prefix(cmd_parms *cmd, void
*dummy, char
> *arg)
> {
> server_rec *s = cmd->server;
> pmc_config *pcfg = (pmc_config *)
> ap_get_module_config(s->module_config, &pmc_module);
> pcfg->cachecleanprefix = arg;
> return NULL;
> }
>
> /* And nowz the time for the pmc_cmds[] decl. */
> static const command_rec pmc_cmds[] =
> {
> {"SSL_Cred", set_ssl_cred, NULL, RSRC_CONF, TAKE1,
> "the SSL Credentials"},
> {"Config_Mode", set_config_mode, NULL, RSRC_CONF,
TAKE1,
> "the Config Mode"},
> {"Op_Mode", set_op_mode, NULL, RSRC_CONF, TAKE1,
> "the Op Mode"},
> {"SSL_Force", set_ssl_force, NULL, RSRC_CONF, TAKE1,
> "SSL Force? (1/0)"},
> {"KeyServer_Url", set_keys_url, NULL, RSRC_CONF,
TAKE1,
> "Key Server URL"},
> {"Auth_Cookie", set_auth_cookie, NULL, RSRC_CONF,
TAKE1,
> "Auth Cookie"},
> {"PDWS_Url", set_pdws_url, NULL, RSRC_CONF, TAKE1,
> "Primary WebServer URL"},
> {"SDWS_Url", set_sdws_url, NULL, RSRC_CONF, TAKE1,
> "Secondary WebServer URL"},
> {"Validity_End", set_validity_end, NULL, RSRC_CONF,
TAKE1,
> "End of Validity(now whatz that?:)"},
> {"Chk_Cln_Time", set_chk_cltime, NULL, RSRC_CONF,
TAKE1,
> "whatz that?"},
> {"Cache_cleanup", set_cacclntmt, NULL, RSRC_CONF,
TAKE1,
> "Cache cleanup timeout"},
> {"Auth_login", set_auth_login, NULL, RSRC_CONF, TAKE1,
> "Auth Login" },
> {"ClrCookieKey", set_clr_cookie_key, NULL, RSRC_CONF,
TAKE1,
> "Cookie Key" },
> {"Pwd_Key", set_pwd_key, NULL, RSRC_CONF, TAKE1,
> "Password Key"},
> {"Cache_clean_prefix", set_c_cln_prefix, NULL,
RSRC_CONF, TAKE1,
> "Cache Cleanup Prefix" },
> {NULL}
> };
>
> /* Response Phase Handler
> * Declare that we want to intercept everything
> */
> static const handler_rec pmc_handlers[] =
> {
> {"*/*", pmc_handler},
> {NULL}
> };
>
> static void init_pmc_cache(pool* p)
> {
> /* Cache Structure initialization*/
> if(pcache == NULL) /* First Kiss! */
> {
> pcache = (pmc_cache *)ap_palloc(p, sizeof (pmc_cache));
>
> pcache->cachedUserTbl = NULL;
> pcache->cachedUserTbl_count = 0;
> pcache->cachedUserTbl_max = 0;
> pcache->sslcachedUserTbl = NULL;
> pcache->sslcachedUserTbl_count = 0;
> pcache->sslcachedUserTbl_max = 0;
> } /* Made it!! */
> return ;
> }
>
> /* The Request Handler */
> static int pmc_handler(request_rec* r)
> {
> /* Init Cache */
> init_pmc_cache(r->pool);
> return OK;
> }
>
> module MODULE_VAR_EXPORT pmc_module =
> {
> STANDARD_MODULE_STUFF,
> NULL, /* initializer */
> NULL, /* dir config creater */
> NULL, /* dir merger --- default is to override */
> create_pmc_config, /* server config */
> NULL, /* merge server config */
> pmc_cmds, /* command table */
> pmc_handlers, /* handlers */
> NULL, /* filename translation */
> NULL, /* check_user_id */
> NULL, /* check auth */
> NULL, /* check access */
> NULL, /* type_checker */
> NULL, /* fixups */
> NULL, /* logger */
> NULL, /* header parser */
> NULL, /* child_init */
> NULL, /* child_exit */
> NULL /* post read-request */
> };
>
> ****************************
> httpd.conf
> ****************************
> Default httpd.conf plus this ->
>
> LoadModule pmc_module libexec/mod_pmc.so
> <IfModule mod_pmc.c>
> SSL_Cred VEDA
> Config_Mode local
> Op_Mode NOSSL
> SSL_Force 0
> KeyServer_Url http://localhost
> Auth_Cookie .wipro
> PDWS_Url http://localhost
> SDWS_Url http://localhost
> Validity_End July
> Chk_Cln_Time 100
> Cache_cleanup 200
> Auth_login paragw
> ClrCookieKey mykey
> Pwd_Key urkey
> Cache_clean_prefix aoc
> </IfModule>
>
> --
>
--------------------------------------------------------------------------
> Parag Warudkar Voice 080-2215010 x124
> Senior Systems Engineer Fax 080-2271954
> Wipro Technologies Cellular 9845077152
> (e-Commerce Division) Business Email :
[EMAIL PROTECTED]
> 40/1A, Lavelle Road Personal Email : [EMAIL PROTECTED]
> Bangalore India Visit us at www.wipro.com
> 560001 www.wipro.com/wiprowebsecure
>
--------------------------------------------------------------------------
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)
www.modssl.org
User Support Mailing List
[EMAIL PROTECTED]
Automated List Manager
[EMAIL PROTECTED]
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]