summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2011-02-14 07:16:55 (GMT)
committer tg(x) <*@tg-x.net>2013-06-05 15:58:40 (GMT)
commit5433f6a3dd621beb152560d64f86f9f1e998221f (patch)
treec09235864ade76e8ea6239949c28042519daaa7f
parenta321956a9c086334addbae62d5d9b784c4835562 (diff)
user_includes setting
-rwxr-xr-xbin/gitzone18
-rw-r--r--etc/gitzone.conf4
2 files changed, 16 insertions, 6 deletions
diff --git a/bin/gitzone b/bin/gitzone
index fa01486..8e3c18a 100755
--- a/bin/gitzone
+++ b/bin/gitzone
@@ -14,7 +14,7 @@ use POSIX qw/strftime/;
use Cwd qw/cwd realpath/;
use File::Basename qw/fileparse/;
-our ($zone_dir, $git, $named_checkzone, $rndc, $class, $default_view, $update_record, $max_depth, $zones, $verbosity);
+our ($zone_dir, $git, $named_checkzone, $rndc, $class, $default_view, $update_record, $user_includes, $max_depth, $zones, $verbosity);
our $user = getpwuid $<;
@ARGV >= 2 or die "Usage: gitzone /path/to/gitzone.conf <command>\n";
@@ -121,11 +121,13 @@ sub process_file {
$line = "$a$s$z\n";
$changed = 1;
} elsif (/^(\W*\$INCLUDE\W+)(\S+)(.*)$/) {
- # check $INCLUDE lines for files outside the user dir
my ($a,$inc_file,$z) = ($1,$2,$3);
- unless ($inc_file =~ m,^$user/, && $inc_file !~ /\.\./) {
- close FILE;
- die "Error in $file:$n: invalid included file name, it should start with: $user/\n";
+ if ($user_includes) {
+ # check $INCLUDE lines for files outside the user dir
+ unless ($inc_file =~ m,^$user/, && $inc_file !~ /\.\./) {
+ close FILE;
+ die "Error in $file:$n: invalid included file name, it should start with: $user/\n";
+ }
}
} else {
if ($n == 1 && /^;INCLUDED_BY\s+(.*)$/) {
@@ -186,7 +188,11 @@ sub check_zones {
$dir = substr $dir, 0, -1;
next unless $files{$file} > 0 && exists $zones->{$user}->{$dir}->{$zone};
- print `$named_checkzone -kn -w .. '$zone' '$user/$file'`;
+ if ($user_includes) {
+ print `$named_checkzone -kn -w .. '$zone' '$user/$file'`;
+ } else {
+ print `$named_checkzone -kn '$zone' '$file'`;
+ }
clean_exit 1 if $?; # error, reject push
push @zones, $file;
}
diff --git a/etc/gitzone.conf b/etc/gitzone.conf
index d2876a0..ab9ae9f 100644
--- a/etc/gitzone.conf
+++ b/etc/gitzone.conf
@@ -17,6 +17,10 @@ $rndc = '/usr/sbin/rndc';
# update-record command: 1 = enabled, 0 = disabled
$update_record = 1;
+# restrict includes to user directories
+# $INCLUDE file names should be prefixed with <username>/ in this case
+$user_includes = 1;
+
# max depth to follow INCLUDED_BY files
$max_depth = 256;
# output verbosity (0..3)