&& (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
&& (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
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^^");
}
#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;
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");
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);
* 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;
}
*/
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 != '/')
--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;
}
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;
if (test_filename[test_filename_len - 1] == '/')
--num_dirs;
- if (S_ISDIR(r->finfo.protection))
+ if (r->finfo.filetype == APR_DIR)
++num_dirs;
/*
* 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);
* 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);
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,
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 &&