]> granicus.if.org Git - apache/commitdiff
Eliminate all assumptions that finfo.protection reflects the existance
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 31 Jan 2001 22:45:35 +0000 (22:45 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 31 Jan 2001 22:45:35 +0000 (22:45 +0000)
  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

16 files changed:
modules/dav/fs/repos.c
modules/filters/mod_include.c
modules/generators/mod_asis.c
modules/generators/mod_autoindex.c
modules/generators/mod_cgi.c
modules/generators/mod_cgid.c
modules/http/http_core.c
modules/http/http_protocol.c
modules/http/http_request.c
modules/mappers/mod_actions.c
modules/mappers/mod_negotiation.c
modules/mappers/mod_speling.c
modules/metadata/mod_cern_meta.c
modules/metadata/mod_expires.c
modules/metadata/mod_mime_magic.c
modules/test/mod_autoindex.c

index a6a102ee2435e4a5bd02ac0f965acc72c398e0b0..c5917dccb80f1fb1306ef50d8e23a2b533d44192 100644 (file)
@@ -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;
 
-       /* the files are "ours" so we only need to check owner exec privs */
+        /* 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? */
index 402006f1ccaa9eb8bbf0f24ac7235cc85b3efa0b..6aeef3da82d99e08699d0d9bdfb60cad5ebeed69 100644 (file)
@@ -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);
     }
index 7e5daa6b53e7470a4d900d647beb4bf5742a5af6..858bd208dd72f02903b75efbef9f719e61345ec6 100644 (file)
@@ -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;
index 518198c5ae1414c68a0f332a83317ef9f7e53928..ce5c6c26127f153b9533a1055afa7858799be493 100644 (file)
@@ -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))) {
index 9c1c3e2f3d2dda53d61e1b0d76e7359f6e27a9c6..4e0767d09d8b56f4d52fa9fca24365a0b7d6a1fd 100644 (file)
@@ -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
index 625dd130256a949086c9b054d478cd3a0dc7bda7..8eb17f2f97f724f89a1851d64b741ddd92339234 100644 (file)
@@ -816,7 +816,7 @@ static int cgid_handler(request_rec *r)
 #error mod_cgid does not work on this platform.  If you teach it to, look 
 #error at mod_cgi.c for required code in this path.
 #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 
index 29da4704d7188f0b727d1fe5429e487d5f19df2d..224e9227b1b514ebd4ac39b59b673ac455356672 100644 (file)
@@ -2992,7 +2992,7 @@ static int default_handler(request_rec *r)
     if (r->method_number == M_PUT) {
         return HTTP_METHOD_NOT_ALLOWED;
     }
-    if (r->finfo.protection == 0 || (r->path_info && *r->path_info)) {
+    if (r->finfo.filetype == 0 || (r->path_info && *r->path_info)) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r,
                      "File does not exist: %s",r->path_info ?
                      apr_pstrcat(r->pool, r->filename, r->path_info, NULL)
index f500b0b9f6734b6073193019b2bcc764cc14740e..659c8b7531a757cf3c3a031895a2d4f096dfc7eb 100644 (file)
@@ -630,7 +630,7 @@ AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak)
     weak = ((r->request_time - r->mtime > APR_USEC_PER_SEC)
            && !force_weak) ? "" : "W/";
 
-    if (r->finfo.protection != 0) {
+    if (r->finfo.filetype != 0) {
         etag = apr_psprintf(r->pool,
                            "%s\"%lx-%lx-%lx\"", weak,
                            (unsigned long) r->finfo.inode,
index d47f6274c46b65b9071ea5d10fa3c0942fe6522c..4cff25727900449929835c3c6b6e2455917776fc 100644 (file)
@@ -134,7 +134,7 @@ AP_IMPLEMENT_HOOK_VOID(insert_filter, (request_rec *r), (r))
 static int check_safe_file(request_rec *r)
 {
 
-    if (r->finfo.protection == 0      /* doesn't exist */
+    if (r->finfo.filetype == 0      /* doesn't exist */
         || r->finfo.filetype == APR_DIR
         || r->finfo.filetype == APR_REG
         || r->finfo.filetype == APR_LNK) {
@@ -226,7 +226,7 @@ static int get_path_info(request_rec *r)
     char bStripSlash=1;
 #endif
 
-    if (r->finfo.protection) {
+    if (r->finfo.filetype) {
        /* assume path_info already set */
        return OK;
     }
@@ -294,7 +294,6 @@ static int get_path_info(request_rec *r)
              * argument starts with the component after that.
              */
             if (r->finfo.filetype == APR_DIR && last_cp) {
-                r->finfo.protection = 0;  /* XXX: Wrong test for no such file... */
                 r->finfo.filetype = APR_NOFILE;  /* No such file... */
                 cp = last_cp;
             }
@@ -351,7 +350,6 @@ static int directory_walk(request_rec *r)
 
     if (r->filename == NULL) {
         r->filename = apr_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;
 
@@ -982,7 +980,7 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
         if (((rv = apr_stat(&rnew->finfo, rnew->filename,
                            APR_FINFO_NORM, rnew->pool)) != APR_SUCCESS)
                                                  && (rv != APR_INCOMPLETE)) {
-            rnew->finfo.protection = 0;
+            rnew->finfo.filetype = 0;
         }
 
         if ((res = check_safe_file(rnew))) {
index 35e2e3497d650c35a0803751134284fe4b5e0468..8c28246c8861221258d6aba610fbb902025a07b7 100644 (file)
@@ -194,7 +194,7 @@ static int action_handler(request_rec *r)
     if ((t = apr_table_get(conf->action_types,
                       action ? action : ap_default_type(r)))) {
        script = t;
-       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;
index b86e65674e005b4b83863fbb4ed309b3b6240cf6..f6e6f4f97c5497f08c7275f671a33215bf83ca74 100644 (file)
@@ -2601,7 +2601,7 @@ static int handle_multi(request_rec *r)
     int res;
     int j;
 
-    if (r->finfo.protection != 0 || !(ap_allow_options(r) & OPT_MULTI)) {
+    if (r->finfo.filetype != 0 || !(ap_allow_options(r) & OPT_MULTI)) {
         return DECLINED;
     }
 
index 4893c02ccda261adb253d9254bbbceee845025c6..845b3b2fec2d9f82ed5af28a72d945d10e3efb03 100644 (file)
@@ -253,7 +253,7 @@ static int check_speling(request_rec *r)
     }
 
     /* We've already got a file of some kind or another */
-    if (r->proxyreq || (r->finfo.protection != 0)) {
+    if (r->proxyreq || (r->finfo.filetype != 0)) {
         return DECLINED;
     }
 
index 66e8acb680aa2a2e30a64deed5646d3aaf228bc2..79aab42fafc087a7cb0a867059952d5fe595eb29 100644 (file)
@@ -323,7 +323,7 @@ static int add_cern_meta_data(request_rec *r)
 
     /* if ./.web/$1.meta exists then output 'asis' */
 
-    if (r->finfo.protection == 0) {
+    if (r->finfo.filetype == 0) {
        return DECLINED;
     };
 
index d122474b4d1f76c0f325728e3a3043d75ebdfbd5..e3a96678fb0037322f4f6c2c4f78566501301ff6 100644 (file)
@@ -467,7 +467,7 @@ static int add_expires(request_rec *r)
 
     switch (code[0]) {
     case 'M':
-       if (r->finfo.protection == 0) { 
+       if (r->finfo.filetype == 0) { 
            /* file doesn't exist on disk, so we can't do anything based on
             * modification time.  Note that this does _not_ log an error.
             */
index 51725097d74cddfa5f7f1b3afa40070a533eea2f..d54d3139748a20c5a80cabedffccfc0d10d4b06b 100644 (file)
@@ -1493,7 +1493,7 @@ static int fsmagic(request_rec *r, const char *fn)
        break;
     default:
        ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
-                   MODNAME ": invalid mode 0%o.", (unsigned int)r->finfo.protection);
+                     MODNAME ": invalid file type %d.", r->finfo.filetype);
        return HTTP_INTERNAL_SERVER_ERROR;
     }
 
@@ -2432,7 +2432,7 @@ static int magic_find_ct(request_rec *r)
     magic_server_config_rec *conf;
 
     /* the file has to exist */
-    if (r->finfo.protection == 0 || !r->filename) {
+    if (r->finfo.filetype == 0 || !r->filename) {
        return DECLINED;
     }
 
index 518198c5ae1414c68a0f332a83317ef9f7e53928..ce5c6c26127f153b9533a1055afa7858799be493 100644 (file)
@@ -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))) {