Bugtraq mailing list archives

Re: More on NFS hacking


From: taino () dsi unimi it (Stefano Taino)
Date: Tue, 19 Apr 1994 17:21:12 +0200 (METDST)


As near as I can tell, this is Sun's definition of the "opaque" file handle:

        long device;    /* device of FS on server. */
        long fs_type;   /* file system type of FS on server. */

        long fsid;      /* fsid of file being specified. */
        long fid;       /* fileid  " " " " */
        long gen;       /* generation " " " " */

        long exp_fsid;  /* fsid of export point on server. */
        long exp_fid;   /* fileid " " " " " */
        long exp_gen;   /* fileid " " " " " */

For the file handle of an export point: 

        fsid == exp_fsid && fid == exp_fid && gen == exp_gen

if the export point happens to be at the root of a UNIX file system,
then both fid and exp_fid will be 2, since UNIX traditionally uses 2
for the root of its file systems.  But if a directory below the root of
a file system is exported, then exp_fid will contain whatever value
that is.

Here are some sample file handles from a Sun server running SunOS
4.1.1.  With "/home" (root of a file system) as the export point, the
fh of the export point is:

        1799 1 655360 2 1155997163 655360 2 1155997163

With "/home/eng" as the export point, the fh of the export point was:

        1799 1 655360 26276 1648502143 655360 26276 1648502143

Notice that there isn't a 2 anywhere in the file handle.  When I
mounted "/home/eng" when the export point was "/home", the fh of the
mount point was:

        1799 1 655360 2 1155997163 655360 2 1155997163

Notice that the {fsid,fid,gen} triple here matches that triple from the
second case, while the {exp_fsid,exp_fid,exp_gen} triple matches that
triple from the first case.  This is because the first triple
represents that actual file the fh is fore, and the second triple
represents the export point of that fh.


-- Stefano.



Current thread: