From: "Kendrick M. Smith" Subject: REPOST patch 22/38: SERVER: type checking in fh_verify() Date: Wed, 14 Aug 2002 16:47:14 -0400 (EDT) Sender: nfs-admin@lists.sourceforge.net Message-ID: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: Received: from berzerk.gpcc.itd.umich.edu ([141.211.2.162]) by usw-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 17f52y-0005zc-00 for ; Wed, 14 Aug 2002 13:47:16 -0700 To: linux-kernel@vger.kernel.org, Errors-To: nfs-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Id: Discussion of NFS under Linux development, interoperability, and testing. List-Unsubscribe: , List-Archive: Change the type checking in fh_verify(). This fixes a bug which I reported on the mailing list a few days ago, and also adds a new error code nfserr_symlink (v4 only). This is returned whenever an operation which is illegal for symlinks is attempted on a symlink, and takes precedence over ERR_NOTDIR or ERR_INVAL. --- old/fs/nfsd/nfsfh.c Thu Aug 1 16:16:19 2002 +++ new/fs/nfsd/nfsfh.c Sun Aug 11 22:52:47 2002 @@ -234,11 +234,23 @@ fh_verify(struct svc_rqst *rqstp, struct /* Type can be negative when creating hardlinks - not to a dir */ if (type > 0 && (inode->i_mode & S_IFMT) != type) { - error = (type == S_IFDIR)? nfserr_notdir : nfserr_isdir; + if (rqstp->rq_vers == 4 && (inode->i_mode & S_IFMT) == S_IFLNK) + error = nfserr_symlink; + else if (type == S_IFDIR) + error = nfserr_notdir; + else if ((inode->i_mode & S_IFMT) == S_IFDIR) + error = nfserr_isdir; + else + error = nfserr_inval; goto out; } if (type < 0 && (inode->i_mode & S_IFMT) == -type) { - error = (type == -S_IFDIR)? nfserr_notdir : nfserr_isdir; + if (rqstp->rq_vers == 4 && (inode->i_mode & S_IFMT) == S_IFLNK) + error = nfserr_symlink; + else if (type == -S_IFDIR) + error = nfserr_isdir; + else + error = nfserr_notdir; goto out; } ------------------------------------------------------- This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today! http://seeker.dice.com/seeker.epl?rel_code=31 _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs