Subject: semantics of NOCRED and FSCRED for file system access?
To: None <tech-kern@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 10/22/2002 19:41:29
This is a multipart MIME message.
--==_Exmh_98659894393280
Content-Type: text/plain; charset=us-ascii
Hi -
there is a problem in the NFS code that these special values are
taken as pointers and derefenenced blindly.
I can reproduce this by auto-configuring a raidframe set on a diskless
box and unconfiguring it later.
So these special values must be handled accordingly. The appended
patch shows where I'd begin.
My problem is that I don't find an information what the values
really mean and what the implications wrt "securelevel" might be.
Does NOCRED mean "no special right", ie a placeholder?
FSCRED probably means "filesystem internal use, has all privileges".
Any hints?
best regards
Matthias
--==_Exmh_98659894393280
Content-Type: application/x-patch ; name="nfscred.patch"
Content-Description: nfscred.patch
Content-Disposition: attachment; filename="nfscred.patch"
Index: sys/nfs/nfs_socket.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_socket.c,v
retrieving revision 1.76
diff -u -r1.76 nfs_socket.c
--- sys/nfs/nfs_socket.c 2002/09/27 15:38:00 1.76
+++ sys/nfs/nfs_socket.c 2002/10/22 17:40:01
@@ -963,6 +963,15 @@
return (error);
}
}
+ } else if (cred == NOCRED) {
+ free((caddr_t)rep, M_NFSREQ);
+ m_freem(mrest);
+ return (EACCES);
+ } else if (cred == FSCRED) {
+ static struct ucred help = {0,0,0,0};
+ auth_type = RPCAUTH_UNIX;
+ auth_len = 5 * NFSX_UNSIGNED;
+ cred = &help;
} else {
auth_type = RPCAUTH_UNIX;
auth_len = (((cred->cr_ngroups > nmp->nm_numgrps) ?
--==_Exmh_98659894393280--