36 lines
696 B
Perl
Executable file
36 lines
696 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# gitolite shell, invoked from ~/.ssh/authorized_keys
|
|
# ----------------------------------------------------------------------
|
|
|
|
BEGIN {
|
|
# find and set bin dir
|
|
$ENV{GL_BINDIR} = "$ENV{HOME}/bin";
|
|
}
|
|
|
|
use lib $ENV{GL_BINDIR};
|
|
use Gitolite::Rc;
|
|
use Gitolite::Common;
|
|
use Gitolite::Conf::Load;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
my $user = shift or die;
|
|
my $aa;
|
|
my $ref = 'any';
|
|
|
|
my $ret;
|
|
while (<>) {
|
|
chomp;
|
|
|
|
my $perm = '';
|
|
for $aa (qw(R W C)) {
|
|
$ret = access($_, $user, $aa, $ref);
|
|
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
|
|
}
|
|
print "$perm\t$_\n" if $perm =~ /\S/;
|
|
}
|