aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--Makefile.PL3
-rw-r--r--gitacl.schema49
-rwxr-xr-xgitaclhook2
-rw-r--r--lib/GitACL.pm8
5 files changed, 58 insertions, 5 deletions
diff --git a/MANIFEST b/MANIFEST
index c89e6ca..be26d52 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,7 @@
MANIFEST
Makefile.PL
gitaclhook
lib/GitACL.pm
lib/GitACL/File.pm
lib/GitACL/LDAP.pm
+gitacl.schema
diff --git a/Makefile.PL b/Makefile.PL
index 0d5e8b3..db3859d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -19,12 +19,15 @@ use ExtUtils::MakeMaker;
my %pm = ('lib/GitACL.pm' => '$(INST_LIBDIR)/GitACL.pm',
'lib/GitACL/File.pm' => '$(INST_LIBDIR)/GitACL/File.pm',
'lib/GitACL/LDAP.pm' => '$(INST_LIBDIR)/GitACL/LDAP.pm');
WriteMakefile(
'NAME' => 'gitaclhook',
+ 'ABSTRACT_FROM' => 'gitaclhook',
+ 'AUTHOR' => 'Sergey Poznyakoff <gray@gnu.org>',
+ 'LICENSE' => 'gpl',
'FIRST_MAKEFILE' => 'Makefile',
'VERSION' => '1.00',
'PM' => \%pm,
'EXE_FILES' => [ 'gitaclhook' ],
'PREREQ_PM' => { 'Getopt::Long' => 2.34,
'File::Spec' => 3.39 }
diff --git a/gitacl.schema b/gitacl.schema
new file mode 100644
index 0000000..d8083e5
--- /dev/null
+++ b/gitacl.schema
@@ -0,0 +1,49 @@
+# Git LDAP schema items
+#
+# depends upon:
+# nis.schema
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.0 NAME 'gitAclProject'
+ DESC 'Project for which the ACL entry is defined'
+ EQUALITY caseExactMatch
+ SUBSTR caseExactSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256}
+ SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.1 NAME 'gitAclVerb'
+ DESC 'ACL verb'
+ EQUALITY caseExactMatch
+ SUBSTR caseExactSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256}
+ SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.2 NAME 'gitAclOp'
+ DESC 'ACL opcode: any combination of C, D, U or R'
+ EQUALITY caseExactMatch
+ SUBSTR caseExactSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.3 NAME 'gitAclRef'
+ DESC 'Git ref'
+ EQUALITY caseExactMatch
+ SUBSTR caseExactSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.4 NAME 'gitAclOrder'
+ DESC 'an integer to order ACL entries'
+ EQUALITY integerMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
+ SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.9163.2.3.1.5 NAME 'gitAclUser'
+ DESC 'Git username'
+ EQUALITY caseExactMatch
+ SUBSTR caseExactSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
+
+objectclass ( 1.3.6.1.4.1.9163.2.3.2.0 NAME 'gitACL'
+ DESC 'Git Access Control List Entry'
+ SUP top STRUCTURAL
+ MUST ( cn $ gitAclProject $ gitAclVerb )
+ MAY ( gitAclUser $ gitAclOp $ gitAclRef $ gitAclOrder $ description ) )
+
diff --git a/gitaclhook b/gitaclhook
index 61b6d0f..5d0d79b 100755
--- a/gitaclhook
+++ b/gitaclhook
@@ -333,13 +333,13 @@ unless ($ENV{GIT_DIR}) {
"debug|d+" => \$debug,
"test|t" => \$test)
or exit (3);
if ($test) {
abend("--test requires four arguments") unless ($#ARGV == 3);
$args{git_dir} = $ENV{GIT_DIR} = $ARGV[0];
- $args{user_name} = $ARGV[1];
+ $args{user} = $ARGV[1];
$args{op} = $ARGV[2];
$args{ref} = $ARGV[3];
$args{old} = '0000000000000000000000000000000000000000';
$args{new} = '0000000000000000000000000000000000000001';
$args{debug} = $debug;
} else {
diff --git a/lib/GitACL.pm b/lib/GitACL.pm
index 51024ac..57b38b8 100644
--- a/lib/GitACL.pm
+++ b/lib/GitACL.pm
@@ -37,13 +37,13 @@ sub logmsg($$$;$) {
my $status = shift;
my $message = shift;
my $loc = shift;
my $fd;
- open($fd, $self->logfile);
+ open($fd, $self->{logfile});
if ($loc) {
print $fd "$status:$loc: $message\n";
} else {
print $fd "$status: $message\n";
}
close($fd);
@@ -51,13 +51,13 @@ sub logmsg($$$;$) {
sub deny($$;$) {
my ($self, $msg, $loc) = @_;
$self->logmsg("DENY",
"$self->{project_name}:$self->{user_name}:".
- "opstr{$self->{op}}:$self->{ref}:$self->{old}:$self->{new}: $msg",
+ "$opstr{$self->{op}}:$self->{ref}:$self->{old}:$self->{new}: $msg",
$loc);
$self->debug(1, "denied by $loc") if $loc;
print STDERR "denied: $msg\n" unless $self->{quiet};
exit 1;
}
@@ -173,14 +173,14 @@ sub new {
if (defined($args{logfile})) {
$obj->{logfile} = $args{logfile};
} else {
$obj->{logfile} = git_value('config', 'hooks.acllog');
}
- if ($obj->{logfile} && $obj->logfile !~ /[>|]/) {
- $obj->{logfile} = ">>${obj->logfile}";
+ if ($obj->{logfile} && $obj->{logfile} !~ /[>|]/) {
+ $obj->{logfile} = ">>$obj->{logfile}";
}
if (defined($args{quiet})) {
$obj->{quiet} = $args{quiet};
} elsif (!$obj->{debug}) {
$obj->{quiet} = git_value('config', 'hooks.aclquiet');

Return to:

Send suggestions and report system problems to the System administrator.