Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2001 02:33:23 -0700
From:      Scott Renfro <scott@renfro.org>
To:        Konstantin Chuguev <Konstantin.Chuguev@dante.org.uk>
Cc:        Josef Karthauser <joe@tao.org.uk>, Vladimir Terziev <vlady@rila.bg>, hackers@FreeBSD.ORG
Subject:   Re: secure Filesystem
Message-ID:  <20010827023323.A59347@bonsai.home.renfro.org>
In-Reply-To: <3B7B9002.8E915742@dante.org.uk>; from Konstantin.Chuguev@dante.org.uk on Thu, Aug 16, 2001 at 10:18:58AM %2B0100
References:  <200108160909.f7G99ic57826@star.rila.bg> <20010816101355.B3163@tao.org.uk> <3B7B9002.8E915742@dante.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Aug 16, 2001 at 10:18:58AM +0100, Konstantin Chuguev wrote:
> 
> I'd say, it's a daemon pretending to be an NFS server. It's running
> locally on port other than NFS.
> 
> Very nice implementation, I use it a lot. A small problem with it is
> that it seems to support 7-bit file names only.

I tracked down tonight the one other problem with cfs that has plagued
me repeatedly (although it hasn't prevented me from using it day in and
day out with a couple of shell scripts to fix-up mail files corrupted by
this bug).

There is a rather serious bug in cfs that causes it to throw away writes
when those writes append to the file, are smaller than the blocksize (8
bytes by default), and would otherwise leave the file a multiple of the
blocksize.  In this situation, the file needs to be truncated (due to
the padding scheme in use), but cfs doesn't truncate and the file
appears unchanged after the write.

Patches have been sent to cfs-users@crypto.com and I submitted a
separate PR[1] to get the patch into ports until a new cfs release hits
the street.  I've attached a copy of that patch since the readers of
this thread seem to be using cfs.

cheers,
--Scott

[1] http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30120

-- 
Scott Renfro <scott@renfro.org>

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cfs-write-bug.diff"

--- cfs_fh.c.orig	Mon Aug 27 01:47:52 2001
+++ cfs_fh.c	Mon Aug 27 01:48:41 2001
@@ -177,6 +177,13 @@
 		perror("write");
 		return -1;
 	}
+	/* due to the way the file is padded we may actually have to
+	   truncate it here. This happens when the write is at the end of
+	   the file, is shorter than CFSBLOCK and brings the file to a length
+	   which is evenly dividable by CFSBLOCK */
+	if (offset+len > dtov(sb.st_size) && vtod(offset+len) < sb.st_size) {
+	  ftruncate(fd, vtod(offset+len));
+	}
 	/* iolen may contain CFSBLOCK extra chars */
 	return(dtov(iolen)-fronterr);
 }

--TB36FDmn/VVEgNH/--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010827023323.A59347>