patch-2.1.91 linux/net/sunrpc/auth_unix.c
Next file: linux/net/sunrpc/svcsock.c
Previous file: linux/net/socket.c
Back to the patch index
Back to the overall index
- Lines: 54
- Date:
Sun Mar 22 15:06:14 1998
- Orig file:
v2.1.90/linux/net/sunrpc/auth_unix.c
- Orig date:
Mon Apr 7 11:35:33 1997
diff -u --recursive --new-file v2.1.90/linux/net/sunrpc/auth_unix.c linux/net/sunrpc/auth_unix.c
@@ -14,11 +14,12 @@
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/auth.h>
+#define NFS_NGROUPS 16
struct unx_cred {
struct rpc_cred uc_base;
uid_t uc_fsuid;
gid_t uc_gid, uc_fsgid;
- gid_t uc_gids[16];
+ gid_t uc_gids[NFS_NGROUPS];
};
#define uc_uid uc_base.cr_uid
#define uc_count uc_base.cr_count
@@ -84,12 +85,18 @@
cred->uc_gid = cred->uc_fsgid = 0;
cred->uc_gids[0] = NOGROUP;
} else {
+ int groups = current->ngroups;
+ if (groups > NFS_NGROUPS)
+ groups = NFS_NGROUPS;
+
cred->uc_uid = current->uid;
cred->uc_gid = current->gid;
cred->uc_fsuid = current->fsuid;
cred->uc_fsgid = current->fsgid;
- for (i = 0; i < 16 && i < NGROUPS; i++)
+ for (i = 0; i < groups; i++)
cred->uc_gids[i] = (gid_t) current->groups[i];
+ if (i < NFS_NGROUPS)
+ cred->uc_gids[i] = NOGROUP;
}
return (struct rpc_cred *) cred;
@@ -135,13 +142,18 @@
int i;
if (!RPC_DO_ROOTOVERRIDE(task)) {
+ int groups;
+
if (cred->uc_uid != current->uid
|| cred->uc_gid != current->gid
|| cred->uc_fsuid != current->fsuid
|| cred->uc_fsgid != current->fsgid)
return 0;
- for (i = 0; i < 16 && i < NGROUPS; i++)
+ groups = current->ngroups;
+ if (groups > NFS_NGROUPS)
+ groups = NFS_NGROUPS;
+ for (i = 0; i < groups ; i++)
if (cred->uc_gids[i] != (gid_t) current->groups[i])
return 0;
return 1;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov