]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_lua: Make r.ap_auth_type writable
authorJoe Orton <jorton@apache.org>
Fri, 11 Oct 2024 16:20:44 +0000 (16:20 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 11 Oct 2024 16:20:44 +0000 (16:20 +0000)
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.

Submitted by: Michael Osipov <michaelo apache.org>
PR: 62497
Github: closes #67

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1921260 13f79535-47bb-0310-9956-ffa450edef68

changes-entries/pr62497.txt [new file with mode: 0644]
docs/manual/mod/mod_lua.xml
docs/manual/mod/mod_lua.xml.fr
modules/lua/lua_request.c

diff --git a/changes-entries/pr62497.txt b/changes-entries/pr62497.txt
new file mode 100644 (file)
index 0000000..c4f555d
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_lua: Make r.ap_auth_type writable.  PR 62497.
+     [Michael Osipov <michaelo apache.org>]
index 3a85d6ec8c97e771326f215c0f745d8c73b58610..38528f9465c09f66b5a30c6ba61b33c53d2408a7 100644 (file)
@@ -360,7 +360,7 @@ end
         <tr>
           <td><code>ap_auth_type</code></td>
           <td>string</td>
-          <td>no</td>
+          <td>yes</td>
           <td>If an authentication check was made, this is set to the type
           of authentication (f.x. <code>basic</code>)</td>
         </tr>
index 3931ad5e50b7aa14f5661b722112baaa307cff98..b61b43e7111ace5ad55d4a2a835ce67557027869 100644 (file)
@@ -383,7 +383,7 @@ end
         <tr>
           <td><code>ap_auth_type</code></td>
           <td>string</td>
-          <td>non</td>
+          <td>oui</td>
          <td>Ce champ contient le type d'authentification effectuĂ©e
          (par exemple <code>basic</code>)</td>
         </tr>
index 6787bbfaf7f7e9615c089400e1ad96c691ca3ff4..15605cd76c1b7519547b6fe2d90a939a033f849f 100644 (file)
@@ -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);