#include <stdlib.h>
#include <unistd.h>

/* change these values to suit your setup */
#define BASE "/usr/local/site/cvsroot"
#define OWNER_UID 287
#define OWNER_GID 287

int main(int argc, char *argv[])
{
	int res;

	res = chdir(BASE);
	if ( res ) exit(1); 

	res = chroot(BASE);
	if ( res ) exit(2); 

	res = setgid(OWNER_GID);
	if ( res ) exit(3); 

	res = setuid(OWNER_UID);
	if ( res ) exit(4); 

	/* there should be --allow-root string for every
	   repository you are going to allow access to */
	execl("/bin/cvs", "cvs", 
		"--allow-root=/projectname1",
		"--allow-root=/projectname2",
		"--allow-root=/projectname3",
		"pserver",
		NULL);
	exit(3);
}
