Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!hc!beta!unm-la!unmvax!turing.UNM.EDU!mike From: mike@turing.UNM.EDU (Michael I. Bushnell) Newsgroups: comp.bugs.4bsd Subject: Bug in ftp handling of .netrc file Message-ID: <1084@unmvax.unm.edu> Date: 8 Jun 88 21:42:19 GMT Sender: news@unmvax.unm.edu Reply-To: mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque Lines: 49 Subject: Ftp handles hostnames in the .netrc differently from rexec. Index: ucb/ftp/ftp.c 4.3BSD Description & Repeat-By: Write a program which uses rexec. Notice that hostnames are canonicalized before being passed to ruserpass to be looked up in the .netrc file. Create a .netrc. Ftp does not canonicalize hosts before looking them up. Fix: Have ftp.c canonicalize the host name (if possible) before sending the name to ruserpass. Install the following patch to ftp.c: *** /tmp/,RCSt1020320 Wed Jun 8 15:39:34 1988 --- /tmp/,RCSt2020320 Wed Jun 8 15:39:36 1988 *************** *** 149,158 **** { char tmp[80]; char *user, *pass, *acct, *getlogin(), *mygetpass(); int n, aflag = 0; user = pass = acct = 0; ! if (ruserpass(host, &user, &pass, &acct) < 0) { disconnect(); code = -1; return(0); --- 149,160 ---- { char tmp[80]; char *user, *pass, *acct, *getlogin(), *mygetpass(); + struct hostent *hp; int n, aflag = 0; + hp = gethostbyname(host); user = pass = acct = 0; ! if (ruserpass(hp ? hp->h_name : host, &user, &pass, &acct) < 0) { disconnect(); code = -1; return(0); -- N u m q u a m G l o r i a D e o Michael I. Bushnell HASA - "A" division mike@turing.unm.edu {ucbvax,gatech}!unmvax!turing.unm.edu!mike