summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-27 16:55:49 +0000
committerpeter <peter@FreeBSD.org>1998-05-27 16:55:49 +0000
commitd1817d351ae37699891cbdbfbef1f7d89a9dd7c6 (patch)
tree9f9ce9e7ef89d4f2759a26fcebb417801409615a /contrib/cvs/src
parent53e563399c75124fe7a4993fe474d4b620d6d8f8 (diff)
downloadFreeBSD-src-d1817d351ae37699891cbdbfbef1f7d89a9dd7c6.zip
FreeBSD-src-d1817d351ae37699891cbdbfbef1f7d89a9dd7c6.tar.gz
If we are logging into a cvs pserver with the username of "anoncvs",
and we have not done an explicit 'cvs login', then use a default password of "anoncvs". This allows things like: setenv CVSROOT :pserver:anoncvs@anoncvs.freebsd.org:/cvs cvs checkout src (without doing the normal 'cvs login' for pserver mode) but this runs over the :pserver: protocol rather than the more troublesome rsh. Naturally, the server had better be running in -R (readonly) mode :-)
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/login.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/cvs/src/login.c b/contrib/cvs/src/login.c
index 4ffce36..0a74f37 100644
--- a/contrib/cvs/src/login.c
+++ b/contrib/cvs/src/login.c
@@ -293,6 +293,9 @@ get_cvs_password ()
FILE *fp;
char *passfile;
int line_length;
+ int anoncvs;
+
+ anoncvs = (strcmp(CVSroot_username, "anoncvs") == 0);
/* If someone (i.e., login()) is calling connect_to_pserver() out of
context, then assume they have supplied the correct, scrambled
@@ -333,6 +336,10 @@ get_cvs_password ()
fp = CVS_FOPEN (passfile, "r");
if (fp == NULL)
{
+ if (anoncvs) {
+ free (passfile);
+ return strdup("Ay=0=h<Z"); /* scrambled "anoncvs" */
+ }
error (0, errno, "could not open %s", passfile);
free (passfile);
error (1, 0, "use \"cvs login\" to log in first");
@@ -354,6 +361,7 @@ get_cvs_password ()
error (0, errno, "cannot read %s", passfile);
if (fclose (fp) < 0)
error (0, errno, "cannot close %s", passfile);
+ free (passfile);
if (found_it)
{
@@ -373,6 +381,8 @@ get_cvs_password ()
{
if (linebuf)
free (linebuf);
+ if (anoncvs)
+ return strdup("Ay=0=h<Z"); /* scrambled "anoncvs" */
error (0, 0, "cannot find password");
error (1, 0, "use \"cvs login\" to log in first");
}
OpenPOWER on IntegriCloud