diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-08-30 10:58:41 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-08-30 10:58:41 +0300 |
commit | 5ed4f7b0dbc72fde6cb94fb051e87f6264115629 (patch) | |
tree | d6689b8c86fc14009bdc109bf48e3fbac4f049cf | |
parent | d45c8b4133e882b3d37ef63930849d714a517010 (diff) | |
download | gitaclhook-master.tar.gz gitaclhook-master.tar.bz2 |
-rw-r--r-- | lib/GitACL.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/GitACL.pm b/lib/GitACL.pm index 4c1cc67..2bb78e5 100644 --- a/lib/GitACL.pm +++ b/lib/GitACL.pm @@ -158,7 +158,7 @@ sub match_ref($$) { my ($self, $expr) = @_; return ($self->{ref} =~ /$expr/) if ($expr =~ /^\^/); - return ("$self->{ref}/" eq $expr or index($self->{ref}, $expr) == 0) + return ("$self->{ref}/" eq $expr || index($self->{ref}, $expr) == 0) if ($expr =~ /\/$/); return $self->{ref} eq $expr; } @@ -180,10 +180,10 @@ sub match_tree($$) { for (my $i = 0; $i <= $#{$self->{tree}}; ) { my $dir = $self->{tree}[$i]; - if (($expr =~ /^\^/ and $dir =~ /$expr/) - or ($expr =~ /\/$/ - and ("$dir/" eq $expr or index($dir, $expr) == 0)) - or $dir eq $expr) { + if (($expr =~ /^\^/ && $dir =~ /$expr/) + || ($expr =~ /\/$/ + && ("$dir/" eq $expr or index($dir, $expr) == 0)) + || $dir eq $expr) { splice(@{$self->{tree}}, $i, 1); } else { ++$i; @@ -202,7 +202,7 @@ sub match_tuple($$) { unless ($x[0] eq 'allow' || $x[0] eq 'deny'); return ( 0, "project mismatch" ) - if ($x[1] ne "all" and $x[1] ne $self->{project_name}); + if ($x[1] ne "all" && $x[1] ne $self->{project_name}); return ( 0, "user mismatch" ) unless $self->match_user($x[2]); return ( 0, "op mismatch" ) @@ -270,12 +270,12 @@ sub new { } $obj->deny("no such user") unless $obj->{user_name}; my $httpdusr = git_value('config', 'hooks.acl.httpd-user'); - if (defined($httpdusr) and $obj->{user_name} eq $httpdusr) { + if (defined($httpdusr) && $obj->{user_name} eq $httpdusr) { $obj->deny("need authenticated user") unless $ENV{AUTH_TYPE}; $obj->{user_name} = $ENV{REMOTE_USER}; $obj->{ip} = $ENV{REMOTE_ADDR}; } else { - my $ipvar = git_value('config', 'hooks.acl.ip-env-var') or 'SSH_CLIENT'; + my $ipvar = git_value('config', 'hooks.acl.ip-env-var') || 'SSH_CLIENT'; if (defined($ENV{$ipvar})) { my @a = split /\S/, $ENV{$ipvar}, 2; $obj->{ip} = $a[0]; |