ap_expr: Add filemod function for checking file modification times.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643145 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Gruno
2014-12-05 00:46:33 +00:00
parent 3d429ab1e3
commit f1d7ed9cde
2 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
*) ap_expr: Add filemod function for checking file modification dates
[Daniel Gruno]
*) SECURITY: CVE-2014-8109 (cve.mitre.org)
mod_lua: Fix handling of the Require line when a LuaAuthzProvider is
used in multiple Require directives with different arguments.

View File

@ -1220,6 +1220,18 @@ static const char *filesize_func(ap_expr_eval_ctx_t *ctx, const void *data,
return "0";
}
static const char *filemod_func(ap_expr_eval_ctx_t *ctx, const void *data,
char *arg)
{
apr_finfo_t sb;
if (apr_stat(&sb, arg, APR_FINFO_MIN, ctx->p) == APR_SUCCESS
&& sb.filetype == APR_REG && sb.mtime > 0)
return apr_psprintf(ctx->p, "%" APR_OFF_T_FMT, sb.mtime);
else
return "0";
}
static const char *unescape_func(ap_expr_eval_ctx_t *ctx, const void *data,
const char *arg)
{
@ -1743,6 +1755,7 @@ static const struct expr_provider_single string_func_providers[] = {
{ unescape_func, "unescape", NULL, 0 },
{ file_func, "file", NULL, 1 },
{ filesize_func, "filesize", NULL, 1 },
{ filemod_func, "filemod", NULL, 1 },
{ base64_func, "base64", NULL, 0 },
{ unbase64_func, "unbase64", NULL, 0 },
{ sha1_func, "sha1", NULL, 0 },