This patch does not apply on 4.9, doesnt matter as its just a diagnostic To: des_ERASE@.FreeBSD Subject: 4.3-RELEASE/src/lib/libfetch/ftp.c.diff to force proxy working From: "Julian H. Stacey" Organization: Vector Systems Ltd - Munich Unix & Internet consultancy X-Web: http://www.berklix.com/~jhs/ Hi des_ERASE@.FreeBSD.org I am getting fetch: ftpmotd: Not logged in & my proxy ftpd.log reports: Jun 22 17:20:14 park ftpd[9965]: command: USER anonymous@.wind Jun 22 17:20:14 park ftpd[9965]: <--- 331 Jun 22 17:20:14 park ftpd[9965]: Password required for anonymous@wind Jun 22 17:20:14 park ftpd[9965]: command: PASS ??? Jun 22 17:20:14 park ftpd[9965]: <--- 530 Jun 22 17:20:14 park ftpd[9965]: Login incorrect. I am running 4.3-RELEASE on host=wind (the source & target) & running 4.1.1-RELEASE on proxy host=park on host wind: printenv | grep -i tp | sort ALL_PROXY=http://gate FTPSERVER=gate FTP_PASSWORD=jhs_ERASE_@berklix.com HTTP_PROXY=http://gate:80 MASTER_SITES=ftp://flip/public/freebsd/distfiles/MASTER_SITES_from_etc_csh.cshrc/ MASTER_SITE_OVERRIDE=ftp://flip/public/FreeBSD/distfiles/ WWW_HOME=http://gate all_proxy=http://gate ftp_proxy=ftp://gate http_proxy=http://gate:80 I have solved it for me with the following patch, but its clearly not acceptable to you, as your trying to do something more fancy, but I'm not sure what, seems to me your passing in more info that 4.1.1 ftpd as a proxy barfs at, not sure what the proper solution is ? Can I help ? Or am I just wrongly configured ? ------- *** 4.3-RELEASE/src/lib/libfetch/ftp.c Sat Apr 7 19:30:48 2001 --- jhs/src/lib/libfetch/ftp.c Fri Jun 22 17:40:30 2001 *************** *** 763,777 **** /* send user name and password */ user = url->user; if (!user || !*user) user = getenv("FTP_LOGIN"); if (!user || !*user) user = FTP_ANONYMOUS_USER; ! if (purl && url->port == _fetch_default_port(url->scheme)) e = _ftp_cmd(cd, "USER %s@%s", user, url->host); ! else if (purl) ! e = _ftp_cmd(cd, "USER %s@%s@%d", user, url->host, url->port); ! else e = _ftp_cmd(cd, "USER %s", user); /* did the server request a password? */ --- 763,796 ---- /* send user name and password */ user = url->user; + /* + fprintf(stderr,"JHS 1 user %d\n", (user)?1:0 ); + fprintf(stderr,"JHS 1 *user %d %s\n", (*user)?1:0, (*user)?user:"\0" ); + */ if (!user || !*user) user = getenv("FTP_LOGIN"); + /* + fprintf(stderr,"JHS user after getenv(FTP_LOGIN):\t%s\n",user); + fprintf(stderr,"JHS 2 user %d\n", (user)?1:0 ); + if (user) + fprintf(stderr,"JHS 2 *user %d %s\n", (*user)?1:0, (*user)?user:"\0" ); + */ if (!user || !*user) user = FTP_ANONYMOUS_USER; ! /* ! fprintf(stderr,"JHS 3 FTP_ANONYMOUS_USER=:%s\n",FTP_ANONYMOUS_USER); ! fprintf(stderr,"JHS 3 user:\t%s\n",user); ! fprintf(stderr,"JHS 3 purl %d\n",(purl)?1:0); ! fprintf(stderr, "JHS 3 url->port=%d\n", url->port ); ! fprintf(stderr, "JHS 3 url->scheme=%s\n", url->scheme ); ! fprintf(stderr, "JHS 3 _fetch_default_port(url->scheme)=%d\n", ! _fetch_default_port(url->scheme)) ; ! if (purl && url->port == _fetch_default_port(url->scheme)) e = _ftp_cmd(cd, "USER %s@%s", user, url->host); ! else if (purl) ! e = _ftp_cmd(cd, "USER %s@%s@%d", user, url->host, url->port); ! else ! */ e = _ftp_cmd(cd, "USER %s", user); /* did the server request a password? */ ------- Julian J.Stacey Munich Unix (FreeBSD, Linux etc) Consultant http://www.berklix.com/~jhs/ Ihr Rauchen => mein allergischer Kopfschmerz ! Kau/Schnupftabak probieren ! ----------------- To: Dag-Erling Smorgrav Subject: Re: 4.3-RELEASE/src/lib/libfetch/ftp.c.diff to force proxy working Hi Dag-Erling > > I am getting > > fetch: ftpmotd: Not logged in > > When you do what? Sorry, running on an internal host, cd /usr/ports/..... make fetch with a gateway host running apache as proxy (& ftpd - see below) to Internet > > & my proxy ftpd.log reports: > > Your proxy log isn't really interesting; what's interesting is the > debugging output from fetch(1) linked with a libfetch that was built > with -DDEBUG. OK, I didnt turn on your generic DEBUG, but I did add my own extra printfs, & tried xxgdb > > I have solved it for me with the following patch, > > but its clearly not acceptable to you, as your > > trying to do something more fancy, but I'm not sure what, > > seems to me your passing in more info that 4.1.1 ftpd as a proxy > > barfs at, not sure what the proper solution is ? > > I'm not sure what you mean by '4.1.1 ftpd as a proxy', as FreeBSD's > ftpd doesn't support running as a proxy. AARGH ! Yes of course ! That's the answer ! I'd sort of assumed ftpd would have been bloated by/had added proxy support by now. I'll have to replace my ftpd bin with one from /usr/ports/ftp/ No idea which, can you reccomend one with proxy ? I'm not too bothered about security here, What do you use ? echo *ftpd* bftpd lukemftpd oftpd proftpd vsftpd wu-ftpd yale-tftpd so one of bftpd lukemftpd oftpd proftpd vsftpd wu-ftpd I don't understand what your code is doing with the extra `@` triggerd by purl if (purl && url->port == _fetch_default_port(url->scheme)) e = _ftp_cmd(cd, "USER %s@%s", user, url->host); else if (purl) e = _ftp_cmd(cd, "USER %s@%s@%d", user, url->host, url->port); else e = _ftp_cmd(cd, "USER %s", user); Could you please tell me a manual/rfc to read to tell me what these @ achieve ? (or just tell me :-) Does @ tell the ftpd to work as a proxy ? Is a double @ something that becomes a cascaded proxy ? or ... ? If so, could fetch.c or .1 make a comment like "your ftpd does not support proxy" if it fails to login with EG anonymous@wind as 4.3 standard ftpd accepts a USER without an @, but rejects any USER with an @ ? > > Ihr Rauchen => mein allergischer Kopfschmerz ! Kau/Schnupftabak probieren > Unfortunately, the smell of chewing tobacco makes me just as sick as > that of tobacco smoke... OK, I'll take your word for it ! I've reduced my .sig to `Schnupf' Julian J.Stacey Munich Unix (FreeBSD, Linux etc) Consultant http://www.berklix.com/~jhs/ Ihr Rauchen => mein allergischer Kopfschmerz ! Schnupftabak probieren !