From cse.psu.edu!9fans-outgoing-owner Fri Nov 10 11:00:43 1995 Received: from colossus.cse.psu.edu ([130.203.1.2]) by cannon.ecf.toronto.edu with SMTP id <927>; Fri, 10 Nov 1995 11:00:34 -0500 Received: by colossus.cse.psu.edu id <78660>; Fri, 10 Nov 1995 10:42:30 -0500 Received: from plan9.att.com ([192.20.225.252]) by colossus.cse.psu.edu with SMTP id <78658>; Fri, 10 Nov 1995 10:42:13 -0500 From: presotto@plan9.att.com To: 9fans@cse.psu.edu Date: Fri, 10 Nov 1995 03:58:16 -0500 subject: re: ftpfs change to compensate for some servers Message-Id: <95Nov10.104213est.78658@colossus.cse.psu.edu> Sender: owner-9fans@cse.psu.edu Precedence: bulk Reply-To: 9fans@cse.psu.edu Status: RO some FTP servers include . and .. in the list, which messes up common commands applied to a mounted ftpfs directory. the following change prevents them from being seen: vortex% diff $home/cd/cmd/ftpfs /sys/src/cmd/ftpfs/proto.c 38a39 > static int isdotdot(char*); 670a672,673 > if(isdotdot(field[7])) > return 0; 681a685,686 > if(isdotdot(field[8])) > return 0; 692a698,699 > if(isdotdot(field[9])) > return 0; 703a711,712 > if(isdotdot(field[0])) > return 0; 721a731,736 > } > > static int > isdotdot(char *n) > { > return n[0]=='.' && (n[1]=='\0' || n[1]=='.' && n[2]=='\0'); I think this is easier and more correct since it covers all systems, not just Unix-like: at the end of the switch statement of crackdir(), before line 714, add if(strcmp(longname, ".") == 0 || strcmp(longname, "..") == 0) return 0; or, if the strcmp's bug you, use forsyth's isdotdot(). From cse.psu.edu!9fans-outgoing-owner Fri Nov 10 16:04:13 1995 Received: from colossus.cse.psu.edu ([130.203.1.2]) by cannon.ecf.toronto.edu with SMTP id <9866>; Fri, 10 Nov 1995 16:04:04 -0500 Received: by colossus.cse.psu.edu id <78664>; Fri, 10 Nov 1995 15:47:31 -0500 Received: from plan9.att.com ([192.20.225.253]) by colossus.cse.psu.edu with SMTP id <78666>; Fri, 10 Nov 1995 15:47:14 -0500 From: presotto@plan9.att.com To: 9fans@cse.psu.edu Date: Fri, 10 Nov 1995 15:40:04 -0500 Message-Id: <95Nov10.154714est.78666@colossus.cse.psu.edu> Sender: owner-9fans@cse.psu.edu Precedence: bulk Reply-To: 9fans@cse.psu.edu Status: RO I made a boddle for some ftpfs changes: //plan9.att.com/plan9/update/cmd/ftpfs/816029425.rc - recognize the current NT ftp server directory format - forsyth's change to avoid files named '.' and '..', . - passive mode accesses From cse.psu.edu!owner-9fans Thu Sep 26 12:36:33 1996 Received: from cse.psu.edu ([130.203.3.50]) by cannon.ecf.toronto.edu with SMTP id <10375>; Thu, 26 Sep 1996 12:36:28 -0400 Received: from localhost (majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) with SMTP id MAA11406; Thu, 26 Sep 1996 12:34:45 -0400 (EDT) Received: by claven.cse.psu.edu (bulk_mailer v1.5); Thu, 26 Sep 1996 12:23:31 -0400 Received: (from majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) id MAA11226 for 9fans-outgoing; Thu, 26 Sep 1996 12:23:12 -0400 (EDT) X-Authentication-Warning: claven.cse.psu.edu: majordom set sender to owner-9fans using -f Received: from galapagos.cse.psu.edu (root@galapagos.cse.psu.edu [130.203.2.12]) by cse.psu.edu (8.7.5/8.7.3) with SMTP id MAA11217 for <9fans@cse.psu.edu>; Thu, 26 Sep 1996 12:22:47 -0400 (EDT) Received: from localhost by galapagos.cse.psu.edu with SMTP id <12690>; Thu, 26 Sep 1996 12:20:56 -0400 To: 9fans@cse.psu.edu Subject: ftpfs bug Date: Thu, 26 Sep 1996 12:20:51 -0400 From: Scott Schwartz Message-Id: <96Sep26.122056edt.12690@galapagos.cse.psu.edu> Sender: owner-9fans@cse.psu.edu Reply-To: 9fans@cse.psu.edu Precedence: bulk Status: R In proto.c:/passive the first call to snprint writes to msg from strings that point into msg. (This usually went unnoticed because most ftp servers put a bunch of random text ahead of the bits we need to read, so it could be overwritten without catastrophe.) Suggested fix: write the dial string to a different array. From cse.psu.edu!owner-9fans Sun Sep 29 01:29:50 1996 Received: from cse.psu.edu ([130.203.3.50]) by cannon.ecf.toronto.edu with SMTP id <730>; Sun, 29 Sep 1996 01:29:45 -0400 Received: from localhost (majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) with SMTP id BAA16124; Sun, 29 Sep 1996 01:29:46 -0400 (EDT) Received: by claven.cse.psu.edu (bulk_mailer v1.5); Sun, 29 Sep 1996 01:23:24 -0400 Received: (from majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) id BAA16060 for 9fans-outgoing; Sun, 29 Sep 1996 01:22:52 -0400 (EDT) X-Authentication-Warning: claven.cse.psu.edu: majordom set sender to owner-9fans using -f Received: from angora.cse.psu.edu (nb9ppp186.cac.psu.edu [146.186.16.186]) by cse.psu.edu (8.7.5/8.7.3) with SMTP id BAA16050 for <9fans@cse.psu.edu>; Sun, 29 Sep 1996 01:21:44 -0400 (EDT) Message-Id: <199609290521.BAA16050@cse.psu.edu> Date: Sun, 29 Sep 1996 01:18:55 -0400 From: Scott Schwartz To: 9fans@cse.psu.edu Subject: ftpfs eplf extension Sender: owner-9fans@cse.psu.edu Reply-To: 9fans@cse.psu.edu Precedence: bulk Status: R The ieft ftp working group has been talking about Dan Bernstein's easily-parsed-list-format proposal (which can be found at ftp://koobera.math.uic.edu/pub/docs/RFCEPLF). I think it's a good idea, so here's a patch to teach ftpfs to interpret it. (The ftp site listed above generates it, if you want an example.) There are a couple of loose ends. First, They're still talking about what character encoding it should use. The existing ftp spec prescribes ascii. Using utf-7 has been proposed to fit within that constraint. If they change it to be 8 bit clean then utf-8 could be used. We'd prefer that, of course, so this code just assumes that's what will happen. :-) Second, there have been suggestions for communicating the file mode bits. None of those have been implemented here, so files are either 777 or 000. Third, eplf communicates a unique file identifier which could be used to help with cache coherence, but isn't. Enclosed is one new file, and patches to the ftpfs source relative to the last update. # To unbundle, run this file echo eplf-patch sed 's/.//' >eplf-patch <<'//GO.SYSIN DD eplf-patch' -% diff /sys/src/cmd/ftpfs/ftpfs.h . -76a77 -> int crack_eplf(char*, Dir*, char*, int); -% diff /sys/src/cmd/ftpfs/mkfile -7a8 -> eplf.$O\ -% diff /sys/src/cmd/ftpfs/proto.c . -539a540,543 -> if (crack_eplf(p, dp, longname, sizeof(longname))) { -> goto finish; /* blech */ -> } -> -739a744 -> finish: -1224a1230 -> char dstr[1024]; -1245a1252 -> -1254c1261,1262 -< snprint(msg, sizeof(msg), "%s!%s.%s.%s.%s!%d", net, ---- -> -> snprint(dstr, sizeof(dstr), "%s!%s.%s.%s.%s!%d", net, -1257d1264 -< -1259c1266 -< fd = dial(msg, 0, 0, 0); ---- -> fd = dial(dstr, 0, 0, 0); -1262c1269 -< fprint(2, "passive mode connect to %s failed: %r\n", msg); ---- -> fprint(2, "passive mode connect to %s failed: %r\n", dstr); //GO.SYSIN DD eplf-patch echo eplf.c sed 's/.//' >eplf.c <<'//GO.SYSIN DD eplf.c' -#include -#include -#include "ftpfs.h" - -int crack_eplf(char* line, Dir* dp, char* longname, int longsize) -{ - int when; - unsigned long size; - - if (*line++ != '+') - return 0; - - strcpy(dp->uid, "none"); - strcpy(dp->gid, "none"); - dp->mode = 0; - dp->length = 0; - dp->atime = 0; - safecpy(longname, "", longsize); - - while (*line) { - switch (*line) { - case '\t': - safecpy(longname, line+1, longsize); - return 1; - case 's': - size = 0; - while (*++line && (*line != ',')) - size = size * 10 + (*line - '0'); - dp->length = size; - break; - case 'm': - when = 0; - while (*++line && (*line != ',')) - when = when * 10 + (*line - '0'); - dp->atime = when; - break; - case 'r': - dp->mode = 0777; - while (*line) if (*line++ == ',') break; - break; - case '/': - dp->length = 0; - dp->mode = CHDIR|0777; - while (*line) if (*line++ == ',') break; - break; - case 'i': - /* We should use this to control the cache, */ - /* but fallthru for now. */ - default: - while (*line) if (*line++ == ',') break; - break; - } - } - return 0; -} - //GO.SYSIN DD eplf.c From 9fans@cse.psu.edu Thu Oct 24 15:34:41 EDT 1996 Article: 1893 of comp.os.plan9 Xref: info.ecf comp.os.plan9:1893 Newsgroups: comp.os.plan9 Path: info.ecf!utnut!nott!bcarh189.bnr.ca!bcarh8ac.bnr.ca!bmdhh222.bnr.ca!dish.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.be.innet.net!INbe.net!news.nl.innet.net!INnl.net!hunter.premier.net!news.mathworks.com!usenet.eel.ufl.edu!warwick!niss!bath.ac.uk!ccsis From: schwartz@galapagos.CSe.psu.EDU (Scott Schwartz) Subject: ftpfs bug Approved: plan9mod@bath.ac.uk Reply-To: 9fans@cse.psu.edu Sender: ccsis@bath.ac.uk (Icarus Sparry) Organization: Plan 9 mailing list Message-ID: <96Sep26.122056edt.12690@galapagos.cse.psu.edu> Date: Thu, 26 Sep 1996 16:26:03 GMT Lines: 7 In proto.c:/passive the first call to snprint writes to msg from strings that point into msg. (This usually went unnoticed because most ftp servers put a bunch of random text ahead of the bits we need to read, so it could be overwritten without catastrophe.) Suggested fix: write the dial string to a different array. From 9fans@cse.psu.edu Thu Oct 24 15:38:17 EDT 1996 Article: 1905 of comp.os.plan9 Xref: info.ecf comp.os.plan9:1905 Newsgroups: comp.os.plan9 Path: info.ecf!utnut!cs.utexas.edu!uwm.edu!newsfeed.internetmci.com!usenet.eel.ufl.edu!warwick!niss!bath.ac.uk!ccsis From: schwartz@cse.psu.EDU (Scott Schwartz) Subject: ftpfs eplf extension Approved: plan9mod@bath.ac.uk Reply-To: 9fans@cse.psu.edu Sender: ccsis@bath.ac.uk (Icarus Sparry) Organization: Plan 9 mailing list Message-ID: <199609290521.BAA16050@cse.psu.edu> Date: Sun, 29 Sep 1996 05:27:15 GMT Lines: 116 The ieft ftp working group has been talking about Dan Bernstein's easily-parsed-list-format proposal (which can be found at ftp://koobera.math.uic.edu/pub/docs/RFCEPLF). I think it's a good idea, so here's a patch to teach ftpfs to interpret it. (The ftp site listed above generates it, if you want an example.) There are a couple of loose ends. First, They're still talking about what character encoding it should use. The existing ftp spec prescribes ascii. Using utf-7 has been proposed to fit within that constraint. If they change it to be 8 bit clean then utf-8 could be used. We'd prefer that, of course, so this code just assumes that's what will happen. :-) Second, there have been suggestions for communicating the file mode bits. None of those have been implemented here, so files are either 777 or 000. Third, eplf communicates a unique file identifier which could be used to help with cache coherence, but isn't. Enclosed is one new file, and patches to the ftpfs source relative to the last update. # To unbundle, run this file echo eplf-patch sed 's/.//' >eplf-patch <<'//GO.SYSIN DD eplf-patch' -% diff /sys/src/cmd/ftpfs/ftpfs.h . -76a77 -> int crack_eplf(char*, Dir*, char*, int); -% diff /sys/src/cmd/ftpfs/mkfile -7a8 -> eplf.$O\ -% diff /sys/src/cmd/ftpfs/proto.c . -539a540,543 -> if (crack_eplf(p, dp, longname, sizeof(longname))) { -> goto finish; /* blech */ -> } -> -739a744 -> finish: -1224a1230 -> char dstr[1024]; -1245a1252 -> -1254c1261,1262 -< snprint(msg, sizeof(msg), "%s!%s.%s.%s.%s!%d", net, ---- -> -> snprint(dstr, sizeof(dstr), "%s!%s.%s.%s.%s!%d", net, -1257d1264 -< -1259c1266 -< fd = dial(msg, 0, 0, 0); ---- -> fd = dial(dstr, 0, 0, 0); -1262c1269 -< fprint(2, "passive mode connect to %s failed: %r\n", msg); ---- -> fprint(2, "passive mode connect to %s failed: %r\n", dstr); //GO.SYSIN DD eplf-patch echo eplf.c sed 's/.//' >eplf.c <<'//GO.SYSIN DD eplf.c' -#include -#include -#include "ftpfs.h" - -int crack_eplf(char* line, Dir* dp, char* longname, int longsize) -{ - int when; - unsigned long size; - - if (*line++ != '+') - return 0; - - strcpy(dp->uid, "none"); - strcpy(dp->gid, "none"); - dp->mode = 0; - dp->length = 0; - dp->atime = 0; - safecpy(longname, "", longsize); - - while (*line) { - switch (*line) { - case '\t': - safecpy(longname, line+1, longsize); - return 1; - case 's': - size = 0; - while (*++line && (*line != ',')) - size = size * 10 + (*line - '0'); - dp->length = size; - break; - case 'm': - when = 0; - while (*++line && (*line != ',')) - when = when * 10 + (*line - '0'); - dp->atime = when; - break; - case 'r': - dp->mode = 0777; - while (*line) if (*line++ == ',') break; - break; - case '/': - dp->length = 0; - dp->mode = CHDIR|0777; - while (*line) if (*line++ == ',') break; - break; - case 'i': - /* We should use this to control the cache, */ - /* but fallthru for now. */ - default: - while (*line) if (*line++ == ',') break; - break; - } - } - return 0; -} - //GO.SYSIN DD eplf.c