]> granicus.if.org Git - apache/commitdiff
Add mod_rewrite's SCRIPT_USER/SCRIPT_GROUP vars to ap_expr
authorStefan Fritsch <sf@apache.org>
Thu, 30 Dec 2010 13:00:36 +0000 (13:00 +0000)
committerStefan Fritsch <sf@apache.org>
Thu, 30 Dec 2010 13:00:36 +0000 (13:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053882 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/expr.html.en
docs/manual/expr.xml
server/util_expr_eval.c

index 919c109faedd374bc824f4ce63b9f6eb2b7f7a6b..e8d91f9c347b18c664a99ffcd5eb409a577a1e9a 100644 (file)
@@ -143,6 +143,10 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
         <td /></tr>
 <tr><td><code>SCRIPT_FILENAME</code></td>
         <td>Same as <code>REQUEST_FILENAME</code></td></tr>
+<tr class="odd"><td><code>SCRIPT_USER</code></td>
+        <td>The user name of the owner of the script.</td></tr>
+<tr><td><code>SCRIPT_GROUP</code></td>
+        <td>The group name of the group of the script.</td></tr>
 <tr class="odd"><td><code>PATH_INFO</code></td>
         <td /></tr>
 <tr><td><code>QUERY_STRING</code></td>
index e3096d7f52398c173ac257cea82ac04a76d93a0d..31809be40526a206a4de79772fc0d388f50a7438 100644 (file)
@@ -146,6 +146,10 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
         <td></td></tr>
     <tr><td><code>SCRIPT_FILENAME</code></td>
         <td>Same as <code>REQUEST_FILENAME</code></td></tr>
+    <tr><td><code>SCRIPT_USER</code></td>
+        <td>The user name of the owner of the script.</td></tr>
+    <tr><td><code>SCRIPT_GROUP</code></td>
+        <td>The group name of the group of the script.</td></tr>
     <tr><td><code>PATH_INFO</code></td>
         <td></td></tr>
     <tr><td><code>QUERY_STRING</code></td>
index ba0df24060e098edbc64b069826f213e16aa44d2..06d0b8fc1152a85634e249c705f8d2a65d138e1b 100644 (file)
@@ -956,6 +956,8 @@ static const char *request_var_names[] = {
     "CONTENT_TYPE",             /* 18 */
     "HANDLER",                  /* 19 */
     "REQUEST_LOG_ID",           /* 20 */
+    "SCRIPT_USER",              /* 21 */
+    "SCRIPT_GROUP",             /* 22 */
     NULL
 };
 
@@ -1010,6 +1012,20 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data)
         return r->handler;
     case 20:
         return r->log_id;
+    case 21:
+        {
+            char *result = "";
+            if (r->finfo.valid & APR_FINFO_USER)
+                apr_uid_name_get(&result, r->finfo.user, ctx->p);
+            return result;
+        }
+    case 22:
+        {
+            char *result = "";
+            if (r->finfo.valid & APR_FINFO_USER)
+                apr_gid_name_get(&result, r->finfo.group, ctx->p);
+            return result;
+        }
     default:
         ap_assert(0);
         return NULL;