NFS client option to force 16-bit ugid.

From: David Woodhouse (dwmw2@infradead.org)
Date: Mon Sep 04 2000 - 04:16:27 EST


My home directory lives on a SunOS 4.1.4 server, which helpfully expands
16-bit UIDs to 32 bits as signed quantities, not unsigned. So any uid above
32768 gets 0xffff0000 added to it.

This patch adds a mount option to the Linux NFS client to work round this
brokenness. I haven't updated the NFS_MOUNT_VERSION - it doesn't seem to be
necessary.

Index: fs/nfs/inode.c
===================================================================
RCS file: /inst/cvs/linux/fs/nfs/inode.c,v
retrieving revision 1.5.2.25
diff -u -r1.5.2.25 inode.c
--- fs/nfs/inode.c 2000/08/24 12:45:21 1.5.2.25
+++ fs/nfs/inode.c 2000/09/04 08:53:48
@@ -1117,7 +1117,10 @@
         inode->i_nlink = fattr->nlink;
         inode->i_uid = fattr->uid;
         inode->i_gid = fattr->gid;
-
+ if (inode->i_sb->u.nfs_sb.s_server.flags & NFS_MOUNT_UGID16) {
+ inode->i_uid &= 0xffff;
+ inode->i_gid &= 0xffff;
+ }
         if (fattr->valid & NFS_ATTR_FATTR_V3) {
                 /*
                  * report the blocks in 512byte units
Index: include/linux/nfs_mount.h
===================================================================
RCS file: /inst/cvs/linux/include/linux/nfs_mount.h,v
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.2 nfs_mount.h
--- include/linux/nfs_mount.h 2000/06/07 14:59:30 1.1.1.1.2.2
+++ include/linux/nfs_mount.h 2000/09/04 07:54:09
@@ -52,6 +52,7 @@
 #define NFS_MOUNT_VER3 0x0080 /* 3 */
 #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */
 #define NFS_MOUNT_NONLM 0x0200 /* 3 */
+#define NFS_MOUNT_UGID16 0x0400 /* 4+ */
 #define NFS_MOUNT_FLAGMASK 0xFFFF
 
 #endif

--
dwmw2

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:17 EST