diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.PL | 3 | ||||
-rw-r--r-- | gitacl.schema | 49 | ||||
-rwxr-xr-x | gitaclhook | 2 | ||||
-rw-r--r-- | lib/GitACL.pm | 8 |
5 files changed, 58 insertions, 5 deletions
@@ -4,3 +4,4 @@ gitaclhook | |||
4 | lib/GitACL.pm | 4 | lib/GitACL.pm |
5 | lib/GitACL/File.pm | 5 | lib/GitACL/File.pm |
6 | lib/GitACL/LDAP.pm | 6 | lib/GitACL/LDAP.pm |
7 | 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', | |||
22 | 22 | ||
23 | WriteMakefile( | 23 | WriteMakefile( |
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 --- /dev/null +++ b/gitacl.schema | |||
@@ -0,0 +1,49 @@ | |||
1 | # Git LDAP schema items | ||
2 | # | ||
3 | # depends upon: | ||
4 | # nis.schema | ||
5 | |||
6 | attributetype ( 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 | |||
13 | attributetype ( 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 | |||
20 | attributetype ( 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 | |||
26 | attributetype ( 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 | |||
32 | attributetype ( 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 | |||
38 | attributetype ( 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 | |||
44 | objectclass ( 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 | |||
@@ -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})) { |