=================================================================== RCS file: /cvsrepo/anoncvs/cvs/www/anoncvs.shar,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** www/anoncvs.shar 2005/02/25 20:33:16 1.18 --- www/anoncvs.shar 2008/06/10 22:52:11 1.19 *************** *** 5,14 **** --- 5,32 ---- # # This archive contains: # + # anoncvs.shar # Makefile # README # anoncvssh.c # + echo x - anoncvs.shar + sed 's/^X//' >anoncvs.shar << 'END-of-anoncvs.shar' + X# This is a shell archive. Save it in a file, remove anything before + X# this line, and then unpack it by entering "sh file". Note, it may + X# create directories; files and directories will be owned by you and + X# have default permissions. + X# + X# This archive contains: + X# + X# anoncvs.shar + X# Makefile + X# README + X# anoncvssh.c + X# + Xecho x - anoncvs.shar + Xsed 's/^X//' >anoncvs.shar << 'END-of-anoncvs.shar' + END-of-anoncvs.shar echo x - Makefile sed 's/^X//' >Makefile << 'END-of-Makefile' X#CVSROOT=anoncvs@anoncvs1.usa.openbsd.org:/cvs *************** *** 59,64 **** --- 77,84 ---- X8) Once you get the distribution in, set up a cron job to run sup X periodically to keep your server up to date. X + X9) Enabling OpenCVS anoncvs. + X X********************************************************************** XSTEP 1) find enough disk space. X You need roughly 2GB. *************** *** 256,261 **** --- 276,310 ---- X-o' is done every few days because sup is not very robust. X X********************************************************************** + XSTEP 9): Enabling OpenCVS anoncvs. + X + XThe next step is to enable OpenCVS, which will run on your system next + Xto the normal GNU cvs server. This will become the default in the + Xfuture. + X + XFirst off, create a new user account "opencvs" like you did for your + Xnormal anoncvs user: + X + Xopencvs::32766:32766::0:0:Anonymous OpenCVS User:/open/anoncvs:/open/anoncvssh + X + XBe sure that the uid and gid are unique for your system, if the ones + Xabove aren't, pick different values. + X + X#define OPENCVS_USER "opencvs" + X + XRecompile anoncvssh.c and install the binary setuid-root in /open/anoncvssh. + X + XCompile and install a current /usr/bin/opencvs. + X + XCopy /usr/bin/opencvs to /open/anoncvs/usr/bin/opencvs + X + XYou can now use OpenCVS anoncvs by using the correct CVSROOT: + X + X opencvs@anoncvs.openbsd.org:/cvs + X + XIf you encounter bugs, send them to joris@openbsd.org + X + X********************************************************************** XEXAMPLE LAYOUT X XExample layout for OpenBSD. In this example "deraadt" is the $SUPUSER. *************** *** 457,474 **** X#endif X X/* ! X * Account and host name to be used when accessing the ! X * CVS repository remotely X */ X#ifndef HOSTNAME ! X#define HOSTNAME "anoncvs@anoncvs1.usa.openbsd.org" X#endif X X/* ! X * $CVSROOT is created based on HOSTNAME and LOCALROOT above X */ X#ifndef CVSROOT ! X#define CVSROOT HOSTNAME ":"LOCALROOT X#endif X X/* --- 506,529 ---- X#endif X X/* ! X * Hostname to be used when accessing the remote repository. X */ X#ifndef HOSTNAME ! X#define HOSTNAME "anoncvs1.usa.openbsd.org" X#endif X X/* ! X * Username to be used when accessing the remote repository. X */ + X#ifndef USERNAME + X#define USERNAME "anoncvs" + X#endif + X + X/* + X * $CVSROOT is created based on USERNAME HOSTNAME and LOCALROOT above + X */ X#ifndef CVSROOT ! X#define CVSROOT USERNAME "@" HOSTNAME ":"LOCALROOT X#endif X X/* *************** *** 498,505 **** X/* Define ANONCVS_USER if you want anoncvssh to complain if invoked by X * anyone other than root or ANONCVS_USER. X */ ! X/* #define ANONCVS_USER "anoncvs" */ X Xint main __P((int, char *[])); X Xchar * const env[] = { --- 553,566 ---- X/* Define ANONCVS_USER if you want anoncvssh to complain if invoked by X * anyone other than root or ANONCVS_USER. X */ ! X/* #define ANONCVS_USER USERNAME */ X + X/* + X * If you want to be able to run an alternate OpenCVS binary on your + X * anoncvs server, define OPENCVS_USER as the user who will invoke it. + X */ + X#define OPENCVS_USER "opencvs" + X Xint main __P((int, char *[])); X Xchar * const env[] = { *************** *** 520,525 **** --- 581,589 ---- X#ifdef DEBUG X int i; X#endif /* DEBUG */ + X#if defined(OPENCVS_USER) + X int opencvs; + X#endif X X pw = getpwuid(getuid()); X if (pw == NULL) { *************** *** 559,564 **** --- 623,635 ---- X chdir("/"); X setuid(pw->pw_uid); X + X#if defined(OPENCVS_USER) + X if (!strcmp(pw->pw_name, OPENCVS_USER)) + X opencvs = 1; + X else + X opencvs = 0; + X#endif + X X /* X * program now "safe" X */ *************** *** 570,576 **** X int slen; X struct sockaddr_in my_sa, peer_sa; X char *us, *them; ! X X slen = sizeof(my_sa); X if (getsockname(0, (struct sockaddr *) &my_sa, &slen) X != 0) { --- 641,655 ---- X int slen; X struct sockaddr_in my_sa, peer_sa; X char *us, *them; ! X ! X#if defined(OPENCVS_USER) ! X if (opencvs == 1) { ! X fprintf(stderr, "OpenCVS does not support pserver\n"); ! X sleep(10); ! X exit(1); ! X } ! X#endif ! X X slen = sizeof(my_sa); X if (getsockname(0, (struct sockaddr *) &my_sa, &slen) X != 0) { *************** *** 616,621 **** --- 695,704 ---- X fprintf(stderr,"version of CVS on your local machine.\n"); X fprintf(stderr,"Then set your CVSROOT environment variable "); X fprintf(stderr,"to the following value:\n"); + X#if defined(OPENCVS_USER) + X fprintf(stderr, "\t%s@%s:%s for OpenCVS\n", OPENCVS_USER, + X HOSTNAME, LOCALROOT); + X#endif X fprintf(stderr,"\t%s\n\n", CVSROOT); X#ifdef DEBUG X fprintf(stderr, "argc = %d\n", argc); *************** *** 625,631 **** X sleep(10); X exit(0); X } ! X execle("/usr/bin/cvs", "cvs", "server", (char *)NULL, env); X perror("execle: cvs"); X fprintf(stderr, "unable to exec CVS server!\n"); X exit(1); --- 708,725 ---- X sleep(10); X exit(0); X } ! X ! X#if defined(OPENCVS_USER) ! X if (opencvs == 1) { ! X execle("/usr/bin/opencvs", "opencvs", ! X "server", (char *)NULL, env); ! X } else { ! X#endif ! X execle("/usr/bin/cvs", "cvs", "server", (char *)NULL, env); ! X#if defined(OPENCVS_USER) ! X } ! X#endif ! X X perror("execle: cvs"); X fprintf(stderr, "unable to exec CVS server!\n"); X exit(1);