From 4d25a2ee498a3a78b9256764fdec45139bbf4c97 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Thu, 26 Aug 2004 13:01:21 +0000 Subject: [PATCH] Backport from HEAD: * Makefile.in: Link httpd against user-supplied $(LIBS). * modules/standard/mod_autoindex.c (index_directory): If stat() fails for a particular dirent, ignore that entry rather than truncating the directory listing. PR: 7882, 17357 Reviewed by: stoddard, trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104815 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 9 ++++++++- Makefile.in | 2 +- STATUS | 13 +------------ modules/generators/mod_autoindex.c | 15 ++++++++++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/CHANGES b/CHANGES index 2fa6196d5fa..9a0c476ac90 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,12 @@ Changes with Apache 2.0.51 + *) mod_autoindex: Don't truncate the directory listing if a stat() + call fails (for instance on a >2Gb file). PR 17357. + [Joe Orton] + + *) Makefile fix: httpd is linked against LIBS given to the + 'make' invocation. PR 7882. [Joe Orton] + *) WinNT MPM: Fix a broken log message at termination. PR 28063. [Eider Oliveira ] @@ -76,7 +83,7 @@ Changes with Apache 2.0.51 This makes the cache work on Linux again. [Graham Leggett] *) Enable special ErrorDocument value 'default' which restores the - canned server response for the scope of the directive + canned server response for the scope of the directive. [Geoffrey Young, Andre Malo] *) work around MSIE Digest auth bug - if AuthDigestEnableQueryStringHack diff --git a/Makefile.in b/Makefile.in index baa6c8ccce2..5664d9769b3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,7 +4,7 @@ CLEAN_SUBDIRS = test PROGRAM_NAME = $(progname) PROGRAM_SOURCES = modules.c -PROGRAM_LDADD = $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) $(AP_LIBS) +PROGRAM_LDADD = $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS) PROGRAM_DEPENDENCIES = \ $(BUILTIN_LIBS) \ $(MPM_LIB) \ diff --git a/STATUS b/STATUS index 85bcdeeab7b..4db8f86780a 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/08/26 12:12:00 $] +Last modified at [$Date: 2004/08/26 13:01:17 $] Release: @@ -94,17 +94,6 @@ PATCHES TO BACKPORT FROM 2.1 PR: 30134 +1: jorton, trawick - *) Build fix: ensure httpd is linked against user-supplied LIBS during make. - http://cvs.apache.org/viewcvs.cgi/httpd-2.0/Makefile.in?r1=1.138&r2=1.139 - PR: 7882 - +1: jorton, stoddard, trawick - - *) mod_autoindex: Don't truncate directory listing when a stat call fails. - http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/generators/mod_autoindex.c?r1=1.132&r2=1.133 - PR: 17357 - +1: jorton, stoddard (stat fails when file size > 2GB even if - large file support is enabled), trawick - *) unixd_accept: Eliminate now-unnecessary apr_os_sock_get() call. http://cvs.apache.org/viewcvs.cgi/httpd-2.0/os/unix/unixd.c?r1=1.66&r2=1.67 +1: jorton, trawick diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index bebdf42044b..a82d261cd66 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -2098,8 +2098,16 @@ static int index_directory(request_rec *r, fullpath = apr_palloc(r->pool, APR_PATH_MAX); dirpathlen = strlen(name); memcpy(fullpath, name, dirpathlen); - while (apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, - thedir) == APR_SUCCESS) { + + do { + status = apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, thedir); + if (APR_STATUS_IS_INCOMPLETE(status)) { + continue; /* ignore un-stat()able files */ + } + else if (status != APR_SUCCESS) { + break; + } + /* We want to explode symlinks here. */ if (dirent.filetype == APR_LNK) { const char *savename; @@ -2125,7 +2133,8 @@ static int index_directory(request_rec *r, head = p; num_ent++; } - } + } while (1); + if (num_ent > 0) { ar = (struct ent **) apr_palloc(r->pool, num_ent * sizeof(struct ent *)); -- 2.47.2