Use "anonymous" rather than "ftp" as login name for anonymous ftp.

Rather than have a separate (misnamed) FTP_ANONYMOUS_PASSWORD constant, use
FTP_ANONYMOUS_USER (i.e. "anonymous") to construct the anonymous ftp password
if getlogin() fails.
This commit is contained in:
des 2001-01-08 13:15:14 +00:00
parent 2e3ba2a4f5
commit e75c537ff5
2 changed files with 3 additions and 4 deletions

View File

@ -5,7 +5,7 @@ LIB= fetch
CFLAGS+= -I. -Wall -pedantic
CFLAGS+= -DINET6
.if !defined(DEBUG)
CFLAGS+= -DNDEBUG
#CFLAGS+= -DNDEBUG
.endif
SRCS= fetch.c common.c ftp.c http.c file.c \
ftperr.h httperr.h

View File

@ -74,8 +74,7 @@
#include "common.h"
#include "ftperr.h"
#define FTP_ANONYMOUS_USER "ftp"
#define FTP_ANONYMOUS_PASSWORD "ftp"
#define FTP_ANONYMOUS_USER "anonymous"
#define FTP_CONNECTION_ALREADY_OPEN 125
#define FTP_OPEN_DATA_CONNECTION 150
@ -779,7 +778,7 @@ _ftp_connect(struct url *url, struct url *purl, char *flags)
pwd = getenv("FTP_PASSWORD");
if (!pwd || !*pwd) {
if ((logname = getlogin()) == 0)
logname = FTP_ANONYMOUS_PASSWORD;
logname = FTP_ANONYMOUS_USER;
gethostname(localhost, sizeof localhost);
snprintf(pbuf, sizeof pbuf, "%s@%s", logname, localhost);
pwd = pbuf;