wrowe 00/11/10 07:19:53
Modified: src/lib/apr/file_io/unix filestat.c
src/lib/apr/include apr_file_io.h
Log:
Teaching new dogs old tricks... apr_stat must behave and never change
its finfo* argument if it fails... apr_stat/Unix must check the ENOENT
and ENOTDIR errno defines [Please- check my work carefully!] and we
start unwinding the ap_os_is_filename_valid() funtion (which is gone
for good, win32 apr_stat() will learn these tricks.)
Revision Changes Path
1.32 +30 -0 apache-2.0/src/lib/apr/file_io/unix/filestat.c
Index: filestat.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filestat.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- filestat.c 2000/11/09 06:15:53 1.31
+++ filestat.c 2000/11/10 15:19:53 1.32
@@ -129,7 +129,37 @@
return APR_SUCCESS;
}
else {
+#if !defined(ENOENT) || !defined(ENOTDIR)
+#error ENOENT || ENOTDIR not defined; please see the
+#error comments at this line in the source for a workaround.
+ /*
+ * If ENOENT || ENOTDIR is not defined in one of the your OS's
+ * include files, APR cannot report a good reason why the stat()
+ * of the file failed; there are cases where it can fail even though
+ * the file exists. This opens holes in Apache, for example, because
+ * it becomes 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 lines and start the compile again. If you need to do this,
+ * please submit a bug report to
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.
+ */
+ /* WARNING: All errors will be handled as not found
+ */
+#if !defined(ENOENT)
+ return APR_ENOENT;
+#else
+ /* WARNING: All errors but not found will be handled as not directory
+ */
+ if (errno != ENOENT)
+ return APR_ENOENT;
+ else
+ return errno;
+#endif
+#else /* All was defined well, report the usual: */
return errno;
+#endif
}
}
1.73 +4 -2 apache-2.0/src/lib/apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- apr_file_io.h 2000/11/08 22:26:19 1.72
+++ apr_file_io.h 2000/11/10 15:19:53 1.73
@@ -509,7 +509,8 @@
/**
* get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file.
- * @param finfo Where to store the information about the file.
+ * @param finfo Where to store the information about the file, which is
+ * never touched if the call fails.
* @param fname The name of the file to stat.
* @param cont the pool to use to allocate the new file.
*/
@@ -519,7 +520,8 @@
* get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file. If the file is a symlink, this
function
* will get the stats for the symlink not the file the symlink refers to.
- * @param finfo Where to store the information about the file.
+ * @param finfo Where to store the information about the file, which is
+ * never touched if the call fails.
* @param fname The name of the file to stat.
* @param cont the pool to use to allocate the new file.
*/