4 ###############################################################################
5 ###############################################################################
6 ###############################################################################
8 # THIS SCRIPT IS PROBABLY BROKEN. REMOVING THE -T SWITCH ON THE #! LINE ABOVE
9 # WOULD FIX IT, BUT THIS IS INSECURE. WE RECOMMEND FIXING THE ERRORS WHICH THE
10 # -T SWITCH WILL CAUSE PERL TO REPORT BEFORE RUNNING THIS SCRIPT FROM A CVS
11 # SERVER TRIGGER. PLEASE SEND PATCHES CONTAINING THE CHANGES YOU FIND
12 # NECESSARY TO RUN THIS SCRIPT WITH THE TAINT-CHECKING ENABLED BACK TO THE
13 # <bug-cvs@gnu.org> MAILING LIST.
15 # For more on general Perl security and taint-checking, please try running the
16 # `perldoc perlsec' command.
18 ###############################################################################
19 ###############################################################################
20 ###############################################################################
22 # Perl filter to handle pre-commit checking of files. This program
23 # records the last directory where commits will be taking place for
24 # use by the log_accum.pl script.
26 # IMPORTANT: this script interacts with log_accum, they have to agree
27 # on the tmpfile name to use. See $LAST_FILE below.
29 # Contributed by David Hampton <hampton@cisco.com>
30 # Stripped to minimum by Roy Fielding
32 ############################################################
33 $TMPDIR = $ENV{'TMPDIR'} || '/tmp';
34 $FILE_PREFIX = '#cvs.';
36 # If see a "-u $USER" argument, then destructively remove it from the
37 # argument list, so $ARGV[0] will be the repository dir again, as it
38 # used to be before we added the -u flag.
39 if ($ARGV[0] eq '-u') {
41 $CVS_USERNAME = shift (@ARGV);
44 # This needs to match the corresponding var in log_accum.pl, including
45 # the appending of the pgrp and username suffixes (see uses of this
47 $LAST_FILE = "$TMPDIR/${FILE_PREFIX}lastdir";
50 my ($filename, $line) = @_;
52 # A check of some kind is needed here, but the rules aren't apparent
55 # foreach($filename, $line){
56 # $_ =~ m#^([-\@\w.\#]+)$#;
60 open(FILE, ">$filename") || die("Cannot open $filename: $!\n");
61 print(FILE $line, "\n");
66 # Record this directory as the last one checked. This will be used
67 # by the log_accumulate script to determine when it is processing
68 # the final directory of a multi-directory commit.
72 &write_line("$LAST_FILE.$id.$CVS_USERNAME", $ARGV[0]);