Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /insurrection/src/

Project highlights: A modern, light-weight, self-contained, web-based toolset for Subversion repository browsing and administration.  A live system can be seen in action here.

insurrection
Discussion topic

Back to topic list

CVS update: /insurrection/src/

Author mksoft
Full name Michae Sinz
Date 2005-04-16 15:21:40 PDT
Message User: mksoft
Date: 05/04/16 15:21:40

Added:
 /insurrection/src/
  auth_blame.cgi, auth_diff.cgi, auth_get.cgi, auth_log.cgi

Modified:
 /insurrection/src/
  .htaccess, admin.cgi, admin.pl, blame.cgi, diff.cgi, get.cgi, log.cgi,
  styles.css

Log:
 Added authentication checks to all of the access scripts such that we can
 make per-repository restricted access rules. Made auth_* versions of all
 of these scripts that require authentication for access suxh that we can
 have annonymous and restricted access in the same server.
 
 It looks a bit ugly, but it should do the job.
 

File Changes:

Directory: /insurrection/src/
=============================

File [changed]: .htaccess
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/.htaccess?r1=1.3​&r2=1.4
Delta lines: +20 -4
--------------------
--- .htaccess 7 Apr 2005 15:49:42 -0000 1.3
+++ .htaccess 16 Apr 2005 22:21:39 -0000 1.4
@@ -7,27 +7,43 @@
     require valid-user
 </Files>
 
-<Files ~ "log.cgi">
+<Files ~ "admin.cgi">
     SetHandler cgi-script
     require valid-user
 </Files>
 
+<Files ~ "log.cgi">
+ SetHandler cgi-script
+</Files>
+
 <Files ~ "get.cgi">
     SetHandler cgi-script
- require valid-user
 </Files>
 
 <Files ~ "diff.cgi">
     SetHandler cgi-script
- require valid-user
 </Files>
 
 <Files ~ "blame.cgi">
     SetHandler cgi-script
+</Files>
+
+<Files ~ "auth_log.cgi">
+ SetHandler cgi-script
     require valid-user
 </Files>
 
-<Files ~ "admin.cgi">
+<Files ~ "auth_get.cgi">
+ SetHandler cgi-script
+ require valid-user
+</Files>
+
+<Files ~ "auth_diff.cgi">
+ SetHandler cgi-script
+ require valid-user
+</Files>
+
+<Files ~ "auth_blame.cgi">
     SetHandler cgi-script
     require valid-user
 </Files>

File [changed]: admin.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/admin.cgi?r1=1.4​&r2=1.5
Delta lines: +3 -3
-------------------
--- admin.cgi 16 Apr 2005 07:56:33 -0000 1.4
+++ admin.cgi 16 Apr 2005 22:21:39 -0000 1.5
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: admin.cgi,v 1.4 2005/04/16 07:56:33 mksoft Exp $
+# $Id: admin.cgi,v 1.5 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the management of the web/svn access
@@ -432,7 +432,7 @@
    print '<tr><td';
    print ' colspan=2' if (!defined $rSize{$group});
    print '>';
- print '<a href="/svn/' , $group , '">' if (defined $rSize{$group});
+ print '<a href="/svn/' , $group , '/">' if (defined $rSize{$group});
    print $group;
    print '</a>' if (defined $rSize{$group});
    print '</td><td align=right>' , $rSize{$group} , 'k' if (defined $rSize{$group});
@@ -445,7 +445,7 @@
 
 print '</form>';
 
-&svn_TRAILER('$Id: admin.cgi,v 1.4 2005/04/16 07:56:33 mksoft Exp $',$AuthUser);
+&svn_TRAILER('$Id: admin.cgi,v 1.5 2005/04/16 22:21:39 mksoft Exp $',$AuthUser);
 
 # all done...
 exit 0;

File [changed]: admin.pl
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/admin.pl?r1=1.5​&r2=1.6
Delta lines: +46 -1
--------------------
--- admin.pl 16 Apr 2005 07:39:50 -0000 1.5
+++ admin.pl 16 Apr 2005 22:21:39 -0000 1.6
@@ -1,5 +1,5 @@
 #
-# $Id: admin.pl,v 1.5 2005/04/16 07:39:50 mksoft Exp $
+# $Id: admin.pl,v 1.6 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # These are the constants that define some of the subversion configuration
@@ -38,6 +38,51 @@
 $accessVersion; ## The version of the access file
 $passwdVersion; ## The version of the password file
 
+###################​####################​####################​###################
+#
+# This call will check if the given repository/path is available to the
+# authorized user.
+#
+sub checkAuthPath($path)
+{
+ my $path = shift;
+
+ ## Append a bit just in case it was not already there...
+ $path .= '/';
+
+ ## Check if we have loaded the admin stuff yet...
+ &loadAccessFile() if (!defined $groupUsers);
+
+ ## Just to make it easier, we add the ":" before the first slash
+ ## in order to match the paths....
+
+ ## NOTE! Currently we just support repository root
+ $path =~ s|^/?([^/]+)/.*$|$1:/|;
+
+ ## Now lets check...
+ return 1 if ((defined ${groupUsers{$path​}}{$AuthUser}) || (defined ${groupUsers{$path}}{'*'}));
+
+ if (!defined $AuthUser)
+ {
+ ## We are not authorized and we are not an authorized user, so
+ ## redirect to the authorization version of this script
+ my $target = $cgi->url;
+ $target =~ s:^(.*)/([^/]+)$:$1/auth_$2:;
+
+ ## just in case a double auth happened...
+ $target =~ s:/auth_auth_:/auth_:;
+
+ ## Now put the rest of the full URL together...
+ $target .= substr($cgi->sel​f_url,length($cgi-​>url));
+
+ print $cgi->redirect($target);
+ }
+ else
+ {
+ print "Status: 403 Access Denied\n\n";
+ }
+ exit 0;
+}
 
 ####################​####################​####################​##################
 #

File [added]: auth_blame.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/auth_blame.cgi?rev​=1.1&content-typ​e=text/vnd.viewcvs-m​arkup
Added lines: 0
--------------

File [added]: auth_diff.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/auth_diff.cgi?rev=​1.1&content-type​=text/vnd.viewcvs-ma​rkup
Added lines: 0
--------------

File [added]: auth_get.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/auth_get.cgi?rev=1​.1&content-type=​text/vnd.viewcvs-mar​kup
Added lines: 0
--------------

File [added]: auth_log.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/auth_log.cgi?rev=1​.1&content-type=​text/vnd.viewcvs-mar​kup
Added lines: 0
--------------

File [changed]: blame.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/blame.cgi?r1=1.5​&r2=1.6
Delta lines: +5 -7
-------------------
--- blame.cgi 12 Apr 2005 19:50:05 -0000 1.5
+++ blame.cgi 16 Apr 2005 22:21:39 -0000 1.6
@@ -1,17 +1,15 @@
 #!/usr/bin/perl
 #
-# $Id: blame.cgi,v 1.5 2005/04/12 19:50:05 mksoft Exp $
+# $Id: blame.cgi,v 1.6 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the display of the "svn blame"
 # output for a specific version.
 #
-require 'common.pl';
+require 'admin.pl';
 
-use CGI;
-
-# Set up our CGI context and get some information
-my $cgi = new CGI;
+## First, lets see if we are allowed to look here:
+&checkAuthPath(​$cgi->path_info)​;
 
 ## Get the revision
 my $rev = $cgi->param('r');
@@ -75,5 +73,5 @@
    print '</table>';
 }
 
-&svn_TRAILER('$Id: blame.cgi,v 1.5 2005/04/12 19:50:05 mksoft Exp $',$cgi->remote_user);
+&svn_TRAILER('$Id: blame.cgi,v 1.6 2005/04/16 22:21:39 mksoft Exp $',$cgi->remote_user);
 

File [changed]: diff.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/diff.cgi?r1=1.6​&r2=1.7
Delta lines: +5 -7
-------------------
--- diff.cgi 12 Apr 2005 19:50:05 -0000 1.6
+++ diff.cgi 16 Apr 2005 22:21:39 -0000 1.7
@@ -1,16 +1,14 @@
 #!/usr/bin/perl
 #
-# $Id: diff.cgi,v 1.6 2005/04/12 19:50:05 mksoft Exp $
+# $Id: diff.cgi,v 1.7 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the display of SVN diff
 #
-require 'common.pl';
+require 'admin.pl';
 
-use CGI;
-
-# Set up our CGI context and get some information
-my $cgi = new CGI;
+## First, lets see if we are allowed to look here:
+&checkAuthPath(​$cgi->path_info)​;
 
 ## Get the revision
 my $rev1 = $cgi->param('r1');
@@ -81,5 +79,5 @@
 
 print $results;
 
-&svn_TRAILER('$Id: diff.cgi,v 1.6 2005/04/12 19:50:05 mksoft Exp $',$cgi->remote_user);
+&svn_TRAILER('$Id: diff.cgi,v 1.7 2005/04/16 22:21:39 mksoft Exp $',$cgi->remote_user);
 

File [changed]: get.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/get.cgi?r1=1.3​&r2=1.4
Delta lines: +4 -6
-------------------
--- get.cgi 28 Feb 2005 17:50:41 -0000 1.3
+++ get.cgi 16 Apr 2005 22:21:39 -0000 1.4
@@ -1,16 +1,14 @@
 #!/usr/bin/perl
 #
-# $Id: get.cgi,v 1.3 2005/02/28 17:50:41 mksoft Exp $
+# $Id: get.cgi,v 1.4 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the display of a specific version
 #
-require 'common.pl';
+require 'admin.pl';
 
-use CGI;
-
-# Set up our CGI context and get some information
-my $cgi = new CGI;
+## First, lets see if we are allowed to look here:
+&checkAuthPath(​$cgi->path_info)​;
 
 ## Get the revision
 my $rev = $cgi->param('r');

File [changed]: log.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/log.cgi?r1=1.7​&r2=1.8
Delta lines: +5 -7
-------------------
--- log.cgi 12 Apr 2005 19:50:05 -0000 1.7
+++ log.cgi 16 Apr 2005 22:21:39 -0000 1.8
@@ -1,16 +1,14 @@
 #!/usr/bin/perl
 #
-# $Id: log.cgi,v 1.7 2005/04/12 19:50:05 mksoft Exp $
+# $Id: log.cgi,v 1.8 2005/04/16 22:21:39 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the display of SVN history/logs
 #
-require 'common.pl';
+require 'admin.pl';
 
-use CGI;
-
-# Set up our CGI context and get some information
-my $cgi = new CGI;
+## First, lets see if we are allowed to look here:
+&checkAuthPath(​$cgi->path_info)​;
 
 ## Get the local document URL
 my $logURL = &svn_URL($cgi-​>path_info);
@@ -94,6 +92,6 @@
        , '<h3>Log command:</h3>'
        , '<pre>' , $cmd , '</pre>';
 
- &svn_TRAILER('$Id: log.cgi,v 1.7 2005/04/12 19:50:05 mksoft Exp $',$cgi->remote_user);
+ &svn_TRAILER('$Id: log.cgi,v 1.8 2005/04/16 22:21:39 mksoft Exp $',$cgi->remote_user);
 }
 

File [changed]: styles.css
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/styles.css?r1=1.17​&r2=1.18
Delta lines: +6 -1
-------------------
--- styles.css 16 Apr 2005 07:39:50 -0000 1.17
+++ styles.css 16 Apr 2005 22:21:39 -0000 1.18
@@ -1,4 +1,4 @@
-/* $Id: styles.css,v 1.17 2005/04/16 07:39:50 mksoft Exp $ */
+/* $Id: styles.css,v 1.18 2005/04/16 22:21:39 mksoft Exp $ */
 
 BODY
 {
@@ -309,6 +309,11 @@
 .dirarrow:hover
 {
   background: rgb(100%,100%,50%);
+}
+
+.editable
+{
+ cursor: pointer; cursor: hand;
 }
 
 .editable:hover




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@insu​rrection.tigris.org
For additional commands, e-mail: cvs-help@insurrectio​n.tigris.org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /insurrection/src/ mksoft Michae Sinz 2005-04-16 15:21:40 PDT
Messages per page: