httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@decus.org (Rodent of Unusual Size)
Subject Re: Bug #17: mod_info not displaying current config
Date Sun, 12 Jan 1997 05:40:22 GMT
>From the fingers of Brian Behlendorf flowed the following:
>
>On Fri, 10 Jan 1997, Rodent of Unusual Size wrote:
>> 
>>     Could someone check to see if the config files at www.apache.org are
>>     readable by the server user?  I don't know what location has been
>>     enabled for the info display at that server, so I can't see if it's
>>     still exhibiting the problem.  If it is, maybe unprotecting the
>>     files and looking again will show the problem fixed..  If it does, I
>>     suspect this bug can be marked `closed.'
>
>Nope, the config files on www.apache.org are world-readable, and the info
>output is still blank.  < http://www.apache.org/serv-info >

    Hah, *squish*!  mod_info.c is making the assumption that the config
    files are relative to ServerRoot.  Looking at the /serv-info, it's
    clear that www.apache.org's server is started with -f and an 
    absolute pathname.  Hence, breakage.  The previous patch would have
    revealed this, BTW, because it would have recorded the attempt to
    access the bogus file ("$ServerRoot/$ServerConfigFile") in the error
    log.

    A slight change to use the standard logic for this, and it appears
    to be working now.  I'm still including the changes that log
    mod_info's failure to find/open the config files.

    #ken    :-)}

Index: mod_info.c
===================================================================
RCS file: /usr/users/coar/myApache/repository/apache/src/mod_info.c,v
retrieving revision 1.8
diff -c -r1.8 mod_info.c
*** 1.8	1997/01/01 18:10:35
--- mod_info.c	1997/01/12 05:34:39
***************
*** 103,116 ****
  	return(ret);
  }
  
! mod_info_config_lines *mod_info_load_config(pool *p, char *filename) {
  	char s[MAX_STRING_LEN];
  	FILE *fp;
  	mod_info_config_lines *new, *ret=NULL, *prev=NULL;
! 	char *t,*tt,o;
  	
  	fp = pfopen(p,filename,"r");
! 	if(!fp) return NULL;
  	while(!cfg_getline(s,MAX_STRING_LEN,fp)) {
  		if(*s=='#') continue; /* skip comments */
  		new = palloc(p,sizeof(struct mod_info_config_lines));
--- 103,126 ----
  	return(ret);
  }
  
! mod_info_config_lines *mod_info_load_config(pool *p, char *filename, request_rec *r) {
  	char s[MAX_STRING_LEN];
  	FILE *fp;
  	mod_info_config_lines *new, *ret=NULL, *prev=NULL;
! 	char *t,*tt,o, *msg;
  	
  	fp = pfopen(p,filename,"r");
! 	if(!fp) {
! 	    msg = pstrcat
! 		    (
! 			r->pool,
! 			"mod_info: couldn't open config file ",
! 			filename,
! 			NULL
! 		    );
! 	    log_error (msg, r->server);
! 	    return NULL;
! 	}
  	while(!cfg_getline(s,MAX_STRING_LEN,fp)) {
  		if(*s=='#') continue; /* skip comments */
  		new = palloc(p,sizeof(struct mod_info_config_lines));
***************
*** 234,240 ****
  
  int display_info(request_rec *r) {
  	module *modp = NULL;
! 	char buf[256];
  	command_rec *cmd=NULL;
  	handler_rec *hand=NULL;
  	server_rec *serv = r->server;
--- 244,250 ----
  
  int display_info(request_rec *r) {
  	module *modp = NULL;
! 	char buf[256], *cfname;
  	command_rec *cmd=NULL;
  	handler_rec *hand=NULL;
  	server_rec *serv = r->server;
***************
*** 267,278 ****
  	rputs("<html><head><title>Server Information</title></head>\n",r);
  	rputs("<body><h1 align=center>Apache Server Information</h1>\n",r);
  	if(!r->args || strcasecmp(r->args,"list")) {
! 		sprintf(buf,"%s/%s",server_root,server_confname);
! 		mod_info_cfg_httpd = mod_info_load_config(r->pool,buf);
! 		sprintf(buf,"%s/%s",server_root,serv->srm_confname);
! 		mod_info_cfg_srm = mod_info_load_config(r->pool,buf);
! 		sprintf(buf,"%s/%s",server_root,serv->access_confname);
! 		mod_info_cfg_access = mod_info_load_config(r->pool,buf);
  		if(!r->args) {
  			rputs("<tt><a href=\"#server\">Server Settings</a>, ",r);
  			for(modp = top_module; modp; modp = modp->next) {
--- 277,288 ----
  	rputs("<html><head><title>Server Information</title></head>\n",r);
  	rputs("<body><h1 align=center>Apache Server Information</h1>\n",r);
  	if(!r->args || strcasecmp(r->args,"list")) {
! 		cfname = server_root_relative (r->pool, server_confname);
! 		mod_info_cfg_httpd = mod_info_load_config (r->pool, cfname, r);
! 		cfname = server_root_relative (r->pool, serv->srm_confname);
! 		mod_info_cfg_srm = mod_info_load_config(r->pool, cfname, r);
! 		cfname = server_root_relative (r->pool, serv->access_confname);
! 		mod_info_cfg_access = mod_info_load_config (r->pool, cfname, r);
  		if(!r->args) {
  			rputs("<tt><a href=\"#server\">Server Settings</a>, ",r);
  			for(modp = top_module; modp; modp = modp->next) {

Mime
View raw message