httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@organic.com>
Subject Re: bad perms on .htaccess can result in access problems (1.1b2)
Date Thu, 02 May 1996 02:44:33 GMT
On Wed, 1 May 1996, Dirk.vanGulik wrote:
> > Thanks for the info and patch. It'll be considered for 1.1
> > 
> 
> I'd vote +++++++++1 for this one! That is a trap far to easily fall in.

This is definitely needed, except: (and I don't have a deep understanding 
of the code in this section, so someone knowlegable help)

> > >*** http_config.c.orig	Tue Apr 30 11:42:04 1996
> > >--- http_config.c	Tue Apr 30 11:44:21 1996
> > >***************
> > >*** 610,617 ****
> > >  	}
> > >  	
> > >  	*result = dc;
> > >!     } else
> > >  	dc = NULL;
> > >  
> > >  /* cache it */
> > >      new = palloc(r->pool, sizeof(struct htaccess_result));
> > >--- 610,625 ----
> > >  	}
> > >  	
> > >  	*result = dc;
> > >!     } else {
> > >!         /* if we couldn't open the file, but it was there, complain */
> > >! 
> > >!         if (errno != ENOENT) {
> > >!             log_reason ("Couldn't open file", filename, r);
> > >!             return SERVER_ERROR;
> > >!         }
> > >! 
> > >  	dc = NULL;
> > >+     }
> > >  
> > >  /* cache it */
> > >      new = palloc(r->pool, sizeof(struct htaccess_result));
> > >

Doesn't "dc=NULL" always happen in the latter case, whereas it only 
happened as a part of the "else" clause in the former?

> > >*** alloc.c.orig	Tue Apr 30 14:36:47 1996
> > >--- alloc.c	Tue Apr 30 14:37:55 1996
> > >***************
> > >*** 719,729 ****
> > >--- 719,732 ----
> > >  FILE *pfopen(struct pool *a, char *name, char *mode)
> > >  {
> > >    FILE *fd;
> > >+   int tmp_errno;
> > >  
> > >    block_alarms();
> > >    fd = fopen(name, mode);
> > >+   tmp_errno = errno;
> > >    if (fd != NULL) note_cleanups_for_file (a, fd);
> > >    unblock_alarms();
> > >+   errno = tmp_errno;
> > >    return fd;
> > >  }
> > >  
> > >***************
> > >*** 730,741 ****
> > >--- 733,747 ----
> > >  FILE *pfdopen(struct pool *a,int fd,char *mode)
> > >  {
> > >    FILE *f;
> > >+   int tmp_errno;
> > >  
> > >    block_alarms();
> > >    f=fdopen(fd,mode);
> > >+   tmp_errno = errno;
> > >    if(f != NULL)
> > >      note_cleanups_for_file(a,f);
> > >    unblock_alarms();
> > >+   errno = tmp_errno;
> > >    return f;
> > >  }

Is this good coding style?

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  |  We're hiring!  http://www.organic.com/Home/Info/Jobs/


Mime
View raw message