From: André Malo Date: Sat, 24 Jan 2004 02:02:09 +0000 (+0000) Subject: Introduce the RewriteCond -x check, which returns X-Git-Tag: pre_ajp_proxy~775 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7e7f6c09eb8fc8db4eaf0cb3a0cdc8ddb86a3cf;p=apache Introduce the RewriteCond -x check, which returns 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 --- diff --git a/CHANGES b/CHANGES index 914ca88620..fc996f6c43 100644 --- 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] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index e1cd993773..6287c70695 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -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);