Remove support for Solaris pre-8
[openafs.git] / src / afs / afs_nfsdisp.c
index 71eac0e..9c7c56c 100644 (file)
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
 #define __XDR_INCLUDE__
 #include "afs/stds.h"
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
-#if defined(AFS_SUN55_ENV) && !defined(AFS_NONFSTRANS)
+#if defined(AFS_SUN5_ENV) && !defined(AFS_NONFSTRANS)
 #include "rpc/types.h"
 #include "rpc/auth.h"
 #include "rpc/auth_unix.h"
 #include "rpc/auth_des.h"
-#if !defined(AFS_SUN58_ENV)
-#include "rpc/auth_kerb.h"
-#endif
 #include "sys/tiuser.h"
 #include "rpc/xdr.h"
 #include "rpc/svc.h"
@@ -63,8 +58,12 @@ struct afs_nfs2_resp {
 };
 
 #ifndef ACL2_NPROC
+#if defined(AFS_SUN510_ENV)
+#define ACL2_NPROC      6
+#else
 #define ACL2_NPROC      5
 #endif
+#endif
 struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC];
 struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC];
 
@@ -173,7 +172,7 @@ nfs2_to_afs_call(int which, caddr_t * args, fhandle_t ** fhpp,
     }
 
     /* Ok if arg 1 is in AFS or if 2 args and arg 2 is in AFS */
-    if (is_afs_fh(fhp1)) {
+    if (fhp1 && is_afs_fh(fhp1)) {
        *fhpp = fhp1;
        if (fhp2)
            *fh2pp = fhp2;
@@ -221,11 +220,19 @@ acl2_to_afs_call(int which, caddr_t * args, fhandle_t ** fhpp)
            fhp = &sargs->fh;
            break;
        }
+#if defined(AFS_SUN510_ENV)
+    case ACLPROC2_GETXATTRDIR:
+       {
+           struct GETXATTRDIR2args *sargs = (struct GETXATTRDIR2args *)args;
+           fhp = &sargs->fh;
+           break;
+       }
+#endif
     default:
        return NULL;
     }
 
-    if (is_afs_fh(fhp)) {
+    if (fhp && is_afs_fh(fhp)) {
        *fhpp = fhp;
        return 1;
     }
@@ -236,7 +243,7 @@ acl2_to_afs_call(int which, caddr_t * args, fhandle_t ** fhpp)
 int
 afs_nfs2_dispatcher(int type, afs_int32 which, char *argp,
                    struct exportinfo **expp, struct svc_req *rp,
-                   struct AFS_UCRED *crp)
+                   afs_ucred_t *crp)
 {
     afs_int32 call = 0;
     afs_int32 code = 0;
@@ -300,11 +307,11 @@ afs_nfs2_dispatcher(int type, afs_int32 which, char *argp,
 void
 afs_nfs2_smallfidder(struct nfsdiropres *dr)
 {
-    register fhandle_t *fhp = (fhandle_t *) & dr->dr_fhandle;
+    fhandle_t *fhp = (fhandle_t *) & dr->dr_fhandle;
     afs_int32 addr[2];
     struct vcache *vcp;
 
-#if defined(AFS_SUN57_64BIT_ENV)
+#if defined(AFS_SUN5_64BIT_ENV)
     /* See also afs_fid() */
     memcpy((char *)addr, fhp->fh_data, SIZEOF_SMALLFID);
     addr[1] = (addr[1] >> 48) & 0xffff;
@@ -321,12 +328,12 @@ afs_nfs2_smallfidder(struct nfsdiropres *dr)
            struct cell *tcell;
 
            /* Make up and copy out a SmallFid */
-           tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK);
-           Sfid.Volume = vcp->fid.Fid.Volume;
+           tcell = afs_GetCell(vcp->f.fid.Cell, READ_LOCK);
+           Sfid.Volume = vcp->f.fid.Fid.Volume;
            Sfid.CellAndUnique =
-               ((tcell->cellIndex << 24) | (vcp->fid.Fid.Unique & 0xffffff));
+               ((tcell->cellIndex << 24) | (vcp->f.fid.Fid.Unique & 0xffffff));
            afs_PutCell(tcell, READ_LOCK);
-           Sfid.Vnode = (u_short) (vcp->fid.Fid.Vnode & 0xffff);
+           Sfid.Vnode = (u_short) (vcp->f.fid.Fid.Vnode & 0xffff);
            fhp->fh_len = SIZEOF_SMALLFID;
            memcpy(dr->dr_fhandle.fh_data, (char *)&Sfid, fhp->fh_len);
 
@@ -366,8 +373,8 @@ void
 afs_nfs2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -381,8 +388,8 @@ void
 afs_nfs2_setattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_SETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -396,8 +403,8 @@ void
 afs_nfs2_lookup(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_LOOKUP, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -414,8 +421,8 @@ void
 afs_nfs2_readlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -429,8 +436,8 @@ void
 afs_nfs2_read(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READ, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -444,8 +451,8 @@ void
 afs_nfs2_write(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_WRITE, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -459,8 +466,8 @@ void
 afs_nfs2_create(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_CREATE, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -477,8 +484,8 @@ void
 afs_nfs2_remove(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_REMOVE, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -492,8 +499,8 @@ void
 afs_nfs2_rename(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_RENAME, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -507,8 +514,8 @@ void
 afs_nfs2_link(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_LINK, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -522,8 +529,8 @@ void
 afs_nfs2_symlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_SYMLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -537,8 +544,8 @@ void
 afs_nfs2_mkdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_MKDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -555,8 +562,8 @@ void
 afs_nfs2_rmdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_RMDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -570,8 +577,8 @@ void
 afs_nfs2_readdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -585,8 +592,8 @@ void
 afs_nfs2_statfs(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs2_dispatcher(0, RFS_STATFS, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -621,8 +628,8 @@ void
 afs_acl2_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs2_dispatcher(1, ACLPROC2_GETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -638,8 +645,8 @@ void
 afs_acl2_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs2_dispatcher(1, ACLPROC2_SETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -655,8 +662,8 @@ void
 afs_acl2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs2_dispatcher(1, ACLPROC2_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -672,8 +679,8 @@ void
 afs_acl2_access(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs2_dispatcher(1, ACLPROC2_ACCESS, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -685,12 +692,34 @@ afs_acl2_access(char *args, char *xp, char *exp, char *rp, char *crp)
     return;
 }
 
-struct afs_nfs_disp_tbl afs_acl_disp_tbl[5] = {
+#if defined(AFS_SUN510_ENV)
+void
+afs_acl2_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
+{
+    u_int call;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
+    call =
+       afs_nfs2_dispatcher(1, ACLPROC2_GETXATTRDIR, (char *)args, &exp, rp, crp);
+    if (call > 1)
+       afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
+    else
+       (*afs_acl_disp_tbl[ACLPROC2_GETXATTRDIR].orig_proc) (args, xp, exp, rp,
+                                                       crp);
+    curthread->t_cred = svcred;
+    return;
+}
+#endif
+
+struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC] = {
     {afs_nfs2_null},
     {afs_acl2_getacl},
     {afs_acl2_setacl},
     {afs_acl2_getattr},
-    {afs_acl2_access}
+    {afs_acl2_access},
+#if defined(AFS_SUN510_ENV)
+    {afs_acl2_getxattrdir}
+#endif
 };
 
 /* Munge the dispatch tables to link us in first */
@@ -719,8 +748,12 @@ afs_xlatorinit_v2(struct rfs_disp_tbl *_rfs_tbl,
 #endif
 
 #ifndef ACL3_NPROC
+#if defined(AFS_SUN510_ENV)
+#define ACL3_NPROC      4
+#else
 #define ACL3_NPROC      3
 #endif
+#endif
 
 struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS3_NPROC];
 struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC];
@@ -747,6 +780,13 @@ afs_nfs3_noaccess(struct afs_nfs3_resp *resp)
     resp->flags = FALSE;
 }
 
+void
+afs_nfs3_notsupp(struct afs_nfs3_resp *resp)
+{
+    resp->status = NFS3ERR_NOTSUPP;
+    resp->flags = FALSE;
+}
+
 afs_int32
 nfs3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp, nfs_fh3 ** fh2pp)
 {
@@ -773,11 +813,7 @@ nfs3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp, nfs_fh3 ** fh2pp)
     case NFSPROC3_LOOKUP:
        {
            LOOKUP3args *arg = (LOOKUP3args *) args;
-#ifdef AFS_SUN58_ENV
            fhp1 = (nfs_fh3 *) arg->what.dirp;
-#else
-           fhp1 = (nfs_fh3 *) & arg->what.dir;
-#endif
            break;
        }
     case NFSPROC3_ACCESS:
@@ -807,51 +843,51 @@ nfs3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp, nfs_fh3 ** fh2pp)
     case NFSPROC3_CREATE:
        {
            CREATE3args *arg = (CREATE3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->where.dir;
+           fhp1 = (nfs_fh3 *) arg->where.dirp;
            break;
        }
     case NFSPROC3_MKDIR:
        {
            MKDIR3args *arg = (MKDIR3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->where.dir;
+           fhp1 = (nfs_fh3 *) arg->where.dirp;
            break;
        }
     case NFSPROC3_SYMLINK:
        {
            SYMLINK3args *arg = (SYMLINK3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->where.dir;
+           fhp1 = (nfs_fh3 *) arg->where.dirp;
            break;
        }
     case NFSPROC3_MKNOD:
        {
            MKNOD3args *arg = (MKNOD3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->where.dir;
+           fhp1 = (nfs_fh3 *) arg->where.dirp;
            break;
        }
     case NFSPROC3_REMOVE:
        {
            REMOVE3args *arg = (REMOVE3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->object.dir;
+           fhp1 = (nfs_fh3 *) arg->object.dirp;
            break;
        }
     case NFSPROC3_RMDIR:
        {
            RMDIR3args *arg = (RMDIR3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->object.dir;
+           fhp1 = (nfs_fh3 *) arg->object.dirp;
            break;
        }
     case NFSPROC3_RENAME:
        {
            RENAME3args *arg = (RENAME3args *) args;
-           fhp1 = (nfs_fh3 *) & arg->from.dir;
-           fhp2 = (nfs_fh3 *) & arg->to.dir;
+           fhp1 = (nfs_fh3 *) arg->from.dirp;
+           fhp2 = (nfs_fh3 *) arg->to.dirp;
            break;
        }
     case NFSPROC3_LINK:
        {
            LINK3args *arg = (LINK3args *) args;
            fhp1 = (nfs_fh3 *) & arg->file;
-           fhp2 = (nfs_fh3 *) & arg->link.dir;
+           fhp2 = (nfs_fh3 *) arg->link.dirp;
            break;
        }
     case NFSPROC3_READDIR:
@@ -894,7 +930,7 @@ nfs3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp, nfs_fh3 ** fh2pp)
        return NULL;
     }
 
-    if (is_afs_fh3(fhp1)) {
+    if (fhp1 && is_afs_fh3(fhp1)) {
        *fhpp = fhp1;
        if (fhp2)
            *fh2pp = fhp2;
@@ -926,11 +962,19 @@ acl3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp)
            fhp = &sargs->fh;
            break;
        }
+#if defined(AFS_SUN510_ENV)
+    case ACLPROC3_GETXATTRDIR:
+       {
+           struct GETXATTRDIR3args *sargs = (struct GETXATTRDIR3args *)args;
+           fhp = &sargs->fh;
+           break;
+       }
+#endif
     default:
        return NULL;
     }
 
-    if (is_afs_fh3(fhp)) {
+    if (fhp && is_afs_fh3(fhp)) {
        *fhpp = fhp;
        return 1;
     }
@@ -941,7 +985,7 @@ acl3_to_afs_call(int which, caddr_t * args, nfs_fh3 ** fhpp)
 int
 afs_nfs3_dispatcher(int type, afs_int32 which, char *argp,
                    struct exportinfo **expp, struct svc_req *rp,
-                   struct AFS_UCRED *crp)
+                   afs_ucred_t *crp)
 {
     afs_int32 call = 0;
     afs_int32 code = 0;
@@ -954,6 +998,9 @@ afs_nfs3_dispatcher(int type, afs_int32 which, char *argp,
        return 2;
 
     sa = (struct sockaddr *)svc_getrpccaller(rp->rq_xprt)->buf;
+    if (sa == NULL)
+       return;
+
     if (sa->sa_family == AF_INET)
        client = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
 
@@ -1008,7 +1055,7 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp, int status)
     afs_int32 addr[2];
     struct vcache *vcp;
 
-#if defined(AFS_SUN57_64BIT_ENV)
+#if defined(AFS_SUN5_64BIT_ENV)
     /* See also afs_fid() */
     memcpy((char *)addr, fhp->fh3_data, 10);
     addr[1] = (addr[1] >> 48) & 0xffff;
@@ -1026,12 +1073,12 @@ afs_nfs3_smallfidder(struct nfs_fh3 *fhp, int status)
            struct cell *tcell;
 
            /* Make up and copy out a SmallFid */
-           tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK);
-           Sfid.Volume = vcp->fid.Fid.Volume;
+           tcell = afs_GetCell(vcp->f.fid.Cell, READ_LOCK);
+           Sfid.Volume = vcp->f.fid.Fid.Volume;
            Sfid.CellAndUnique =
-               ((tcell->cellIndex << 24) | (vcp->fid.Fid.Unique & 0xffffff));
+               ((tcell->cellIndex << 24) | (vcp->f.fid.Fid.Unique & 0xffffff));
            afs_PutCell(tcell, READ_LOCK);
-           Sfid.Vnode = (u_short) (vcp->fid.Fid.Vnode & 0xffff);
+           Sfid.Vnode = (u_short) (vcp->f.fid.Fid.Vnode & 0xffff);
            fhp->fh3_len = SIZEOF_SMALLFID;
            memcpy(fhp->fh3_data, (char *)&Sfid, fhp->fh3_len);
 
@@ -1051,8 +1098,8 @@ afs_nfs3_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1069,8 +1116,8 @@ afs_nfs3_setattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_SETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1087,8 +1134,8 @@ afs_nfs3_lookup(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_LOOKUP, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1110,8 +1157,8 @@ afs_nfs3_access(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_ACCESS, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1128,8 +1175,8 @@ afs_nfs3_readlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_READLINK, (char *)args, &exp, rp,
                            crp);
@@ -1147,8 +1194,8 @@ afs_nfs3_read(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs3_dispatcher(0, NFSPROC3_READ, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
@@ -1164,8 +1211,8 @@ afs_nfs3_write(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_WRITE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1182,8 +1229,8 @@ afs_nfs3_create(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_CREATE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1205,8 +1252,8 @@ afs_nfs3_mkdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_MKDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1228,8 +1275,8 @@ afs_nfs3_symlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_SYMLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1251,8 +1298,8 @@ afs_nfs3_mknod(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_MKNOD, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1274,8 +1321,8 @@ afs_nfs3_remove(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_REMOVE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1292,8 +1339,8 @@ afs_nfs3_rmdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_RMDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1310,8 +1357,8 @@ afs_nfs3_rename(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_RENAME, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1328,8 +1375,8 @@ afs_nfs3_link(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call = afs_nfs3_dispatcher(0, NFSPROC3_LINK, (char *)args, &exp, rp, crp);
     if (call > 1)
        afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
@@ -1345,8 +1392,8 @@ afs_nfs3_readdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_READDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1363,13 +1410,15 @@ afs_nfs3_readdirplus(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_READDIRPLUS, (char *)args, &exp, rp,
                            crp);
     if (call > 1)
        afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
+    else if (call == 1)
+       afs_nfs3_notsupp((struct afs_nfs3_resp *)xp);
     else
        (*afs_rfs3_disp_tbl[NFSPROC3_READDIRPLUS].orig_proc) (args, xp, exp,
                                                              rp, crp);
@@ -1382,8 +1431,8 @@ afs_nfs3_fsstat(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_FSSTAT, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1400,8 +1449,8 @@ afs_nfs3_fsinfo(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_FSINFO, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1418,8 +1467,8 @@ afs_nfs3_pathconf(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_PATHCONF, (char *)args, &exp, rp,
                            crp);
@@ -1437,8 +1486,8 @@ afs_nfs3_commit(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(0, NFSPROC3_COMMIT, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1479,8 +1528,8 @@ void
 afs_acl3_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(1, ACLPROC3_GETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1496,8 +1545,8 @@ void
 afs_acl3_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
     call =
        afs_nfs3_dispatcher(1, ACLPROC3_SETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1509,10 +1558,32 @@ afs_acl3_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
     return;
 }
 
-struct afs_nfs_disp_tbl afs_acl3_disp_tbl[3] = {
+#if defined(AFS_SUN510_ENV)
+void
+afs_acl3_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
+{
+    u_int call;
+    afs_ucred_t *svcred = curthread->t_cred;
+    curthread->t_cred = (afs_ucred_t *)crp;
+    call =
+       afs_nfs3_dispatcher(1, ACLPROC3_GETXATTRDIR, (char *)args, &exp, rp, crp);
+    if (call > 1)
+       afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
+    else
+       (*afs_acl3_disp_tbl[ACLPROC3_GETXATTRDIR].orig_proc) (args, xp, exp, rp,
+                                                        crp);
+    curthread->t_cred = svcred;
+    return;
+}
+#endif
+
+struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC] = {
     {afs_nfs2_null},
     {afs_acl3_getacl},
     {afs_acl3_setacl},
+#if defined(AFS_SUN510_ENV)
+    {afs_acl3_getxattrdir},
+#endif
 };
 
 /* Munge the dispatch tables to link us in first */