aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/login.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1998-05-27 16:55:49 +0000
committerPeter Wemm <peter@FreeBSD.org>1998-05-27 16:55:49 +0000
commit989c1370291b566c27a207f0fdc8e3106a60116f (patch)
treed5370c7499c0fdde31df0a81181088c20313b848 /contrib/cvs/src/login.c
parent090fc164723cc20e895aad5cbe61ed3a39b89b29 (diff)
downloadsrc-989c1370291b566c27a207f0fdc8e3106a60116f.tar.gz
src-989c1370291b566c27a207f0fdc8e3106a60116f.zip
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 :-)
Notes
Notes: svn path=/head/; revision=36427
Diffstat (limited to 'contrib/cvs/src/login.c')
-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 4ffce36d0fd9..0a74f373dd87 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");
}