This file is indexed.

/usr/share/perl5/SVN/Hooks/Generic.pm is in libsvn-hooks-perl 1.34-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package SVN::Hooks::Generic;
# ABSTRACT: Implement generic checks for all Subversion hooks.
$SVN::Hooks::Generic::VERSION = '1.34';
use strict;
use warnings;

use Carp;
use Data::Util qw(:check);
use SVN::Hooks;

use Exporter qw/import/;
my $HOOK = 'GENERIC';
our @EXPORT = ($HOOK);


sub GENERIC {
    my (@args) = @_;

    (@args % 2) == 0
	or croak "$HOOK: odd number of arguments.\n";

    my %args = @args;

    while (my ($hook, $functions) = each %args) {
	$hook =~ /(?:(?:pre|post)-(?:commit|lock|revprop-change|unlock)|start-commit)/
	    or die "$HOOK: invalid hook name ($hook)";
	if (is_code_ref($functions)) {
	    $functions = [$functions];
	} elsif (! is_array_ref($functions)) {
	    die "$HOOK: hook '$hook' should be mapped to a CODE-ref or to an ARRAY-ref.\n";
	}
	foreach my $foo (@$functions) {
	    is_code_ref($foo) or die "$HOOK: hook '$hook' should be mapped to CODE-refs.\n";
            unless (exists $SVN::Hooks::Hooks{$hook}{set}{$foo}) {
                push @{$SVN::Hooks::Hooks{$hook}{list}},
                    ($SVN::Hooks::Hooks{$hook}{set}{$foo} = sub { $foo->(@_); });
            }
	}
    }

    return 1;
}

1; # End of SVN::Hooks::Generic

__END__

=pod

=encoding UTF-8

=head1 NAME

SVN::Hooks::Generic - Implement generic checks for all Subversion hooks.

=head1 VERSION

version 1.34

=head1 SYNOPSIS

This SVN::Hooks plugin allows you to easily write generic checks for
all Subversion standard hooks. It's deprecated. You should use the
SVN::Hooks hook defining exported directives instead.

This module is configured by the following directive.

=head2 GENERIC(HOOK => FUNCTION, HOOK => [FUNCTIONS], ...)

This directive associates FUNCTION with a specific HOOK. You can make
more than one association with a single directive call, or you can use
multiple calls to make multiple associations. Moreover, you can
associate a hook with a single function or with a list of functions
(passing them as elements of an array). All functions associated with
a hook will be called in an unspecified order with the same arguments.

Each hook must be associated with functions with a specific signature,
i.e., the arguments that are passed to the function depends on the
hook to which it is associated.

The hooks are specified by their standard names.

The function signatures are the following:

=over

=item post-commit(SVN::Look)

=item post-lock(repos-path, username)

=item post-revprop-change(SVN::Look, username, property-name, action)

=item post-unlock(repos-path, username)

=item pre-commit(SVN::Look)

=item pre-lock(repos-path, path, username, comment, steal-lock-flag)

=item pre-revprop-change(SVN::Look, username, property-name, action)

=item pre-unlock(repos-path, path, username, lock-token, break-unlock-flag)

=item start-commit(repos-path, username, capabilities, txt-name)

=back

The functions may perform whatever checks they want. If the checks
succeed the function must simply return. Otherwise, they must die with
a suitable error message, which will be sent back to the user
performing the Subversion action which triggered the hook.

The sketch below shows how this directive could be used.

	sub my_start_commit {
	    my ($repo_path, $username, $capabilities, $txt_name) = @_;
	    # ...
	}

	sub my_pre_commit {
	    my ($svnlook) = @_;
	    # ...
	}

	GENERIC(
	    'start-commit' => \&my_start_commit,
	    'pre-commit'   => \&my_pre_commit,
	);

=head1 AUTHOR

Gustavo L. de M. Chaves <gnustavo@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by CPqD <www.cpqd.com.br>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut