summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver/nfs_srvsubs.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-31 17:27:58 +0000
committerpeter <peter@FreeBSD.org>1998-05-31 17:27:58 +0000
commite58631da3c81e111dd78b54402762f8f6875aa62 (patch)
tree5d5b5b3e488d62a97cd4059fbf25ec5ee46fca91 /sys/nfsserver/nfs_srvsubs.c
parent21e75a7ad9fa17b5c52ac550ad110499608debf5 (diff)
downloadFreeBSD-src-e58631da3c81e111dd78b54402762f8f6875aa62.zip
FreeBSD-src-e58631da3c81e111dd78b54402762f8f6875aa62.tar.gz
NFS Jumbo commit part 1. Cosmetic and structural changes only. The aim
of this part of commits is to minimize unnecessary differences between the other NFS's of similar origin. Yes, there are gratuitous changes here that the style folks won't like, but it makes the catch-up less difficult.
Diffstat (limited to 'sys/nfsserver/nfs_srvsubs.c')
-rw-r--r--sys/nfsserver/nfs_srvsubs.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 93fca3c..27cece4 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -33,8 +33,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.54 1998/05/19 07:11:24 peter Exp $
+ * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
+ * $Id: nfs_subs.c,v 1.55 1998/05/24 14:41:53 peter Exp $
*/
/*
@@ -2129,4 +2129,45 @@ nfsrv_object_create(vp)
return (vfs_object_create(vp, curproc,
curproc ? curproc->p_ucred : NULL, 1));
}
+
+/*
+ * Sort the group list in increasing numerical order.
+ * (Insertion sort by Chris Torek, who was grossed out by the bubble sort
+ * that used to be here.)
+ */
+void
+nfsrvw_sort(list, num)
+ register gid_t *list;
+ register int num;
+{
+ register int i, j;
+ gid_t v;
+
+ /* Insertion sort. */
+ for (i = 1; i < num; i++) {
+ v = list[i];
+ /* find correct slot for value v, moving others up */
+ for (j = i; --j >= 0 && v < list[j];)
+ list[j + 1] = list[j];
+ list[j + 1] = v;
+ }
+}
+
+/*
+ * copy credentials making sure that the result can be compared with bcmp().
+ */
+void
+nfsrv_setcred(incred, outcred)
+ register struct ucred *incred, *outcred;
+{
+ register int i;
+
+ bzero((caddr_t)outcred, sizeof (struct ucred));
+ outcred->cr_ref = 1;
+ outcred->cr_uid = incred->cr_uid;
+ outcred->cr_ngroups = incred->cr_ngroups;
+ for (i = 0; i < incred->cr_ngroups; i++)
+ outcred->cr_groups[i] = incred->cr_groups[i];
+ nfsrvw_sort(outcred->cr_groups, outcred->cr_ngroups);
+}
#endif /* NFS_NOSERVER */
OpenPOWER on IntegriCloud