Thread (15 messages) flat view 15 messages, 2 authors, 2016-06-15
STALE3727d

[PATCH 3/5] cvsserver: Allow to override the configuration per access method

From: Frank Lichtenheld <hidden>
Date: 2016-06-15 22:43:00
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

Allow to override the gitcvs.enabled and gitcvs.logfile configuration
variables for each access method (i.e. "ext" or "pserver") in the
form gitcvs.<method>.<var>

Signed-off-by: Frank Lichtenheld <redacted>
---
 Documentation/git-cvsserver.txt |   12 ++++++++++++
 git-cvsserver.perl              |   10 +++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt
index 85d0950..6904aad 100644
--- a/Documentation/git-cvsserver.txt
+++ b/Documentation/git-cvsserver.txt
@@ -68,6 +68,18 @@ Note: you need to ensure each user that is going to invoke git-cvsserver has
 write access to the log file and to the git repository. When offering anon
 access via pserver, this means that the nobody user should have write access
 to at least the sqlite database at the root of the repository.
+
+Both configuration variables can also be overriden for a specific method of
+access. Valid method names are "ext" (for SSH access) and "pserver". The
+following example configuration would disable pserver access while still
+allowing access over SSH.
+------
+   [gitcvs]
+        enabled=0
+
+   [gitcvs "ext"]
+        enabled=1
+------
 --
 3. On the client machine you need to set the following variables.
    CVSROOT should be set as per normal, but the directory should point at the
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 4edb796..5d2b6f3 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -191,7 +191,10 @@ sub req_Root
         }
     }
 
-    unless ( defined ( $cfg->{gitcvs}{enabled} ) and $cfg->{gitcvs}{enabled} =~ /^\s*(1|true|yes)\s*$/i )
+    unless ( ($cfg->{gitcvs}{$state->{method}}{enabled}
+	      and $cfg->{gitcvs}{$state->{method}}{enabled} =~ /^\s*(1|true|yes)\s*$/i)
+	     or ($cfg->{gitcvs}{enabled}
+	      and $cfg->{gitcvs}{enabled} =~ /^\s*(1|true|yes)\s*$/i) )
     {
         print "E GITCVS emulation needs to be enabled on this repo\n";
         print "E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\n";
@@ -200,9 +203,10 @@ sub req_Root
         return 0;
     }
 
-    if ( defined ( $cfg->{gitcvs}{logfile} ) )
+    my $logfile = $cfg->{gitcvs}{$state->{method}}{logfile} || $cfg->{gitcvs}{logfile};
+    if ( $logfile )
     {
-        $log->setfile($cfg->{gitcvs}{logfile});
+        $log->setfile($logfile);
     } else {
         $log->nofile();
     }
-- 
1.5.0.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help