BSD 4_3_Reno release
[unix-history] / usr / src / sys / nfs / nfs_subs.c
index 56305da..b2344f4 100644 (file)
@@ -5,9 +5,22 @@
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
- * %sccs.include.redist.c%
+ * Redistribution is only permitted until one year after the first shipment
+ * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
+ * binary forms are permitted provided that: (1) source distributions retain
+ * this entire copyright notice and comment, and (2) distributions including
+ * binaries display the following acknowledgement:  This product includes
+ * software developed by the University of California, Berkeley and its
+ * contributors'' in the documentation or other materials provided with the
+ * distribution and in all advertising materials mentioning features or use
+ * of this software.  Neither the name of the University nor the names of
+ * its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *
- *     @(#)nfs_subs.c  7.28 (Berkeley) %G%
+ *     @(#)nfs_subs.c  7.29 (Berkeley) 7/26/90
  */
 
 /*
  */
 
 /*
@@ -63,7 +76,7 @@ static char *nfs_unixauth();
  * Maximum number of groups passed through to NFS server.
  * According to RFC1057 it should be 16.
  * For release 3.X systems, the maximum value is 8.
  * Maximum number of groups passed through to NFS server.
  * According to RFC1057 it should be 16.
  * For release 3.X systems, the maximum value is 8.
- * For release 4.X systems, the maximum value is 10.
+ * For some other servers, the maximum value is 10.
  */
 int numgrps = 8;
 
  */
 int numgrps = 8;
 
@@ -92,7 +105,8 @@ struct mbuf *nfsm_reqh(prog, vers, procid, cred, hsiz, bpos, mb, retxid)
        int asiz, siz;
 
        NFSMGETHDR(mreq);
        int asiz, siz;
 
        NFSMGETHDR(mreq);
-       asiz = (((cred->cr_ngroups > numgrps) ? numgrps : cred->cr_ngroups)<<2);
+       asiz = ((((cred->cr_ngroups - 1) > numgrps) ? numgrps :
+                 (cred->cr_ngroups - 1)) << 2);
 #ifdef FILLINHOST
        asiz += nfsm_rndup(hostnamelen)+(9*NFSX_UNSIGNED);
 #else
 #ifdef FILLINHOST
        asiz += nfsm_rndup(hostnamelen)+(9*NFSX_UNSIGNED);
 #else
@@ -518,9 +532,9 @@ static char *nfs_unixauth(cr)
        /* Maybe someday there should be a cache of AUTH_SHORT's */
        if ((p = rpc_uidp) == NULL) {
 #ifdef FILLINHOST
        /* Maybe someday there should be a cache of AUTH_SHORT's */
        if ((p = rpc_uidp) == NULL) {
 #ifdef FILLINHOST
-               i = nfsm_rndup(hostnamelen)+(19*NFSX_UNSIGNED);
+               i = nfsm_rndup(hostnamelen)+(25*NFSX_UNSIGNED);
 #else
 #else
-               i = 19*NFSX_UNSIGNED;
+               i = 25*NFSX_UNSIGNED;
 #endif
                MALLOC(p, u_long *, i, M_TEMP, M_WAITOK);
                bzero((caddr_t)p, i);
 #endif
                MALLOC(p, u_long *, i, M_TEMP, M_WAITOK);
                bzero((caddr_t)p, i);
@@ -540,9 +554,9 @@ static char *nfs_unixauth(cr)
        }
        *p++ = txdr_unsigned(cr->cr_uid);
        *p++ = txdr_unsigned(cr->cr_groups[0]);
        }
        *p++ = txdr_unsigned(cr->cr_uid);
        *p++ = txdr_unsigned(cr->cr_groups[0]);
-       ngr = (cr->cr_ngroups > numgrps) ? numgrps : cr->cr_ngroups;
+       ngr = ((cr->cr_ngroups - 1) > numgrps) ? numgrps : (cr->cr_ngroups - 1);
        *p++ = txdr_unsigned(ngr);
        *p++ = txdr_unsigned(ngr);
-       for (i = 0; i < ngr; i++)
+       for (i = 1; i <= ngr; i++)
                *p++ = txdr_unsigned(cr->cr_groups[i]);
        /* And add the AUTH_NULL */
        *p++ = 0;
                *p++ = txdr_unsigned(cr->cr_groups[i]);
        /* And add the AUTH_NULL */
        *p++ = 0;