]> granicus.if.org Git - apache/commitdiff
Introduce the RewriteCond -x check, which returns
authorAndré Malo <nd@apache.org>
Sat, 24 Jan 2004 02:02:09 +0000 (02:02 +0000)
committerAndré Malo <nd@apache.org>
Sat, 24 Jan 2004 02:02:09 +0000 (02:02 +0000)
true if the pattern is a file with execution permissions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102398 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 914ca8862030c2e58f3dc85bd191f4f1bf376594..fc996f6c43a0a40b0ff475f6130ef1f2f8807aaf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_rewrite: Introduce the RewriteCond -x check, which returns
+     true if the pattern is a file with execution permissions.
+     [André Malo]
+
   *) mod_ssl: Fix streaming output from an nph- CGI script. PR 21944
      [Joe Orton]
 
index e1cd993773f3a034c00d80754101805c9ba9ffd0..6287c706950f9b00ace08657efe8f87aecb37aac 100644 (file)
@@ -276,6 +276,7 @@ typedef enum {
     CONDPAT_FILE_SIZE,
     CONDPAT_FILE_LINK,
     CONDPAT_FILE_DIR,
+    CONDPAT_FILE_XBIT,
     CONDPAT_LU_URL,
     CONDPAT_LU_FILE,
     CONDPAT_STR_GT,
@@ -3040,6 +3041,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
             case 's': newcond->ptype = CONDPAT_FILE_SIZE;   break;
             case 'l': newcond->ptype = CONDPAT_FILE_LINK;   break;
             case 'd': newcond->ptype = CONDPAT_FILE_DIR;    break;
+            case 'x': newcond->ptype = CONDPAT_FILE_XBIT;   break;
             case 'U': newcond->ptype = CONDPAT_LU_URL;      break;
             case 'F': newcond->ptype = CONDPAT_LU_FILE;     break;
             }
@@ -3414,6 +3416,13 @@ static int apply_rewrite_cond(rewritecond_entry *p, rewrite_ctx *ctx)
         }
         break;
 
+    case CONDPAT_FILE_XBIT:
+        if (   apr_stat(&sb, input, APR_FINFO_PROT, r->pool) == APR_SUCCESS
+            && (sb.protection & (APR_UEXECUTE | APR_GEXECUTE | APR_WEXECUTE))) {
+            rc = 1;
+        }
+        break;
+
     case CONDPAT_LU_URL:
         if (*input && subreq_ok(r)) {
             rsub = ap_sub_req_lookup_uri(input, r, NULL);