From d489f13739874db6aa65d8a9d0b1367aa2942e31 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Thu, 30 Dec 2010 13:00:36 +0000 Subject: [PATCH] Add mod_rewrite's SCRIPT_USER/SCRIPT_GROUP vars to ap_expr git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053882 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/expr.html.en | 4 ++++ docs/manual/expr.xml | 4 ++++ server/util_expr_eval.c | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/docs/manual/expr.html.en b/docs/manual/expr.html.en index 919c109fae..e8d91f9c34 100644 --- a/docs/manual/expr.html.en +++ b/docs/manual/expr.html.en @@ -143,6 +143,10 @@ listfunction ::= listfuncname "(" word ")" SCRIPT_FILENAME Same as REQUEST_FILENAME +SCRIPT_USER + The user name of the owner of the script. +SCRIPT_GROUP + The group name of the group of the script. PATH_INFO QUERY_STRING diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index e3096d7f52..31809be405 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -146,6 +146,10 @@ listfunction ::= listfuncname "(" word ")" SCRIPT_FILENAME Same as REQUEST_FILENAME + SCRIPT_USER + The user name of the owner of the script. + SCRIPT_GROUP + The group name of the group of the script. PATH_INFO QUERY_STRING diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index ba0df24060..06d0b8fc11 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -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; -- 2.50.1