linux24-new-afs-xsetgroups32-implementation-20010406
authorChaskiel M Grundman <cg2v@andrew.cmu.edu>
Fri, 6 Apr 2001 19:08:09 +0000 (19:08 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 6 Apr 2001 19:08:09 +0000 (19:08 +0000)
afs_xsetgroups32 is now a copy of afs_xsetgroups, with the call to
sys_setgroupsp changed to sys_setgroups32p

no change to sparc64 port stuff

src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_module.c

index 9e1706d..760e8a5 100644 (file)
@@ -126,12 +126,40 @@ asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist)
     return code;
 }
 
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_LINUX24_ENV)
+#if defined(AFS_LINUX24_ENV)
+/* Intercept the standard uid32 system call. */
+extern int (*sys_setgroups32p)(int gidsetsize, gid_t *grouplist);
+asmlinkage int afs_xsetgroups32(int gidsetsize, gid_t *grouplist)
+{
+    int code;
+    cred_t *cr = crref();
+    afs_uint32 junk;
+    int old_pag;
+    
+    lock_kernel();
+    old_pag = PagInCred(cr);
+    crfree(cr);
+    unlock_kernel();
+
+    code = (*sys_setgroups32p)(gidsetsize, grouplist);
+    if (code) {
+       return code;
+    }
+
+    lock_kernel();
+    cr = crref();
+    if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
+       /* re-install old pag if there's room. */
+       code = setpag(&cr, old_pag, &junk, 0);
+    }
+    crfree(cr);
+    unlock_kernel();
+
+    return code;
+}
+#endif
 #if defined(AFS_SPARC64_LINUX20_ENV)
 asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
-#else
-asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid32_t *grouplist)
-#endif
 {
     gid_t gl[NGROUPS];
     int ret, i;
index aab88bc..e2652e2 100644 (file)
@@ -74,7 +74,7 @@ __asm__ __volatile__ ("
 #endif
 
 #if defined(AFS_LINUX24_ENV)
-asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid32_t *grouplist);
+asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
 #endif 
 
 #ifdef AFS_SPARC64_LINUX20_ENV
@@ -136,7 +136,7 @@ int init_module(void)
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32;
 #endif
 #if defined(AFS_LINUX24_ENV)
-    sys_setgroupsp32 = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
+    sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
 #endif
 
@@ -154,7 +154,7 @@ void cleanup_module(void)
     sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
 #endif
 #if defined(AFS_LINUX24_ENV)
-    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroupsp32;
+    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
 #endif
     unregister_filesystem(&afs_file_system);