You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bj...@hyperreal.org on 2000/01/10 16:35:54 UTC
cvs commit: apache-2.0/src/modules/standard mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_dir.c mod_mime.c mod_negotiation.c
bjh 00/01/10 07:35:53
Modified: src/lib/apr/file_io/os2 fileacc.c filedup.c fileio.h
filestat.c open.c readwrite.c seek.c
src/lib/apr/file_io/unix fileacc.c filestat.c
src/lib/apr/include apr_file_io.h
src/main http_request.c util.c
src/modules/standard mod_autoindex.c mod_cern_meta.c
mod_cgi.c mod_dir.c mod_mime.c mod_negotiation.c
Log:
Rework ap_finfo_t to split the file type out of the protection field.
I've taken a stab at the unix implementation but tested only on OS/2.
Revision Changes Path
1.6 +0 -146 apache-2.0/src/lib/apr/file_io/os2/fileacc.c
Index: fileacc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/fileacc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fileacc.c 1999/10/18 10:14:46 1.5
+++ fileacc.c 2000/01/10 15:35:44 1.6
@@ -76,152 +76,6 @@
-ap_status_t ap_get_filesize(ap_ssize_t *size, struct file_t *file)
-{
- ap_status_t rv;
-
- if (file != NULL) {
- if (!file->validstatus) {
- rv = ap_getfileinfo(file);
-
- if (rv)
- return rv;
- }
-
- *size = file->status.cbFile;
- return APR_SUCCESS;
- } else {
- *size = -1;
- return APR_ENOFILE;
- }
-}
-
-
-
-ap_status_t ap_get_fileperms(ap_fileperms_t *perm, struct file_t *file)
-{
- ap_status_t rv;
-
- if (file != NULL) {
- if (!file->validstatus) {
- rv = ap_getfileinfo(file);
-
- if (rv)
- return rv;
- }
-
- *perm = (file->status.attrFile & FILE_READONLY) ? 0555 : 0777;
- return APR_SUCCESS;
- } else {
- *perm = -1;
- return APR_ENOFILE;
- }
-}
-
-
-
-ap_status_t ap_get_fileatime(time_t *time, struct file_t *file)
-{
- ap_status_t rv;
-
- if (file != NULL) {
- if (!file->validstatus) {
- rv = ap_getfileinfo(file);
-
- if (rv)
- return rv;
- }
-
- *time = os2date2unix( file->status.fdateLastAccess, file->status.ftimeLastAccess );
- return APR_SUCCESS;
- } else {
- *time = -1;
- return APR_ENOFILE;
- }
-}
-
-
-
-ap_status_t ap_get_filectime(time_t *time, struct file_t *file)
-{
- ap_status_t rv;
-
- if (file != NULL) {
- if (!file->validstatus) {
- rv = ap_getfileinfo(file);
-
- if (rv)
- return rv;
- }
-
- *time = os2date2unix( file->status.fdateCreation, file->status.ftimeCreation );
- return APR_SUCCESS;
- }
- else {
- *time = -1;
- return APR_ENOFILE;
- }
-}
-
-
-
-ap_status_t ap_get_filemtime(time_t *time, struct file_t *file)
-{
- ap_status_t rv;
-
- if (file != NULL) {
- if (!file->validstatus) {
- rv = ap_getfileinfo(file);
-
- if (rv)
- return rv;
- }
-
- *time = os2date2unix( file->status.fdateLastWrite, file->status.ftimeLastWrite );
- return APR_SUCCESS;
- }
- else {
- *time = -1;
- return APR_ENOFILE;
- }
-}
-
-
-
-ap_status_t ap_get_filetype(ap_filetype_e *type, struct file_t *file)
-{
- ULONG rc, filetype, fileattr;
-
- if (file != NULL && file->isopen) {
- rc = DosQueryHType( file->filedes, &filetype, &fileattr );
-
- if (rc)
- return os2errno(rc);
-
- switch (filetype & 0xff) {
- case 0:
- *type = APR_REG;
- break;
-
- case 1:
- *type = APR_CHR;
- break;
-
- case 2:
- *type = APR_PIPE;
- break;
- }
-
- return APR_SUCCESS;
- }
- else {
- *type = APR_REG;
- return APR_ENOFILE;
- }
-}
-
-
-
ap_status_t ap_get_filedata(void **data, char *key, struct file_t *file)
{
if (file != NULL) {
1.6 +0 -1 apache-2.0/src/lib/apr/file_io/os2/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/filedup.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- filedup.c 2000/01/10 14:21:53 1.5
+++ filedup.c 2000/01/10 15:35:45 1.6
@@ -87,7 +87,6 @@
dup_file->fname = ap_pstrdup(dup_file->cntxt, old_file->fname);
dup_file->buffered = old_file->buffered;
- dup_file->status = old_file->status;
dup_file->isopen = old_file->isopen;
dup_file->flags = old_file->flags;
1.7 +1 -3 apache-2.0/src/lib/apr/file_io/os2/fileio.h
Index: fileio.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/fileio.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- fileio.h 2000/01/10 14:21:53 1.6
+++ fileio.h 2000/01/10 15:35:45 1.7
@@ -72,8 +72,6 @@
char * fname;
int isopen;
int buffered;
- FILESTATUS3 status;
- int validstatus;
int eof_hit;
ap_int32_t flags;
@@ -99,7 +97,7 @@
};
ap_status_t file_cleanup(void *);
-long os2date2unix( FDATE os2date, FTIME os2time );
+ap_status_t ap_os2_time_to_ap_time(ap_time_t *result, FDATE os2date, FTIME os2time);
int os2errno( ULONG oserror );
#endif /* ! FILE_IO_H */
1.3 +83 -21 apache-2.0/src/lib/apr/file_io/os2/filestat.c
Index: filestat.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/filestat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- filestat.c 1999/10/13 09:38:08 1.2
+++ filestat.c 2000/01/10 15:35:45 1.3
@@ -53,48 +53,110 @@
*
*/
+#define INCL_DOS
+#define INCL_DOSERRORS
#include "fileio.h"
#include "apr_file_io.h"
#include "apr_lib.h"
#include <sys/time.h>
-
-#define INCL_DOS
#include <os2.h>
-long os2date2unix( FDATE os2date, FTIME os2time )
+static void FS3_to_finfo(ap_finfo_t *finfo, FILESTATUS3 *fstatus)
{
- struct tm tmpdate;
+ finfo->protection = (fstatus->attrFile & FILE_READONLY) ? 0555 : 0777;
- memset(&tmpdate, 0, sizeof(tmpdate));
- tmpdate.tm_hour = os2time.hours;
- tmpdate.tm_min = os2time.minutes;
- tmpdate.tm_sec = os2time.twosecs * 2;
-
- tmpdate.tm_mday = os2date.day;
- tmpdate.tm_mon = os2date.month - 1;
- tmpdate.tm_year = os2date.year + 80;
- tmpdate.tm_isdst = -1;
+ if (fstatus->attrFile & FILE_DIRECTORY)
+ finfo->filetype = APR_DIR;
+ else
+ finfo->filetype = APR_REG;
- return mktime( &tmpdate );
+ finfo->user = 0;
+ finfo->group = 0;
+ finfo->inode = 0;
+ finfo->size = fstatus->cbFile;
+ ap_os2_time_to_ap_time(&finfo->atime, fstatus->fdateLastAccess, fstatus->ftimeLastAccess );
+ ap_os2_time_to_ap_time(&finfo->mtime, fstatus->fdateLastWrite, fstatus->ftimeLastWrite );
+ ap_os2_time_to_ap_time(&finfo->ctime, fstatus->fdateCreation, fstatus->ftimeCreation );
}
-ap_status_t ap_getfileinfo(struct file_t *thefile)
+static ap_status_t handle_type(ap_filetype_e *ftype, HFILE file)
{
- ULONG rc;
-
+ ULONG filetype, fileattr, rc;
+
+ rc = DosQueryHType(file, &filetype, &fileattr);
+
+ if (rc == 0) {
+ switch (filetype & 0xff) {
+ case 0:
+ *ftype = APR_REG;
+ break;
+
+ case 1:
+ *ftype = APR_CHR;
+ break;
+
+ case 2:
+ *ftype = APR_PIPE;
+ break;
+ }
+
+ return APR_SUCCESS;
+ }
+ return os2errno(rc);
+}
+
+
+
+ap_status_t ap_getfileinfo(ap_finfo_t *finfo, struct file_t *thefile)
+{
+ ULONG rc;
+ FILESTATUS3 fstatus;
+
if (thefile->isopen)
- rc = DosQueryFileInfo(thefile->filedes, FIL_STANDARD, &thefile->status, sizeof(thefile->status));
+ rc = DosQueryFileInfo(thefile->filedes, FIL_STANDARD, &fstatus, sizeof(fstatus));
else
- rc = DosQueryPathInfo(thefile->fname, FIL_STANDARD, &thefile->status, sizeof(thefile->status));
+ rc = DosQueryPathInfo(thefile->fname, FIL_STANDARD, &fstatus, sizeof(fstatus));
+
+ if (rc == 0) {
+ FS3_to_finfo(finfo, &fstatus);
+
+ if (finfo->filetype == APR_REG) {
+ if (thefile->isopen) {
+ return handle_type(&finfo->filetype, thefile->filedes);
+ }
+ } else {
+ return APR_SUCCESS;
+ }
+ }
+
+ finfo->protection = 0;
+ finfo->filetype = APR_NOFILE;
+ return os2errno(rc);
+}
+
+
+
+ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont)
+{
+ ULONG rc;
+ FILESTATUS3 fstatus;
+
+ finfo->protection = 0;
+ finfo->filetype = APR_NOFILE;
+ rc = DosQueryPathInfo(fname, FIL_STANDARD, &fstatus, sizeof(fstatus));
if (rc == 0) {
- thefile->validstatus = TRUE;
+ FS3_to_finfo(finfo, &fstatus);
+ return APR_SUCCESS;
+ } else if (rc == ERROR_INVALID_ACCESS) {
+ memset(finfo, 0, sizeof(ap_finfo_t));
+ finfo->protection = 0444;
+ finfo->filetype = APR_CHR;
return APR_SUCCESS;
}
- thefile->validstatus = FALSE;
return os2errno(rc);
}
1.14 +0 -3 apache-2.0/src/lib/apr/file_io/os2/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/open.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- open.c 2000/01/10 14:21:53 1.13
+++ open.c 2000/01/10 15:35:45 1.14
@@ -81,7 +81,6 @@
*new = dafile;
dafile->cntxt = cntxt;
dafile->isopen = FALSE;
- dafile->validstatus = FALSE;
dafile->eof_hit = FALSE;
dafile->buffer = NULL;
dafile->flags = flag;
@@ -203,7 +202,6 @@
(*file)->filedes = *dafile;
(*file)->isopen = TRUE;
(*file)->buffered = FALSE;
- (*file)->validstatus = FALSE;
(*file)->eof_hit = FALSE;
(*file)->flags = 0;
return APR_SUCCESS;
@@ -232,7 +230,6 @@
(*thefile)->fname = NULL;
(*thefile)->isopen = TRUE;
(*thefile)->buffered = FALSE;
- (*thefile)->validstatus = FALSE;
(*thefile)->eof_hit = FALSE;
(*thefile)->flags = 0;
1.11 +0 -3 apache-2.0/src/lib/apr/file_io/os2/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- readwrite.c 1999/12/19 08:16:02 1.10
+++ readwrite.c 2000/01/10 15:35:45 1.11
@@ -175,7 +175,6 @@
}
*nbytes = byteswritten;
- thefile->validstatus = FALSE;
return APR_SUCCESS;
}
}
@@ -206,7 +205,6 @@
}
else {
*iocnt = bytes;
- thefile->validstatus = FALSE;
return APR_SUCCESS;
}
}
@@ -229,7 +227,6 @@
return os2errno(rc);
}
- thefile->validstatus = FALSE;
return APR_SUCCESS;
}
1.3 +3 -3 apache-2.0/src/lib/apr/file_io/os2/seek.c
Index: seek.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/seek.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- seek.c 1999/10/19 15:24:20 1.2
+++ seek.c 2000/01/10 15:35:45 1.3
@@ -100,7 +100,7 @@
if (thefile->buffered) {
int rc = EINVAL;
- ap_ssize_t filesize;
+ ap_finfo_t finfo;
switch (where) {
case APR_SET:
@@ -112,9 +112,9 @@
break;
case APR_END:
- rc = ap_get_filesize(&filesize, thefile);
+ rc = ap_getfileinfo(&finfo, thefile);
if (rc == APR_SUCCESS)
- rc = setptr(thefile, filesize - *offset);
+ rc = setptr(thefile, finfo.size - *offset);
break;
}
1.14 +0 -27 apache-2.0/src/lib/apr/file_io/unix/fileacc.c
Index: fileacc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileacc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- fileacc.c 2000/01/06 14:43:05 1.13
+++ fileacc.c 2000/01/10 15:35:47 1.14
@@ -104,33 +104,6 @@
}
/* ***APRDOC********************************************************
- * ap_status_t ap_get_filetype(ap_filetype_e, ap_file_t *)
- * Return the type of the current file.
- * arg 1) The currently open file.
- * arg 2) The file type
- */
-ap_status_t ap_get_filetype(ap_filetype_e *type, ap_fileperms_t perms)
-{
- if (S_ISREG(perms))
- *type = APR_REG;
- if (S_ISDIR(perms))
- *type = APR_DIR;
- if (S_ISCHR(perms))
- *type = APR_CHR;
- if (S_ISBLK(perms))
- *type = APR_BLK;
- if (S_ISFIFO(perms))
- *type = APR_PIPE;
- if (S_ISLNK(perms))
- *type = APR_LNK;
-#ifndef BEOS
- if (S_ISSOCK(perms))
- *type = APR_SOCK;
-#endif
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
* ap_status_t ap_get_filedata(void **, char *key, ap_file_t *)
* Return the data associated with the current file.
* arg 1) The currently open file.
1.10 +24 -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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- filestat.c 2000/01/09 05:18:18 1.9
+++ filestat.c 2000/01/10 15:35:47 1.10
@@ -58,6 +58,28 @@
#include "apr_general.h"
#include "apr_errno.h"
+static ap_filetype_e filetype_from_mode(int mode)
+{
+ ap_filetype_e type = APR_NOFILE;
+
+ if (S_ISREG(mode))
+ type = APR_REG;
+ if (S_ISDIR(mode))
+ type = APR_DIR;
+ if (S_ISCHR(mode))
+ type = APR_CHR;
+ if (S_ISBLK(mode))
+ type = APR_BLK;
+ if (S_ISFIFO(mode))
+ type = APR_PIPE;
+ if (S_ISLNK(mode))
+ type = APR_LNK;
+#ifndef BEOS
+ if (S_ISSOCK(mode))
+ type = APR_SOCK;
+#endif
+}
+
/* ***APRDOC********************************************************
* ap_status_t ap_getfileinfo(ap_file_t *)
* get the specified file's stats..
@@ -71,6 +93,7 @@
if (rv == 0) {
finfo->protection = info.st_mode;
+ finfo->filetype = filetype_from_mode(info.st_mode);
finfo->user = info.st_uid;
finfo->group = info.st_gid;
finfo->size = info.st_size;
@@ -100,6 +123,7 @@
if (rv == 0) {
finfo->protection = info.st_mode;
+ finfo->filetype = filetype_from_mode(info.st_mode);
finfo->user = info.st_uid;
finfo->group = info.st_gid;
finfo->size = info.st_size;
1.28 +2 -3 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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- apr_file_io.h 2000/01/09 05:18:18 1.27
+++ apr_file_io.h 2000/01/10 15:35:48 1.28
@@ -67,7 +67,7 @@
extern "C" {
#endif /* __cplusplus */
-typedef enum {APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE, APR_LNK,
+typedef enum {APR_NOFILE, APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE, APR_LNK,
APR_SOCK} ap_filetype_e;
/* Flags for ap_open */
@@ -116,6 +116,7 @@
struct ap_finfo_t {
ap_fileperms_t protection;
+ ap_filetype_e filetype;
ap_uid_t user;
ap_gid_t group;
ap_ino_t inode;
@@ -173,8 +174,6 @@
ap_status_t ap_dir_entry_size(ap_ssize_t *, ap_dir_t *);
ap_status_t ap_dir_entry_mtime(time_t *, ap_dir_t *);
ap_status_t ap_dir_entry_ftype(ap_filetype_e *, ap_dir_t *);
-
-ap_status_t ap_get_filetype(ap_filetype_e *, ap_fileperms_t);
#ifdef __cplusplus
}
1.15 +16 -13 apache-2.0/src/main/http_request.c
Index: http_request.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_request.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- http_request.c 2000/01/09 05:18:23 1.14
+++ http_request.c 2000/01/10 15:35:49 1.15
@@ -116,12 +116,13 @@
static int check_safe_file(request_rec *r)
{
- if (r->finfo.protection == 0 /* doesn't exist */
- || S_ISDIR(r->finfo.protection)
- || S_ISREG(r->finfo.protection)
- || S_ISLNK(r->finfo.protection)) {
+ if (r->finfo.protection == 0 /* doesn't exist */
+ || r->finfo.filetype == APR_DIR
+ || r->finfo.filetype == APR_REG
+ || r->finfo.filetype == APR_LNK) {
return OK;
}
+
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"object is not a file, directory or symlink: %s",
r->filename);
@@ -272,8 +273,9 @@
* contents of that directory for a multi_match, so the PATH_INFO
* argument starts with the component after that.
*/
- if (S_ISDIR(r->finfo.protection) && last_cp) {
+ if (r->finfo.filetype == APR_DIR && last_cp) {
r->finfo.protection = 0; /* No such file... */
+ r->finfo.filetype = APR_NOFILE; /* No such file... */
cp = last_cp;
}
@@ -286,8 +288,8 @@
*/
r->finfo.protection = 0;
-#if defined(ENOENT) && defined(ENOTDIR)
- if (errno == ENOENT || errno == ENOTDIR) {
+#if defined(APR_ENOENT) && defined(APR_ENOTDIR)
+ if (rv == APR_ENOENT || rv == APR_ENOTDIR) {
last_cp = cp;
while (--cp > path && *cp != '/')
@@ -297,10 +299,10 @@
--cp;
}
else {
-#if defined(EACCES)
- if (errno != EACCES)
+#if defined(APR_EACCES)
+ if (rv != APR_EACCES)
#endif
- ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"access to %s failed", r->uri);
return HTTP_FORBIDDEN;
}
@@ -355,6 +357,7 @@
if (r->filename == NULL) {
r->filename = ap_pstrdup(r->pool, r->uri);
r->finfo.protection = 0; /* Not really a file... */
+ r->finfo.filetype = APR_NOFILE;
r->per_dir_config = per_dir_defaults;
return OK;
@@ -436,7 +439,7 @@
if (test_filename[test_filename_len - 1] == '/')
--num_dirs;
- if (S_ISDIR(r->finfo.protection))
+ if (r->finfo.filetype == APR_DIR)
++num_dirs;
/*
@@ -571,7 +574,7 @@
* S_ISDIR test. But if you accessed /symlink/index.html, for example,
* you would *not* get the 403.
*/
- if (!S_ISDIR(r->finfo.protection)
+ if (r->finfo.filetype != APR_DIR
&& (res = check_symlinks(r->filename, ap_allow_options(r)))) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Symbolic link not allowed: %s", r->filename);
@@ -875,7 +878,7 @@
* no matter what, if it's a subdirectory, we need to re-run
* directory_walk
*/
- if (S_ISDIR(rnew->finfo.protection)) {
+ if (rnew->finfo.filetype == APR_DIR) {
res = directory_walk(rnew);
if (!res) {
res = file_walk(rnew);
1.26 +2 -4 apache-2.0/src/main/util.c
Index: util.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/util.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- util.c 2000/01/09 05:18:24 1.25
+++ util.c 2000/01/10 15:35:49 1.26
@@ -756,7 +756,6 @@
ap_file_t *file = NULL;
ap_finfo_t finfo;
ap_status_t stat;
- ap_filetype_e type;
if (name == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL,
@@ -780,12 +779,11 @@
if (stat != APR_SUCCESS)
return stat;
- ap_getfileinfo(&finfo, file);
- stat = ap_get_filetype(&type, finfo.protection);
+ stat = ap_getfileinfo(&finfo, file);
if (stat != APR_SUCCESS)
return stat;
- if (type != APR_REG &&
+ if (finfo.filetype != APR_REG &&
#if defined(WIN32) || defined(OS2)
!(strcasecmp(name, "nul") == 0 ||
(strlen(name) >= 4 &&
1.20 +3 -3 apache-2.0/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- mod_autoindex.c 2000/01/09 05:18:29 1.19
+++ mod_autoindex.c 2000/01/10 15:35:50 1.20
@@ -953,7 +953,7 @@
&& (rr = ap_sub_req_lookup_uri(header_fname, r))
&& (rr->status == HTTP_OK)
&& (rr->filename != NULL)
- && S_ISREG(rr->finfo.protection)) {
+ && rr->finfo.filetype == APR_REG) {
/*
* Check for the two specific cases we allow: text/html and
* text/anything-else. The former is allowed to be processed for
@@ -1036,7 +1036,7 @@
&& (rr = ap_sub_req_lookup_uri(readme_fname, r))
&& (rr->status == HTTP_OK)
&& (rr->filename != NULL)
- && S_ISREG(rr->finfo.protection)) {
+ && rr->finfo.filetype == APR_REG) {
/*
* Check for the two specific cases we allow: text/html and
* text/anything-else. The former is allowed to be processed for
@@ -1163,7 +1163,7 @@
if (rr->finfo.protection != 0) {
p->lm = rr->finfo.mtime;
- if (S_ISDIR(rr->finfo.protection)) {
+ if (rr->finfo.filetype == APR_DIR) {
if (!(p->icon = find_icon(d, rr, 1))) {
p->icon = find_default_icon(d, "^^DIRECTORY^^");
}
1.7 +1 -1 apache-2.0/src/modules/standard/mod_cern_meta.c
Index: mod_cern_meta.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cern_meta.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mod_cern_meta.c 2000/01/07 15:52:18 1.6
+++ mod_cern_meta.c 2000/01/10 15:35:51 1.7
@@ -314,7 +314,7 @@
};
/* is this a directory? */
- if (S_ISDIR(r->finfo.protection) || r->uri[strlen(r->uri) - 1] == '/') {
+ if (r->finfo.filetype == APR_DIR || r->uri[strlen(r->uri) - 1] == '/') {
return DECLINED;
};
1.25 +2 -2 apache-2.0/src/modules/standard/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mod_cgi.c 2000/01/09 05:18:30 1.24
+++ mod_cgi.c 2000/01/10 15:35:51 1.25
@@ -482,7 +482,7 @@
#if defined(OS2) || defined(WIN32)
/* Allow for cgi files without the .EXE extension on them under OS/2 */
- if (r->finfo.st_mode == 0) {
+ if (r->finfo.protection == 0) {
struct stat statbuf;
char *newfile;
@@ -500,7 +500,7 @@
return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO,
"script not found or unable to stat");
#endif
- if (S_ISDIR(r->finfo.protection))
+ if (r->finfo.filetype == APR_DIR)
return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO,
"attempt to invoke directory as script");
1.5 +1 -1 apache-2.0/src/modules/standard/mod_dir.c
Index: mod_dir.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_dir.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mod_dir.c 2000/01/06 14:43:39 1.4
+++ mod_dir.c 2000/01/10 15:35:51 1.5
@@ -161,7 +161,7 @@
char *name_ptr = *names_ptr;
request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r);
- if (rr->status == HTTP_OK && S_ISREG(rr->finfo.protection)) {
+ if (rr->status == HTTP_OK && rr->finfo.filetype == APR_REG) {
char *new_uri = ap_escape_uri(r->pool, rr->uri);
if (rr->args != NULL)
1.7 +1 -1 apache-2.0/src/modules/standard/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_mime.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mod_mime.c 2000/01/06 14:43:40 1.6
+++ mod_mime.c 2000/01/10 15:35:51 1.7
@@ -286,7 +286,7 @@
const char *orighandler = r->handler;
const char *type;
- if (S_ISDIR(r->finfo.protection)) {
+ if (r->finfo.filetype == APR_DIR) {
r->content_type = DIR_MAGIC_TYPE;
return OK;
}
1.16 +1 -1 apache-2.0/src/modules/standard/mod_negotiation.c
Index: mod_negotiation.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_negotiation.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mod_negotiation.c 2000/01/06 14:43:40 1.15
+++ mod_negotiation.c 2000/01/10 15:35:51 1.16
@@ -2621,7 +2621,7 @@
/* BLECH --- don't multi-resolve non-ordinary files */
- if (!S_ISREG(sub_req->finfo.protection)) {
+ if (sub_req->finfo.filetype != APR_REG) {
res = NOT_FOUND;
goto return_from_multi;
}
Re: cvs commit: apache-2.0/src/modules/standard mod_autoindex.c
mod_cern_meta.c mod_cgi.c mod_dir.c mod_mime.c mod_negotiation.c
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
Thanks for doing the work, I'll look at the Unix impl now.
Ryan
> Rework ap_finfo_t to split the file type out of the protection field.
> I've taken a stab at the unix implementation but tested only on OS/2.
Re: cvs commit: apache-2.0/src/modules/standard mod_autoindex.c
mod_cern_meta.c mod_cgi.c mod_dir.c mod_mime.c mod_negotiation.c
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
Thanks for doing the work, I'll look at the Unix impl now.
Ryan
> Rework ap_finfo_t to split the file type out of the protection field.
> I've taken a stab at the unix implementation but tested only on OS/2.