core: Fix integer overflow in ap_pregsub. This can be triggered e.g.
with mod_setenvif via a malicious .htaccess. [Stefan Fritsch]
+ *) mod_lua: Expose SSL variables via r:ssl_var_lookup(). [Eric Covener]
+
*) mod_lua: LuaHook{AccessChecker,AuthChecker,CheckUserID,TranslateName}
can now additionally be run as "early" or "late" relative to other modules.
[Eric Covener]
* add ap_pregsub_ex()
* 20111025.1 (2.3.15-dev) Add ap_escape_urlencoded(), ap_escape_urlencoded_buffer()
* and ap_unescape_urlencoded().
+ * 20111025.2 (2.3.15-dev) Add ap_lua_ssl_val to mod_lua
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20111025
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
lua_pushstring(L, ap_escape_html(r->pool, s));
return 1;
}
+/* wrap optional ssl_var_lookup as r:ssl_var_lookup(String) */
+static int req_ssl_var_lookup(lua_State *L)
+{
+ request_rec *r = ap_lua_check_request_rec(L, 1);
+ const char *s = luaL_checkstring(L, 2);
+ const char *res = ap_lua_ssl_val(r->pool, r->server, r->connection, r,
+ (char *)s);
+ lua_pushstring(L, res);
+ return 1;
+}
/* BEGIN dispatch mathods for request_rec fields */
/* not really a field, but we treat it like one */
makefun(&req_construct_url, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "escape_html", APR_HASH_KEY_STRING,
makefun(&req_escape_html, APL_REQ_FUNTYPE_LUACFUN, p));
+ apr_hash_set(dispatch, "ssl_var_lookup", APR_HASH_KEY_STRING,
+ makefun(&req_ssl_var_lookup, APL_REQ_FUNTYPE_LUACFUN, p));
apr_hash_set(dispatch, "assbackwards", APR_HASH_KEY_STRING,
makefun(&req_assbackwards_field, APL_REQ_FUNTYPE_BOOLEAN, p));
apr_hash_set(dispatch, "status", APR_HASH_KEY_STRING,
#include "lua_apr.h"
#include "lua_config.h"
+#include "apr_optional.h"
+#include "mod_ssl.h"
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap_lua, AP_LUA, int, lua_open,
(lua_State *L, apr_pool_t *p),
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap_lua, AP_LUA, int, lua_request,
(lua_State *L, request_rec *r),
(L, r), OK, DECLINED)
+static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *lua_ssl_val = NULL;
module AP_MODULE_DECLARE_DATA lua_module;
cfg->root_path = root;
return NULL;
}
+AP_LUA_DECLARE(const char *) ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var)
+{
+ if (lua_ssl_val) {
+ return (const char *)lua_ssl_val(p, s, c, r, (char *)var);
+ }
+ return NULL;
+}
/*******************************/
return OK;
}
+static int lua_post_config(apr_pool_t *pconf, apr_pool_t *plog,
+ apr_pool_t *ptemp, server_rec *s)
+{
+ lua_ssl_val = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
+ return OK;
+}
+
static void lua_register_hooks(apr_pool_t *p)
{
/* ap_register_output_filter("luahood", luahood, NULL, AP_FTYPE_RESOURCE); */
ap_hook_quick_handler(lua_quick_harness, NULL, NULL, APR_HOOK_FIRST);
ap_hook_translate_name(lua_alias_munger, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_post_config(lua_post_config, NULL, NULL, APR_HOOK_MIDDLE);
APR_OPTIONAL_HOOK(ap_lua, lua_open, lua_open_hook, NULL, NULL,
APR_HOOK_REALLY_FIRST);
APR_DECLARE_EXTERNAL_HOOK(ap_lua, AP_LUA, int, lua_request,
(lua_State *L, request_rec *r))
+AP_LUA_DECLARE(const char *) ap_lua_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var);
+
#endif /* !_MOD_LUA_H_ */