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) (unidiff)
treea2d1fe3d439dd92dbcf33e23fc07cfad8d264e52
parentec125e9f860adf89f72e25641c65a1dc79c1e4a9 (diff)
downloadgitaclhook-33ba97cd28f138b49697273e445b479d42bf42a9.tar.gz
gitaclhook-33ba97cd28f138b49697273e445b479d42bf42a9.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
4lib/GitACL.pm 4lib/GitACL.pm
5lib/GitACL/File.pm 5lib/GitACL/File.pm
6lib/GitACL/LDAP.pm 6lib/GitACL/LDAP.pm
7gitacl.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',
22 22
23WriteMakefile( 23WriteMakefile(
24 'NAME' => 'gitaclhook', 24 'NAME' => 'gitaclhook',
25 'ABSTRACT_FROM' => 'gitaclhook',
26 'AUTHOR' => 'Sergey Poznyakoff <gray@gnu.org>',
27 'LICENSE' => 'gpl',
25 'FIRST_MAKEFILE' => 'Makefile', 28 'FIRST_MAKEFILE' => 'Makefile',
26 'VERSION' => '1.00', 29 'VERSION' => '1.00',
27 'PM' => \%pm, 30 '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 @@
1# Git LDAP schema items
2#
3# depends upon:
4# nis.schema
5
6attributetype ( 1.3.6.1.4.1.9163.2.3.1.0 NAME 'gitAclProject'
7 DESC 'Project for which the ACL entry is defined'
8 EQUALITY caseExactMatch
9 SUBSTR caseExactSubstringsMatch
10 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256}
11 SINGLE-VALUE )
12
13attributetype ( 1.3.6.1.4.1.9163.2.3.1.1 NAME 'gitAclVerb'
14 DESC 'ACL verb'
15 EQUALITY caseExactMatch
16 SUBSTR caseExactSubstringsMatch
17 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256}
18 SINGLE-VALUE )
19
20attributetype ( 1.3.6.1.4.1.9163.2.3.1.2 NAME 'gitAclOp'
21 DESC 'ACL opcode: any combination of C, D, U or R'
22 EQUALITY caseExactMatch
23 SUBSTR caseExactSubstringsMatch
24 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
25
26attributetype ( 1.3.6.1.4.1.9163.2.3.1.3 NAME 'gitAclRef'
27 DESC 'Git ref'
28 EQUALITY caseExactMatch
29 SUBSTR caseExactSubstringsMatch
30 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
31
32attributetype ( 1.3.6.1.4.1.9163.2.3.1.4 NAME 'gitAclOrder'
33 DESC 'an integer to order ACL entries'
34 EQUALITY integerMatch
35 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
36 SINGLE-VALUE )
37
38attributetype ( 1.3.6.1.4.1.9163.2.3.1.5 NAME 'gitAclUser'
39 DESC 'Git username'
40 EQUALITY caseExactMatch
41 SUBSTR caseExactSubstringsMatch
42 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
43
44objectclass ( 1.3.6.1.4.1.9163.2.3.2.0 NAME 'gitACL'
45 DESC 'Git Access Control List Entry'
46 SUP top STRUCTURAL
47 MUST ( cn $ gitAclProject $ gitAclVerb )
48 MAY ( gitAclUser $ gitAclOp $ gitAclRef $ gitAclOrder $ description ) )
49
diff --git a/gitaclhook b/gitaclhook
index 61b6d0f..5d0d79b 100755
--- a/gitaclhook
+++ b/gitaclhook
@@ -336,7 +336,7 @@ unless ($ENV{GIT_DIR}) {
336 if ($test) { 336 if ($test) {
337 abend("--test requires four arguments") unless ($#ARGV == 3); 337 abend("--test requires four arguments") unless ($#ARGV == 3);
338 $args{git_dir} = $ENV{GIT_DIR} = $ARGV[0]; 338 $args{git_dir} = $ENV{GIT_DIR} = $ARGV[0];
339 $args{user_name} = $ARGV[1]; 339 $args{user} = $ARGV[1];
340 $args{op} = $ARGV[2]; 340 $args{op} = $ARGV[2];
341 $args{ref} = $ARGV[3]; 341 $args{ref} = $ARGV[3];
342 $args{old} = '0000000000000000000000000000000000000000'; 342 $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($$$;$) {
40 my $loc = shift; 40 my $loc = shift;
41 my $fd; 41 my $fd;
42 42
43 open($fd, $self->logfile); 43 open($fd, $self->{logfile});
44 if ($loc) { 44 if ($loc) {
45 print $fd "$status:$loc: $message\n"; 45 print $fd "$status:$loc: $message\n";
46 } else { 46 } else {
@@ -54,7 +54,7 @@ sub deny($$;$) {
54 54
55 $self->logmsg("DENY", 55 $self->logmsg("DENY",
56 "$self->{project_name}:$self->{user_name}:". 56 "$self->{project_name}:$self->{user_name}:".
57 "opstr{$self->{op}}:$self->{ref}:$self->{old}:$self->{new}: $msg", 57 "$opstr{$self->{op}}:$self->{ref}:$self->{old}:$self->{new}: $msg",
58 $loc); 58 $loc);
59 59
60 $self->debug(1, "denied by $loc") if $loc; 60 $self->debug(1, "denied by $loc") if $loc;
@@ -176,8 +176,8 @@ sub new {
176 } else { 176 } else {
177 $obj->{logfile} = git_value('config', 'hooks.acllog'); 177 $obj->{logfile} = git_value('config', 'hooks.acllog');
178 } 178 }
179 if ($obj->{logfile} && $obj->logfile !~ /[>|]/) { 179 if ($obj->{logfile} && $obj->{logfile} !~ /[>|]/) {
180 $obj->{logfile} = ">>${obj->logfile}"; 180 $obj->{logfile} = ">>$obj->{logfile}";
181 } 181 }
182 182
183 if (defined($args{quiet})) { 183 if (defined($args{quiet})) {

Return to:

Send suggestions and report system problems to the System administrator.