summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-06-25 09:36:31 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-06-25 09:36:31 (GMT)
commit33ba97cd28f138b49697273e445b479d42bf42a9 (patch) (side-by-side diff)
treea2d1fe3d439dd92dbcf33e23fc07cfad8d264e52
parentec125e9f860adf89f72e25641c65a1dc79c1e4a9 (diff)
downloadgitaclhook-release-1.00.tar.gz
gitaclhook-release-1.00.tar.bz2
Bugfixes.release-1.00
* gitacl.schema: An example LDAP schema. * MANIFEST: Add gitacl.schema * Makefile.PL: Update. * gitaclhook: Fix passing 'user' parameter in test mode. * lib/GitACL.pm: Fix malformed references.
Diffstat (more/less context) (ignore whitespace changes)
-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
@@ -4,3 +4,4 @@ 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
@@ -22,6 +22,9 @@ my %pm = ('lib/GitACL.pm' => '$(INST_LIBDIR)/GitACL.pm',
WriteMakefile(
'NAME' => 'gitaclhook',
+ 'ABSTRACT_FROM' => 'gitaclhook',
+ 'AUTHOR' => 'Sergey Poznyakoff <gray@gnu.org>',
+ 'LICENSE' => 'gpl',
'FIRST_MAKEFILE' => 'Makefile',
'VERSION' => '1.00',
'PM' => \%pm,
diff --git a/gitacl.schema b/gitacl.schema
new file mode 100644
index 0000000..d8083e5
--- a/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
@@ -336,7 +336,7 @@ unless ($ENV{GIT_DIR}) {
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';
diff --git a/lib/GitACL.pm b/lib/GitACL.pm
index 51024ac..57b38b8 100644
--- a/lib/GitACL.pm
+++ b/lib/GitACL.pm
@@ -40,7 +40,7 @@ sub logmsg($$$;$) {
my $loc = shift;
my $fd;
- open($fd, $self->logfile);
+ open($fd, $self->{logfile});
if ($loc) {
print $fd "$status:$loc: $message\n";
} else {
@@ -54,7 +54,7 @@ sub deny($$;$) {
$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;
@@ -176,8 +176,8 @@ sub new {
} 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})) {

Return to:

Send suggestions and report system problems to the System administrator.