From e58a4807bd4092c10066a623bb183fa8ffbebcf6 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Mon, 19 Aug 2019 14:11:18 +0200 Subject: [PATCH] BZ-62497: Make r.ap_auth_type writable via mod_lua This completes the option of setting the remote user by the authentication mechanism which actually verified the user. One possible usecase is that a proxied (upstream) server performs the authentication, but the access log of HTTPd does not contain this information. The upstream server can pass this kind of information back to HTTPd and both servers will have consistent access logs. --- docs/manual/mod/mod_lua.xml | 2 +- docs/manual/mod/mod_lua.xml.fr | 2 +- modules/lua/lua_request.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index 3a85d6ec8c9..38528f9465c 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -360,7 +360,7 @@ end ap_auth_type string - no + yes If an authentication check was made, this is set to the type of authentication (f.x. basic) diff --git a/docs/manual/mod/mod_lua.xml.fr b/docs/manual/mod/mod_lua.xml.fr index 3931ad5e50b..b61b43e7111 100644 --- a/docs/manual/mod/mod_lua.xml.fr +++ b/docs/manual/mod/mod_lua.xml.fr @@ -383,7 +383,7 @@ end ap_auth_type string - non + oui Ce champ contient le type d'authentification effectuée (par exemple basic) diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index 6787bbfaf7f..15605cd76c1 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -2551,6 +2551,12 @@ static int req_newindex(lua_State *L) request_rec *r = ap_lua_check_request_rec(L, 1); key = luaL_checkstring(L, 2); + if (0 == strcmp("ap_auth_type", key)) { + const char *value = luaL_checkstring(L, 3); + r->ap_auth_type = apr_pstrdup(r->pool, value); + return 0; + } + if (0 == strcmp("args", key)) { const char *value = luaL_checkstring(L, 3); r->args = apr_pstrdup(r->pool, value);