[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgit
Subject:    [PATCH] Set environment variables for auth filter.
From:       Hugo =?utf-8?Q?H=C3=B6rnquist?= <hugo () lysator ! liu ! se>
Date:       2018-11-13 12:41:13
Message-ID: 20181113124100.GB7375 () STATENS_laptop
[Download RAW message or body]

Hello again!

A while back I wrote to this list with a problem regarding
environment variables in the authentication filter.
Slightly after I proposed a patch. I'm still interested in
getting this merged.

This patch exposes the CGIT_REPO_* environment variables to
the authentication filters. Which I need for using the
CGIT_REPO_OWNER to give login access. 

I also attached a patch for the documentation, which I
believe should better reflect reality.

-- 
hugo

["0001-Set-environment-flags-before-auth-filters.patch" (text/plain)]

From 2cdefdc06acd658e99c559a9ddaf3f2d3e30b213 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo Hörnquist?= <hugo@hornquist.se>
Date: Sun, 21 Oct 2018 17:09:33 +0200
Subject: [PATCH 1/2] Set environment flags before auth filters.

---
 cgit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cgit.c b/cgit.c
index 6301b87..7a4978e 100644
--- a/cgit.c
+++ b/cgit.c
@@ -1081,6 +1081,9 @@ int cmd_main(int argc, const char **argv)
 		cgit_parse_url(ctx.qry.url);
 	}

+	if (ctx.repo)
+		cgit_prepare_repo_env(ctx.repo);
+
 	/* Before we go any further, we set ctx.env.authenticated by checking to see
 	 * if the supplied cookie is valid. All cookies are valid if there is no
 	 * auth_filter. If there is an auth_filter, the filter decides. */
--
2.19.1


["0002-Update-documentation-about-environment-variables.patch" (text/plain)]

From 6ed1cbc23ae25d1921cd3b20f476729ec620bee2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo Hörnquist?= <hugo@lysator.liu.se>
Date: Tue, 13 Nov 2018 13:35:50 +0100
Subject: [PATCH 2/2] Update documentation about environment variables.

---
 cgitrc.5.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 34b351b..8b23a22 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -717,7 +717,8 @@ source filter::
 	filtered contents is expected on standard output.


-All filters are handed the following environment variables:
+All filters (except for auth-filter, when action is "authenticate-post")
+are handed the following environment variables:

 - CGIT_REPO_URL (from repo.url)
 - CGIT_REPO_NAME (from repo.name)
--
2.19.1



_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic