summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkatz <jkatz@cvs.openbsd.org>1997-05-05 20:49:52 +0000
committerjkatz <jkatz@cvs.openbsd.org>1997-05-05 20:49:52 +0000
commit264ddd10fe78d61c67d20bc861889d9a8eec5001 (patch)
tree40e7d8c3ccc27e42d2680eb1f92edc2f546e8b33
parent9ef2cce7830fedd9aacf3de2c679ab968f4ff962 (diff)
This fixes FTP so that it first tries with the username FTP, and then with
the username ANONYMOUS. It works, too :-)
-rw-r--r--usr.bin/ftp/util.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index e379c882d9e..644d8f13d1d 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.7 1997/04/23 20:33:24 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.8 1997/05/05 20:49:51 jkatz Exp $ */
/* $NetBSD: util.c,v 1.7 1997/04/14 09:09:24 lukem Exp $ */
/*
@@ -35,7 +35,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.7 1997/04/23 20:33:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.8 1997/05/05 20:49:51 jkatz Exp $";
#endif /* not lint */
/*
@@ -183,7 +183,7 @@ login(host, user, pass)
char *acct;
char anonpass[MAXLOGNAME + 1 + MAXHOSTNAMELEN]; /* "user@hostname" */
char hostname[MAXHOSTNAMELEN];
- int n, aflag = 0;
+ int n, aflag, retry = 0;
acct = NULL;
if (user == NULL) {
@@ -220,9 +220,16 @@ login(host, user, pass)
user, hp->h_name);
#endif
pass = anonpass;
+ user = "ftp";
+ }
+
+tryagain:
+
+ if (retry) {
user = "anonymous";
}
+
while (user == NULL) {
char *myname = getlogin();
@@ -258,7 +265,12 @@ login(host, user, pass)
if ((n != COMPLETE) ||
(!aflag && acct != NULL && command("ACCT %s", acct) != COMPLETE)) {
warnx("Login failed.");
- return (0);
+ if (retry){
+ return (0);
+ } else
+ retry = 1;
+ goto tryagain;
+
}
if (proxy)
return (1);