]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
linux-nfs-pag-handling-20070822
authorDerrick Brashear <shadow@dementia.org>
Wed, 22 Aug 2007 20:37:10 +0000 (20:37 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 22 Aug 2007 20:37:10 +0000 (20:37 +0000)
don't mishandle pag argument when passed in from e.g. knfs

don't make keyring pag for nfs clients

src/afs/LINUX/osi_groups.c
src/afs/afs_nfsclnt.c
src/afs/afs_osi_pag.c
src/afs/afs_pioctl.c

index c0d82702792ceb47da3d2aa87de3a6138dffb5d1..ed7516c673fd7334b06436738ad135a9ef9bed7b 100644 (file)
@@ -25,6 +25,7 @@ RCSID
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
 #include "afs/afs_stats.h"     /* statistics */
+#include "afs/nfsclient.h"
 #ifdef AFS_LINUX22_ENV
 #include "h/smp_lock.h"
 #endif
@@ -330,8 +331,7 @@ setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
     code = __setpag(cr, pagvalue, newpag, change_parent);
 
 #ifdef LINUX_KEYRING_SUPPORT
-    if (code == 0) {
-
+    if (code == 0 && (*cr)->cr_rgid != NFSXLATOR_CRED) {
        (void) install_session_keyring(current, NULL);
 
        if (current->signal->session_keyring) {
index 59aaa457c8620780d6dc9e72ee03266efcd7f1fa..c8941dd219d685cd67eb51c12f04200c92cb77a8 100644 (file)
@@ -202,6 +202,12 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
     uid = crgetuid(*cred);
 #else
     uid = (*cred)->cr_uid;
+#endif
+    /* Do this early, so pag management knows */
+#ifdef AFS_OSF_ENV
+    (*cred)->cr_ruid = NFSXLATOR_CRED; /* Identify it as nfs xlator call */
+#else
+    (*cred)->cr_rgid = NFSXLATOR_CRED; /* Identify it as nfs xlator call */
 #endif
     if ((afs_nfsexporter->exp_states & EXP_CLIPAGS) && pag != NOPAG) {
        uid = pag;
@@ -300,11 +306,6 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
     *pagparam = pag;
     *outexporter = (struct afs_exporter *)np;
     afs_PutUser(au, WRITE_LOCK);
-#ifdef AFS_OSF_ENV
-    (*cred)->cr_ruid = NFSXLATOR_CRED; /* Identify it as nfs xlator call */
-#else
-    (*cred)->cr_rgid = NFSXLATOR_CRED; /* Identify it as nfs xlator call */
-#endif
 /*    ReleaseWriteLock(&afs_xnfsreq);  */
     return 0;
 }
index 9ebbdd1afbde3f25fdcf50daae9feb229a67ae2c..ac6062b15e53ca2e675c93cee1db60b2c09c180d 100644 (file)
@@ -599,7 +599,7 @@ PagInCred(const struct AFS_UCRED *cred)
 #endif
 out:
 #if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT)
-    if (pag == NOPAG) {
+    if (pag == NOPAG && cred->cr_rgid != NFSXLATOR_CRED) {
        struct key *key;
        afs_uint32 upag, newpag;
 
index f192a542a20b0b941a8ee48826a32c3305f2c989..5f540ce7ca283632a5daccc8ef122e393e604384 100644 (file)
@@ -3340,6 +3340,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
     struct AFS_UCRED *newcred;
     struct unixuser *au;
     afs_uint32 comp = *com & 0xff00;
+    afs_uint32 h, l;
 
 #if defined(AFS_SGIMP_ENV)
     osi_Assert(ISAFS_GLOCK());
@@ -3381,7 +3382,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
        u.u_error = 0;
 #endif
        /* check for acceptable opcodes for normal folks, which are, so far,
-        * set tokens and unlog.
+        * get/set tokens, sysname, and unlog.
         */
        if (i != 9 && i != 3 && i != 38 && i != 8) {
            osi_FreeLargeSpace(inData);
@@ -3410,9 +3411,17 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
     newcred->cr_groupset.gs_union.un_groups[0] = g0;
     newcred->cr_groupset.gs_union.un_groups[1] = g1;
 #elif defined(AFS_LINUX26_ENV)
+#ifdef AFS_LINUX26_ONEGROUP_ENV
+    newcred->cr_group_info = groups_alloc(1); /* not that anything sets this */
+    l = (((g0-0x3f00) & 0x3fff) << 14) | ((g1-0x3f00) & 0x3fff);
+    h = ((g0-0x3f00) >> 14);
+    h = ((g1-0x3f00) >> 14) + h + h + h;
+    GROUP_AT(newcred->cr_group_info, 0) = ((h << 28) | l);
+#else
     newcred->cr_group_info = groups_alloc(2);
     GROUP_AT(newcred->cr_group_info, 0) = g0;
     GROUP_AT(newcred->cr_group_info, 1) = g1;
+#endif
 #else
     newcred->cr_groups[0] = g0;
     newcred->cr_groups[1] = g1;
@@ -3468,7 +3477,7 @@ HandleClientContext(struct afs_ioctl *ablob, int *com,
        EXP_RELE(outexporter);
     }
     if (!code) 
-      *com = (*com) | comp;
+       *com = (*com) | comp;
     return code;
 }
 #endif /* AFS_NEED_CLIENTCONTEXT */