From: wessels <> Date: Thu, 4 Apr 1996 11:33:09 +0000 (+0000) Subject: This is a patch that adds the configuration directive ftp_user. X-Git-Tag: SQUID_3_0_PRE1~6298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb263c4c2a5e885de1f5758ee43dbd3d0699ad13;p=thirdparty%2Fsquid.git This is a patch that adds the configuration directive ftp_user. this directive can be used to change the email address used for anonymous ftp. Note that perl.com requires that the email address can be validated using SMTP VRFY (i.e. it has to be a valid email address) The patch is as always available on my web page http://www.his.se/ida/~squid/ /Henrik --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 8a09350021..0a9d3ba58d 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,4 +1,4 @@ -/* $Id: cache_cf.cc,v 1.10 1996/03/29 21:14:32 wessels Exp $ */ +/* $Id: cache_cf.cc,v 1.11 1996/04/04 04:33:09 wessels Exp $ */ /* DEBUG: Section 3 cache_cf: Configuration file parsing */ @@ -63,6 +63,7 @@ static struct { char *debugOptions; char *pidFilename; char *visibleHostname; + char *ftpUser; } Config; #define DefaultMemMaxSize (16 << 20) /* 16 MB */ @@ -121,6 +122,7 @@ static struct { #define DefaultSingleParentBypass 0 /* default off */ #define DefaultPidFilename (char *)NULL /* default NONE */ #define DefaultVisibleHostname (char *)NULL /* default NONE */ +#define DefaultFtpUser "cached@" /* Default without domain */ extern char *config_file; @@ -968,6 +970,17 @@ static void parseVisibleHostnameLine(line_in) Config.visibleHostname = xstrdup(token); } +static void parseFtpUserLine(line_in) + char *line_in; +{ + char *token; + token = strtok(NULL, w_space); + safe_free(Config.ftpUser); + if (token == (char *) NULL) + self_destruct(line_in); + Config.ftpUser = xstrdup(token); +} + int parseConfigFile(file_name) char *file_name; { @@ -1226,6 +1239,9 @@ int parseConfigFile(file_name) else if (!strcmp(token, "visible_hostname")) parseVisibleHostnameLine(line_in); + else if (!strcmp(token, "ftp_user")) + parseFtpUserLine(line_in); + /* If unknown, treat as a comment line */ else { /* EMPTY */ ; @@ -1461,6 +1477,10 @@ char *getVisibleHostname() { return Config.visibleHostname; } +char *getFtpUser() +{ + return Config.ftpUser; +} int setAsciiPortNum(p) int p; @@ -1542,6 +1562,7 @@ static void configSetFactoryDefaults() Config.Accel.withProxy = DefaultAccelWithProxy; Config.pidFilename = safe_xstrdup(DefaultPidFilename); Config.visibleHostname = safe_xstrdup(DefaultVisibleHostname); + Config.ftpUser = safe_xstrdup(DefaultFtpUser); } static void configDoConfigure() diff --git a/src/ftp.cc b/src/ftp.cc index 7984589e1b..2603460bb6 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,4 +1,4 @@ -/* $Id: ftp.cc,v 1.18 1996/04/04 01:30:43 wessels Exp $ */ +/* $Id: ftp.cc,v 1.19 1996/04/04 04:33:11 wessels Exp $ */ /* * DEBUG: Section 9 ftp: FTP @@ -84,7 +84,7 @@ int ftp_url_parser(url, data) if (t < 3) { strcpy(host, user); /* no login/passwd information */ strcpy(user, "anonymous"); - strcpy(password, "harvest@"); + strcpy(password, getFtpUser()); } /* we need to convert user and password for URL encodings */ tmp = url_convert_hex(user);