Newsgroups: comp.protocols.nfs
Path: utzoo!utgpu!watserv1!watmath!att!pacbell.com!ames!think.com!barmar
From: barmar@think.com (Barry Margolin)
Subject: Re: Filenames with 0 length - An NFS bug or feature ?
Message-ID: <1990Dec20.053123.24104@Think.COM>
Sender: news@Think.COM
Organization: Thinking Machines Corporation, Cambridge MA, USA
References: <1990Dec20.035507.20698@massey.ac.nz>
Date: Thu, 20 Dec 90 05:31:23 GMT

In article <1990Dec20.035507.20698@massey.ac.nz> G.Eustace@massey.ac.nz (Glen Eustace) writes:
>Some time ago I posted a query about files with names that were of
>zero length.  No one responded so I assumed that the problem was
>unique to us.  I have just read a posting in comp.unix.questions,
>Message-ID: 1410@forty2.physik.unizh.ch,  which sounds very similiar.

Here's a suggestion that might work: Use "clri" to clear the inode
corresponding to the file, and then fsck the partition.  Hopefully this
will remove the directory entry, but it's possible that fsck will simply
reconstruct the inode.

>Based on that and my earlier query, can someone enlighten me on the
>following.  Is it possible to create a file with no-name ( zero
>length ) via NFS intentionally.  If files can be created ought not
>this be a bug or is it a feature.

I haven't seen zero-length directory entries, but I've seen file names
containing slashes.  In our case, I think it was TOPS that created the
files, when someone backed up a Macintosh to a Sun, but I've also heard of
it happening with PC NFS clients.  The bug is related to the fact that the
Sun NFS server is implemented in the kernel, and the NFS protocol
operations map directly to internal file system operations; e.g. the
create-file operation passes a directory handle and a name, so there's no
need to parse the pathname, and that is what prevents such files from being
created by normal processes.  The bug is that the NFS server doesn't
perform sanity checks on the file name.

>The common denominator in both queries appears to be PCs running NFS.  
>Although not specifically mentioned I am guessing that the other 
>poster may be using PC-NFS and if so is passing a request to the 
>server to create a file with no name a bug in PC-NFS?

While it's probably not a great idea for any client to create zero-length
file names, I don't think there's anything in the protocol spec that
forbids it.  For all the PC knows, the server (which need not be a Unix
system) actually supports such names.  I think the slash problem we have is
a better example of this possibility, as there are many OSes that allow
slashes in their file names (probably most non-Unix-derived systems), but
the NFS protocol doesn't provide any way to find out whether a particular
server is one of them (the proposed NeFS protocol does provide a way to
find out the restricted characters).  And even if the protocol did prohibit
such names, a robust server must be prepared to deal with broken or
malicious clients that break the rules, especially if failing to detect the
error can impact other clients and local users.
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
