#!/usr/bin/env perl
#
# $FreeBSD: CVSROOT-src/commitcheck,v 1.26 2002/10/13 23:25:06 peter Exp $

# Local modifications by David P. Reese, Jr. <daver@gomerbud.com>

#
# This script is the first thing that is run at commit time
# to determine whether the committer has commit priviledges.
# (See CVSROOT/commitinfo).
#

use strict;
use warnings;
use lib $ENV{CVSROOT};
use CVSROOT::cfg;
my $CVSROOT = $ENV{CVSROOT} || die "Can't determine CVSROOT (commitcheck)!\n";

#
# Sanity check to make sure we've been run through the wrapper and our
# primary group matches the group that owns the cvs repo.
#
my $GRP=`/usr/bin/id -gn`;
chomp $GRP;
unless ($GRP =~ /^$cfg::CVSGROUP$/) {
	print "You do not have group $cfg::CVSGROUP (commitcheck)!\n";
	exit 1;
}

#
# Does the access control list allow them commit access?
#
system("$CVSROOT/CVSROOT/cvs_acls.pl", @ARGV);
if ($? >> 8) {
	print "Access control checks failed! (cvs_acls.pl)\n";
	exit 1;
}

exit 0;		# Lets do it!
#end
