Commit 6c6c4939 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Eliminate all assumptions that finfo.protection reflects the existance
  or absense of a file.  finfo.filetype is defined as 0 if APR_NOFILE,
  or a non-zero value if the file could be apr_stat()'ed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87933 13f79535-47bb-0310-9956-ffa450edef68
parent 20485918
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ static dav_error * dav_fs_get_resource(
	resource->uri = r->uri;
    }

    if (r->finfo.protection != 0) {
    if (r->finfo.filetype != 0) {
        resource->exists = 1;
        resource->collection = r->finfo.filetype == APR_DIR;

@@ -688,7 +688,7 @@ static dav_error * dav_fs_get_resource(

	    /* retain proper integrity across the structures */
	    if (!resource->exists) {
		ctx->finfo.protection = 0;
		ctx->finfo.filetype = 0;
	    }
	}
    }
@@ -765,7 +765,7 @@ static int dav_fs_is_same_resource(
#ifdef WIN32
    return stricmp(ctx1->pathname, ctx2->pathname) == 0;
#else
    if (ctx1->finfo.protection != 0)
    if (ctx1->finfo.filetype != 0)
        return ctx1->finfo.inode == ctx2->finfo.inode;
    else
        return strcmp(ctx1->pathname, ctx2->pathname) == 0;
@@ -1134,7 +1134,7 @@ static dav_error * dav_fs_move_resource(
    /* determine whether a simple rename will work.
     * Assume source exists, else we wouldn't get called.
     */
    if (dstinfo->finfo.protection != 0) {
    if (dstinfo->finfo.filetype != 0) {
	if (dstinfo->finfo.device == srcinfo->finfo.device) {
	    /* target exists and is on the same device. */
	    can_rename = 1;
@@ -1692,7 +1692,7 @@ static const char *dav_fs_getetag(const dav_resource *resource)
    if (!resource->exists) 
	return apr_pstrdup(ctx->pool, "");

    if (ctx->finfo.protection != 0) {
    if (ctx->finfo.filetype != 0) {
        return apr_psprintf(ctx->pool, "\"%lx-%lx-%lx\"",
			   (unsigned long) ctx->finfo.inode,
			   (unsigned long) ctx->finfo.size,
@@ -1788,21 +1788,20 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
	break;

    case DAV_PROPID_FS_executable:
#ifdef WIN32
        /* our property, but not defined on the Win32 platform */
        return DAV_PROP_INSERT_NOTDEF;
#else
	/* our property, but not defined on collection resources */
	if (resource->collection)
	    return DAV_PROP_INSERT_NOTDEF;

        /* our property, but not defined on this platform */
        if (!(resource->info->finfo.valid & APR_FINFO_UPROT))
            return DAV_PROP_INSERT_NOTDEF;

        /* the files are "ours" so we only need to check owner exec privs */
	if (resource->info->finfo.protection & APR_UEXECUTE)
	    value = "T";
	else
	    value = "F";
	break;
#endif /* WIN32 */

    default:
        /* ### what the heck was this property? */
+6 −8
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ static int include_cgi(char *s, request_rec *r, ap_filter_t *next,
    if ((rr->path_info && rr->path_info[0]) || rr->args) {
        return -1;
    }
    if (rr->finfo.protection == 0) {
    if (rr->finfo.filetype == 0) {
        return -1;
    }

@@ -1274,7 +1274,7 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
               we never attempt to "run" this sub request. */
            rr = ap_sub_req_lookup_file(tag_val, r, NULL);

            if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
            if (rr->status == HTTP_OK && rr->finfo.filetype != 0) {
                to_send = rr->filename;
                if ((rv = apr_stat(finfo, to_send, APR_FINFO_GPROT 
                                | APR_FINFO_MIN, rr->pool)) != APR_SUCCESS
@@ -1304,7 +1304,7 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
           we never attempt to "run" this sub request. */
        rr = ap_sub_req_lookup_uri(tag_val, r, NULL);

        if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
        if (rr->status == HTTP_OK && rr->finfo.filetype != 0) {
            memcpy((char *) finfo, (const char *) &rr->finfo,
                   sizeof(rr->finfo));
            ap_destroy_sub_req(rr);
@@ -2970,12 +2970,10 @@ static int includes_filter(ap_filter_t *f, apr_bucket_brigade *b)
        }
    }

    /* Assure the platform supports Group protections */
    if ((*state == xbithack_full)
#if !defined(OS2) && !defined(WIN32)
    /*  OS/2 dosen't support Groups. */
        && (r->finfo.protection & APR_GEXECUTE)
#endif
        ) {
        && (r->finfo.valid & APR_FINFO_GPROT)
        && (r->finfo.protection & APR_GEXECUTE)) {
        ap_update_mtime(r, r->finfo.mtime);
        ap_set_last_modified(r);
    }
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static int asis_handler(request_rec *r)
    r->allowed |= (1 << M_GET);
    if (r->method_number != M_GET)
	return DECLINED;
    if (r->finfo.protection == 0) {
    if (r->finfo.filetype == 0) {
	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
		    "File does not exist: %s", r->filename);
	return HTTP_NOT_FOUND;
+1 −1
Original line number Diff line number Diff line
@@ -1186,7 +1186,7 @@ static struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
    if (autoindex_opts & FANCY_INDEXING) {
        request_rec *rr = ap_sub_req_lookup_file(name, r, NULL);

	if (rr->finfo.protection != 0) {
	if (rr->finfo.filetype != 0) {
	    p->lm = rr->finfo.mtime;
	    if (rr->finfo.filetype == APR_DIR) {
	        if (!(p->icon = find_icon(d, rr, 1))) {
+2 −2
Original line number Diff line number Diff line
@@ -550,7 +550,7 @@ static int cgi_handler(request_rec *r)
     *      entity until the sysadmin overrides that behavior.
     * Allow for cgi files without the .EXE extension on them under OS/2 
     */
    if (r->finfo.protection == 0) {
    if (r->finfo.filetype == 0) {
        apr_finfo_t finfo;
        char *newfile;
        apr_status_t rv;
@@ -565,7 +565,7 @@ static int cgi_handler(request_rec *r)
        }
    }
#else
    if (r->finfo.protection == 0)
    if (r->finfo.filetype == 0)
	return log_scripterror(r, conf, HTTP_NOT_FOUND, 0,
			       "script not found or unable to stat");
#endif
Loading