From owner-freebsd-cvsweb@FreeBSD.ORG Thu Jan 12 04:33:38 2006 Return-Path: X-Original-To: freebsd-cvsweb@freebsd.org Delivered-To: freebsd-cvsweb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A70E16A41F for ; Thu, 12 Jan 2006 04:33:38 +0000 (GMT) (envelope-from noackjr@alumni.rice.edu) Received: from smtp104.biz.mail.re2.yahoo.com (smtp104.biz.mail.re2.yahoo.com [206.190.52.173]) by mx1.FreeBSD.org (Postfix) with SMTP id 8234A43D45 for ; Thu, 12 Jan 2006 04:33:37 +0000 (GMT) (envelope-from noackjr@alumni.rice.edu) Received: (qmail 79934 invoked from network); 12 Jan 2006 04:33:36 -0000 Received: from unknown (HELO optimator.noacks.org) (noackjr@supercrime.org@24.99.22.177 with login) by smtp104.biz.mail.re2.yahoo.com with SMTP; 12 Jan 2006 04:33:36 -0000 Received: from localhost (localhost [127.0.0.1]) by optimator.noacks.org (Postfix) with ESMTP id 05A5A60D4; Wed, 11 Jan 2006 23:33:36 -0500 (EST) Received: from optimator.noacks.org ([127.0.0.1]) by localhost (optimator.noacks.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05045-01; Wed, 11 Jan 2006 23:33:34 -0500 (EST) Received: from [192.168.1.9] (bastion.noacks.org [192.168.1.9]) by optimator.noacks.org (Postfix) with ESMTP id A560060CE; Wed, 11 Jan 2006 23:33:34 -0500 (EST) Message-ID: <43C5DC1C.9040209@alumni.rice.edu> Date: Wed, 11 Jan 2006 23:33:32 -0500 From: Jonathan Noack User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Manuel Lemos References: <43C5CEBC.6070908@acm.org> In-Reply-To: <43C5CEBC.6070908@acm.org> Content-Type: multipart/mixed; boundary="------------040608050106060802090807" X-Virus-Scanned: amavisd-new at noacks.org Cc: freebsd-cvsweb@freebsd.org Subject: Re: Hiding some directories X-BeenThere: freebsd-cvsweb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: noackjr@alumni.rice.edu List-Id: CVS Web maintenance mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2006 04:33:38 -0000 This is a multi-part message in MIME format. --------------040608050106060802090807 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Manuel Lemos wrote: > on 01/11/2006 06:35 PM Jerry.Nairn@microchip.com said the following: > >> Is there a way to hide some directories besides CVSROOT? > > > > See the @ForbiddenFiles array in cvsweb.conf. > > Thanks, that is what I am looking for. > > BTW, I am not familiar enough with Perl. Although I was able to > configure that array to forbid all directories that I did not want, I > wonder if is there a way to specify in that array just a few top level > directories that I want. How about an @AllowedFiles list that only displays files and directories that match? See attached patches for cvsweb.cgi and cvsweb.conf. -Jonathan --------------040608050106060802090807 Content-Type: text/plain; name="cvsweb.cgi.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cvsweb.cgi.diff" --- cvsweb.cgi.old Wed Jan 11 22:12:42 2006 +++ cvsweb.cgi Wed Jan 11 23:15:30 2006 @@ -82,7 +82,7 @@ $allow_log_extra $allow_dir_extra $allow_source_extra $allow_cvsgraph $cvsgraph_config $use_java_script $edit_option_form $show_subdir_lastmod $show_log_in_markup $preformat_in_markup - $tabstop $state $annTable $sel @ForbiddenFiles + $tabstop $state $annTable $sel @ForbiddenFiles @AllowedFiles $use_descriptions %descriptions @mytz $dwhere $use_moddate $gzip_open $file_list_len $allow_tar @tar_options @gzip_options @zip_options @cvs_options @@ -4339,7 +4339,10 @@ # -# See if a file/dir is listed in the config file's @ForbiddenFiles list. +# If a file/dir is listed in the config file's @ForbiddenFiles list, +# forbid access to it. If the @AllowedFiles list is defined in the config +# file then a file/dir must be listed for access to be granted. +# @ForbiddenFiles takes precedence over @AllowedFiles. # Takes a full file system path or one relative to $cvsroot, and strips the # trailing ",v" if present, then compares. Returns 1 if forbidden, else 0. # @@ -4349,6 +4352,12 @@ $path =~ s|^$cvsroot/+||; for my $forbidden_re (@ForbiddenFiles) { return 1 if ($path =~ $forbidden_re); + } + if (($cvsroot ne $path) && (defined(@AllowedFiles))) { + for my $allowed_re (@AllowedFiles) { + return 0 if ($path =~ $allowed_re); + } + return 1; } return 0; } --------------040608050106060802090807 Content-Type: text/plain; name="cvsweb.conf.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cvsweb.conf.diff" --- cvsweb.conf.dist Thu Dec 1 23:10:10 2005 +++ cvsweb.conf Wed Jan 11 23:24:16 2006 @@ -266,6 +266,17 @@ #qr|^my/+secret/+dir|o, ); +# Regular expressions for files and directories which should be shown. +# Each regexp is compared against a path relative to a CVS root, after +# stripping the trailing ",v" if present. Only matching files and +# directories are displayed. +# @ForbiddenFiles takes precedence over @AllowedFiles. +# If @AllowedFiles is not defined, only @ForbiddenFiles is enforced. +# +#@AllowedFiles = ( + #qr|^my/+public/+dir|o, +#); + # Use CVSROOT/descriptions for describing the directories/modules? # See INSTALL, section 9. # --------------040608050106060802090807--