You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/01/12 02:45:10 UTC
Re: 1.1.2 plan
> What do people think of my updated directory index patch with the
> ifdef?
>
> If there end up being lots of systems without ENOENT defined, having
> some provisions for that in 1.1.2 could avoid the need for 1.1.3...
Probably a good idea. If you get the CVS mail, you'll see that I have
applied this to 1.1.2 and am just waiting on dust to settle before
tagging.
Seems like adding the #error would also be a good idea so this does
not quitely compile for people if they don't have ENOENT.
Re: 1.1.2 plan
Posted by Marc Slemko <ma...@znep.com>.
On Sat, 11 Jan 1997, Marc Slemko wrote:
> + #if defined(ENOENTD)
> + else if (errno == ENOENT) {
> + #else
if anyone is still listening to me, the ENOENTD above should, of course,
be ENOENT. Was testing and forgot to remove the D.
Re: 1.1.2 plan
Posted by Marc Slemko <ma...@znep.com>.
On Sat, 11 Jan 1997, Randy Terbush wrote:
> > What do people think of my updated directory index patch with the
> > ifdef?
> >
> > If there end up being lots of systems without ENOENT defined, having
> > some provisions for that in 1.1.2 could avoid the need for 1.1.3...
>
> Probably a good idea. If you get the CVS mail, you'll see that I have
> applied this to 1.1.2 and am just waiting on dust to settle before
> tagging.
>
> Seems like adding the #error would also be a good idea so this does
> not quitely compile for people if they don't have ENOENT.
I was just about to suggest this patch (I am wondering if some compilers
may stop on the first error and not display the rest), but I see you have
just committed one. The one you committed looks fine, but in case anyone
cares, what i was going to suggest is included below.
(oh, and what exactly is the difference between where HTTP_FORBIDDEN and
FORBIDDEN should be used? Looking at it, FORBIDDEN does seem to be the
right one to use as your patch fixes.)
Index: http_request.c
===================================================================
RCS file: /home/marcs/archive/apache/cvs/apache/src/http_request.c,v
retrieving revision 1.35
diff -c -r1.35 http_request.c
*** http_request.c 1997/01/04 15:10:16 1.35
--- http_request.c 1997/01/12 02:06:28
***************
*** 137,143 ****
/* Dealing with the file system to get PATH_INFO
*/
! void get_path_info(request_rec *r)
{
char *cp;
char *path = r->filename;
--- 137,143 ----
/* Dealing with the file system to get PATH_INFO
*/
! int get_path_info(request_rec *r)
{
char *cp;
char *path = r->filename;
***************
*** 155,161 ****
--- 155,164 ----
/* See if the pathname ending here exists... */
*cp = '\0';
+
+ errno = 0;
rv = stat(path, &r->finfo);
+
if (cp != end) *cp = '/';
if (!rv) {
***************
*** 172,180 ****
r->path_info = pstrdup (r->pool, cp);
*cp = '\0';
! return;
}
else {
last_cp = cp;
while (--cp > path && *cp != '/')
--- 175,203 ----
r->path_info = pstrdup (r->pool, cp);
*cp = '\0';
! return OK;
}
+ #if defined(ENOENTD)
+ else if (errno == ENOENT) {
+ #else
+ #error ENOENT not defined -- check the comment below this line in the source for details
+ /*
+ * If ENOENT is not defined in one of the your OS's include
+ * files, Apache does not know how to check to see why the
+ * stat() of the index file failed; there are cases where
+ * it can fail even though the file exists. This means
+ * that it is possible for someone to get a directory
+ * listing of a directory even though there is an index
+ * (eg. index.html) file in it. If you do not have a
+ * problem with this, delete the above #error line and
+ * start the compile again. If you need to do this, please
+ * submit a bug report from http://www.apache.org/bug_report.html
+ * letting us know that you needed to do this. Please be
+ * sure to include the operating system you are using.
+ */
+
else {
+ #endif
last_cp = cp;
while (--cp > path && *cp != '/')
***************
*** 182,189 ****
--- 205,219 ----
while (cp > path && cp[-1] == '/')
--cp;
+ }
+ #if defined(ENOENT)
+ else {
+ log_reason("unable to determine if index file exists (stat() returned unexpected error)", r->filename, r);
+ return HTTP_FORBIDDEN;
}
+ #endif
}
+ return OK;
}
int directory_walk (request_rec *r)
***************
*** 269,275 ****
no2slash (test_filename);
num_dirs = count_dirs(test_filename);
! get_path_info (r);
if (test_filename[strlen(test_filename)-1] == '/')
--num_dirs;
--- 299,308 ----
no2slash (test_filename);
num_dirs = count_dirs(test_filename);
! res = get_path_info (r);
! if (res != OK) {
! return res;
! }
if (test_filename[strlen(test_filename)-1] == '/')
--num_dirs;